/* ============================================================
   SENTINEL — Product Dashboard Token Layer  [v3 — warm-light default + dark toggle]
   site/assets/sentinel-tokens.css

   v3 (2026-06-11, operator-directed register change): warm editorial
   LIGHT is the default product register (closer to the homepage),
   replacing the dark terminal default. The warm-dark register (v2
   copper, warmed per WARMDARK-3 rec) is kept behind
   [data-theme="dark"] and a persistent toggle (assets/js/theme.js,
   a-i.gi convention: localStorage 'sentinel-theme' > system > light).

   Depth pass vs the WARMLIGHT-2 rec (operator: "too light, lacking
   contrast and depth"): --bg deepened #f7f3ee -> #f3ece2, --panel2
   deepened to #ebe2d4, hairlines darkened, warm layered shadows
   strengthened, and a copper page wash (--bg-wash) added.

   Three-grammar trust system + severity scale semantics UNCHANGED.
   Freshness grammar (change-state) UNCHANGED.

   WCAG 2.1 AA — computed 2026-06-11 (worst case = text on --panel2).
   LIGHT (vs #f3ece2 / #fffdfa / #ebe2d4):
     --ink   #221c15        14.4/16.6/13.1  AA+ everywhere
     --muted #6a6052         5.3/ 6.1/ 4.8  AA
     --accent-text #8a4420   6.1/ 7.1/ 5.6  AA small text
     sev-crit-text #b3261e   5.6/ 6.4/ 5.1  AA
     sev-high-text #99511a   5.1/ 5.8/ 4.6  AA
     sev-elev-text #7d6200   5.0/ 5.7/ 4.5  AA
     sev-mon-text  #1a5f99   5.7/ 6.6/ 5.2  AA
     Badge fills, WHITE ink:  crit #b3261e 6.5 · high #a85a16 5.1
                              elev #8f6e00 4.8 · mon #1f6fb2 5.3  AA
   DARK (vs #16130f / #1e1a15 / #232027):
     --ink #f0ece6 ~15:1 · --muted #a39b91 ~6.2:1
     --accent-text #d98a5e ~5.4:1 AA small text
   RAW copper #7a3e1e fails ALL text use on BOTH registers —
   chrome / fills / rules only.
   ============================================================ */

