/* CardStock color tokens.
   Source: docs/brand.md §2 (tokens, verbatim). */

/* ---------------------------------------------------------------------
   Color tokens — brand.md §2.2 (chrome), §2.3 (state), §2.5 (brand).
   Light lives bare on :root; dark and CVD are overrides per §2.4's
   four-selector cascade (the "long" dark-chrome block is canonical).
   --------------------------------------------------------------------- */

:root {
  /* Chrome — brand.md §2.2, light */
  --bg: #FAFAF7;
  --card: #FFFFFF;
  --ink: #1C1C1E;
  --mut: #5B5B57;
  --mut2: #6B6B66;
  --mut3: #8F8F8A; /* decorative strokes/handles only — never text, brand.md §8 */
  --mutbg: #F3F3EE;
  --hov: #F6F6F2;
  --line: #E4E4E0;
  --line2: #D9D9D4;
  --line3: #C9C9C4;
  --line4: #F0F0EC;
  --inbg: #FAFAF7;
  --acc: #4A63D0;
  --accH: #3A4FB8;
  --btn: #4A63D0;
  --btnH: #3A4FB8;
  --accBg: #EEF1FB;
  --accMut: #B9C4E8;
  /* D-191 (owner, 2026-08-26): the selected tier tile's fill. Light is --accBg's value —
     ContrastTests pins the equality; dark is #12162B, chosen from real-pixel candidates
     because --accBg washed out against ink there. The only hex D-191 adds. */
  --selBg: #EEF1FB;
  --tooltipBg: rgba(255, 255, 255, 0.95);
  --logoTeal: #0E8A7B;

  /* State — brand.md §2.3, light standard */
  --pos: #157A50;
  --pos2: #189E63;
  --on-pos2: #1C1C1E;   /* ContrastTests.TextOnFill */
  --neg: #C13A3A;
  --neg2: #D64545;
  --neg3: #A93838;
  /* D-190 (owner ruling 2026-08-26): darkened one step from the prototypes' #8F6614,
     which measured 4.44:1 as the anchor-tier banner's ink on the --warnBg tint over
     the page background (card.md §2.3.3; D-145 makes AA binding); #886113 measures
     4.81 there and lifts .chip-caution on a hovered Home row from 4.28. Same hue.
     Dark mode unchanged. */
  --warn: #886113;
  --warnInk: #886113;

  /* Tint bases — brand.md §2.3's posBg()/negBg()/warnBg() are alpha-parameterised
     functions in the prototype (observed alpha: .06 .07 .08 .10 .12 .25 light,
     .18 .20 dark); a flat CSS custom property can't take a parameter, so these
     fix .10 — itself one of the documented observed values — as the general-purpose
     default. A call site that needs a different documented intensity should
     compose the same rgb channels at that alpha directly rather than add a
     same-named variant here. */
  --posBg: rgba(24, 158, 99, .10);
  --negBg: rgba(214, 69, 69, .10);
  --warnBg: rgba(176, 127, 26, .10);

  /* Brand tokens — brand.md §2.5, light (brand/brand-tokens.css) */
  --brand-primary: #4A63D0;
  --brand-primary-strong: #3A4FB8;
  --brand-logo-teal: #0E8A7B;
  --brand-foil: #9A7B2D;
  --focus-ring: 0 0 0 3px rgba(74, 99, 208, 0.22);
  --link: #4A63D0;
  --link-hover: #3A4FB8;
}

/* Dark chrome — the "long" block (brand.md §2.4): all chrome tokens plus
   --warn/--warnInk, which is theme-scoped, not colorblind-scoped. */
html[data-theme="dark"] {
  --bg: #161614;
  --card: #1E1E1C;
  --ink: #E9E9E5;
  --mut: #B4B4AE;
  --mut2: #A8A8A2;
  --mut3: #9A9A94;
  --mutbg: #2A2A27;
  --hov: #282825;
  --line: #33332F;
  --line2: #3E3E39;
  --line3: #4A4A44;
  --line4: #262623;
  --inbg: #262624;
  --acc: #8C9BF2;
  --accH: #AAB6F6;
  --btn: #4A63D0;
  --btnH: #3A4FB8;
  --accBg: #252B44;
  --accMut: #3A4570;
  --selBg: #12162B;
  --tooltipBg: rgba(30, 30, 28, 0.95);
  --logoTeal: #3FBFAD;

  --warn: #D6A54A;
  --warnInk: #D6A54A;

  --brand-primary: #8C9BF2;
  --brand-primary-strong: #AAB6F6;
  --brand-logo-teal: #3FBFAD;
  --brand-foil: #C9A84C;
  --focus-ring: 0 0 0 3px rgba(140, 155, 242, 0.25);
  --link: #8C9BF2;
  --link-hover: #AAB6F6;
}

/* Light CVD — brand.md §2.4 selector 1: state hues + tints only. */
html[data-cvd="1"] {
  --pos: #0B69A8;
  --pos2: #0072B2;
  --on-pos2: #FFFFFF;   /* white, not ink: ink fails AA on this fill. ContrastTests.TextOnFill */
  /* --neg here is owner-authorised and load-bearing, darkened three times from the
     prototypes' #CC5F00: D-146 took it to #BE5800, which cleared AA on --card but still
     failed on --bg (4.38) and --mutbg (4.11) — live on the Signals panel, whose container
     is --bg. D-164 took it to #B35300, clearing all three. D-212 (owner, 2026-08-29) takes
     the last step to #AD5000: --selBg arrived with D-191 as a fourth surface --neg renders
     on, and #B35300 measured 4.48 there — the whole shortfall was 0.02, and the owner chose
     the darkening over an exception. Now 5.35 / 5.12 / 4.81 / 4.74 on --card / --bg /
     --mutbg / --selBg. Do not revert it toward the prototype value; the floor is enforced by
     ContrastTests, which checks every text hue on every surface in all four modes. */
  --neg: #AD5000;
  --neg2: #D55E00;
  --neg3: #B34E00;
  --posBg: rgba(0, 114, 178, .10);
  --negBg: rgba(213, 94, 0, .10);
}

/* Dark standard — brand.md §2.4 selector 3. */
html[data-theme="dark"]:not([data-cvd="1"]) {
  --pos: #4CC08D;
  --pos2: #4CC08D;
  --on-pos2: #1C1C1E;   /* ContrastTests.TextOnFill */
  --neg: #E57B7B;
  --neg2: #E57B7B;
  --neg3: #E57B7B;
}

/* Dark CVD — brand.md §2.4 selector 4. */
html[data-theme="dark"][data-cvd="1"] {
  --pos: #58A9E6;
  --pos2: #58A9E6;
  --on-pos2: #1C1C1E;   /* ContrastTests.TextOnFill */
  --neg: #F5924E;
  --neg2: #F5924E;
  --neg3: #E8874D;
}
