/* ==========================================================================
   MERIDIAN: a modern ideas magazine for The Apostates
   --------------------------------------------------------------------------
   System plan
   - Color: one cool neutral (blue-grey paper) + one accent (cobalt #1f3fbf).
     Dark mode is a cobalt-black night; cobalt lifts to #8fa3ff for text.
   - Type: Literata (display + reading), Geist (UI, meta, labels),
     Amiri Quran (Quranic Arabic: the only face here that carries every
     Uthmani mark in the verified verses; Readex Pro lacks U+06DF/06E5/06E6).
   - Scale: fluid major third, 7 steps (--t-xs ... --t-3xl), reading body 19px.
   - Rhythm: 8px base unit; section rhythm --sec; reading line-height 1.62.
   - Grid: 12 named columns inside fluid gutters (.grid), full-bleed lines
     [full-start/full-end] for cover images and bands.
   - Radius: one value, --r (2px), everywhere. Images are "plates":
     cobalt duotone via mix-blend-mode: luminosity, colour revealed on hover.
   - Motion: opacity/transform only, reveal-on-enter, off under reduced motion.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #f3f4f7;
  --paper-2: #e7eaf1;
  --ink: #0d1120;
  --ink-2: #3f4659;
  --ink-3: #5c6378;
  --rule: #cfd4df;
  --rule-strong: #0d1120;
  --accent: #1f3fbf;
  --accent-hover: #17309a;
  --btn: #1f3fbf;
  --on-btn: #fff;
  --band: #1f3fbf;
  --band-ink: #fff;
  --band-ink-2: #d4dcff;
  --duo: #34449a;
  --foot: #0d1120;
  --foot-ink: #e9ebf2;
  --foot-ink-2: #a9afc0;
  --focus: #1f3fbf;

  --f-display: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --f-ar: "Amiri Quran", "Geeza Pro", "Noto Naskh Arabic", "Times New Roman", serif;

  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-base: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --t-md: clamp(1.25rem, 1.12rem + 0.55vw, 1.5rem);
  --t-lg: clamp(1.5rem, 1.25rem + 1.1vw, 2.125rem);
  --t-xl: clamp(2rem, 1.45rem + 2.4vw, 3.5rem);
  --t-2xl: clamp(2.75rem, 1.6rem + 5vw, 6rem);
  --t-3xl: clamp(3.25rem, 1.5rem + 7.4vw, 8.25rem);

  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-5: 3rem;
  --sp-6: 4.5rem;
  --sec: clamp(4.5rem, 3rem + 7vw, 9.5rem);
  --gut: clamp(1rem, 0.4rem + 3vw, 3rem);
  --gap: clamp(1rem, 0.6rem + 1vw, 1.5rem);
  --r: 2px;
  --mast-h: 4rem;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}

/* Dark tokens: system preference unless the reader chose light; or chosen dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0e16; --paper-2: #131828; --ink: #e9ebf2; --ink-2: #b9bfcd; --ink-3: #9097aa;
    --rule: #262c3e; --rule-strong: #e9ebf2; --accent: #9aadff; --accent-hover: #c2ceff;
    --btn: #3b5be0; --on-btn: #fff; --band: #182a86; --band-ink: #f1f3ff; --band-ink-2: #c3ceff;
    --duo: #2a3b8f; --plate-b: 0.84; --foot: #05070c; --foot-ink: #e9ebf2; --foot-ink-2: #9097aa; --focus: #9aadff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b0e16; --paper-2: #131828; --ink: #e9ebf2; --ink-2: #b9bfcd; --ink-3: #9097aa;
  --rule: #262c3e; --rule-strong: #e9ebf2; --accent: #9aadff; --accent-hover: #c2ceff;
  --btn: #3b5be0; --on-btn: #fff; --band: #182a86; --band-ink: #f1f3ff; --band-ink-2: #c3ceff;
  --duo: #2a3b8f; --plate-b: 0.84; --foot: #05070c; --foot-ink: #e9ebf2; --foot-ink-2: #9097aa; --focus: #9aadff;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--mast-h) + 1.5rem); hanging-punctuation: first allow-end last; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-base)/1.62 var(--f-display);
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r); }
::selection { background: var(--accent); color: var(--paper); }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 400; line-height: 1.08; letter-spacing: -0.018em; margin: 0; text-wrap: balance; }
p, li, dd, figcaption, blockquote { text-wrap: pretty; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[lang="ar"] { font-family: var(--f-ar); line-height: 2.15; font-variant-numeric: normal; letter-spacing: 0; hanging-punctuation: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.js-only { display: none !important; }
.js .js-only { display: revert !important; }

.skip { position: absolute; inset-inline-start: var(--gut); top: -4rem; z-index: 100; background: var(--btn); color: var(--on-btn); padding: 0.75rem 1rem; font: 500 var(--t-sm) var(--f-sans); border-radius: var(--r); text-decoration: none; }
.skip:focus { top: 0.75rem; color: var(--on-btn); }

/* UI type voice: Geist, lining figures, quiet tracking */
.ui, .meta, .label, .btn, .chip, .mast, .foot, label, input, textarea, .note-ui { font-family: var(--f-sans); font-variant-numeric: lining-nums tabular-nums; }
.label { font: 500 var(--t-xs)/1.3 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.meta { font-size: var(--t-xs); line-height: 1.45; color: var(--ink-3); letter-spacing: 0.01em; }
.meta > * + *::before { content: "\00b7"; margin-inline: 0.5em; color: var(--ink-3); }

/* ---------- Layout: 12 named columns inside fluid gutters ---------- */
.grid {
  display: grid; column-gap: var(--gap);
  grid-template-columns: [full-start] minmax(calc(var(--gut) - var(--gap)), 1fr) [c-start] repeat(12, [col] minmax(0, 5.25rem)) [c-end] minmax(calc(var(--gut) - var(--gap)), 1fr) [full-end];
}
.grid > * { grid-column: c-start / c-end; min-width: 0; }
.wrap { width: min(100% - 2 * var(--gut), 84rem); margin-inline: auto; }
.sec { padding-block: var(--sec); }

/* ---------- Buttons and links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6em; min-height: 3rem; padding: 0.7rem 1.35rem; border-radius: var(--r); font-size: var(--t-sm); font-weight: 500; letter-spacing: 0.005em; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform 0.25s var(--ease), opacity 0.25s; }
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--btn); color: var(--on-btn); }
.btn-solid:hover { color: var(--on-btn); opacity: 0.9; }
.btn-line { border-color: currentColor; color: var(--ink); background: transparent; }
.btn-line:hover { color: var(--accent); }
.arrow { display: inline-block; transition: transform 0.3s var(--ease); }
a:hover .arrow, button:hover .arrow { transform: translateX(0.2em); }
.go { font: 500 var(--t-sm)/1.3 var(--f-sans); color: var(--accent); text-decoration: none; display: inline-flex; gap: 0.45em; align-items: center; min-height: 44px; }
.go:hover { color: var(--accent-hover); }
.go .ul { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; }

/* ---------- Masthead ---------- */
.mast { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 90%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--rule); }
.mast-in { height: var(--mast-h); display: flex; align-items: center; gap: var(--sp-3); }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; margin-inline-end: auto; min-height: 44px; }
.brand img { width: 30px; height: 30px; border-radius: var(--r); }
.brand span { font: 600 1.1875rem/1 var(--f-display); letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.brand:hover span { color: var(--ink); }
.nav { display: flex; gap: 0.25rem; }
.nav a { font-size: var(--t-sm); text-decoration: none; color: var(--ink-2); padding: 0.6rem 0.75rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: var(--r); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.tools { display: flex; align-items: center; gap: 0.5rem; }
.theme { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--r); cursor: pointer; color: var(--ink-2); }
.theme:hover { color: var(--ink); }
.theme svg { width: 18px; height: 18px; }
.exit { font: 500 var(--t-xs)/1 var(--f-sans); letter-spacing: 0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0 0.85rem; border: 1px solid var(--rule); border-radius: var(--r); white-space: nowrap; }
.exit:hover { border-color: var(--ink); color: var(--ink); }
.exit kbd { font: inherit; color: var(--ink-3); }
.subnav { display: none; }
@media (max-width: 52rem) {
  .mast .nav, .exit kbd { display: none; }
  .subnav { display: block; border-bottom: 1px solid var(--rule); }
  .subnav .nav { justify-content: space-between; }
  .subnav .nav a { padding-inline: 0.6rem; }
}
@media (max-width: 22rem) { .mast-in { gap: var(--sp-1); } .mast .brand img { display: none; } .mast .exit { padding-inline: 0.6rem; } .brand span { font-size: 1.0625rem; } .subnav .nav a { padding-inline: 0.4rem; font-size: 0.875rem; } }

/* ---------- Plates: cobalt duotone images, colour revealed on hover ---------- */
.plate { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--duo); border-radius: var(--r); isolation: isolate; }
.plate img { width: 100%; height: 100%; object-fit: cover; scale: 1.035; mix-blend-mode: luminosity; filter: contrast(1.06) brightness(var(--plate-b, 1.04)); }
.plate img.c { position: absolute; inset: 0; mix-blend-mode: normal; filter: none; opacity: 0; transition: opacity 0.6s var(--ease); }
a:hover .plate img.c, a:focus-visible .plate img.c { opacity: 1; }
.plate-zoom img { transition: transform 0.9s var(--ease), opacity 0.6s var(--ease); }
a:hover .plate-zoom img { transform: scale(1.025); }

