/* Sima Yari — site styles. Right-to-left first; English blocks set dir="ltr". */

@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap; src: url(/assets/fonts/vazirmatn-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-display: swap; src: url(/assets/fonts/vazirmatn-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Vazirmatn"; font-weight: 400; font-display: swap; src: url(/assets/fonts/vazirmatn-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Vazirmatn"; font-weight: 700; font-display: swap; src: url(/assets/fonts/vazirmatn-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Verse"; font-weight: 400; font-display: swap; src: url(/assets/fonts/markazi-text-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Verse"; font-weight: 400 600; font-display: swap; src: url(/assets/fonts/markazi-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Verse"; font-weight: 600; font-display: swap; src: url(/assets/fonts/markazi-text-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Garamond"; font-weight: 400; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); }

:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d8;
  --card: #fbf8f2;
  --ink: #2a2420;
  --muted: #776b5f;
  --line: #e0d5c2;
  --accent: #8e2b36;      /* pomegranate */
  --accent-ink: #fff;
  --gold: #a8874f;
  --shadow: 0 1px 2px rgb(60 40 20 / .06), 0 8px 24px -12px rgb(60 40 20 / .25);

  --ui: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --verse: "Verse", "Markazi Text", "Vazirmatn", serif;
  --latin: "Garamond", "EB Garamond", Georgia, serif;
  --poem-size: 1.55rem;
  --radius: 14px;
  --wrap: 1120px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #16130f; --paper-2: #1e1a15; --card: #1f1b16; --ink: #ece4d6; --muted: #a59886;
  --line: #3a322a; --accent: #e07f89; --accent-ink: #1a0f10; --gold: #c9a86c;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16130f; --paper-2: #1e1a15; --card: #1f1b16; --ink: #ece4d6; --muted: #a59886;
    --line: #3a322a; --accent: #e07f89; --accent-ink: #1a0f10; --gold: #c9a86c;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.9 var(--ui);
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: .3em; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--verse); font-weight: 600; line-height: 1.5; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 4.5vw, 2.9rem); }
h2 { font-size: 1.7rem; }
h2 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
[lang="en"], [lang="en"] :is(h1, h2, h3, blockquote) { font-family: var(--latin); }
[lang="en"] :is(h1, h2, h3) { font-weight: 400; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.en { font-family: var(--latin); font-size: .95em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 1rem; top: -3rem; background: var(--accent); color: var(--accent-ink); padding: .4rem .8rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 1rem; }
.eyebrow { color: var(--gold); font-size: .85rem; letter-spacing: .02em; margin-bottom: .4rem; }
.lead { font-size: 1.12rem; }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.more { color: var(--accent); text-decoration: none; font-size: .95rem; white-space: nowrap; }
.more:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }
.brand { display: flex; align-items: baseline; gap: .65rem; text-decoration: none; }
.brand-fa { font-family: var(--verse); font-weight: 600; font-size: 1.85rem; line-height: 1; }
.brand-en { font-family: var(--latin); font-style: italic; color: var(--muted); font-size: 1.05rem; }
.site-nav { display: flex; align-items: center; gap: .25rem; }
.site-nav a, .site-nav button { text-decoration: none; padding: .45rem .8rem; border-radius: 999px; color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; }
.site-nav a:hover, .site-nav button:hover { background: var(--paper-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.nav-icon { display: inline-grid !important; place-items: center; padding: .5rem !important; }
.menu-toggle { display: none; background: none; border: 0; padding: .6rem; cursor: pointer; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; transition: transform .2s, opacity .2s; }
@media (max-width: 860px) {
  .brand-en { display: none; }
  .menu-toggle { display: block; }
  .site-nav { position: absolute; inset-inline: 0; top: 100%; flex-direction: column; align-items: stretch; padding: .75rem 1.25rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line); display: none; }
  .site-nav.open { display: flex; }
  .site-nav a, .site-nav button { padding: .7rem .9rem; border-radius: 10px; text-align: start; }
  .nav-icon { justify-content: start; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ------------------------------------------------------------------ buttons */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.actions.center { justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .62rem 1.25rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; transition: transform .15s, background .15s, border-color .15s; }
.btn:hover { transform: translateY(-1px); border-color: var(--gold); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-ghost { background: transparent; }

/* ------------------------------------------------------------------ home */
.hero { padding: clamp(2rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); background:
  radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 60%),
  radial-gradient(40rem 26rem at 0% 110%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%); }
.hero-inner { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero-portrait { margin: 0; aspect-ratio: 3 / 4; border-radius: 999px 999px var(--radius) var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 6px solid var(--card); }
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.hero-name { font-size: clamp(2.8rem, 7vw, 4.6rem); margin: 0; line-height: 1.25; }
.hero-name-en { font-family: var(--latin); font-style: italic; font-size: clamp(1.3rem, 2.5vw, 1.7rem); color: var(--muted); margin: 0 0 1.25rem; text-align: right; }
.hero-text .lead { max-width: 38rem; }
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-portrait { width: min(70%, 260px); margin-inline: auto; }
  .hero-name-en { text-align: center; }
  .hero .actions { justify-content: center; }
}

.featured { padding: clamp(2.5rem, 6vw, 4rem) 0; background: var(--card); border-block: 1px solid var(--line); }
.poem-excerpt { position: relative; max-height: 26rem; overflow: hidden; margin: 1.5rem auto; width: fit-content; max-width: 100%;
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent); mask-image: linear-gradient(to bottom, black 70%, transparent); }

.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.quote { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; position: relative; }
.quote::before { content: "«"; position: absolute; inset-inline-start: 1rem; top: -.2rem; font-family: var(--verse); font-size: 3rem; color: color-mix(in srgb, var(--gold) 50%, transparent); line-height: 1; }
.quote[dir="ltr"]::before { content: "“"; }
.quote blockquote { margin: 0; font-family: var(--verse); font-size: 1.3rem; line-height: 2; flex: 1; }
.quote[lang="en"] blockquote { font-family: var(--latin); font-size: 1.15rem; line-height: 1.6; }
.quote blockquote p:last-child { margin: 0; }
.quote figcaption { display: flex; flex-direction: column; font-size: .9rem; line-height: 1.6; border-top: 1px solid var(--line); padding-top: .8rem; }
.quotes-full { grid-template-columns: 1fr; max-width: 820px; margin-inline: auto; }
.support { color: var(--muted); font-size: .95rem; border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; }
.support p { margin: 0; }

/* ------------------------------------------------------------------ books */
.shelf { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2rem 1.5rem; }
.book-card { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; }
.cover { display: block; aspect-ratio: 2 / 3; background: var(--paper-2); border-radius: 6px 10px 10px 6px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, rgb(0 0 0 / .14), transparent 7%, transparent 93%, rgb(255 255 255 / .06)); pointer-events: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .cover { transition: transform .25s ease, box-shadow .25s ease; }
.book-card:hover .cover { transform: translateY(-4px) rotate(-.6deg); }
.book-card-title { font-family: var(--verse); font-weight: 600; font-size: 1.35rem; margin-top: .55rem; line-height: 1.5; }
.book-card-meta { font-size: .85rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head .lead { margin-bottom: 2.5rem; }

.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .9rem; margin-bottom: 1.75rem; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs > * + *::before { content: "‹"; margin-inline-end: .5rem; color: var(--line); }

.book-head { display: grid; grid-template-columns: 260px 1fr; gap: clamp(1.5rem, 5vw, 3.5rem); align-items: start; margin-bottom: 3rem; }
.cover-lg { margin: 0; }
.book-head h1 { margin: 0; }
.book-en { font-family: var(--latin); font-style: italic; color: var(--muted); font-size: 1.25rem; margin: 0 0 .5rem; text-align: right; }
@media (max-width: 680px) {
  .book-head { grid-template-columns: 1fr; }
  .cover-lg { width: 60%; max-width: 220px; }
}
.prose { font-size: 1.05rem; line-height: 2.05; }
.prose h2 { margin-top: 2.2rem; }
.prose blockquote { margin: 1.5rem 0; padding: 1rem 1.5rem; border-inline-start: 3px solid var(--gold); background: var(--card); border-radius: var(--radius) 0 0 var(--radius); font-family: var(--verse); font-size: 1.35rem; }
.prose img { margin: 1.5rem auto; border-radius: 8px; box-shadow: var(--shadow); }

.toc { border-top: 1px solid var(--line); padding-top: 2rem; }
.toc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.toc-head h2 { margin: 0; }
.toc-filter input, .search-input { font: inherit; padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); min-width: min(18rem, 100%); }
.toc-list { list-style: none; margin: 0; padding: 0; columns: 3 15rem; column-gap: 2.5rem; }
.toc-list li { break-inside: avoid; }
.toc-list a { display: flex; gap: .7rem; align-items: baseline; padding: .32rem 0; text-decoration: none; border-bottom: 1px dotted var(--line); font-family: var(--verse); font-size: 1.25rem; }
.toc-list .n { color: var(--gold); font-family: var(--ui); font-size: .8rem; min-width: 1.8rem; }
.toc-list .en { font-size: .9rem; }
.badge { color: var(--accent); font-size: .85rem; }
.toc-list li[hidden] { display: none; }

/* ------------------------------------------------------------------ poem */
.poem, .story { font-family: var(--verse); font-size: var(--poem-size); line-height: 1.85; white-space: pre-wrap; overflow-wrap: break-word; tab-size: 8; }
.story { white-space: pre-line; text-align: justify; line-height: 2.2; }
.translation .poem { font-family: var(--latin); line-height: 1.75; font-size: calc(var(--poem-size) * .82); }
.poem-page .wrap { max-width: 900px; }
.poem-layout { display: grid; grid-template-columns: 1fr; gap: 3rem; justify-items: center; }
.poem-col { width: fit-content; max-width: 100%; min-width: min(100%, 22rem); }
.poem-page.has-translation .wrap { max-width: var(--wrap); }
.has-translation .poem-layout { grid-template-columns: 1fr 1fr; justify-items: stretch; align-items: start; }
.has-translation .poem-col { width: auto; }
.translation { border-inline-start: 1px solid var(--line); padding-inline-start: 3rem; }
@media (max-width: 820px) {
  .has-translation .poem-layout { grid-template-columns: 1fr; }
  .translation { border: 0; border-top: 1px solid var(--line); padding: 2rem 0 0; }
}
.poem-title { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 1.25rem; }
.poem-title a { text-decoration: none; }
.poem-title::after { content: ""; display: block; width: 3rem; height: 2px; background: var(--gold); margin-top: .6rem; border-radius: 2px; }
.center.poem-title::after { margin-inline: auto; }
.poem-note { color: var(--muted); font-size: .92rem; white-space: pre-line; margin-top: -.5rem; }
.poem-audio { max-width: 32rem; margin: 2.5rem auto 0; text-align: center; }
audio { width: 100%; height: 44px; }
.poem-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 3rem 0 1.5rem; }
.tool { font: inherit; font-size: .85rem; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.tool:hover { color: var(--accent); border-color: var(--accent); }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: stretch; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.pager a { text-decoration: none; display: flex; flex-direction: column; font-family: var(--verse); font-size: 1.3rem; line-height: 1.5; padding: .6rem .9rem; border-radius: 10px; }
.pager a:hover { background: var(--card); }
.pager .small { font-family: var(--ui); }
.pager-next { text-align: left; align-items: flex-end; }
.pager-up { align-self: center; font-family: var(--ui) !important; font-size: .9rem !important; color: var(--muted); border: 1px solid var(--line); border-radius: 999px !important; padding: .35rem 1rem !important; }

/* ------------------------------------------------------------------ about / voice / press */
.about-photo { margin: 0 0 2rem; }
.about-photo img { border-radius: var(--radius); box-shadow: var(--shadow); margin-inline: auto; max-height: 520px; width: auto; }
.about-photo figcaption { text-align: center; margin-top: .6rem; }
.recordings { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1rem; }
.recording { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.recording-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.recording h2 { font-size: 1.35rem; margin: 0 0 .4rem; }
.press-list { display: grid; gap: 3rem; margin-top: 2rem; }
.press-item h2 { font-size: 1.4rem; }
.press-item h2 a { text-decoration: none; }
.press-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; align-items: start; }
.press-images img { border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* ------------------------------------------------------------------ search (Pagefind UI) */
#search { --pagefind-ui-scale: 1; --pagefind-ui-primary: var(--accent); --pagefind-ui-text: var(--ink); --pagefind-ui-background: var(--card); --pagefind-ui-border: var(--line); --pagefind-ui-tag: var(--paper-2); --pagefind-ui-border-radius: 12px; --pagefind-ui-font: var(--ui); margin-top: 1.5rem; }
#search .pagefind-ui__result-title { font-family: var(--verse); font-size: 1.2rem; }
#search .pagefind-ui__result-excerpt { font-family: var(--verse); }
#search .pagefind-ui__result-thumb { display: none; }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-2); padding: 2.5rem 0; margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; }
.footer-name { font-size: 1.4rem; }
.footer-inner p { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-nav a { text-decoration: none; color: var(--muted); }
.copyright { flex-basis: 100%; text-align: center; font-family: var(--ui); }

@media print {
  .site-header, .site-footer, .poem-tools, .pager, .crumbs, .poem-audio { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
