:root{
  /* ============================================================
     PROJECT ALETHIA / TOKENS — Reading-Terminal direction.
     Marble-light content, dark-instrument frame. The carved Word.
     ============================================================ */

  /* —— TRAVERTINE / MARBLE GROUND (resting dominant) —— */
  --travertine:#EFE9DD;        /* page ground · ~60% of any lit view */
  --travertine-hi:#F6F1E7;     /* raised slabs / inscription panels */
  --travertine-lo:#E3DBCB;     /* recessed insets / carved channels */
  --travertine-edge:#D6CCB8;   /* stone-seam hairlines, panel borders */
  --mortar:#C9BEA8;            /* deepest non-text stone · <5% */

  /* —— INK / THE WORD —— */
  --ink:#1A1714;               /* carved Word + prose · 13.9:1 (AAA) */
  --ink-soft:#3D3630;          /* secondary prose · 9.6:1 (AAA) */
  --ink-mute:#6B6155;          /* labels / captions · 5.1:1 (AA) */
  --ink-faint:rgba(26,23,20,0.14); /* hairlines, reticle ticks */

  /* —— GILT (rationed accent · ≤4% viewport) —— */
  --gilt:#A9852F;              /* the one glow · UI/large only · 3.2:1 */
  --gilt-hi:#C9A227;           /* foil specular stop */
  --gilt-deep:#7C6020;         /* small gilt text · 4.6:1 (AA) */

  /* —— VERDIGRIS (secondary · ≤6%) —— */
  --verdigris:#2F6A5E;         /* stable / confirmed · 4.8:1 (AA) */
  --verdigris-deep:#234C44;    /* small verdigris text · 8.1:1 (AAA) */

  /* —— OBSIDIAN (dark state: boot + Undercity only) —— */
  --obsidian:#0C0B0A;          /* powered-down ground */
  --obsidian-raised:#14120F;   /* raised dark panels */
  --obsidian-edge:rgba(239,233,221,0.12);
  --bone:#E7E1D3;              /* text on obsidian · 15.3:1 (AAA) */

  /* —— LAPIS (instrument accent · <5% strict) —— */
  --lapis:#274B79;             /* live cursor / boot arc · 6.2:1 on travertine */
  --lapis-hi:#3E6BA0;          /* lapis on obsidian · 4.4:1 (AA-lg) */

  /* —— PHOSPHOR + AMBER (dark-terminal pair ONLY; never on marble) —— */
  --phosphor:#6FE3B0;          /* CRT power-on glow · 11.4:1 on obsidian */
  --phosphor-dim:rgba(111,227,176,0.42);
  --amber:#E8A23C;             /* dark-state fault/alarm · 9.1:1 · ≤2% */

  /* —— MATERIAL —— */
  --basalt:#1A1714;            /* the censor's bar (= ink on marble) */
  --basalt-edge:#2A2520;       /* bar bevel highlight stop */

  /* —— TYPE FAMILIES —— */
  --f-display:"Cormorant","Cormorant Garamond",Georgia,serif; /* the carved Word */
  --f-prose:"EB Garamond",Georgia,"Times New Roman",serif;     /* reading prose */
  --f-civic:"Archivo","Helvetica Neue",Arial,sans-serif;       /* civil labels / UI */
  --f-mono:"IBM Plex Mono",ui-monospace,"Courier New",monospace;/* telemetry / designations */
  /* aliases used by the motion layer */
  --display:var(--f-display);
  --mono:var(--f-mono);

  --feat-display:"liga" 1,"dlig" 1,"swsh" 0;
  --feat-prose:"kern" 1,"liga" 1,"onum" 1;   /* oldstyle figures in prose */
  --feat-civic:"kern" 1;
  --feat-mono:"tnum" 1,"zero" 1;             /* tabular + slashed zero */

  /* —— TYPE SCALE · display Perfect Fourth, text Major Third. Line counts are the DESIGN TARGET. —— */
  --t-monument:clamp(2.1rem, 5.8vw, 5.25rem);  /* hero · big on desktop, 2 lines on mobile · lh .96 */
  --t-display: clamp(2rem, 3.8vw, 3.4rem);     /* scene titles · short 2-line carved Words · lh 1.02 */
  --t-title:   clamp(1.6rem, 3.0vw, 2.4rem);   /* Cormorant 500 · 1-2 lines · lh 1.10 */
  --t-quote:   clamp(1.5rem, 3.2vw, 2.5rem);   /* Cormorant italic · lh 1.18 */
  --t-lead:    clamp(1.2rem, 1.5vw, 1.45rem);  /* EB Garamond 500 · lh 1.45 */
  --t-body:    clamp(1.05rem, 1.15vw, 1.2rem); /* EB Garamond 400 · lh 1.65 */
  --t-eyebrow: clamp(0.69rem, 0.8vw, 0.8rem);  /* Archivo 600 · lh 1.3 */
  --t-ui:      clamp(0.81rem, 1.0vw, 0.9rem);  /* Archivo 600 · lh 1.2 */
  --t-caption: 0.75rem;                        /* Archivo 500 · lh 1.5 */
  --t-telemetry:clamp(0.625rem, 0.8vw, 0.75rem);/* Plex Mono · lh 1.8 */
  --t-readout: clamp(1.5rem, 3vw, 2.25rem);    /* Plex Mono 500 · tabular */

  --lh-monument:0.96; --lh-display:1.02; --lh-title:1.10; --lh-quote:1.18;
  --lh-lead:1.45; --lh-body:1.65; --lh-ui:1.2; --lh-telemetry:1.8;
  --track-monument:-0.012em; --track-display:-0.008em; --track-title:-0.004em;
  --track-eyebrow:0.2em; --track-ui:0.12em; --track-telemetry:0.22em;

  /* —— SPACING (8px base; 4px fine detail) —— */
  --s-0:4px; --s-1:8px; --s-2:16px; --s-3:24px; --s-4:32px;
  --s-5:48px; --s-6:64px; --s-7:96px; --s-8:128px; --s-9:192px;
  --measure:64ch;            /* justified prose measure (60–68ch) */

  /* —— CORNERS (architectural; 0 is law) —— */
  --radius:0px;              /* everywhere: panels, buttons, inputs, frames */
  --radius-seal:50%;         /* the ONLY exception: true circles */
  --hair:1px;                /* hairline structure stroke */
  --rule:1.5px;              /* reticle / motif stroke */
  --active:2px;              /* focus / live-signal stroke */

  /* —— MATERIALS —— */
  --carve-text:                                /* carved marble text, DISPLAY ONLY */
    0 1px 0 rgba(255,255,255,0.55),
    0 -1px 0 rgba(26,23,20,0.10),
    0 2px 3px rgba(26,23,20,0.14);
  --elev-rest:
    inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -1px 0 rgba(26,23,20,0.06),
    0 1px 2px rgba(26,23,20,0.05),
    0 12px 28px rgba(26,23,20,0.10),
    0 36px 64px rgba(26,23,20,0.08);
  --elev-raise:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 2px 4px rgba(26,23,20,0.07),
    0 18px 40px rgba(26,23,20,0.14),
    0 52px 92px rgba(26,23,20,0.11);
  --foil-band:linear-gradient(100deg,
    var(--gilt) 0%, var(--gilt-hi) 42%, #E9D38A 50%, var(--gilt-hi) 58%, var(--gilt) 100%);
  --foil-shadow:0 1px 0 rgba(255,255,255,0.5) inset, 0 6px 18px rgba(124,96,32,0.22);

  /* —— MOTION (slow, deliberate, showpiece) —— */
  --ease-stone:cubic-bezier(0.22,0.61,0.36,1); /* weight settling */
  --ease-act:cubic-bezier(0.2,0.7,0.3,1);      /* crisp actuation */
  --t-stage:1100ms;          /* slow staging clock */
  --t-act:220ms;             /* crisp actuation clock */
  --dur-unconceal:1200ms;    /* the carve / reveal */
  --dur-sweep:1600ms;        /* foil leaf-catch */
  --dur-ui:220ms;            /* honest UI response */
}

/* dark-instrument scope: boot + Undercity face ONLY */
[data-state="terminal"]{
  --ground:var(--obsidian); --on-ground:var(--bone);
  --edge:var(--obsidian-edge); --signal:var(--lapis-hi);
  --glow:var(--phosphor); --alarm:var(--amber);
}
/* marble-light scope: everything else (resting default) */
:root,[data-state="lit"]{
  --ground:var(--travertine); --on-ground:var(--ink);
  --edge:var(--travertine-edge); --signal:var(--lapis);
  --accent:var(--gilt); --secondary:var(--verdigris);
}

/* GLOBAL MOTION KILL-SWITCH — single source of truth */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important; scroll-behavior:auto !important;
  }
  :root{ --dur-unconceal:0ms; --dur-sweep:0ms; }
}