/* ---------- Video facade (identical behaviour everywhere) ---------- */
.yt { display: block; position: relative; text-decoration: none; color: var(--on-btn); }
.yt-play { position: absolute; inset-inline-start: clamp(0.75rem, 2vw, 1.5rem); bottom: clamp(0.75rem, 2vw, 1.5rem); display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.55rem 1rem 0.55rem 0.6rem; min-height: 44px; background: var(--btn); color: var(--on-btn); border-radius: var(--r); font: 500 var(--t-sm)/1 var(--f-sans); font-variant-numeric: tabular-nums; transition: transform 0.35s var(--ease); }
.yt-play svg { width: 28px; height: 28px; flex: none; }
.yt-play .t { opacity: 0.75; padding-inline-start: 0.75rem; border-inline-start: 1px solid rgb(255 255 255 / 0.35); }
.yt:hover .yt-play { transform: translateY(-2px); }
.yt:hover { color: var(--on-btn); }
.yt-frame { aspect-ratio: 16 / 9; width: 100%; border-radius: var(--r); overflow: hidden; background: #000; }
.yt-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Reveal motion (enhancement only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
  .js [data-reveal].in { opacity: 1; transform: none; }
}

/* ==========================================================================
   HOME
   ========================================================================== */

/* Cover: headline left, cover plate bleeding off the right edge */
.cover { min-height: min(calc(100dvh - var(--mast-h)), 58rem); align-content: center; padding-block: clamp(2.5rem, 6vh, 5rem); row-gap: var(--sp-4); }
.cover-text { grid-column: c-start / col 6; align-self: center; }
.cover h1 { font-size: var(--t-3xl); font-weight: 400; line-height: 0.96; letter-spacing: -0.035em; margin-inline-start: -0.04em; }
.cover h1 em { font-style: italic; font-weight: 300; color: var(--accent); }
.cover-sub { margin-top: var(--sp-4); font-size: var(--t-md); line-height: 1.42; color: var(--ink-2); max-width: 26ch; }
.cover-cta { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; }
.cover-fig { grid-column: col 7 / full-end; margin: 0; align-self: center; }
.cover-fig .plate, .cover-fig .yt-frame { border-start-end-radius: 0; border-end-end-radius: 0; }
.cover-fig figcaption { margin-top: var(--sp-2); padding-inline-end: var(--gut); display: flex; gap: var(--sp-3); justify-content: space-between; align-items: baseline; }
.cover-fig figcaption a { font: 400 var(--t-sm)/1.4 var(--f-display); font-style: italic; color: var(--ink-2); text-decoration: none; }
.cover-fig figcaption a:hover { color: var(--accent); }
@media (max-width: 60rem) {
  .cover { min-height: 0; padding-top: var(--sp-5); }
  .cover-text { grid-column: c-start / c-end; }
  .cover-fig { grid-column: full-start / full-end; }
  .cover-fig .plate, .cover-fig .yt-frame { border-radius: 0; }
  .cover-fig figcaption { padding-inline: var(--gut); flex-direction: column; gap: 0.25rem; }
}

/* Lead essay: the full-bleed cobalt band, the verse as the hero */
.band { background: var(--band); color: var(--band-ink); }
.band a { color: var(--band-ink); }
.band .label { color: var(--band-ink-2); }
.lead { row-gap: var(--sp-5); align-items: start; }
.lead-text { grid-column: c-start / col 6; }
.lead-text h2 { font-size: var(--t-xl); margin-top: var(--sp-3); letter-spacing: -0.025em; }
.lead-dek { margin-top: var(--sp-3); font-size: var(--t-md); line-height: 1.45; font-style: italic; color: var(--band-ink-2); max-width: 32ch; }
.lead-text .meta { margin-top: var(--sp-4); color: var(--band-ink-2); }
.lead-text .meta > * + *::before { color: var(--band-ink-2); }
.lead-text .btn { margin-top: var(--sp-4); background: var(--band-ink); color: var(--band); }
.lead-text .btn:hover { color: var(--band); opacity: 0.92; }
.lead-verse { grid-column: col 7 / c-end; margin: 0; padding-top: var(--sp-2); }
.lead-verse [lang="ar"] { font-size: clamp(1.6rem, 1.15rem + 1.6vw, 2.5rem); line-height: 2.2; text-align: right; }
.lead-verse blockquote { margin: 0; }
.lead-verse .ref { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.band .meta, .band .meta > * + *::before { color: var(--band-ink-2); }
.lead-verse .tr { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid rgb(255 255 255 / 0.28); font-size: var(--t-base); line-height: 1.6; color: var(--band-ink-2); max-width: 58ch; }
.lead-verse figcaption { margin-top: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: center; justify-content: space-between; }
.lead-verse figcaption .go { color: var(--band-ink); }
@media (max-width: 60rem) { .lead-text, .lead-verse { grid-column: c-start / c-end; } }

/* Pillars: a manifesto statement, then three unequal entries on a staggered rail */
.manifesto { row-gap: var(--sp-6); }
.manifesto-quote { grid-column: c-start / col 11; margin: 0; }
.manifesto-quote p { font-size: var(--t-xl); font-weight: 300; line-height: 1.18; letter-spacing: -0.022em; text-indent: -0.42em; }
.manifesto-quote p + p { text-indent: 0; margin-top: var(--sp-3); font-size: var(--t-md); font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.manifesto-quote strong { font-weight: 300; color: var(--accent); }
.pillars { grid-column: c-start / c-end; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.pillar { border-top: 1px solid var(--rule-strong); padding-top: var(--sp-3); }
.pillar:nth-child(1) { grid-column: 1 / span 5; }
.pillar:nth-child(2) { grid-column: 7 / span 3; margin-top: var(--sp-6); }
.pillar:nth-child(3) { grid-column: 10 / span 3; margin-top: calc(var(--sp-6) * 2); }
.pillar h3 { font-size: var(--t-lg); letter-spacing: -0.02em; }
.pillar:nth-child(1) h3 { font-size: var(--t-xl); }
.pillar p { margin-top: var(--sp-2); font-family: var(--f-sans); font-size: var(--t-sm); line-height: 1.6; color: var(--ink-2); max-width: 38ch; }
.pillar .go { margin-top: var(--sp-2); }
@media (max-width: 60rem) {
  .manifesto-quote { grid-column: c-start / c-end; }
  .pillars { grid-template-columns: 1fr; row-gap: var(--sp-5); }
  .pillar:nth-child(n) { grid-column: 1; margin-top: 0; }
}

/* Stories: the "No Apostate Left Behind" spread */
.spread { background: var(--paper-2); }
.spread-head { row-gap: var(--sp-3); align-items: end; padding-bottom: var(--sp-5); }
.spread-head h2 { grid-column: c-start / col 9; font-size: var(--t-2xl); font-weight: 300; letter-spacing: -0.035em; line-height: 0.98; }
.spread-head h2 em { font-weight: 400; }
.spread-head p { grid-column: col 9 / c-end; font-size: var(--t-md); line-height: 1.45; color: var(--ink-2); font-style: italic; }
.spread-body { row-gap: var(--sp-5); border-top: 1px solid var(--rule-strong); padding-top: var(--sp-4); }
.story-lead { grid-column: c-start / col 8; text-decoration: none; display: block; }
.story-lead h3 { margin-top: var(--sp-3); font-size: var(--t-lg); line-height: 1.18; max-width: 26ch; }
.story-lead .meta { margin-top: var(--sp-2); }
.story-list { grid-column: col 8 / c-end; list-style: none; margin: 0; padding: 0; padding-inline-start: var(--sp-3); }
.story-list li + li { border-top: 1px solid var(--rule); }
.story-list a { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--sp-2); padding-block: var(--sp-2); text-decoration: none; align-items: start; }
.story-list li:first-child a { padding-top: 0; }
.story-list h3 { font-size: 1.0625rem; line-height: 1.35; letter-spacing: -0.005em; }
.story-list .meta { margin-top: 0.35rem; }
.spread-foot { margin-top: var(--sp-5); display: flex; justify-content: flex-end; }
@media (max-width: 60rem) {
  .spread-head h2, .spread-head p, .story-lead, .story-list { grid-column: c-start / c-end; }
  .story-list { padding-inline-start: 0; }
  .spread-foot { justify-content: flex-start; }
}
@media (max-width: 26rem) { .story-list a { grid-template-columns: 6rem 1fr; } }

/* Latest: asymmetric mosaic, one large plate + a dense index */
.latest-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.latest-head h2 { font-size: var(--t-xl); }
.mosaic { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4) var(--gap); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mosaic li:first-child { grid-column: span 2; grid-row: span 2; }
.card { display: block; text-decoration: none; }
.card .label { display: block; margin-top: var(--sp-2); color: var(--accent); }
.card h3 { margin-top: 0.4rem; font-size: 1.0625rem; line-height: 1.32; letter-spacing: -0.005em; }
.mosaic li:first-child h3 { font-size: var(--t-lg); line-height: 1.15; max-width: 22ch; }
.card .meta { margin-top: 0.4rem; }
@media (max-width: 60rem) { .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) {
  .mosaic { grid-template-columns: 1fr; gap: 0; }
  .mosaic li:first-child { grid-column: auto; grid-row: auto; padding-bottom: var(--sp-3); }
  .mosaic li:not(:first-child) { border-top: 1px solid var(--rule); }
  .mosaic li:not(:first-child) .card { display: grid; grid-template-columns: 7.5rem 1fr; column-gap: var(--sp-2); padding-block: var(--sp-2); align-content: start; }
  .mosaic li:not(:first-child) .plate { grid-row: 1 / span 3; }
  .mosaic li:not(:first-child) .card > :not(.plate) { grid-column: 2; margin-top: 0; }
  .mosaic li:not(:first-child) .card h3 { font-size: 1rem; }
}

/* Sources teaser: ledger rows, the reference set as the headline */
.ledger-sec { row-gap: var(--sp-5); }
.ledger-intro { grid-column: c-start / col 5; }
.ledger-intro h2 { font-size: var(--t-xl); margin-top: var(--sp-2); }
.ledger-intro p { margin-top: var(--sp-3); color: var(--ink-2); max-width: 34ch; }
.ledger-intro .go { margin-top: var(--sp-3); }
.ledger { grid-column: col 6 / c-end; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.ledger li { border-bottom: 1px solid var(--rule); }
.ledger a { display: grid; grid-template-columns: 5.5rem 9.5rem 1fr auto; gap: var(--gap); align-items: baseline; padding-block: var(--sp-3); text-decoration: none; }
.ledger .ref { white-space: nowrap; font-size: var(--t-md); letter-spacing: -0.01em; font-variant-numeric: lining-nums; }
.ledger .note-ui { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.5; }
.ledger .arrow { color: var(--accent); }
@media (max-width: 60rem) { .ledger-intro, .ledger { grid-column: c-start / c-end; } }
@media (max-width: 40rem) { .ledger a { grid-template-columns: 1fr auto; row-gap: 0.25rem; } .ledger .label { grid-column: 1 / -1; } .ledger .note-ui { grid-column: 1 / -1; } .ledger .arrow { grid-row: 2; grid-column: 2; } }

/* Support: closing line + actions + newsletter */
.home-end { border-top: 1px solid var(--rule); }
.welcome { row-gap: var(--sp-5); }
.welcome-text { grid-column: c-start / col 7; }
.welcome-text h2 { font-size: var(--t-2xl); font-weight: 300; letter-spacing: -0.035em; line-height: 0.98; }
.welcome-text p { margin-top: var(--sp-4); font-size: var(--t-md); line-height: 1.45; color: var(--ink-2); max-width: 34ch; }
.welcome-actions { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.letter { grid-column: col 8 / c-end; align-self: end; background: var(--paper-2); padding: clamp(1.5rem, 3vw, 2.5rem); border-radius: var(--r); }
.letter h3 { font-size: var(--t-md); }
.letter > p { margin-top: var(--sp-1); font-family: var(--f-sans); font-size: var(--t-sm); color: var(--ink-2); }
@media (max-width: 60rem) { .welcome-text, .letter { grid-column: c-start / c-end; } }

/* ---------- Forms (shared) ---------- */
.field { display: grid; gap: 0.45rem; margin-top: var(--sp-3); }
.field label { font-size: var(--t-sm); font-weight: 500; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--ink-3); }
.field input, .field textarea { width: 100%; min-height: 3rem; padding: 0.7rem 0.9rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); font-size: 1rem; }
.field textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
.field input:hover, .field textarea:hover { border-color: var(--ink-3); }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.help { font-family: var(--f-sans); font-size: var(--t-xs); color: var(--ink-3); line-height: 1.45; }
.err { font-family: var(--f-sans); font-size: var(--t-xs); color: #b3261e; font-weight: 500; display: none; }
:root[data-theme="dark"] .err { color: #ffb4ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err { color: #ffb4ab; } }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: currentColor; }
.form-row { display: flex; gap: var(--sp-1); margin-top: 0.45rem; }
.form-row input { flex: 1; min-width: 0; }
.form-status { font-family: var(--f-sans); font-size: var(--t-sm); margin-top: var(--sp-2); color: var(--accent); min-height: 1.4em; }

/* ---------- Footer ---------- */
.foot { background: var(--foot); color: var(--foot-ink); padding-block: var(--sp-6) var(--sp-4); font-size: var(--t-sm); }
.foot a { color: var(--foot-ink); }
.foot-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--sp-5) var(--gap); }
.foot .brand span { color: var(--foot-ink); font-size: 1.375rem; }
.foot-line { margin-top: var(--sp-2); font-family: var(--f-display); font-style: italic; color: var(--foot-ink-2); font-size: var(--t-base); }
.foot h2 { font: 500 var(--t-xs)/1.3 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--foot-ink-2); }
.foot ul { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.foot li a { display: inline-flex; min-height: 36px; align-items: center; text-decoration: none; }
.foot li a:hover { text-decoration: underline; color: var(--foot-ink); }
.foot-bottom { margin-top: var(--sp-6); padding-top: var(--sp-3); border-top: 1px solid rgb(255 255 255 / 0.14); display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); justify-content: space-between; align-items: center; color: var(--foot-ink-2); font-size: var(--t-xs); }
.foot .exit { color: var(--foot-ink); border-color: rgb(255 255 255 / 0.25); }
.foot .exit kbd { color: var(--foot-ink-2); }
@media (max-width: 48rem) { .foot-top { grid-template-columns: 1fr 1fr; } .foot-top > :first-child { grid-column: 1 / -1; } }

/* ==========================================================================
   ARTICLE
   ========================================================================== */
.progress { position: fixed; top: 0; inset-inline: 0; height: 2px; z-index: 60; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress { animation: grow linear both; animation-timeline: scroll(root); }
    @keyframes grow { to { transform: scaleX(1); } }
  }
}
@supports not (animation-timeline: scroll()) { .progress { display: none; } }

.art { display: grid; column-gap: 0;
  grid-template-columns: [full-start] minmax(var(--gut), 1fr) [body-start] minmax(0, 40rem) [body-end] minmax(var(--gut), 1fr) [full-end]; }
.art > * { grid-column: body-start / body-end; min-width: 0; }
.art-head { padding-top: clamp(3rem, 8vh, 6rem); }
.art-head .label a { color: var(--accent); text-decoration: none; }
.art-head h1 { margin-top: var(--sp-3); font-size: var(--t-2xl); letter-spacing: -0.035em; line-height: 1; }
.art-head h1 .q { display: block; font-style: italic; font-weight: 300; color: var(--accent); }
.dek { margin-top: var(--sp-4); font-size: var(--t-md); line-height: 1.45; color: var(--ink-2); max-width: 40ch; }
.byline { margin-top: var(--sp-4); padding-top: var(--sp-2); border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); }
.byline img { width: 36px; height: 36px; border-radius: var(--r); }
.byline .who { font: 500 var(--t-sm)/1.2 var(--f-sans); }
.art-video { margin: var(--sp-5) 0 0; }
.art-video figcaption { margin-top: var(--sp-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-1) var(--sp-3); }
.art-video figcaption b { font: 500 var(--t-sm)/1.4 var(--f-sans); }

