/* Memorial site for Ata Alinejad.
   Theme: night lapis and muted gold, Persian tile patterns,
   Shahnameh manuscript frames (jadval, sarlowh, shamseh). */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Nastaliq";
  src: url("../fonts/nastaliq.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #0b111b;
  --ink-2: #111a28;
  --ink-3: #172235;
  --lapis: #1c2b48;
  --turquoise: #4f8d8f;
  --gold: #bfa063;
  --gold-soft: #8d7647;
  --parchment: #e8dfca;
  --text: #d9d1bf;
  --muted: #9d968a;
  --rubric: #8a3b34;
  --line: rgba(191, 160, 99, 0.28);
  --radius: 4px;
  --wrap: 1040px;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23bfa063' stroke-width='.8' opacity='.10'%3E%3Cpath d='M20 20H60V60H20Z'/%3E%3Cpath d='M40 11.7L68.3 40L40 68.3L11.7 40Z'/%3E%3Cpath d='M40 0V11.7M40 68.3V80M0 40H11.7M68.3 40H80M20 20L0 0M60 20L80 0M20 60L0 80M60 60L80 80'/%3E%3Ccircle cx='40' cy='40' r='9'/%3E%3C/g%3E%3C/svg%3E");
  --band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 18'%3E%3Cg fill='none' stroke-width='1'%3E%3Cpath d='M0 9L12 2L24 9L36 16L48 9' stroke='%23bfa063' opacity='.55'/%3E%3Cpath d='M0 9L12 16L24 9L36 2L48 9' stroke='%234f8d8f' opacity='.55'/%3E%3C/g%3E%3Ccircle cx='24' cy='9' r='1.6' fill='%23bfa063' opacity='.7'/%3E%3Ccircle cx='0' cy='9' r='1.6' fill='%23bfa063' opacity='.7'/%3E%3Ccircle cx='48' cy='9' r='1.6' fill='%23bfa063' opacity='.7'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--ink);
  background-image:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(191, 160, 99, 0.10), transparent 70%),
    var(--star);
  background-size: auto, 80px 80px;
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 17px;
  line-height: 2;
  text-rendering: optimizeLegibility;
}

a { color: var(--gold); text-decoration-color: var(--gold-soft); text-underline-offset: 4px; }
a:hover { color: var(--parchment); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }

.band {
  height: 18px;
  background-image: var(--band);
  background-size: 48px 18px;
  background-repeat: repeat-x;
  opacity: 0.9;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 17, 27, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--parchment);
  text-decoration: none;
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-size: 22px;
  line-height: 1;
  padding-block: 8px;
}
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.nav a:hover { color: var(--parchment); border-color: var(--line); }
.nav a[aria-current="page"] { color: var(--gold); border-color: var(--line); background: rgba(191, 160, 99, 0.06); }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--gold);
  border-radius: var(--radius);
  width: 44px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
}

/* ---------- Hero (home) ---------- */

.hero { padding-block: 56px 24px; text-align: center; position: relative; }
.hero-portrait {
  position: relative;
  width: min(300px, 72vw);
  margin: 0 auto 28px;
  aspect-ratio: 1;
}
.hero-portrait .shamseh {
  position: absolute;
  inset: -16%;
  width: 132%;
  height: 132%;
  color: var(--gold);
  opacity: 0.55;
}
.hero-portrait img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--gold-soft);
  box-shadow: 0 0 0 6px var(--ink), 0 0 0 7px var(--line), 0 20px 60px rgba(0, 0, 0, 0.6);
  filter: saturate(0.75) contrast(1.02);
}
.hero h1 {
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-weight: 400;
  color: var(--parchment);
  font-size: clamp(40px, 8vw, 64px);
  line-height: 1.9;
  margin: 0;
}
.hero .full-name { color: var(--muted); font-size: 16px; margin: 0; }
.hero .roles { color: var(--text); font-size: 18px; margin: 12px auto 0; max-width: 640px; }
.dates {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--gold);
  font-size: 16px;
  letter-spacing: 0.5px;
}

