/* =====================================================================
   THE APOSTATES · 09 LATTICE
   Design system plan
   - Voice: heritage scholarship read critically. Terracotta on slate,
     warm stone paper. One accent (terracotta); slate is the neutral.
   - Type: Spectral (display, light 300 at large sizes; italic for
     quotations), Readex Pro (text, UI, and Arabic terms), Amiri Quran
     (Quranic text only: Readex lacks the Uthmani small high marks).
   - Rhythm: one baseline unit --lh = 1.75rem (17px text x 1.65).
     All vertical spacing is a multiple of half a line (--s2).
   - Grid: centred column, max 82rem, fluid gutter; 12 tracks for
     editorial layouts; article uses toc | text (41rem ~ 66ch) | notes.
   - Lattice: an exact eight-point star girih, computed with Hankin's
     "polygons in contact" method on the 4.8.8 tiling (contact angle
     67.5deg), stored as one 120-unit SVG tile and applied as a CSS
     mask. Used only in the hero field and as section separators.
   - Radius: one system, --r = 2px (precise, never pill). Shadows: none.
   - Motion: only the hero entrance (opacity/transform); off when
     prefers-reduced-motion.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M102.42 102.42L72.42 90.00 M60.00 120.00L72.42 90.00 M60.00 120.00L47.57 90.00 M17.57 102.42L47.57 90.00 M17.57 102.42L30.00 72.42 M-0.00 60.00L30.00 72.42 M-0.00 60.00L30.00 47.57 M17.57 17.57L30.00 47.57 M17.57 17.57L47.57 30.00 M60.00 0.00L47.57 30.00 M60.00 0.00L72.42 30.00 M102.42 17.57L72.42 30.00 M102.42 17.57L90.00 47.57 M120.00 60.00L90.00 47.57 M120.00 60.00L90.00 72.42 M102.42 102.42L90.00 72.42 M17.57 17.57L0.00 10.29 M-17.57 17.57L0.00 10.29 M-17.57 17.57L-10.29 0.00 M-17.57 -17.57L-10.29 0.00 M-17.57 -17.57L-0.00 -10.29 M17.57 -17.57L-0.00 -10.29 M17.57 -17.57L10.29 -0.00 M17.57 17.57L10.29 -0.00 M17.57 137.57L0.00 130.29 M-17.57 137.57L0.00 130.29 M-17.57 137.57L-10.29 120.00 M-17.57 102.42L-10.29 120.00 M-17.57 102.42L0.00 109.70 M17.57 102.42L0.00 109.70 M17.57 102.42L10.29 120.00 M17.57 137.57L10.29 120.00 M137.57 17.57L120.00 10.29 M102.42 17.57L120.00 10.29 M102.42 17.57L109.70 0.00 M102.42 -17.57L109.70 0.00 M102.42 -17.57L120.00 -10.29 M137.57 -17.57L120.00 -10.29 M137.57 -17.57L130.29 0.00 M137.57 17.57L130.29 0.00 M137.57 137.57L120.00 130.29 M102.42 137.57L120.00 130.29 M102.42 137.57L109.70 120.00 M102.42 102.42L109.70 120.00 M102.42 102.42L120.00 109.70 M137.57 102.42L120.00 109.70 M137.57 102.42L130.29 120.00 M137.57 137.57L130.29 120.00' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");

  --bg: #f4f1eb;
  --bg-2: #ebe6dd;
  --ink: #1e2830;
  --muted: #56616b;
  --rule: #d6cfc4;
  --rule-strong: #b9b0a3;
  --accent: #a4461f;
  --on-accent: #ffffff;
  --lattice-ink: #a4461f;
  --lattice-alpha: .26;
  --band: #1e2a33;
  --band-ink: #f4f1eb;
  --band-muted: #b9c0c6;
  --band-rule: #34434e;
  --band-accent: #e8865f;
  --focus: #a4461f;

  --f-display: "Spectral", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-text: "Readex Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-quran: "Amiri Quran", "Readex Pro", serif;

  --t-xs: .8125rem;
  --t-sm: .9375rem;
  --t-base: 1.0625rem;
  --t-md: 1.25rem;
  --t-lg: clamp(1.375rem, 1.15rem + .9vw, 1.75rem);
  --t-xl: clamp(1.875rem, 1.35rem + 2vw, 2.75rem);
  --t-2xl: clamp(2.375rem, 1.5rem + 3.6vw, 4.25rem);
  --t-hero: clamp(3.5rem, 1rem + 11vw, 9rem);

  --lh: 1.75rem;
  --s1: .4375rem;
  --s2: .875rem;
  --s3: 1.75rem;
  --s4: 2.625rem;
  --s5: 3.5rem;
  --s6: 5.25rem;
  --s7: 7rem;
  --s8: 10.5rem;

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 82rem;
  --measure: 41rem;
  --r: 2px;

  color-scheme: light;
}

/* Dark: slate night with terracotta. Same token names, both entry points. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11181d; --bg-2: #182128; --ink: #e9e4dc; --muted: #a7afb5;
    --rule: #2b3740; --rule-strong: #3e4d58; --accent: #e8865f; --on-accent: #11181d;
    --lattice-ink: #e8865f; --lattice-alpha: .16;
    --band: #1b252c; --band-ink: #e9e4dc; --band-muted: #a7afb5; --band-rule: #31404a; --band-accent: #e8865f;
    --focus: #e8865f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11181d; --bg-2: #182128; --ink: #e9e4dc; --muted: #a7afb5;
  --rule: #2b3740; --rule-strong: #3e4d58; --accent: #e8865f; --on-accent: #11181d;
  --lattice-ink: #e8865f; --lattice-alpha: .16;
  --band: #1b252c; --band-ink: #e9e4dc; --band-muted: #a7afb5; --band-rule: #31404a; --band-accent: #e8865f;
  --focus: #e8865f; color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; hanging-punctuation: first allow-end last; scroll-padding-block-start: var(--s3); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-base)/var(--lh) var(--f-text);
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r); }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 300; text-wrap: balance; letter-spacing: -.01em; }
p, li, dd, blockquote { text-wrap: pretty; }
p { margin: 0; }
p + p { margin-block-start: var(--s2); }
em, i, cite { font-family: var(--f-display); font-style: italic; font-size: 1.06em; }
cite { font-size: 1em; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.label {
  font: 500 var(--t-xs)/1.4 var(--f-text);
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.meta { font-size: var(--t-sm); color: var(--muted); }

/* Arabic term + transliteration + gloss, the bilingual voice */
.term { white-space: nowrap; }
.term [lang="ar"] { font-family: var(--f-text); font-weight: 400; font-size: 1.12em; line-height: 1; }
.term i { color: var(--accent); }
.label .term { text-transform: none; letter-spacing: 0; font-size: 1.15em; }