.toc { font-family: var(--f-sans); margin-top: var(--sp-5); padding-block: var(--sp-3); border-block: 1px solid var(--rule); }
.toc ol { list-style: none; margin: var(--sp-2) 0 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: grid; grid-template-columns: 1.5rem 1fr; padding-block: 0.4rem; text-decoration: none; font-size: var(--t-sm); line-height: 1.4; color: var(--ink-2); min-height: 36px; align-items: baseline; transition: color 0.2s; }
.toc a::before { content: counter(toc); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.toc a:hover, .toc a.on { color: var(--ink); }
.toc a.on::before { color: var(--accent); }

.abstract { margin-top: var(--sp-5); padding: var(--sp-4); background: var(--paper-2); border-radius: var(--r); }
.abstract p { margin-top: var(--sp-1); font-size: var(--t-base); line-height: 1.6; }

/* Reading body: 40rem measure, about 66 characters per line */
.prose { padding-bottom: var(--sp-4); }
.prose h2 { font-size: var(--t-lg); margin-top: var(--sp-6); margin-bottom: var(--sp-3); letter-spacing: -0.02em; line-height: 1.15; }
.prose > section:first-child h2 { margin-top: var(--sp-5); }
.prose p + p { text-indent: 1.5em; }
.prose p { hyphens: manual; }
.prose .lede::first-line { font-variant-caps: all-small-caps; letter-spacing: 0.04em; font-variant-numeric: oldstyle-nums; }
.prose a { color: var(--accent); }
.fnref { font: 500 0.68em/0 var(--f-sans); vertical-align: 0.6em; margin-inline-start: 0.08em; font-variant-numeric: lining-nums; }
.fnref a { text-decoration: none; padding: 0.2em 0.1em; color: var(--accent); }
.sn { display: none; }

/* Quranic verse: Arabic as the visual hero, translation and link beneath */
.verse { margin: var(--sp-5) 0; padding-block: var(--sp-4) var(--sp-3); border-block: 1px solid var(--rule-strong); text-indent: 0; }
.verse .ref { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.verse .ref .label { color: var(--accent); }
.verse [lang="ar"] { margin-top: var(--sp-3); font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2.125rem); line-height: 2.25; text-align: center; text-wrap: balance; }
.verse .tr { margin-top: var(--sp-3); font-style: italic; font-size: var(--t-base); line-height: 1.6; color: var(--ink-2); text-indent: 0 !important; }
.verse figcaption { margin-top: var(--sp-3); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-1) var(--sp-3); }

