/* THE COLOR TOKENS — the second chokepoint of the Rung-8 color system (docs/design/mvp-ux/07-color-system.md §3a).
   The SINGLE source of every hue in the product. Three tiers: PRIMITIVES (raw palette) → SEMANTIC (role meanings,
   the layer components use) → the role→hue APPLICATION. A component never names a raw hex and never a primitive.
   Change the whole strategy by editing the tier-1→2 map; dark mode is a second map (bottom); a partner re-hue
   edits one line. Loaded by every surface, so "critical red" has exactly ONE definition — drift is structurally
   impossible. Paired with lib/attention.js (the resolver): the resolver sets [data-role], this file colors it. */

:root {
  /* ───────── Tier 1 — PRIMITIVES (named by what they ARE; never used directly by a component) ───────── */
  /* ONE warm-stone neutral ramp — the Card's; the cool-zinc Panel + cooler-slate public/ warm to match it. */
  --stone-0:#ffffff;  --stone-50:#fafaf9; --stone-100:#f3f3f1; --stone-150:#ececea; --stone-200:#e6e6e2;
  --stone-300:#d8d8d2; --stone-400:#b3b2aa; --stone-500:#8a8980; --stone-600:#71706a; --stone-700:#55544d;
  --stone-850:#2c2c25; --stone-900:#16160f;
  /* three earned-hue scales — each a text-safe dark (≥4.5:1 on --stone-50, verified) + a light for fills/future. */
  --red-700:#c0271e;   --red-100:#f7e9e7;    /* danger / same-day        — ~5.6:1 */
  --amber-800:#9e5d08; --amber-100:#f5ecd9;  /* attention / not-emergency — ~4.9:1 */
  --blue-700:#38678c;  --blue-100:#e7eef4;   /* informational / can't-see — ~4.8:1 */
  /* the non-semantic UI accent — a SEPARATE namespace so it can never collide with a clinical role.
     2026-07-08 owner re-hue: calmer/grounded muted indigo (#463C86) replaces the electric #4f46e5. */
  --indigo-600:#463C86; --indigo-50:#f3f2f9;

  /* ───────── Tier 2 — SEMANTIC (named by what they MEAN; the only layer components touch) ───────── */
  /* the three clinical roles — the resolver's output (lib/attention.js ROLE) maps here, and ONLY here. */
  --role-critical:var(--red-700);     --role-critical-soft:var(--red-100);
  --role-attention:var(--amber-800);  --role-attention-soft:var(--amber-100);
  --role-info:var(--blue-700);        --role-info-soft:var(--blue-100);
  /* the neutral ink ramp + surfaces — the ~90% of every screen (canonical names; the warm specimens already use
     these, so they conform with no rename; the Panel renames onto them). */
  --paper:var(--stone-50); --card:var(--stone-0); --surface:var(--stone-0); --hairline:var(--stone-200);
  --ink:var(--stone-900); --mid:var(--stone-700); --muted:var(--stone-500); --faint:var(--stone-400);
  --band:var(--stone-150); --plotline:var(--stone-600); --plotquiet:#9b9a92;
  --bar:#bdbcb4; --barhot:#6f6e68;   /* plot/bar component greys — kept at the approved Reading-Instrument values */
  /* UI / interaction (non-semantic) — separate namespace from the clinical roles. */
  --ui-selection:var(--indigo-600); --ui-selection-bg:var(--indigo-50);
}

/* ───────── the role → hue APPLICATION (shared, so every surface colors a role identically) ─────────
   The resolver sets data-role on an element; this colors it. Weight/size stay in the component (a critical rail
   VALUE is weight-800; an "info" coverage row is not) — only the HUE is shared here. `neutral` deliberately sets
   nothing: it inherits the ink ramp (grey is the default, never a color). */
[data-role="critical"]  { color: var(--role-critical); }
[data-role="attention"] { color: var(--role-attention); }
[data-role="info"]      { color: var(--role-info); }
/* coverage ink-weight WITHIN the blue family (a hue is never added for this — 07 §1): strong = the dangerous
   blind-beside-abnormal gap; faint = a "couldn't assess" abstention; normal = overdue / never-drawn. */
[data-role="info"][data-emph="strong"] { color: var(--role-info); font-weight: 600; }
[data-role="info"][data-emph="faint"]  { color: var(--role-info); opacity: .72; }

/* ───────── DARK MODE — a SECOND tier-1→2 map ONLY (no component changes; meaning unchanged, surface flips).
   Scaffolded for the dark fast-follow and gated behind an explicit opt-in, so it does NOT ship to users yet; it
   proves the architecture is theme-ready (a re-theme is this block, nothing else). Dark hues are first-pass —
   contrast-in-dark validation is the Rung-8b task before this is enabled by default. ───────── */
:root[data-theme="dark"] {
  --paper:#14140f; --card:#1a1a15; --surface:#1a1a15; --hairline:#33332b;
  --ink:#f3f3f1; --mid:#b3b2aa; --muted:#8a8980; --faint:#55544d;
  --band:#2c2c25; --plotline:#9b9a92; --plotquiet:#71706a; --bar:#3a3a31; --barhot:#9b9a92;
  --role-critical:#f0857a; --role-attention:#d8a24a; --role-info:#7fa8c9;   /* lighter on dark — held ≥4.5:1 (pending validation) */
  --ui-selection:#a49bd6; --ui-selection-bg:#262238;  /* dark map for the muted-indigo accent (first-pass, pending Rung-8b validation) */
}