/* Candle */
.candle { position: relative; width: 14px; height: 34px; display: inline-block; }
.candle::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 2px;
  width: 10px;
  height: 20px;
  background: linear-gradient(#e8dfca, #a99c80);
  border-radius: 2px;
}
.candle::after {
  content: "";
  position: absolute;
  bottom: 20px;
  left: 3px;
  width: 8px;
  height: 13px;
  background: radial-gradient(ellipse at 50% 70%, #fff4c9 0%, #f0b45a 45%, rgba(240, 120, 40, 0) 75%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 2.6s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); opacity: 0.95; }
  30% { transform: scale(0.92, 1.06) rotate(1.5deg); opacity: 0.85; }
  60% { transform: scale(1.04, 0.95) rotate(-2deg); opacity: 1; }
}

/* ---------- Verses (Shahnameh layout) ---------- */

.beyt {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  max-width: 720px;
  margin: 32px auto;
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-size: clamp(20px, 3.2vw, 27px);
  line-height: 2.6;
  color: var(--parchment);
}
.beyt .m1 { text-align: start; }
.beyt .m2 { text-align: end; }
.beyt .sep { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); opacity: 0.8; }
.beyt-source {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: -18px;
}
@media (max-width: 560px) {
  .beyt { grid-template-columns: 1fr; gap: 0; text-align: center; }
  .beyt .m1, .beyt .m2 { text-align: center; }
  .beyt .sep { display: none; }
}

/* ---------- Page title (sarlowh) ---------- */

.page-head { text-align: center; padding-block: 48px 8px; }
.sarlowh {
  position: relative;
  display: inline-block;
  padding: 10px 56px 4px;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(28, 43, 72, 0.85), rgba(17, 26, 40, 0.85)),
    var(--star);
  background-size: auto, 40px 40px;
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 5px var(--line);
}
.sarlowh::before,
.sarlowh::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--gold);
  transform: translateY(-50%) rotate(45deg);
}
.sarlowh::before { right: 18px; }
.sarlowh::after { left: 18px; }
.sarlowh h1 {
  margin: 0;
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-weight: 400;
  color: var(--parchment);
  font-size: clamp(28px, 5vw, 40px);
  line-height: 2;
}
.page-head .lead { color: var(--muted); max-width: 640px; margin: 18px auto 0; }

/* ---------- Folio (manuscript frame) ---------- */

.folio {
  position: relative;
  background: linear-gradient(180deg, rgba(23, 34, 53, 0.92), rgba(17, 26, 40, 0.92));
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  box-shadow:
    inset 0 0 0 5px var(--ink-2),
    inset 0 0 0 6px rgba(79, 141, 143, 0.45),
    inset 0 0 0 9px var(--ink-2),
    inset 0 0 0 10px rgba(191, 160, 99, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 40px clamp(20px, 5vw, 56px);
  margin-block: 28px;
}
.folio .corner {
  position: absolute;
  width: 46px;
  height: 46px;
  color: var(--gold);
  opacity: 0.75;
}
.folio .c-tr { top: 12px; right: 12px; }
.folio .c-tl { top: 12px; left: 12px; transform: scaleX(-1); }
.folio .c-br { bottom: 12px; right: 12px; transform: scaleY(-1); }
.folio .c-bl { bottom: 12px; left: 12px; transform: scale(-1, -1); }

.folio h2 {
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-weight: 400;
  color: var(--gold);
  font-size: clamp(24px, 4vw, 30px);
  line-height: 2;
  margin: 0 0 8px;
  text-align: center;
}
.folio h3 { color: var(--parchment); font-size: 18px; margin: 28px 0 4px; }
.folio p { margin: 0 0 16px; text-align: justify; }
.folio > :last-child { margin-bottom: 0; }

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px auto;
  color: var(--gold);
}
.divider::before,
.divider::after {
  content: "";
  height: 1px;
  width: min(180px, 30vw);
  background: linear-gradient(to left, transparent, var(--gold-soft));
}
.divider::after { background: linear-gradient(to right, transparent, var(--gold-soft)); }
.divider svg { width: 26px; height: 26px; }