/* Hadith: a catalogued record, not a quote */
.hadith { margin: var(--sp-5) 0; padding: var(--sp-4); background: var(--paper-2); border-radius: var(--r); }
.hadith dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem var(--sp-3); font-family: var(--f-sans); font-size: var(--t-xs); }
.hadith dt { color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.hadith dd { margin: 0; color: var(--ink); font-weight: 500; }
.hadith .grade { color: var(--accent); }
.hadith blockquote { margin: var(--sp-3) 0 0; padding-top: var(--sp-3); border-top: 1px solid var(--rule); font-size: var(--t-base); }
.hadith blockquote p { text-indent: 0 !important; }
.hadith .go { margin-top: var(--sp-2); }

/* Pull-quote: hanging opening mark, accent ink */
.pq { margin: var(--sp-5) 0; padding: 0; text-indent: 0; }
.pq p { font-size: var(--t-lg); font-weight: 300; line-height: 1.22; letter-spacing: -0.018em; color: var(--accent); text-indent: -0.42em !important; }

/* Back matter */
.back { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--rule-strong); }
.back h2 { font: 500 var(--t-xs)/1.3 var(--f-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--sp-3); }
.fns { margin: 0; padding-inline-start: 1.75rem; font-size: var(--t-sm); line-height: 1.55; color: var(--ink-2); }
.fns li { padding-inline-start: 0.25rem; }
.fns li + li { margin-top: 0.6rem; }
.fns li::marker { font: 500 var(--t-xs) var(--f-sans); color: var(--ink-3); }
.fns li:target { color: var(--ink); }
.fns a { color: var(--accent); }
.fns .bk { text-decoration: none; font-family: var(--f-sans); margin-inline-start: 0.35em; display: inline-block; padding: 0 0.25em; }
.reflist { list-style: none; margin: 0; padding: 0; }
.reflist li { padding-block: 0.85rem; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--sp-2); align-items: baseline; font-size: var(--t-sm); line-height: 1.5; }
.reflist li:first-child { border-top: 1px solid var(--rule); }
.reflist a { color: var(--accent); }
.cite { padding: var(--sp-3); border: 1px solid var(--rule); border-radius: var(--r); }
.cite p { font-size: var(--t-sm); line-height: 1.55; overflow-wrap: anywhere; }
.cite .btn { margin-top: var(--sp-2); }
.share { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.btn-sm { min-height: 44px; padding: 0.5rem 1rem; font-size: var(--t-xs); }

.related { padding-block: var(--sec) var(--sp-5); }
.related h2 { font-size: var(--t-xl); margin-bottom: var(--sp-4); }
.rel { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4) var(--gap); }
@media (max-width: 60rem) { .rel { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 30rem) { .rel { grid-template-columns: 1fr; } }
.pn { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule-strong); margin-bottom: var(--sec); }
.pn a { display: block; padding: var(--sp-4) 0; text-decoration: none; }
.pn a + a { text-align: end; border-inline-start: 1px solid var(--rule); padding-inline-start: var(--gap); }
.pn a:first-child { padding-inline-end: var(--gap); }
.pn b { display: block; margin-top: var(--sp-1); font: 400 var(--t-md)/1.25 var(--f-display); letter-spacing: -0.01em; }
@media (max-width: 40rem) { .pn { grid-template-columns: 1fr; } .pn a + a { text-align: start; border-inline-start: 0; border-top: 1px solid var(--rule); padding-inline-start: 0; } }

