/*
  Bitcoin Canon — Design Tokens
  Single source of truth for the entire design system.
  No !important here. Everything downstream inherits.
*/

:root {
  color-scheme: dark;

  /* — Material — ground / panel / ink / line ————————— */
  /* Theme: Midnight. Warm manuscript material; ornament is separate. */
  --c-bg:       #0d0c0a;   /* deep warm black — aged leather, not cool slate */
  --c-bg-deep:  #0c0c14;   /* body-gradient midpoint — themeable so light themes don't fade to black */
  --c-panel:    #14110c;   /* dark warm panel — like aged parchment in shadow */
  --c-panel-2:  #1b1710;   /* slightly lighter for inset and hover states */

  /* — Text ——————————————————————————————————————— */
  /* Three legible ink steps. Every theme holds its contrast targets against the
     WORST surface the text actually lands on — --c-bg, --c-panel and
     --c-panel-2, not the page background alone. Cards, drawers and sheets are
     panels, so measuring only against --c-bg overstates legibility by ~0.5.
     Targets: ink ≥ 10:1, muted ≥ 5.7:1, dim ≥ 4.5:1 (WCAG AA body text) on all
     three. --c-dim is the faintest step, not a sub-legible one: it carries real
     copy (footer, breadcrumb, chapter chips, verse actions, the mobile search
     placeholder), so it must clear AA wherever it is painted. */
  --c-ink:      #ece4cf;   /* aged parchment ivory — warm, not cool white */
  --c-muted:    #a79a7a;   /* warm gray-gold — like faded manuscript ink */
  --c-dim:      #947e63;   /* deepest legible step — quiet, still readable */

  /* — Seal + verification ————————————————————————— */
  /* These hues do not re-theme. Gold is reserved for verified provenance,
     block time, current-position marks, verse refs, and the search focus ring.
     Green is an integrity signal only. */
  --c-seal:       #cba23c;
  --c-seal-2:     #e0b652;
  --c-seal-bg:    rgba(203, 162, 60, .09);
  --c-seal-line:  rgba(203, 162, 60, .26);
  --c-seal-ground: #0d0c0a;
  --c-verify:     #3ddc97;

  /* Theme-aware ground for the redaction apparatus only. Unlike the invariant
     seal ground above, this surface follows the reading material in light
     themes so themed text never lands on a dark wash. */
  --c-apparatus-ground: #0d0c0a;

  /* Deprecated presentation aliases. Keeping them additive avoids a broad
     selector rewrite while neutralising the former gold-as-chrome palette. */
  --c-amber:      var(--c-muted);
  --c-amber-2:    var(--c-ink);
  --c-amber-bg:   var(--c-panel-2);

  /* — Borders ———————————————————————————————————— */
  --c-line:        rgba(220, 195, 150, .12);   /* warm parchment-tinted lines */
  --c-line-strong: rgba(220, 195, 150, .22);
  --c-line-amber:  var(--c-line-strong);

  /* — Spacing — 4/8 base ——————————————————————— */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* — Radius ————————————————————————————————————— */
  --radius-none: 0;
  --radius-sm: 2px;
  --radius-md: 6px;
  --radius-pill: 999px;

  /* — Elevation ————————————————————————————————— */
  --c-shadow:  rgba(0, 0, 0, .65);
  --c-shadow-2: rgba(0, 0, 0, .35);
  --elevation-1: 0 8px 24px var(--c-shadow-2);
  --elevation-2: 0 24px 60px var(--c-shadow);

  /* — Fonts ————————————————————————————————————— */
  --f-serif: "EB Garamond", Georgia, serif;
  --f-sans:  Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* — Type scale ————————————————————————————————— */
  --type-2xs: .58rem;
  --type-xs: .65rem;
  --type-sm: .78rem;
  --type-body: 1rem;
  --type-reading: 1.24rem;
  --type-title-sm: 1.6rem;
  --type-title: clamp(2rem, 4vw, 3.2rem);

  /* — Reading geometry ————————————————————————— */
  --reading-width:  68ch;
  --sidebar-width:  240px;
  --content-max:    1120px;
  --reader-scale:   1;       /* overridden by JS for text size control */

  /* — Motion ————————————————————————————————————— */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: .14s;
  --mid:  .22s;
}