/* ---------- Skip link, quick exit ---------- */
.skip {
  position: absolute; inset-inline-start: var(--s2); inset-block-start: -4rem; z-index: 50;
  padding: var(--s2) var(--s3); background: var(--ink); color: var(--bg); border-radius: var(--r);
}
.skip:focus { inset-block-start: var(--s2); color: var(--bg); }
.exit {
  position: fixed; z-index: 40; inset-inline-end: var(--s2); inset-block-end: var(--s2);
  display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; padding-inline: var(--s2);
  font: 500 var(--t-xs)/1 var(--f-text); letter-spacing: .06em; text-decoration: none;
  color: var(--ink); background: var(--bg); border: 1px solid var(--rule-strong); border-radius: var(--r);
}
.exit kbd { font: inherit; color: var(--muted); }
.exit:hover { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.exit:hover kbd { color: inherit; }

/* ---------- Header ---------- */
.site-head { border-block-end: 1px solid var(--rule); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 4.5rem; padding-block: var(--s1); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; margin-inline-end: auto; min-height: 44px; }
.brand img { width: 36px; height: 36px; border-radius: var(--r); }
.brand span { font: 400 1.3125rem/1 var(--f-display); letter-spacing: .005em; }
.nav { display: flex; align-items: center; gap: var(--s3); }
.nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: var(--t-sm); color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--accent); }
.theme {
  inline-size: 44px; block-size: 44px; display: grid; place-items: center;
  background: none; border: 1px solid var(--rule); border-radius: var(--r); color: var(--ink); cursor: pointer;
}
.theme::before {
  content: ""; inline-size: 14px; block-size: 14px; border-radius: 50%;
  border: 1.5px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.theme:hover { border-color: var(--ink); }
@media (max-width: 40rem) {
  .nav { order: 3; inline-size: 100%; gap: var(--s3); border-block-start: 1px solid var(--rule); }
  .brand span { font-size: 1.1875rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 48px; padding: 0 1.375rem; border: 1px solid var(--accent); border-radius: var(--r);
  background: var(--accent); color: var(--on-accent);
  font: 500 var(--t-sm)/1 var(--f-text); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.btn:hover { background: transparent; color: var(--accent); }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn--quiet:hover { border-color: var(--ink); color: var(--ink); }
.more { display: inline-flex; align-items: center; gap: .5em; min-height: 44px; font-weight: 500; font-size: var(--t-sm); text-decoration: none; color: var(--accent); }
.more::after { content: "\2192"; transition: transform .2s; }
.more:hover::after { transform: translateX(3px); }

/* ---------- Lattice ---------- */
/* The tile is a mask; colour comes from tokens, so it is exact in both themes. */
.lattice-field, .lattice-rule {
  background: var(--lattice-ink);
  pointer-events: none;
}
.lattice-field {
  position: absolute; inset: 0; opacity: var(--lattice-alpha);
  -webkit-mask: var(--lattice) center / var(--tile) repeat, radial-gradient(closest-side, #000 25%, transparent 100%) center / 100% 100% no-repeat;
  -webkit-mask-composite: source-in;
  mask: var(--lattice) center / var(--tile) repeat, radial-gradient(closest-side, #000 25%, transparent 100%) center / 100% 100% no-repeat;
  mask-composite: intersect;
}
.lattice-rule {
  --tile: 64px; display: block; margin-block: var(--s4); block-size: 96px; opacity: calc(var(--lattice-alpha) * 2.2);
  -webkit-mask: var(--lattice) center / var(--tile) repeat, radial-gradient(closest-side, #000 35%, transparent) center / 100% 100% no-repeat;
  -webkit-mask-composite: source-in;
  mask: var(--lattice) center / var(--tile) repeat, radial-gradient(closest-side, #000 35%, transparent) center / 100% 100% no-repeat;
  mask-composite: intersect;
}

/* ---------- Home: hero ---------- */
.hero { position: relative; isolation: isolate; overflow: clip; }
.hero .lattice-field { --tile: clamp(132px, 12vw, 176px); z-index: -1; inset-inline-start: 38%; inset-block: -10% -10%; }
.hero .wrap {
  min-height: min(calc(100dvh - 4.5rem), 54rem);
  display: grid; align-content: center; padding-block: var(--s6) var(--s6);
}
.hero h1 { font-size: var(--t-hero); line-height: .98; letter-spacing: -.035em; max-inline-size: 9ch; margin-inline-start: -.04em; }
.hero p { margin-block-start: var(--s4); max-inline-size: 30ch; font-size: var(--t-lg); font-weight: 300; line-height: 1.45; color: var(--muted); }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-block-start: var(--s4); }
@media (max-width: 40rem) {
  .hero .lattice-field { inset-inline-start: 0; inset-block: auto 0; block-size: 55%; }
  .hero .wrap { align-content: start; padding-block: var(--s5) var(--s7); min-height: min(calc(100dvh - 8rem), 46rem); }
}

/* ---------- Section scaffolding ---------- */
.section { padding-block: var(--s7); }
.section-head { display: flex; flex-wrap: wrap; align-items: last baseline; justify-content: space-between; gap: var(--s2) var(--s3); margin-block-end: var(--s4); }
.section-head h2 { font-size: var(--t-xl); line-height: 1.12; }
@media (max-width: 40rem) { .section { padding-block: var(--s6); } }

/* ---------- Featured debunk (asymmetric split) ---------- */
.feature { display: grid; gap: var(--s4) var(--s5); align-items: end; }
@media (min-width: 60rem) { .feature { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); } }
.feature h2 { font-size: var(--t-xl); line-height: 1.1; margin-block: var(--s2) var(--s3); }
.feature h2 a { text-decoration: none; }
.feature .dek { color: var(--muted); max-inline-size: 38ch; }
.feature .meta { margin-block: var(--s3) var(--s2); }

/* ---------- YouTube facade ---------- */
.player { position: relative; aspect-ratio: 16 / 9; background: var(--band); border-radius: var(--r); overflow: hidden; }
.player iframe { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; border: 0; }
.yt { position: absolute; inset: 0; display: block; color: #f4f1eb; }
.yt img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.yt::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(12, 17, 21, .72)); }
.yt-label {
  position: absolute; z-index: 1; inset-inline-start: var(--s3); inset-block-end: var(--s3);
  display: inline-flex; align-items: center; gap: var(--s2); font: 500 var(--t-sm)/1 var(--f-text); letter-spacing: .02em;
}
.yt-play { inline-size: 52px; block-size: 52px; display: grid; place-items: center; background: #a4461f; border-radius: var(--r); transition: transform .25s; }
.yt-play::before { content: ""; inline-size: 14px; block-size: 16px; margin-inline-start: 3px; background: #fff; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.yt:hover .yt-play, .yt:focus-visible .yt-play { transform: scale(1.06); }
.yt:hover { color: #fff; }
@media (max-width: 40rem) {
  .yt-label { inset-inline-start: var(--s2); inset-block-end: var(--s2); }
  .yt-play { inline-size: 44px; block-size: 44px; }
  .exit kbd { display: none; }
}
.nw { white-space: nowrap; }
figure { margin: 0; }
figcaption { margin-block-start: var(--s2); font-size: var(--t-sm); color: var(--muted); }

/* ---------- Verse: the primary source, set with reverence ---------- */
.verse { text-align: center; }
.verse .ar {
  font-family: var(--f-quran); font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.875rem);
  line-height: 2.05; color: var(--ink); text-wrap: balance; margin: 0 auto; max-inline-size: 26em;
}
.verse .en { margin: var(--s4) auto 0; max-inline-size: 36rem; font: 300 var(--t-md)/1.6 var(--f-text); color: var(--muted); }
.verse .src { margin-block-start: var(--s3); display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: var(--t-sm); color: var(--muted); }
.verse .src a { color: var(--accent); font-weight: 500; }
.interlude { padding-block: var(--s6) var(--s7); }
.interlude .label { display: block; text-align: center; margin-block-end: var(--s4); }

/* ---------- Pillars (offset manifesto, not cards) ---------- */
.pillars { display: grid; gap: var(--s5); }
@media (min-width: 60rem) { .pillars { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--s6); } .pillars > header { position: sticky; top: var(--s4); align-self: start; } }
.pillars h2 { font-size: var(--t-2xl); line-height: 1.04; letter-spacing: -.025em; }
.pillars > header p { margin-block-start: var(--s3); color: var(--muted); max-inline-size: 40ch; }
.pillar-list { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--ink); }
.pillar-list li { display: grid; justify-items: start; gap: var(--s1); padding-block: var(--s4); border-block-end: 1px solid var(--rule); }
.pillar-list h3 { font-size: var(--t-lg); line-height: 1.25; font-weight: 400; }
.pillar-list p { color: var(--muted); max-inline-size: 52ch; }
.pillar-list .term { font-size: var(--t-sm); color: var(--muted); }

/* ---------- Video grid (1 large + 8) ---------- */
.vgrid { display: grid; gap: var(--s3) var(--s2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vgrid .v:first-child { grid-column: 1 / -1; }
@media (max-width: 47.99rem) { .vgrid .v:not(:first-child) h3 { font-size: var(--t-sm); line-height: 1.4; } .v a { gap: var(--s1); } }
@media (min-width: 48rem) { .vgrid { gap: var(--s4) var(--s3); grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 60rem) {
  .vgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .vgrid .v:first-child { grid-column: span 2; grid-row: span 2; }
  .vgrid .v:first-child h3 { font-size: var(--t-lg); }
}
.v a { display: grid; gap: var(--s2); text-decoration: none; }
.v img { aspect-ratio: 16 / 9; inline-size: 100%; object-fit: cover; border-radius: var(--r); background: var(--bg-2); }
.v h3 { font: 400 var(--t-md)/1.35 var(--f-display); letter-spacing: 0; }
.v a:hover h3 { color: var(--accent); }
.v .meta { display: flex; flex-wrap: wrap; gap: 0 var(--s2); font-size: var(--t-xs); letter-spacing: .02em; }
.v .kicker { order: -1; }
.v img { order: -2; }

/* ---------- Stories band (inverted slate) ---------- */
.band { background: var(--band); color: var(--band-ink); --muted: var(--band-muted); --rule: var(--band-rule); --accent: var(--band-accent); --focus: var(--band-accent); }
.stories { display: grid; gap: var(--s5); }
@media (min-width: 60rem) { .stories { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--s6); } .stories > header { position: sticky; top: var(--s4); align-self: start; } }
.stories h2 { font-size: var(--t-2xl); line-height: 1.04; letter-spacing: -.025em; margin-block: var(--s2) var(--s3); }
.stories > header p { color: var(--muted); max-inline-size: 34ch; }
.story-list { list-style: none; margin: 0; padding: 0; }
.story-list li + li { border-block-start: 1px solid var(--rule); }
.story-list a { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: var(--s3); align-items: center; padding-block: var(--s3); text-decoration: none; }
.story-list img { aspect-ratio: 16 / 9; inline-size: 100%; object-fit: cover; border-radius: var(--r); }
.story-list h3 { font: 300 var(--t-lg)/1.25 var(--f-display); }
.story-list a:hover h3 { color: var(--accent); }
.story-list .meta { margin-block-start: var(--s1); font-size: var(--t-xs); }
@media (max-width: 34rem) { .story-list a { grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--s2); } .story-list h3 { font-size: var(--t-md); } }

/* ---------- Ledger (sources teaser + library) ---------- */
.ledger { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--ink); }
.entry { display: grid; gap: var(--s2) var(--s4); padding-block: var(--s3); border-block-end: 1px solid var(--rule); scroll-margin-block-start: var(--s3); }
@media (min-width: 48rem) { .entry { grid-template-columns: 11rem minmax(0, 1fr) auto; align-items: baseline; } }
.entry .type { display: flex; align-items: baseline; gap: var(--s2); }
.entry .type [lang="ar"] { font-size: 1.125rem; line-height: 1; color: var(--accent); }
.entry .ref { font: 400 var(--t-md)/1.35 var(--f-display); }
.entry .note { margin-block-start: var(--s1); color: var(--muted); font-size: var(--t-sm); max-inline-size: 60ch; }
.entry .ar { margin-block-start: var(--s2); font: 400 1.5rem/2 var(--f-quran); text-align: right; }
.entry .acts { display: flex; flex-wrap: wrap; gap: 0 var(--s3); align-items: center; }
.entry .acts a, .copy { font-size: var(--t-sm); }
.entry .acts a { display: inline-flex; min-height: 44px; align-items: center; color: var(--accent); font-weight: 500; }
.copy {
  min-height: 44px; padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: var(--f-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em;
}
.copy:hover { color: var(--ink); }
.copy[data-done] { color: var(--accent); text-decoration: none; }
.teaser { display: grid; gap: var(--s4); }
@media (min-width: 60rem) { .teaser { grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: var(--s6); } }
.teaser h2 { font-size: var(--t-xl); line-height: 1.1; }
.teaser header p { margin-block: var(--s3) var(--s2); color: var(--muted); }

/* ---------- Support + forms ---------- */
.support { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 60rem) { .support { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--s6); } }
.support h2 { font-size: var(--t-hero); line-height: .98; letter-spacing: -.035em; }
.support .lede { margin-block-start: var(--s3); color: var(--muted); max-inline-size: 42ch; }
.support .actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-block-start: var(--s4); }
.panel { padding: clamp(var(--s3), 4vw, var(--s4)); background: var(--bg-2); border-radius: var(--r); }
.panel h3 { font-size: var(--t-lg); margin-block-end: var(--s3); font-weight: 400; }
.field { display: grid; gap: var(--s1); }
.field + .field { margin-block-start: var(--s3); }
.field label { font-weight: 500; font-size: var(--t-sm); }
.field label small { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  inline-size: 100%; min-height: 48px; padding: .75rem .875rem; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--rule-strong); border-radius: var(--r);
}
.field textarea { min-height: 7rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field .help { font-size: var(--t-xs); line-height: 1.5; color: var(--muted); }
.field .err { font-size: var(--t-xs); line-height: 1.5; color: var(--accent); font-weight: 500; }
.field [aria-invalid="true"] { border-color: var(--accent); }
.form-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-block-start: var(--s3); }
.status { font-size: var(--t-sm); color: var(--accent); }

/* ---------- Footer ---------- */
.site-foot { border-block-start: 1px solid var(--rule); padding-block: var(--s5) var(--s6); font-size: var(--t-sm); color: var(--muted); }
.site-foot .wrap { display: grid; gap: var(--s3); }
@media (min-width: 48rem) { .site-foot .wrap { grid-template-columns: 1fr auto; align-items: start; } }
.site-foot nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.site-foot nav a { display: inline-flex; min-height: 44px; align-items: center; }
.site-foot .closing { font: 300 var(--t-lg)/1.3 var(--f-display); color: var(--ink); }

/* ---------- Article ---------- */
.a-head { padding-block: var(--s6) var(--s4); }
.a-head .inner { max-inline-size: 58rem; }
.a-head h1 { font-size: var(--t-2xl); line-height: 1.04; letter-spacing: -.028em; margin-block: var(--s3) var(--s3); }
.a-head .dek { font: 300 var(--t-lg)/1.45 var(--f-text); color: var(--muted); max-inline-size: 44ch; }
.byline { display: flex; flex-wrap: wrap; gap: 0 var(--s2); margin-block-start: var(--s4); padding-block-start: var(--s2); border-block-start: 1px solid var(--rule); font-size: var(--t-sm); color: var(--muted); }
.byline span:not(:last-child)::after { content: "\00B7"; margin-inline-start: var(--s2); }
.byline strong { color: var(--ink); font-weight: 500; }
.watch { margin-block-end: var(--s6); }
.watch .label { display: block; margin-block-end: var(--s2); }

.a-body { display: grid; gap: var(--s4); }
.toc { font-size: var(--t-sm); }
.toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--rule); }
.toc a { display: block; padding: .5rem 0 .5rem var(--s2); margin-inline-start: -1px; border-inline-start: 1px solid transparent; text-decoration: none; color: var(--muted); line-height: 1.4; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current="true"] { color: var(--ink); border-color: var(--accent); }
.toc details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 500; }
.toc .label { display: block; margin-block-end: var(--s2); }