/* ============================================================
   V2 — "THE EGRESS": type duet, glow rebalance, scroll-grade scalar
   ============================================================ */

/* typed scalars so calc()/color-mix interpolate them as numbers */
@property --egress { syntax:"<number>"; inherits:true; initial-value:0; }
@property --bloom  { syntax:"<number>"; inherits:false; initial-value:0; }

:root{
  /* —— THE SCROLL-GRADE SCALAR (written by scene.js once per frame) —— */
  --egress: 0;                                     /* 0 = intact core · 1 = cordon */
  --grade-warm: calc(1 - var(--egress));           /* 1 warm → 0 cold */
  --grade-dust: var(--egress);                     /* particulate density */
  --grade-scan: calc(var(--egress) * 0.9);         /* scanline drive */
  --grade-fail: clamp(0, calc((var(--egress) - 0.55) / 0.45), 1); /* structural failure ramp */
  --grade-vig:  calc(var(--egress) * var(--egress));              /* vignette closes quadratically */

  /* —— TYPE DUET: Archivo promoted to a full display tier —— */
  --f-hud:"Archivo Expanded","Archivo","Helvetica Neue",Arial,sans-serif; /* machine display */
  --vf-hud-wide:"wdth" 125,"wght" 700;   /* program designation, ring names */
  --vf-hud-mid:"wdth" 112,"wght" 650;    /* panel titles, ledger heads */
  --feat-hud:"kern" 1;

  --t-program:clamp(1.15rem,2.0vw,1.7rem);       /* demoted below the carved Word */
  --t-designation:clamp(0.8rem,1.1vw,1rem);      /* the scene label / program tag */
  --t-hud-title:clamp(1.05rem,1.5vw,1.4rem);     /* tile + ledger titles */

  --track-program:0.16em;
  --track-designation:0.34em;                    /* widest, engraved-into-metal */

  /* —— GLOW REBALANCE: lapis becomes the page-wide instrument signature —— */
  --instr:var(--lapis);                /* lit-scene instrument stroke */
  --instr-faint:var(--ink-faint);
  --instr-glow:transparent;            /* no glow on marble by default */
  --glow-lapis:0 0 6px rgba(39,75,121,0.35);  /* lit-safe bloom — strokes only, never text */
}

