/* =====================================================================
   comfort.flip.css - Comfort cascade flip + legacy/-bz- alias layer (APP-ONLY)
   =====================================================================
   Part 2 of comfort-remediation-architecture.md. This is the app integration layer that
   makes Comfort WIN and neutralizes the competing visual systems by ALIASING their token
   names to the Comfort canonical values (var(--k-*) from comfort.tokens.css). It does NOT
   delete anything (Phase D does that once C2 consumer counts hit 0); it re-points ownership.

   REVERSIBLE FEATURE FLAG: everything here is scoped under `html.comfort-on`. Remove that
   class (localStorage: comfort=off) to fully revert to the legacy systems with no redeploy.

   CASCADE MATH: `html.comfort-on:root` has specificity (0,2,1) which beats every legacy
   selector -- plain `:root` (0,1,0) AND `:root[data-theme="dark"]` (0,2,0) -- regardless of
   load order. So this one block wins in BOTH themes; because every value is var(--k-*), and
   --k-* is dark-aware (comfort.tokens.css :root[data-theme="dark"] overrides --k-*), the
   aliases resolve to the correct light/dark value automatically. No raw hex here (prod-legal).

   RULING: aliases are time-boxed. Phase C migrates consumers off these legacy NAMES onto the
   Comfort public tokens; Phase D deletes the aliases + orphaned legacy :root blocks. The C2
   ratchet proves the consumer count only ever decreases. */

html.comfort-on:root {
  /* ---------- interactive / brand -> ONE accent (retires #12B8AE, #1463FF) ---------- */
  --teal:var(--k-accent); --teal-deep:var(--k-accent-press); --teal-soft:var(--k-accent-tint);
  --navy:var(--k-accent); --navy-lt:var(--k-accent-tint); --navy2:var(--k-accent);
  --brand-blue:var(--k-accent); --blue:var(--k-accent); --blue-lt:var(--k-accent-tint); --blue-bg:var(--k-accent-tint);
  --accent-blue:var(--k-accent); --accent-blue-bg:var(--k-accent-tint);
  /* legacy --accent-text = teal interactive LINK text (.btn-text etc.); keep it a readable
     teal (accent-press is AA on page in both themes), NOT white. */
  --accent-text:var(--k-accent-press);
  --teal-25:var(--k-accent-tint); --teal-50:var(--k-accent-tint); --teal-500:var(--k-accent);
  --teal-600:var(--k-accent); --teal-700:var(--k-accent); --teal-800:var(--k-accent-press);
  --teal-900:var(--k-accent-press); --teal-950:var(--k-accent-press);
  --cockpit-gradient:var(--k-grad-hero);

  /* ---------- surfaces ---------- */
  --bg:var(--k-page); --bg-deep:var(--k-page); --bg-elev:var(--k-surface);
  --surface:var(--k-surface); --header:var(--k-header);
  --card:var(--k-surface); --card-bg:var(--k-surface);
  --card-border:var(--k-line); --card-line:var(--k-line);
  --card-shadow:var(--k-shadow-card); --card-shadow-lift:var(--k-shadow-2);
  --line:var(--k-line); --line-strong:var(--k-line); --border:var(--k-line);
  /* hero-bg is a DARK teal surface carrying WHITE text (.btn / .row-action / wizard+reports
     headers). It must NOT alias to the white --header, or white-on-white makes those buttons
     invisible-but-clickable (Comfort regression fix 2026-07-07). */
  --hero-bg:var(--k-hero-surface); --hero-bg-2:var(--k-hero-surface-2);

  /* ---------- text: collapse 4 ink levels -> 3 ---------- */
  --ink:var(--k-text-primary); --ink-1:var(--k-text-primary); --ink-900:var(--k-text-primary);
  /* NOTE: --ink-900 stays aliased (theme-aware) because most of its 18 consumers
     sit on theme-aware surfaces. Surfaces that are hardcoded WHITE in both themes
     (the Google-brand button, the .ow-* onboarding cards) must NOT use it -- they
     use --ink-on-white, which is fixed and deliberately never aliased here. */
  --ink-2:var(--k-text-secondary); --ink2:var(--k-text-secondary); --ink-700:var(--k-text-secondary); --ink-500:var(--k-text-secondary);
  --ink-3:var(--k-text-tertiary); --ink3:var(--k-text-tertiary); --ink-4:var(--k-text-tertiary);
  --ink-200:var(--k-text-tertiary); --ink-soft:var(--k-text-tertiary); --ink-muted:var(--k-text-tertiary);
  --text-primary:var(--k-text-primary); --text-secondary:var(--k-text-secondary); --text-tertiary:var(--k-text-tertiary);

  /* ---------- money / status ---------- */
  --green:var(--k-pos); --positive:var(--k-pos); --green-bg:var(--k-surface-2); --green-lt:var(--k-surface-2); --green-soft:var(--k-surface-2);
  --coral:var(--k-neg); --negative:var(--k-neg); --coral-bg:var(--k-neg-tint); --coral-soft:var(--k-neg-tint);
  --amber:var(--k-warn); --amber-bg:var(--k-surface-2); --amber-lt:var(--k-surface-2);
  --warn:var(--k-warn); --pos-text:var(--k-pos); --neg-text:var(--k-neg);

  /* ---------- type: ONE set ---------- */
  --serif:var(--k-font-serif); --sans:var(--k-font-sans); --mono:var(--k-font-mono);
  --font-serif:var(--k-font-serif); --font-sans:var(--k-font-sans); --font-mono:var(--k-font-mono);

  /* ---------- shape / radius (retire code 16px override) ---------- */
  --r-lg:var(--k-r-lg); --radius:var(--k-radius);

  /* ---------- design-tokens.css onboarding accent scale -> Comfort identity/status ---------- */
  --accent-amber:var(--k-warn); --accent-amber-bg:var(--k-surface-2);
  --accent-rose:var(--k-neg); --accent-rose-bg:var(--k-neg-tint);
  --accent-violet:var(--k-cat-settle); --accent-violet-bg:var(--k-surface-2);
  --accent-stone:var(--k-text-tertiary); --accent-stone-bg:var(--k-surface-2);

  /* ---------- raptor3 --bz-* cockpit tokens -> Comfort (no independent bz visual authority) ---------- */
  --bz-bg:var(--k-page); --bz-bg-deep:var(--k-page); --bz-bg-elev:var(--k-surface);
  --bz-ink:var(--k-text-primary); --bz-ink-muted:var(--k-text-secondary); --bz-ink-soft:var(--k-text-tertiary);
  --bz-line:var(--k-line);
  --bz-teal:var(--k-accent); --bz-teal-deep:var(--k-accent-press); --bz-teal-soft:var(--k-accent-tint);
  --bz-green:var(--k-pos); --bz-green-soft:var(--k-surface-2);
  --bz-red:var(--k-neg); --bz-red-soft:var(--k-neg-tint);
  --bz-brass:var(--k-warn); --bz-brass-soft:var(--k-surface-2);
  --bz-serif:var(--k-font-serif); --bz-sans:var(--k-font-sans); --bz-mono:var(--k-font-mono);
  --bz-shadow-sm:var(--k-shadow-1); --bz-shadow-md:var(--k-shadow-2);
}