/* Wide screens: sticky contents left, body centre, sidenotes in the margin */
@media (min-width: 78rem) {
  .art { grid-template-columns: [full-start] minmax(var(--gut), 1fr) [toc-start] 13rem [toc-end] 3.5rem [body-start] 40rem [body-end] 3.5rem [note-start] 14rem [note-end] minmax(var(--gut), 1fr) [full-end]; }
  .art-head, .art-video { grid-column: body-start / note-end; }
  .art-head h1 { max-width: 15ch; }
  .art-video { grid-column: toc-start / note-end; }
  .toc { grid-column: toc-start / toc-end; align-self: start; position: sticky; top: calc(var(--mast-h) + 2rem); margin-top: var(--sp-5); border-bottom: 0; }
  .sn { display: block; float: right; clear: right; width: 14rem; margin-right: -17.5rem; margin-top: 0.3rem; margin-bottom: var(--sp-2); text-indent: 0; font: 400 var(--t-xs)/1.5 var(--f-sans); color: var(--ink-3); font-variant-numeric: lining-nums; }
  .sn b { color: var(--accent); font-weight: 500; margin-inline-end: 0.35em; }
  .sn a { color: var(--ink-2); }
  .verse, .hadith, .pq { clear: right; }
  .related, .pn { grid-column: toc-start / note-end; }
}