/* ── Reading themes (2026-06-16) — variable overrides only ──────────── */
:root[data-theme="sepia"] {
  color-scheme: light;
  --c-bg:       #ece0c6;
  --c-bg-deep:  #e2d3b2;   /* light theme: fade to slightly deeper parchment, never dark */
  --c-panel:    #e4d6b8;
  --c-panel-2:  #dccba6;
  --c-ink:      #3a2f1c;
  --c-muted:    #52472e;
  --c-dim:      #61553d;
  --c-line:        rgba(80, 60, 28, .18);
  --c-line-strong: rgba(80, 60, 28, .28);
  --c-shadow:   rgba(80, 60, 28, .22);
  --c-shadow-2: rgba(80, 60, 28, .12);
  --c-apparatus-ground: #ece0c6;
}
:root[data-theme="paper"] {
  color-scheme: light;
  --c-bg:       #faf6ee;
  --c-bg-deep:  #efe8d8;   /* light theme: fade to slightly deeper parchment, never dark */
  --c-panel:    #f1ebdd;
  --c-panel-2:  #e8e0cf;
  --c-ink:      #211c14;
  --c-muted:    #5c5345;
  --c-dim:      #6a6354;
  --c-line:        rgba(40, 30, 14, .13);
  --c-line-strong: rgba(40, 30, 14, .22);
  --c-shadow:   rgba(40, 30, 14, .15);
  --c-shadow-2: rgba(40, 30, 14, .08);
  --c-apparatus-ground: #faf6ee;
}

/* ───────────────────────────────────────────────────────────────
   PREVIEW THEMES — selectable via ?theme=NAME (non-persisted) or the
   theme toggle once promoted. NOT the live default. See feedback memory:
   stage/preview before changing :root.
   ─────────────────────────────────────────────────────────────── */
:root[data-theme="oxblood"] {
  color-scheme: dark;
  --c-bg: #190e0c; --c-panel: #241412; --c-panel-2: #2e1a17;
  --c-ink: #eedfce; --c-muted: #b4997e; --c-dim: #a57f68;
  --c-line: rgba(210,170,140, .12); --c-line-strong: rgba(210,170,140, .20);
  --c-shadow: rgba(0,0,0,.65); --c-shadow-2: rgba(0,0,0,.35);
}
:root[data-theme="indigo"] {
  color-scheme: dark;
  --c-bg: #0b0d15; --c-panel: #11131f; --c-panel-2: #191c2b;
  --c-ink: #e8e5dd; --c-muted: #979bac; --c-dim: #7e8499;
  --c-line: rgba(185,190,215, .12); --c-line-strong: rgba(185,190,215, .20);
  --c-shadow: rgba(0,0,0,.65); --c-shadow-2: rgba(0,0,0,.35);
}
:root[data-theme="forest"] {
  color-scheme: dark;
  --c-bg: #0a100e; --c-panel: #0f1714; --c-panel-2: #16201c;
  --c-ink: #e7e4d4; --c-muted: #979f8b; --c-dim: #7b8a72;
  --c-line: rgba(190,200,175, .12); --c-line-strong: rgba(190,200,175, .20);
  --c-shadow: rgba(0,0,0,.65); --c-shadow-2: rgba(0,0,0,.35);
}
:root[data-theme="orange"] {
  color-scheme: dark;
  --c-bg: #0a0a0b; --c-panel: #121214; --c-panel-2: #1b1c1f;
  --c-ink: #e9e7e2; --c-muted: #99999e; --c-dim: #82848b;
  --c-line: rgba(210,210,215, .12); --c-line-strong: rgba(210,210,215, .20);
  --c-shadow: rgba(0,0,0,.65); --c-shadow-2: rgba(0,0,0,.35);
}
:root[data-theme="vellum"] {
  color-scheme: light;
  --c-bg: #f3ecda; --c-bg-deep: #e9dfc5; --c-panel: #ece2c9; --c-panel-2: #e3d6b8;
  --c-ink: #2a2018; --c-muted: #594d39; --c-dim: #685c44;
  --c-line: rgba(120,95,55, .12); --c-line-strong: rgba(120,95,55, .20);
  --c-shadow: rgba(80,60,28,.22); --c-shadow-2: rgba(80,60,28,.12);
  --c-apparatus-ground: #f3ecda;
}