/* dark scope: instrument recolour to phosphor */
[data-state="terminal"]{
  --instr:var(--phosphor);
  --instr-faint:var(--obsidian-edge);
  --instr-glow:var(--phosphor-dim);
}

@media (prefers-reduced-motion: reduce){
  :root{ --egress:0; }
}

/* ============================================================
   V3 — measure (orphan cure), editorial flow, asymmetric grid
   ============================================================ */
:root{
  /* MEASURE: body 45-75ch (target 66); display measures are line-count targets, not tight caps */
  --measure-prose:   66ch;
  --measure-lead:    52ch;
  --measure-caption: 44ch;
  --measure-monument:18ch;   /* authored to a clean 2-liner at monument size */
  --measure-display: 24ch;
  --measure-title:   30ch;

  /* EDITORIAL FLOW: the negative space IS the rhythm. Use these for vertical flow. */
  --flow-tight:   var(--s-3);   /* kicker -> title (24px) */
  --flow-default: var(--s-5);   /* title -> lead (48px) */
  --flow-loose:   var(--s-7);   /* focal -> next cluster (96px) */
  --rest:         var(--s-9);   /* the empty row between major beats (192px) */
  --scene-pad-y:  clamp(var(--s-8), 14vh, 200px);

  /* 12-COL ASYMMETRIC GRID: the page margin is the minimalism */
  --grid-cols:12;
  --grid-gutter:clamp(16px, 1.6vw, 28px);
  --grid-margin:clamp(20px, 6vw, 120px);
  --content-max:1240px;
}