.prose { max-inline-size: var(--measure); min-inline-size: 0; }
.prose > * + * { margin-block-start: var(--s3); }
.prose p + p { margin-block-start: var(--s2); }
.prose h2 { font-size: var(--t-xl); line-height: 1.15; margin-block-start: var(--s6); scroll-margin-block-start: var(--s3); }
.prose h2 + p { margin-block-start: var(--s3); }
.prose p a { color: var(--accent); }
.abstract { padding: var(--s3) var(--s3) var(--s3); background: var(--bg-2); border-radius: var(--r); }
.abstract .label { display: block; margin-block-end: var(--s2); }
.abstract p { font-size: var(--t-sm); line-height: 1.65; }

.terms { margin: 0; display: grid; gap: var(--s2); font-size: var(--t-sm); }
.terms div { display: grid; grid-template-columns: 4.25rem 1fr; gap: 0 var(--s2); align-items: baseline; }
.terms dt { font-family: var(--f-text); font-size: 1.1875rem; color: var(--accent); }
.terms dd { margin: 0; line-height: 1.45; }
.terms dd i { color: var(--ink); }
.terms dd span { display: block; color: var(--muted); }

sup.fn { line-height: 0; font-size: .72em; font-weight: 500; }
sup.fn a { color: var(--accent); text-decoration: none; padding-inline: .1em; }
.sidenote { display: none; }