/* ---------- Cards (home) ---------- */

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-block: 36px;
}
.card {
  display: block;
  flex: 1 1 280px;
  max-width: 334px;
  text-decoration: none;
  color: var(--text);
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 26, 40, 0.8);
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--gold-soft); color: var(--text); transform: translateY(-2px); }
.card h3 {
  margin: 0 0 6px;
  font-family: "Nastaliq", "Vazirmatn", serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 2;
  color: var(--gold);
}
.card p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.9; }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  inset-inline-start: 7px;
  width: 1px;
  background: linear-gradient(var(--gold-soft), rgba(141, 118, 71, 0.15));
}
.timeline li { position: relative; padding-inline-start: 36px; margin-bottom: 22px; }
.timeline li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 10px;
  width: 11px;
  height: 11px;
  background: var(--ink-2);
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}
.timeline .when { display: block; color: var(--gold); font-weight: 600; font-size: 15px; }
.timeline .what { display: block; }
.timeline li.end::before { background: #050608; border-color: var(--muted); }

/* ---------- Lists and tables ---------- */

.ornate-list { list-style: none; padding: 0; margin: 0 0 16px; }
.ornate-list li { position: relative; padding-inline-start: 26px; margin-bottom: 8px; }
.ornate-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: 13px;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  opacity: 0.8;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.8; }
th { color: var(--gold); font-weight: 600; border-bottom-color: var(--gold-soft); }
td.role { white-space: nowrap; color: var(--muted); }

.note {
  border-inline-start: 2px solid var(--rubric);
  padding: 4px 16px;
  color: var(--muted);
  font-size: 15px;
  margin: 16px 0;
}

blockquote.saying {
  margin: 24px 0;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--gold-soft);
  background: rgba(11, 17, 27, 0.5);
  color: var(--parchment);
}
blockquote.saying footer { color: var(--muted); font-size: 14px; margin-top: 8px; }

/* ---------- Two-column media layout ---------- */

.split { display: grid; grid-template-columns: 280px 1fr; gap: 36px; align-items: start; }
.split figure { margin: 0; }
.split figcaption, figure figcaption { color: var(--muted); font-size: 14px; text-align: center; margin-top: 10px; line-height: 1.8; }
.framed { border: 1px solid var(--gold-soft); padding: 6px; background: var(--ink); border-radius: var(--radius); }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } .split figure { max-width: 320px; margin-inline: auto; } }

/* ---------- Music player ---------- */

.player {
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  background: rgba(11, 17, 27, 0.6);
  padding: 18px;
}
.player audio { width: 100%; margin-bottom: 10px; }
.now-playing { color: var(--gold); font-size: 15px; margin-bottom: 8px; min-height: 30px; }
.tracks { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.tracks button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  padding: 10px 6px;
  cursor: pointer;
  text-align: start;
}
.tracks button:hover { color: var(--parchment); background: rgba(191, 160, 99, 0.05); }
.tracks button[aria-pressed="true"] { color: var(--gold); }
.tracks .num { width: 24px; color: var(--muted); font-size: 14px; }
.tracks .title { flex: 1; }
.tracks .len { color: var(--muted); font-size: 14px; }

/* ---------- Gallery ---------- */

.gallery { columns: 3 240px; column-gap: 18px; }
.gallery figure { break-inside: avoid; margin: 0 0 18px; }
.gallery button { display: block; width: 100%; padding: 0; border: 1px solid var(--gold-soft); background: var(--ink); cursor: zoom-in; border-radius: var(--radius); overflow: hidden; }
.gallery img { width: 100%; transition: opacity 0.2s; }
.gallery button:hover img { opacity: 0.85; }

dialog.lightbox {
  border: 1px solid var(--gold-soft);
  background: var(--ink);
  color: var(--text);
  padding: 12px;
  max-width: min(94vw, 900px);
  max-height: 94vh;
}
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
dialog.lightbox img { max-height: 80vh; margin-inline: auto; }
dialog.lightbox p { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 0; }
dialog.lightbox .close { position: absolute; top: 6px; left: 6px; background: var(--ink-2); color: var(--gold); border: 1px solid var(--line); width: 36px; height: 36px; cursor: pointer; font-size: 18px; }

/* ---------- Footer ---------- */

.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: rgba(8, 12, 19, 0.9); }
.site-footer .beyt { margin-block: 28px 8px; font-size: clamp(18px, 2.6vw, 22px); }
.site-footer .small { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 28px; margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .candle::after { animation: none; }
  .card { transition: none; }
}
