/* ==========================================================================
   CEBE Tracker theme tokens
   Served at /theme.css. Linked from each page's <head> BEFORE that page's
   inline <style>, so an unmigrated page's own :root keeps governing until the
   sweep points its definitions here. Migration stays incremental.

   Dark is the default and stays canonical: the dark values live on :root, so a
   page with no data-theme attribute renders dark. The [data-theme="light"]
   block below is INERT in Phase 1 -- the nav toggle remains switched off, and
   nothing sets data-theme="light". Phase 3 is a toggle flip plus verification,
   not a build.

   Names describe ROLE, never value. The disease this replaces was name
   fragmentation: #f7931a was defined under --orange, --btc, --orange-primary
   and --accent; --cebe-text-muted named two different values on different pages.
   ========================================================================== */

:root {
  /* --- Surfaces ------------------------------------------------------- */
  --cebe-surface-page:        #09090b;
  --cebe-surface-card:        #111111;
  --cebe-surface-card-hover:  #161616;

  /* --- Text ----------------------------------------------------------- */
  --cebe-text-primary:        #fafafa;
  --cebe-text-secondary:      #a0a0a0;
  --cebe-text-muted:          #666666;

  /* --- Borders -------------------------------------------------------- */
  --cebe-border-subtle:       rgba(255,255,255,0.06);
  --cebe-border-strong:       rgba(255,255,255,0.12);
  --cebe-border-solid:        #27272a;

  /* --- Brand ---------------------------------------------------------- *
   * --cebe-brand-orange is CONSTANT across both themes: glow, fills, borders,
   * chart marks, logo, active pills. Only --cebe-brand-orange-text moves, and
   * only because #F7931A measures ~2.2:1 on warm paper and fails WCAG AA
   * for text (it measures ~8.7:1 on #09090b, which is why this never
   * surfaced in dark). #b45309 measures 4.74:1 and passes.
   *
   * --cebe-brand-glow is deliberately NOT folded into --cebe-brand-orange-dim even
   * though both are rgba(247,147,26,0.12) in dark. The glow's light-mode
   * opacity is ratified to the 0.14-0.18 band independently; collapsing the
   * two would make that band untunable without dragging every orange tint
   * along with it. This separation must survive future tidying. */
  --cebe-brand-orange:        #F7931A;
  --cebe-brand-orange-text:   #F7931A;
  --cebe-brand-orange-dim:    rgba(247,147,26,0.12);
  --cebe-brand-glow:          rgba(247,147,26,0.08);

  /* --- Semantic ------------------------------------------------------- */
  --cebe-semantic-positive:      #22c55e;
  --cebe-semantic-negative:      #ef4444;
  --cebe-semantic-warning:       #f59e0b;
  --cebe-semantic-stress:        #5ba0f5;
  --cebe-semantic-positive-dim:  rgba(34,197,94,0.1);
  --cebe-semantic-negative-dim:  rgba(239,68,68,0.1);
  --cebe-semantic-stress-dim:    rgba(91,160,245,0.1);
}

/* ==========================================================================
   LIGHT -- inert in Phase 1.

   Basis of record: the hand-tuned palette already deployed in the @media print
   blocks of twelve /insights/ articles, which is the site's oldest light
   citation and independently reached the same conclusion as the brand-orange
   text split. Ten of its twelve values already cleared AA against warm paper;
   the two that fell short are lifted here, both ratified:
       orange  #b36b00 (3.95:1)  ->  #b45309 (4.74:1)
       green   #16873e (4.34:1)  ->  #15803d (4.73:1)

   One reconciliation to note: print uses pure #fff, but the standing ruling is
   that light base tokens lean warm (off-white/paper, never pure white) so the
   persistent orange glow reads as ambient warmth. Warm-paper canon governs the
   surfaces; print's neutrals are warmed to match. Every contrast figure in the
   comments below is measured against --cebe-surface-page #faf8f5, not against #fff.

   The twelve print blocks are NOT converted to consume these tokens; that is
   confirmed follow-up, not Phase 1. Their !important keeps them winning.
   ========================================================================== */

[data-theme="light"] {
  /* --- Surfaces: warm paper, never pure white ------------------------- */
  --cebe-surface-page:        #faf8f5;
  --cebe-surface-card:        #f4f1ec;
  --cebe-surface-card-hover:  #eae6df;

  /* --- Text (from print --text / --text-2 / --text-3) ----------------- */
  --cebe-text-primary:        #111111;  /* 17.81:1 */
  --cebe-text-secondary:      #444444;  /*  9.19:1 */
  --cebe-text-muted:          #666666;  /*  5.42:1 */

  /* --- Borders -------------------------------------------------------- */
  --cebe-border-subtle:       rgba(0,0,0,0.08);
  --cebe-border-strong:       rgba(0,0,0,0.16);
  --cebe-border-solid:        rgba(0,0,0,0.12);

  /* --- Brand: the orange constant holds; only text moves -------------- */
  --cebe-brand-orange:        #F7931A;
  --cebe-brand-orange-text:   #b45309;  /*  4.74:1, lifted from print #b36b00 */
  --cebe-brand-orange-dim:    rgba(247,147,26,0.14);
  --cebe-brand-glow:          rgba(247,147,26,0.16);  /* ratified 0.14-0.18 band */

  /* --- Semantic ------------------------------------------------------- *
   * --cebe-semantic-warning is #92400e, not a naive darkening of #f59e0b. In dark,
   * brand #F7931A and warning #f59e0b sit adjacent but distinct (dE2000 4.92).
   * A naive darkened warning lands on #b45309 and merges with
   * --cebe-brand-orange-text, collapsing that distinction. #92400e measures 6.69:1
   * against the light surface and dE2000 9.20 from --cebe-brand-orange-text, so it
   * clears AA and is nearly twice as separated as the dark pair it preserves. */
  --cebe-semantic-positive:      #15803d;  /*  4.73:1, lifted from print #16873e */
  --cebe-semantic-negative:      #b91c1c;  /*  6.10:1, print value unchanged */
  --cebe-semantic-warning:       #92400e;  /*  6.69:1, dE2000 9.20 from brand text */
  --cebe-semantic-stress:        #1d4ed8;  /*  6.32:1, print value unchanged */
  --cebe-semantic-positive-dim:  rgba(21,128,61,0.10);
  --cebe-semantic-negative-dim:  rgba(185,28,28,0.10);
  --cebe-semantic-stress-dim:    rgba(29,78,216,0.10);
}
