/* ============================================================
   aligned-tokens.css — DCMS2 "Aligned" token bridge (Build 1, v3.84.151)
   Design authority: dcms2_kit/conventions.css (values transplanted verbatim).

   Loaded LAST in each shell's <head> (after the chrome's inline <style>), so:
     header-inline  <  aligned-tokens/core  <  per-view <style> (loads after </head>)
   That lets these tokens re-point the app's legacy vars (chrome re-skins for
   free) while each view keeps its own look until its wave.

   Two jobs: (1) publish the Aligned --c-* / --app-* / --font-* names that
   aligned-core.css consumes; (2) re-point the legacy --brand/--radius/--bg…
   the whole app already reads from. Dark twins included — single source of
   truth for both themes (no component-level dark hacks).
   ============================================================ */

:root {
  /* ---- Aligned named palette (verbatim, conventions.css) ---- */
  --c-white:            #FFFFFF;
  --c-alabaster:        #FAFAFA;
  --c-black:            #000000;
  /* Wave D1 (Delmar brand law): dominant blue is #003685 (was the stale Figma 0x002387).
     Correcting this one token flips --delmar-blue, --brand, nav chrome, .btn, --info. */
  --c-resolution-blue:  #003685;   /* Delmar Blue — PMS 287C */
  --c-downriver:        #0E2D52;
  --c-navy-900:         #021E47;   /* deepest navy — sidebar / display numerals */
  --c-westar:           #DCD9D0;
  --c-valencia:         #db364a;   /* Delmar Red — PMS 1925C (CTA/highlight, <2%) */
  --c-well-read:        #b71b2f;
  --c-azure-500:        #809AC2;
  --c-azure-400:        #BFCDE0;
  --c-azure-300:        #E5EBF3;
  --c-azure-200:        #F2F5F9;
  --c-azure-100:        #F3F7FD;
  --c-green:            #0C6E40;   /* success fg (readable on white) */
  --c-fresh:            #38bd00;   /* Delmar Fresh — vivid green for bar fills */
  --c-fresh-2:          #5dd734;
  /* DS blue scale aliases (so the component layer can use brand-book names too) */
  --blue-300: #1061df; --blue-500: #0845a2; --blue-700: #003685; --blue-800: #032c67; --blue-900: #021e47;
  --red-700: #db364a; --red-800: #b71b2f;

  /* ---- Aligned semantic tokens (verbatim) ---- */
  --app-bg:           #F4F5F2;   /* Wave D1: warm off-white (brand book), was cool #FAFAFA */
  --app-surface:      var(--c-white);
  --app-surface-2:    var(--c-azure-200);
  --app-surface-3:    var(--c-azure-300);
  --app-text:         #0B0C0F;
  --app-text-2:       rgba(0, 0, 0, 0.60);
  --app-text-3:       rgba(0, 0, 0, 0.42);
  --app-border:       rgba(14, 45, 82, 0.12);
  --app-border-2:     rgba(14, 45, 82, 0.22);
  --app-divider:      rgba(14, 45, 82, 0.08);
  --app-input-bg:     var(--c-white);
  --app-input-bd:     rgba(14, 45, 82, 0.22);
  --app-row-hover:    rgba(0, 35, 135, 0.05);
  --app-row-stripe:   rgba(0, 35, 135, 0.025);
  --app-info-bg:      rgba(0, 35, 135, 0.10);
  --app-info-fg:      var(--c-resolution-blue);
  --app-neutral-bg:   rgba(0, 0, 0, 0.06);
  --app-neutral-fg:   rgba(0, 0, 0, 0.60);
  --app-danger-bg:    rgba(213, 64, 58, 0.12);
  --app-danger-fg:    var(--c-well-read);
  --app-success-bg:   rgba(12, 110, 64, 0.12);
  --app-success-fg:   var(--c-green);
  --app-warning-bg:   rgba(163, 82, 0, 0.12);
  --app-warning-fg:   #8A4B00;
  --stroke-weight:    1px;

  /* ---- Type families — Wave D1 restores the Delmar brand voice: Noto Sans everywhere,
     headlines rendered Black-Italic UPPERCASE by delmar-core (was the upright-Helvetica reset). ---- */
  --font-strong:  'Noto Sans', Arial, system-ui, sans-serif;
  --font-branded: 'Noto Sans', Arial, system-ui, sans-serif;

  /* ---- Bridge: re-point the legacy tokens the app already consumes ----
     Overriding --delmar-blue flips everything derived from it (--brand,
     --nav-active-bar, --nav-avatar-bg, .btn text) to Resolution Blue. */
  --delmar-blue:    var(--c-resolution-blue);
  --delmar-blue-2:  #0A3AA6;
  --delmar-blue-4:  var(--c-downriver);
  --delmar-red:     var(--c-valencia);
  --delmar-red-2:   var(--c-well-read);

  --bg:          var(--app-bg);   /* warm off-white (Wave D1), not cool alabaster */
  --surface:     var(--c-white);
  --surface-2:   var(--c-azure-200);
  --card:        var(--c-white);
  --line:        var(--app-border);
  --text:        var(--app-text);
  --muted:       var(--app-text-2);
  --border-color:var(--app-border);
  --danger:      var(--c-valencia);
  --ok:          var(--c-green);
  --info:        var(--c-resolution-blue);

  --radius:     4px;   /* Wave D1: kit product-UI radii — cards/tiles 4px */
  --radius-sm:  3px;   /* buttons / inputs / selects 3px */
  /* --radius-xs stays 0 (cards/panels) — do not re-point */

  /* Nav chrome — nudge the Quiet Rail values onto exact Aligned tints */
  --nav-active-bg:  var(--c-azure-100);
  --nav-active-bar: var(--c-resolution-blue);
  --nav-avatar-bg:  var(--c-resolution-blue);
  --nav-fg:         var(--c-downriver);
  --nav-border:     var(--app-border);
}

