/* =============================================================================
   Trove Tools — Design Tokens  v2.1.0-preview
   v2.1.0: --scrim, --drawer-w, --z-drawer (nav drawer)
   Formalized from the "Trove Monday Huddle" visual language.

   Theme resolution (highest wins):
     1. <html data-theme="dark|light">   manual override
     2. prefers-color-scheme: dark        OS setting
     3. :root                             light (default)

   Rule: components.css and app CSS reference these variables only.
   No raw hex values anywhere outside this file.
   ========================================================================== */

:root,
[data-theme="light"] {
  color-scheme: light;

  /* ---- Brand (fixed in every theme) ------------------------------------- */
  --navy:   #000E24;
  --navy-2: #0D2140;
  --navy-3: #1A3156;
  --gold:   #C49F4F;
  --gold-2: #D9BC7C;
  --pearl:  #F1F2F2;

  /* ---- Surfaces ---------------------------------------------------------- */
  --bg:    #F3F4F7;
  --card:  #FFFFFF;
  --input: #FFFFFF;

  /* ---- Text -------------------------------------------------------------- */
  --ink:      #0E1A2E;   /* body text                         */
  --muted:    #5F6B7C;   /* labels, hints, secondary text     */
  --head:     #000E24;   /* headings                          */
  --gold-ink: #8A6A26;   /* gold as TEXT (eyebrows, links)    */

  /* ---- Lines ------------------------------------------------------------- */
  --line:   #DFE3EA;     /* borders                           */
  --line-2: #EEF1F5;     /* row dividers, subtle fills        */

  /* ---- Status: fg / bg --------------------------------------------------- */
  --red:      #B4362F;  --red-bg:   #FBEAEA;   /* act now, stuck, error   */
  --amber:    #8F6210;  --amber-bg: #FBF3E2;   /* watch, waiting, saving  */
  --green:    #1F7A4D;  --green-bg: #E5F4EC;   /* ok, done, saved, +delta */
  --blue:     #1F4E8C;  --blue-bg:  #E7EEF8;   /* info, default project   */

  /* ---- Role aliases (semantic → raw) ------------------------------------ */
  --focus-ring:  var(--gold);
  --focus-halo:  0 0 0 6px var(--navy);  /* light only: navy behind + around the 2px gold ring (gap + 2px outer halo) so the indicator passes 3:1 on light surfaces */
  --accent:      var(--gold);
  --select-bg:   var(--blue-bg);   /* selected rows, soft highlights (not a gold tint: it would read as amber "watch") */
  --bar-fill:    var(--gold-ink); /* progress bars, meters, sparklines: bronze in light (gold alone is 2.2:1 on the track), gold in dark */
  --on-navy:     var(--pearl);
  --primary-bg:  var(--navy);     /* .btn-primary fill  */
  --primary-fg:  var(--pearl);
  --active-bg:   var(--navy);     /* segmented / filter active */
  --active-fg:   var(--pearl);
  --toast-bg:    var(--navy);
  --toast-fg:    var(--pearl);

  /* ---- Typography -------------------------------------------------------- */
  --font-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono:    ui-monospace, "Cascadia Code", Consolas, monospace;

  --fs-body:   14.5px;  --lh-body: 1.5;
  --fs-h1:     24px;
  --fs-h2:     17px;
  --fs-h3:     14.5px;
  --fs-tab:    13px;
  --fs-sub:    13.5px;  /* sub-heads, secondary paragraphs */
  --fs-hint:   12.5px;  /* hints, notes                    */
  --fs-label:  10.5px;  /* uppercase labels                */
  --fs-eyebrow: 11px;   /* uppercase eyebrows              */
  --fs-stat:   22px;
  --fs-stat-big: 28px;
  --fs-tagline: 9.5px;

  --track-label:   0.9px;
  --track-eyebrow: 1.6px;
  --track-tagline: 2.4px;
  --track-wordmark: 6px;

  /* ---- Spacing rhythm ---------------------------------------------------- */
  --sp-1: 4px;
  --sp-2: 6px;
  --sp-3: 8px;
  --sp-4: 10px;
  --sp-5: 12px;
  --sp-6: 14px;
  --sp-7: 16px;
  --sp-8: 22px;
  --sp-9: 28px;

  --gap-section: var(--sp-9);   /* 28 */
  --pad-card:    var(--sp-7);   /* 16 */
  --gap-grid:    var(--sp-4);   /* 10 */

  /* ---- Layout ------------------------------------------------------------ */
  --content-max: 1180px;
  --drawer-w:    min(320px, 86vw);
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
  --safe-b:   env(safe-area-inset-bottom, 0px);

  /* ---- Radius ------------------------------------------------------------ */
  --r-tab:  6px;
  --r-btn:  7px;   /* buttons + inputs */
  --r-tile: 8px;
  --r-card: 10px;
  --r-pill: 20px;  /* pills + chips    */

  /* ---- Borders ----------------------------------------------------------- */
  --bw-rule:   2px;  /* brand bar bottom, focus, timeline rail */
  --bw-tile:   3px;  /* stat tile top, recap left              */
  --bw-status: 4px;  /* project card left                      */

  /* ---- Elevation --------------------------------------------------------- */
  --shadow:     0 1px 2px rgba(0, 14, 36, .06);
  --shadow-pop: 0 6px 20px rgba(0, 14, 36, .18);
  --shadow-drawer: -8px 0 28px rgba(0, 14, 36, .28);
  --scrim:      rgba(0, 14, 36, .55);   /* behind the nav drawer */

  /* ---- Motion (applied only under prefers-reduced-motion: no-preference) - */
  --dur-fast: .15s;
  --ease:     ease;

  /* ---- Layers ------------------------------------------------------------ */
  --z-bar:   50;
  --z-pop:   80;
  --z-drawer: 90;
  --z-toast: 100;
}

/* ---- Dark values (shared by the OS query and the manual override) ------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #050F21;  --card: #0B1A33;  --input: #08152B;
    --ink: #E7EAF0; --muted: #9AA6B8; --head: #F1F2F2; --gold-ink: #D9BC7C;
    --line: #1E3254; --line-2: #132643;
    --red: #F08A80;   --red-bg: #3A1618;
    --amber: #E8BE6A; --amber-bg: #33270F;
    --green: #6FCF9C; --green-bg: #0F2E21;
    --blue: #8DB4EA;  --blue-bg: #13284A;
    --shadow: none;
    --focus-halo: none;
    --primary-bg: var(--gold); --primary-fg: var(--navy);
    --active-bg:  var(--gold); --active-fg:  var(--navy);
    --bar-fill:   var(--gold);
  }
}

:root[data-theme="dark"],
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050F21;  --card: #0B1A33;  --input: #08152B;
  --ink: #E7EAF0; --muted: #9AA6B8; --head: #F1F2F2; --gold-ink: #D9BC7C;
  --line: #1E3254; --line-2: #132643;
  --red: #F08A80;   --red-bg: #3A1618;
  --amber: #E8BE6A; --amber-bg: #33270F;
  --green: #6FCF9C; --green-bg: #0F2E21;
  --blue: #8DB4EA;  --blue-bg: #13284A;
  --shadow: none;
  --focus-halo: none;
  --primary-bg: var(--gold); --primary-fg: var(--navy);
  --active-bg:  var(--gold); --active-fg:  var(--navy);
  --bar-fill:   var(--gold);
}

/* Scoping: [data-theme] also works on any element (a panel, a preview, an
   email-style block). Light values live on [data-theme="light"] too, so a light
   island inside a dark page resolves correctly. Give the scoped element
   background: var(--bg) and color: var(--ink) so it repaints. */