:root,
[data-theme="light"],
[data-surface="product"] {
  /* -- Structure: warm editorial light, depth-tuned ----------- */
  --bg:        #f3ece2;   /* warm paper, deepened for panel contrast */
  --panel:     #fffdfa;   /* card */
  --panel2:    #ebe2d4;   /* inset / second elevation */
  --line:      #dbd0bf;   /* warm hairline */
  --line-soft: #e8dfd1;
  /* Copper page wash — subtle colour + depth behind the workspace */
  --bg-wash:   radial-gradient(1100px 520px at 78% -120px, rgba(154,79,40,0.07), transparent 60%),
               linear-gradient(180deg, rgba(122,62,30,0.04), transparent 280px);

  /* -- Text --------------------------------------------------- */
  --ink:       #221c15;   /* warm near-black */
  --ink-2:     #51483c;   /* secondary ink — between ink and muted, AA+ */
  --muted:     #6a6052;   /* AA on all three surfaces */
  --faint:     #a89c8b;   /* decorative only — never body text */

  /* -- Brand accent — COPPER (homepage network identity) ------ */
  /* --accent for chrome/fills/rules only; --accent-text for any
     small text (AA-verified above).                              */
  --accent:        #7a3e1e;
  --accent-bright: #9a4f28;   /* large UI accent on light */
  --accent-text:   #8a4420;   /* AA small-text accent on light */
  --accent-bg:     rgba(122, 62, 30, 0.07);

  /* -- Severity scale (colour = significance; semantics fixed) - */
  --sev-critical:       #b3261e;
  --sev-critical-text:  #b3261e;
  --sev-high:           #a85a16;
  --sev-high-text:      #99511a;
  --sev-elevated:       #8f6e00;
  --sev-elevated-text:  #7d6200;
  --sev-monitored:      #1f6fb2;
  --sev-monitored-text: #1a5f99;
  --sev-badge-ink:      #ffffff;  /* white AA on all four fills (light) */

  /* -- Trust grammar (UNCHANGED) ------------------------------ */
  --confidence-pill-bg:   var(--panel2);
  --confidence-pill-ink:  var(--muted);
  --confidence-pill-line: var(--line);
  --tier-annotation-ink:  var(--muted);

  /* -- Freshness grammar (change-state, never severity) ------- */
  --fresh-updated:  var(--accent-text);
  --fresh-stable:   var(--muted);
  --fresh-archived: var(--faint);

  /* -- Signal direction (homepage tokens — light-native) ------ */
  --signal-escalating:    #b44a2d;
  --signal-stable:        #5a8a3a;
  --signal-de-escalating: #3a7a8a;

  /* -- Type ---------------------------------------------------- */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.125rem;
  --text-xl:   1.5rem;
  --text-2xl:  2.25rem;
  --text-hero: 3.5rem;

  /* -- Spacing scale ------------------------------------------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --gap: var(--space-3);

  /* -- Shape (+ warm layered elevation, depth-tuned) ----------- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(80, 50, 20, 0.09);
  --shadow-md: 0 8px 28px rgba(80, 50, 20, 0.12), 0 2px 4px rgba(80, 50, 20, 0.06);
  --transition: 160ms ease-out;
}

/* ---- WARM DARK register (toggle) — WARMDARK-3 rec ----------- */
/* Warm editorial dark (ink-on-warm-charcoal), NOT the retired cold
   terminal #0c1018. Copper identity carried across both registers. */
[data-theme="dark"] {
  --bg:        #16130f;
  --panel:     #1e1a15;
  --panel2:    #232027;
  --line:      #322c24;
  --line-soft: #2a251f;
  --bg-wash:   radial-gradient(1100px 520px at 78% -120px, rgba(196,122,78,0.06), transparent 60%);

  --ink:       #f0ece6;
  --ink-2:     #c9c2b8;
  --muted:     #a39b91;
  --faint:     #6f675e;

  --accent:        #7a3e1e;
  --accent-bright: #c47a4e;
  --accent-text:   #d98a5e;
  --accent-bg:     rgba(196, 122, 78, 0.10);

  --sev-critical:       #dc2626;
  --sev-critical-text:  #f25555;
  --sev-high:           #d97706;
  --sev-high-text:      #e0913a;
  --sev-elevated:       #eab308;
  --sev-elevated-text:  #eab308;
  --sev-monitored:      #3b82f6;
  --sev-monitored-text: #60a5fa;
  --sev-badge-ink:      #16130f;  /* dark ink on bright fills (dark) */

  --fresh-updated:  var(--accent-bright);
  --fresh-stable:   var(--muted);
  --fresh-archived: #6f675e;

  --signal-escalating:    #d4663f;
  --signal-stable:        #74a653;
  --signal-de-escalating: #5499ab;

  --shadow-sm: 0 1px 2px rgba(12, 8, 4, 0.5);
  --shadow-md: 0 6px 24px rgba(12, 8, 4, 0.55), 0 1px 2px rgba(12, 8, 4, 0.5);
}

/* Persistent regulatory-boundary chrome (D5/D10 — non-negotiable). */
.boundary-strip {
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-xs);
  padding: 6px 16px;
}

/* Severity badge grammar — colour carries severity only.
   Ink per register via --sev-badge-ink (AA both registers). */
.sev-badge { border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; padding: 2px 8px; color: var(--sev-badge-ink); }
.sev-badge--critical  { background: var(--sev-critical); }
.sev-badge--high      { background: var(--sev-high); }
.sev-badge--elevated  { background: var(--sev-elevated); }
.sev-badge--monitored { background: var(--sev-monitored); }
[data-theme="dark"] .sev-badge--critical,
[data-theme="dark"] .sev-badge--monitored { color: #f0ece6; }

/* Confidence pill grammar — deliberately neutral */
.confidence-pill {
  background: var(--confidence-pill-bg);
  border: 1px solid var(--confidence-pill-line);
  border-radius: 999px;
  color: var(--confidence-pill-ink);
  font-size: var(--text-xs);
  padding: 1px 8px;
}

/* Theme toggle (a-i.gi convention) */
.theme-toggle {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent-text); }
