/* tokens.css — the archive's design tokens: the ONE place for colour, type, space, shape and motion.
   Linked first on every page (base.html), before base.css and the section stylesheets, which only consume these.

   Palette: Paper Emerald by day, sage by night (chosen 2026-11-27; alternatives in static/themes/, review mockups).
   Fonts (work/polish/content/rules.md css-ar-face, ux-research §9):
     --font-ur        Noto Nastaliq Urdu — all Urdu
     --font-ar        Amiri              — all Arabic text: Quran, hadith, duas, Arabic blocks, surah names (user prefers Amiri)
     --font-ar-display Amiri             — large Arabic display titles only (surah titles, basmala)
     --font-en        Source Serif 4     — English
   Type scale (1.2 ratio, 16 px base): --fs-{caption,small,body,lead,h3,h2,h1,display} for Latin; --fs-ur-* for Urdu
   (Nastaliq needs ~1.3× the size and ~2× the leading to read at the same weight). Caption is the minimum anywhere.
   The dark palette applies from the OS preference; scheme.js forces light/dark by rewriting this media query. */

:root {
  color-scheme: light dark;

  /* ─── Colour: surfaces and text ─── */
  --bg: #fdfdfa;            /* page (surface-0) */
  --bg-2: #ffffff;          /* raised surface: panels, rails, bars (surface-1) */
  --bg-3: #f3f4ef;          /* subtle fill: hover, chips, buttons, header (surface-2) */
  --fg: #1b211e;            /* text-1 */
  --fg-2: #565c57;          /* text-2: secondary text */
  --muted: var(--fg-2);
  --accent: #0d6647;        /* brand */
  --accent-2: #0a4732;      /* brand-strong: headings, titles, nav labels */
  --on-accent: #ffffff;
  --border: #e2e4dc;        /* line */
  --rule: #ecede6;          /* line-soft: hairlines and dividers */
  --glass: rgba(255, 255, 255, 0.94);
  --focus: var(--accent);

  /* ─── Colour: semantic ─── */
  --green: #1d7550; --yellow: #66665e; --red: #a93527;
  --quran-bg: #ebf5ee; --quran-fg: #154830;
  --hadith-bg: #f0f2f1; --hadith-fg: #3a4744;
  --dua-bg: #f3f4ef;
  --theme-bg: #e8f2f3; --theme-fg: #1f4f55;
  --quote-bg: #f6f7f3; --note-bg: #f0f6f2;
  --ok-bg: #e0f1e6; --warn-bg: #f1f2ee; --danger-bg: #f8e5e1;
  --gap-bg: #f3f4ef; --gap-fg: #4a4b44; --gap-border: #a8aa9f;
  --highlight: #fff4c2;     /* search hits, the paragraph now playing, a contents jump landing */
  --nl-mark: #b4b7ad;
  --paper: #fefefc;         /* behind page scans */
  --shadow: 0 1px 2px rgba(30, 40, 30, 0.04), 0 4px 16px rgba(40, 50, 30, 0.06);
  --shadow-hover: 0 4px 12px rgba(30, 40, 30, 0.09);
  --shadow-book: 0 18px 40px rgba(20, 45, 30, 0.16), 0 2px 6px rgba(20, 45, 30, 0.10);

  /* ─── Fonts ─── */
  --font-ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
  --font-ar: 'Amiri', 'Noto Naskh Arabic', serif;  /* user 2026-11-29: Amiri everywhere (basmala style), not Noto Naskh */
  --font-ar-ui: var(--font-ar);
  --font-ar-display: 'Amiri', 'Noto Naskh Arabic', serif;
  --font-en: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;  /* review builds only */

  /* ─── Type scale ─── */
  --fs-caption: 12px;  --fs-small: 14px;  --fs-body: 16px;  --fs-lead: 19px;
  --fs-h3: 20px;       --fs-h2: 24px;     --fs-h1: 32px;    --fs-display: 40px;
  --fs-ur-caption: 15px; --fs-ur-small: 17px; --fs-ur-body: 21px; --fs-ur-lead: 24px;
  --fs-ur-h3: 24px;      --fs-ur-h2: 30px;    --fs-ur-h1: 40px;   --fs-ur-display: 52px;
  --lh-en: 1.6; --lh-ur: 2.1; --lh-ar: 1.9; --lh-ur-tight: 1.8;
  /* used by the transcript and book columns */
  --fs-xs: 11px; --fs-s: var(--fs-caption); --fs-m: var(--fs-small);
  --fs-trans: 15px;
  --fs-urdu: var(--fs-ur-body); --lh-urdu: var(--lh-ur);
  --fs-arabic: 22px; --lh-arabic: var(--lh-ar);
  --fs-persian: 20px;
  --fs-latin-block: 15px;

  /* ─── Space, shape, layout, motion ─── */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --gutter: 16px;                       /* phone side gutter */
  --measure-en: 72ch; --measure-ur: 34em;
  --radius-s: 6px; --radius-m: 10px; --radius-l: 16px; --radius-pill: 999px;
  --sidebar-w: 320px;
  --content-max: 1200px;
  --dur: 150ms;
}

@media screen and (prefers-color-scheme: dark) {  /* never in print: pale ink on white */
  :root {
    /* sage night */
    --bg: #111513; --bg-2: #181d1a; --bg-3: #212824;
    --fg: #ebedea; --fg-2: #a6aea9;
    --accent: #93b59f; --accent-2: #cfe0d3; --on-accent: #111513;
    --border: #2d3631; --rule: #252d29; --glass: rgba(24, 29, 26, 0.94);
    --green: #6fcf9c; --yellow: #b8b9b2; --red: #ec8874;
    --quran-bg: #162b21; --quran-fg: #bfe5cf;
    --hadith-bg: #1f2523; --hadith-fg: #cfd8d4;
    --dua-bg: #1d2421;
    --theme-bg: #172a2c; --theme-fg: #b4dade;
    --quote-bg: #1a201d; --note-bg: #19241f;
    --ok-bg: #162b21; --warn-bg: #222623; --danger-bg: #37201c;
    --gap-bg: #222623; --gap-fg: #d2d4cc; --gap-border: #6d706a;
    --highlight: #4a3c22;
    --nl-mark: #57605b;
    --paper: #e9ebe6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 24px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-book: 0 18px 50px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
  }
}