/* ==========================================================================
   SOURCES
   ========================================================================== */
.src-head { padding-block: clamp(3rem, 8vh, 6rem) var(--sp-5); row-gap: var(--sp-4); align-items: end; }
.src-head h1 { grid-column: c-start / col 7; font-size: var(--t-3xl); letter-spacing: -0.04em; line-height: 0.95; }
.src-head blockquote { grid-column: col 8 / c-end; margin: 0; }
.src-head blockquote p { font-size: var(--t-md); line-height: 1.42; font-style: italic; color: var(--ink-2); text-indent: -0.4em; }
.src-head blockquote footer { margin-top: var(--sp-2); }
@media (min-width: 60rem) { .controls { position: sticky; } }
@media (max-width: 60rem) { .src-head h1, .src-head blockquote { grid-column: c-start / c-end; } }

.controls { position: relative; top: var(--mast-h); z-index: 20; background: var(--paper); border-block: 1px solid var(--rule); padding-block: var(--sp-2); }
.controls .wrap { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; }
.search { position: relative; flex: 1 1 18rem; }
.search svg { position: absolute; inset-inline-start: 0.85rem; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; min-height: 44px; padding: 0.6rem 0.9rem 0.6rem 2.5rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); font-size: 1rem; }
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { min-height: 44px; padding: 0.4rem 0.95rem; border: 1px solid var(--rule); border-radius: var(--r); background: transparent; font-size: var(--t-sm); cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.count { font-family: var(--f-sans); font-size: var(--t-xs); color: var(--ink-3); margin-inline-start: auto; }

.lib { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: [type] 8rem [ref] minmax(0, 13rem) [body] minmax(0, 1fr) [act] auto; gap: var(--sp-1) var(--gap); padding-block: var(--sp-4); border-bottom: 1px solid var(--rule); align-items: baseline; }
.entry:target { background: linear-gradient(to right, transparent, var(--paper-2) 1rem, var(--paper-2) calc(100% - 1rem), transparent); }
.entry .label { color: var(--accent); }
.entry .ref { font-size: var(--t-md); letter-spacing: -0.01em; font-variant-numeric: lining-nums; line-height: 1.25; }
.entry h2 { font-size: var(--t-base); font-weight: 500; line-height: 1.35; letter-spacing: 0; }
.entry .by { margin-top: 0.25rem; font-family: var(--f-sans); font-size: var(--t-xs); color: var(--ink-3); }
.entry .note { margin-top: var(--sp-1); font-size: var(--t-sm); line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.entry [lang="ar"] { margin-block: var(--sp-2) var(--sp-1); font-size: clamp(1.3rem, 1.1rem + 0.6vw, 1.6rem); line-height: 2.1; }
.entry .act { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.entry .act .go { white-space: nowrap; }
.copy { background: none; border: 0; padding: 0; cursor: pointer; }
@media (max-width: 60rem) { .entry { grid-template-columns: 7rem minmax(0, 1fr); } .entry .bd, .entry .act { grid-column: 2; } .entry .act { flex-direction: row; align-items: center; gap: var(--sp-3); } }
@media (max-width: 34rem) { .entry { grid-template-columns: 1fr; } .entry .bd, .entry .act { grid-column: 1; } }
.empty { padding-block: var(--sp-6); text-align: center; }
.empty p { font-size: var(--t-md); font-style: italic; color: var(--ink-2); }
.empty .btn { margin-top: var(--sp-3); }

.submit { row-gap: var(--sp-4); }
.submit-text { grid-column: c-start / col 5; }
.submit-text h2 { font-size: var(--t-xl); }
.submit-text p { margin-top: var(--sp-3); color: var(--ink-2); max-width: 34ch; }
.submit form { grid-column: col 6 / col 12; }
.submit form .field:first-child { margin-top: 0; }
.submit form .btn { margin-top: var(--sp-4); }
@media (max-width: 60rem) { .submit-text, .submit form { grid-column: c-start / c-end; } }

/* ---------- Reduced motion: everything still ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print: a clean paper ---------- */
@media print {
  @page { margin: 2cm 2.2cm; }
  :root { --paper: #fff; --paper-2: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --rule: #bbb; --rule-strong: #000; --accent: #000; }
  body { font-size: 11pt; line-height: 1.5; background: #fff; color: #000; }
  .mast, .subnav, .skip, .progress, .toc, .share, .related, .pn, .foot, .cite .btn, .yt-play, .exit, .theme, .js-only, .sn { display: none !important; }
  .art { display: block; }
  .art-head h1 { font-size: 26pt; max-width: none; }
  .art-video .plate { display: none; }
  .art-video .yt::after { content: "Video: " attr(href); font: 10pt var(--f-sans); color: #000; }
  .prose a[href^="http"]::after, .reflist a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; overflow-wrap: anywhere; }
  .verse, .hadith, .pq, .abstract, .cite { break-inside: avoid; }
  .abstract, .hadith { border: 1px solid #bbb; }
  h2 { break-after: avoid; }
  .prose p { orphans: 3; widows: 3; }
}