/* ============================================================
   DARK MODE — every token above gets its dark twin here.
   Bases: navy-900 page, downriver surfaces, azure text/accents.
   ============================================================ */
html[data-theme="dark"], body[data-theme="dark"],
html.rq-dark, body.rq-dark {
  --app-bg:         var(--c-navy-900);
  --app-surface:    var(--c-downriver);
  --app-surface-2:  #16375F;
  --app-surface-3:  #1D426E;
  --app-text:       #F2F5F9;
  --app-text-2:     rgba(242, 245, 249, 0.65);
  --app-text-3:     rgba(242, 245, 249, 0.45);
  --app-border:     rgba(191, 205, 224, 0.16);
  --app-border-2:   rgba(191, 205, 224, 0.28);
  --app-divider:    rgba(191, 205, 224, 0.10);
  --app-input-bg:   #16375F;
  --app-input-bd:   rgba(191, 205, 224, 0.28);
  --app-row-hover:  rgba(128, 154, 194, 0.12);
  --app-row-stripe: rgba(128, 154, 194, 0.05);
  --app-info-bg:    rgba(128, 154, 194, 0.16);
  --app-info-fg:    var(--c-azure-400);
  --app-neutral-bg: rgba(255, 255, 255, 0.08);
  --app-neutral-fg: rgba(242, 245, 249, 0.65);
  --app-danger-bg:  rgba(213, 64, 58, 0.22);
  --app-danger-fg:  #F0A6A1;
  --app-success-bg: rgba(12, 110, 64, 0.26);
  --app-success-fg: #7FD1A6;
  --app-warning-bg: rgba(214, 158, 46, 0.20);
  --app-warning-fg: #F2C879;

  /* Bridge (dark): brighten the accent so ghost buttons / links read on navy. */
  --delmar-blue:  var(--c-azure-400);
  --bg:           var(--c-navy-900);
  --surface:      var(--c-downriver);
  --surface-2:    #16375F;
  --card:         var(--c-downriver);
  --line:         var(--app-border);
  --text:         var(--app-text);
  --muted:        var(--app-text-2);
  --border-color: var(--app-border);
  --info:         var(--c-azure-400);

  --nav-active-bg:  rgba(128, 154, 194, 0.15);
  --nav-active-bar: var(--c-azure-400);
  --nav-avatar-bg:  rgba(128, 154, 194, 0.22);
  --nav-fg:         #F2F5F9;
  --nav-border:     rgba(191, 205, 224, 0.16);
}