.prose .verse { margin-block: var(--s5); padding-block: var(--s4); border-block: 1px solid var(--rule); }
.prose .verse .ar { font-size: clamp(1.625rem, 1.2rem + 1.5vw, 2.25rem); }
.prose .verse .en { font-size: var(--t-base); }

.hadith { display: grid; gap: var(--s2) var(--s3); margin-block: var(--s5); padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--r); }
@media (min-width: 40rem) { .hadith { grid-template-columns: 9.5rem minmax(0, 1fr); } }
.hadith dl { margin: 0; display: grid; gap: var(--s1); font-size: var(--t-xs); align-content: start; }
.hadith dt { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
.hadith dd { margin: 0 0 var(--s1); font: 400 var(--t-sm)/1.4 var(--f-text); color: var(--ink); }
.hadith blockquote { margin: 0; font: 400 var(--t-md)/1.55 var(--f-display); }
.hadith .src { grid-column: 1 / -1; font-size: var(--t-sm); }
.hadith .src a { color: var(--accent); font-weight: 500; }

.pull { margin-block: var(--s5); padding: 0; }
.pull blockquote { margin: 0; font: 400 italic var(--t-xl)/1.22 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
.pull figcaption { margin-block-start: var(--s2); }
.pull figcaption::before { content: ""; display: inline-block; inline-size: 2rem; block-size: 1px; background: var(--accent); vertical-align: middle; margin-inline-end: var(--s2); }

.end { margin-block-start: var(--s6); }
.prose .end h2 { font-size: var(--t-lg); font-weight: 400; margin-block: 0 var(--s3); }
.notes ol { margin: 0; padding-inline-start: 1.5rem; font-size: var(--t-sm); line-height: 1.6; color: var(--muted); }
.notes li + li { margin-block-start: var(--s1); }
.notes li::marker { color: var(--accent); font-weight: 500; }
.notes a { color: var(--ink); }
.notes .back { text-decoration: none; color: var(--accent); margin-inline-start: .25em; padding: .25em; }
.notes li:target { color: var(--ink); }
.reading { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.reading li { padding-block: var(--s2); border-block-end: 1px solid var(--rule); }
.reading li:first-child { border-block-start: 1px solid var(--rule); }
.reading .ref { font: 400 var(--t-md)/1.35 var(--f-display); }

.cite { padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--r); }
.cite p { font: 400 var(--t-sm)/1.6 var(--f-text); overflow-wrap: anywhere; }
.cite .form-row { margin-block-start: var(--s2); }
.share { display: flex; flex-wrap: wrap; gap: 0 var(--s3); font-size: var(--t-sm); }
.share a, .share button { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); }

.related .vgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.related .vgrid .v:first-child { grid-column: auto; grid-row: auto; }
@media (max-width: 47.99rem) { .related .vgrid .v:first-child { grid-column: 1 / -1; } }
.related .vgrid .v:first-child h3 { font-size: var(--t-md); }
.prevnext { display: grid; gap: var(--s3); border-block-start: 1px solid var(--ink); padding-block-start: var(--s3); }
@media (min-width: 48rem) { .prevnext { grid-template-columns: 1fr 1fr; } .prevnext a:last-child { text-align: end; } }
.prevnext a { display: grid; gap: var(--s1); text-decoration: none; }
.prevnext a span:last-child { font: 300 var(--t-lg)/1.25 var(--f-display); }
.prevnext a:hover span:last-child { color: var(--accent); }

/* Wide: toc | text | sidenotes. Notes float into the outer margin (Tufte). */
@media (min-width: 75rem) {
  .a-body { grid-template-columns: 12rem minmax(0, var(--measure)) 15rem; gap: 0 var(--s5); justify-content: space-between; }
  .toc { position: sticky; top: var(--s4); align-self: start; }
  .toc details > summary { display: none; }
  .prose { grid-column: 2; }
  .sidenote {
    display: block; float: right; clear: right; inline-size: 15rem; margin-inline-end: calc(-15rem - var(--s5));
    margin-block: .35rem var(--s2); font-size: var(--t-xs); line-height: 1.55; color: var(--muted);
  }
  .sidenote b { color: var(--accent); font-weight: 500; margin-inline-end: .35em; }
  .sidenote a { color: inherit; }
  .prose .aside-terms { float: right; clear: right; inline-size: 15rem; margin: 0 calc(-15rem - var(--s5)) var(--s3) 0; }
  .a-wide { grid-column: 2 / 4; max-inline-size: none; }
}
@media (max-width: 74.99rem) {
  .toc details { border-block: 1px solid var(--rule); padding-block: var(--s1); }
  .toc details[open] { padding-block-end: var(--s3); }
  .toc details .label { display: none; }
  .aside-terms { padding-block: var(--s3); border-block: 1px solid var(--rule); }
}

/* ---------- Sources library ---------- */
.s-head { padding-block: var(--s6) var(--s4); display: grid; gap: var(--s3); }
@media (min-width: 60rem) { .s-head { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: end; gap: var(--s6); } }
.s-head h1 { font-size: var(--t-2xl); line-height: 1.04; letter-spacing: -.028em; }
.s-head p { color: var(--muted); }
.controls { display: grid; gap: var(--s3); padding-block: var(--s3); border-block-start: 1px solid var(--rule); }
@media (min-width: 60rem) { .controls { grid-template-columns: minmax(0, 22rem) 1fr; align-items: end; } }
.controls .field input { background: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
@media (min-width: 60rem) { .chips { justify-content: flex-end; } }
.chip {
  min-height: 44px; padding: 0 var(--s2); display: inline-flex; align-items: center; gap: .5em;
  font: 400 var(--t-sm)/1 var(--f-text); color: var(--ink); background: transparent;
  border: 1px solid var(--rule-strong); border-radius: var(--r); cursor: pointer;
}
.chip [lang="ar"] { color: var(--accent); font-size: 1.0625rem; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] [lang="ar"] { color: inherit; }
.count { font-size: var(--t-sm); color: var(--muted); margin-block: var(--s2) var(--s2); }
.empty { padding-block: var(--s5); text-align: center; border-block-end: 1px solid var(--rule); }
.empty p { font: 300 var(--t-lg)/1.3 var(--f-display); margin-block-end: var(--s2); }
.submit { display: grid; gap: var(--s4); }
@media (min-width: 60rem) { .submit { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: var(--s6); } }
.submit h2 { font-size: var(--t-xl); line-height: 1.1; margin-block-end: var(--s3); }
.submit header p { color: var(--muted); max-inline-size: 40ch; }

/* ---------- Entrance motion (hero only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero p, .hero .actions { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
  .hero p { animation-delay: .12s; }
  .hero .actions { animation-delay: .22s; }
  .hero .lattice-field { animation: settle 1.6s ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes settle { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print: a clean paper ---------- */
@media print {
  @page { margin: 2cm 2.2cm; }
  :root { --bg: #fff; --bg-2: #fff; --ink: #000; --muted: #333; --rule: #bbb; --rule-strong: #999; --accent: #000; }
  body { font: 10.5pt/1.5 var(--f-text); background: #fff; color: #000; }
  .site-head, .site-foot, .exit, .skip, .toc, .lattice-rule, .share, .related, .prevnext, .cite .form-row, .watch .player, .sidenote, .theme, .notes .back { display: none !important; }
  .watch .print-url { display: block !important; }
  .a-head { padding-block: 0 12pt; }
  .a-head h1 { font-size: 24pt; }
  .a-body { display: block; }
  .prose { max-inline-size: none; }
  .prose h2 { font-size: 14pt; margin-block-start: 18pt; break-after: avoid; }
  .verse, .hadith, .pull, .abstract, blockquote { break-inside: avoid; }
  .prose a[href^="http"]::after, .end a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #333; overflow-wrap: anywhere; }
}
.print-url { display: none; }
