/* =========================================================================
   ROSIE — Design tokens · the single source of truth (light + dark)
   =========================================================================
   Palette source: design_system/v2/colors_and_type.css + rosie-shell.css.

   THEMING MODEL
   -------------
   - LIGHT is the default, defined on :root.
   - DARK is applied via html[data-theme="dark"] and flips ONLY the neutral
     surface/text tokens; brand accents (cyan / teal / gold / KSA) are tuned
     per-theme for legibility but keep their identity.
   - The whole app re-themes from one attribute on <html>. The header/footer
     are intentionally navy in BOTH themes (see base.css / app-header).

   TOKEN LAYERS
   ------------
   1. BRAND palette  — the v2 names (--ink-*, --paper, --cyan-*, --teal-*,
      --gold-*, --ksa-*). The canonical values; reference these in new code.
   2. APP vocabulary — the names the existing components already use
      (--bg, --surface, --text, --teal, --blue, --red, --yellow, --shadow…).
      These are ALIASED onto the brand palette so the ~30 component files keep
      working unchanged, and flip automatically with the theme.

   The RTA HUD keeps its own --rta-* namespace (components/live-call/
   rta-theme.css); it already keys off [data-theme="dark"], so the global
   toggle drives it too.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,700;0,9..144,900;1,9..144,700;1,9..144,900&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* =========================================================================
   LIGHT (default)
   ========================================================================= */
:root {
  /* ---- 1. BRAND palette (v2 colors_and_type.css) ----------------------- */
  --ink-900:  #1A2E4A;   /* headings, navy sections */
  --ink-700:  #3D5068;   /* body text */
  --ink-500:  #6B7E93;   /* labels, captions */
  --ink-300:  #A8B4C2;   /* disabled, quiet dividers */

  --paper:    #F8F6F2;   /* page background — warm off-white */
  --paper-2:  #F1EEE7;   /* subtle band alt */
  --white:    #FFFFFF;   /* card / control surface */

  --cyan-600: #0891B2;   /* primary CTA / RTA */
  --cyan-500: #22B4D4;   /* hover */
  --cyan-050: #E8F7FB;   /* pale fill */

  --teal-600: #2A9D8F;   /* secondary — post-call / success */
  --teal-050: #EBF7F6;

  --gold-500: #FFA94D;   /* PGI accent */
  --gold-050: #FFE9D1;

  /* ---- 2. APP vocabulary (aliased to the light brand palette) ---------- */
  /* Surfaces */
  --bg:             var(--paper);          /* page base + contrast-on-accent */
  --app-nav:        #14233B;               /* global navy header (theme-fixed) */
  --app-nav-2:      #1F3350;               /* header hover / raised navy */
  --surface:        var(--white);          /* cards / panels */
  --surface-raised: #F4F1EC;               /* inset fields, toggle tracks, code */
  --surface-hover:  #FBFAF8;

  /* Borders (colour values — components do `1px solid var(--border)`) */
  --border:         rgba(26, 46, 74, 0.09);
  --border-emph:    rgba(26, 46, 74, 0.15);

  /* Text — ink ramp */
  --text:           var(--ink-900);
  --text-dim:       var(--ink-700);
  --text-muted:     var(--ink-500);
  --text-faint:     var(--ink-300);

  /* Teal — success / positive / agent / "go" */
  --teal:           #2A9D8F;
  --teal-dark:      #1F7A6F;
  --teal-soft:      #EBF7F6;
  --teal-border:    rgba(42, 157, 143, 0.32);
  --teal-glow:      rgba(42, 157, 143, 0.22);

  /* Accent / green aliases — keep accent == teal as a coherent interactive id */
  --accent:         var(--teal);
  --accent-dark:    var(--teal-dark);
  --accent-soft:    var(--teal-soft);
  --accent-border:  var(--teal-border);
  --accent-glow:    var(--teal-glow);
  --accent-light:   var(--teal-soft);
  --green:          var(--teal);
  --green-soft:     var(--teal-soft);

  /* Blue — knowledge / info / customer speaker */
  --blue:           #2C6FB0;
  --blue-dark:      #1A5276;
  --blue-soft:      #E8F1FB;
  --blue-border:    rgba(44, 111, 176, 0.28);

  /* Coral — high alert / danger */
  --red:            #E15A47;
  --red-dark:       #C7402E;
  --red-soft:       #FCEBE8;
  --red-border:     rgba(225, 90, 71, 0.30);

  /* Amber — warning / score (darkened to gold-open so it reads on paper) */
  --yellow:         #E0922B;
  --yellow-soft:    #FFE9D1;
  --yellow-border:  rgba(224, 146, 43, 0.32);

  /* KSA semantic (Knowledge / Skill / Attitude) — light fills */
  --ksa-k-bg: #D6EAF8; --ksa-k-text: #1A5276; --ksa-k-border: rgba(26, 82, 118, 0.28);
  --ksa-s-bg: #D5F5E3; --ksa-s-text: #1E8449; --ksa-s-border: rgba(30, 132, 73, 0.28);
  --ksa-a-bg: #FDEBD0; --ksa-a-text: #784212; --ksa-a-border: rgba(120, 66, 18, 0.28);

  /* ---- App shell metrics ----------------------------------------------
     Height of the fixed navy header. Declared here (not inline on
     .app-header) because the live-call layout sizes itself against the
     viewport minus this chrome — both must read the same number. */
  --app-header-h: 60px;

  /* ---- Radii (v2 scale: card 18 · chrome 12 · input 8) ----------------- */
  --radius:      18px;   /* cards / panels */
  --radius-sm:   12px;   /* chrome / inset blocks */
  --radius-xs:    8px;   /* inputs / fields / chips */
  --radius-pill: 100px;

  /* ---- Elevation — soft ink shadows ------------------------------------ */
  --shadow:    0 8px 26px rgba(26, 46, 74, 0.07);
  --shadow-sm: 0 2px 10px rgba(26, 46, 74, 0.05);

  /* ---- Scrollbars (v2 rosie-shell) ------------------------------------- */
  --rosie-thumb:       rgba(26, 46, 74, 0.20);
  --rosie-thumb-hover: var(--cyan-600);

  /* ---- Typography ------------------------------------------------------ */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body:    'DM Sans', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ---- Motion ---------------------------------------------------------- */
  --ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-micro:   120ms;
  --dur-comp:    240ms;
  --dur-page:    480ms;

  color-scheme: light;
}

/* =========================================================================
   DARK — flip the neutral surface/text tokens only.
   Values carried over from the original dark tokens.css; brand neutrals from
   v2 rosie-shell.css. Brand accents brighten slightly for dark legibility.
   ========================================================================= */
html[data-theme="dark"] {
  /* ---- Brand neutrals (rosie-shell dark) ------------------------------- */
  --ink-900:  #F4F6F9;
  --ink-700:  #C6D2E0;
  --ink-500:  #8EA0B6;
  --ink-300:  #56697F;
  --paper:    #0A0F1A;
  --paper-2:  #16263F;
  --white:    #13203A;

  /* ---- Surfaces -------------------------------------------------------- */
  --bg:             var(--paper);
  --surface:        var(--white);
  --surface-raised: rgba(255, 255, 255, 0.03);
  --surface-hover:  rgba(255, 255, 255, 0.05);

  /* ---- Borders --------------------------------------------------------- */
  --border:         rgba(255, 255, 255, 0.08);
  --border-emph:    rgba(255, 255, 255, 0.14);

  /* ---- Text ------------------------------------------------------------ */
  --text:           var(--ink-900);
  --text-dim:       var(--ink-700);
  --text-muted:     var(--ink-500);
  --text-faint:     #4D5F78;

  /* ---- Teal — brighter for dark surfaces ------------------------------- */
  --teal:           #3CC5B4;
  --teal-dark:      #2A9D8F;
  --teal-soft:      rgba(60, 165, 154, 0.14);
  --teal-border:    rgba(60, 165, 154, 0.38);
  --teal-glow:      rgba(60, 165, 154, 0.35);

  /* ---- Blue ------------------------------------------------------------ */
  --blue:           #6FB1F0;
  --blue-dark:      #4A90E2;
  --blue-soft:      rgba(74, 144, 226, 0.16);
  --blue-border:    rgba(74, 144, 226, 0.32);

  /* ---- Coral ----------------------------------------------------------- */
  --red:            #F97560;
  --red-dark:       #E06050;
  --red-soft:       rgba(249, 117, 96, 0.14);
  --red-border:     rgba(249, 117, 96, 0.38);

  /* ---- Amber — fill-bright on dark ------------------------------------- */
  --yellow:         #FFA94D;
  --yellow-soft:    rgba(255, 169, 77, 0.12);
  --yellow-border:  rgba(255, 169, 77, 0.32);

  /* ---- Brand accents on dark — brighten the line/text colours for
     legibility and turn the pale -050 fills translucent so chips, badges and
     section highlights sit IN the dark surface instead of glowing as light
     pills. (Brand identity preserved; just dark-appropriate.) */
  --cyan-600: #22B4D4;  --cyan-050: rgba(34, 180, 212, 0.14);
  --teal-600: #34B3A2;  --teal-050: rgba(60, 197, 180, 0.14);
  --gold-500: #FFC078;  --gold-050: rgba(255, 169, 77, 0.16);

  /* ---- KSA — dark fills ------------------------------------------------ */
  --ksa-k-bg: rgba(74, 144, 226, 0.16); --ksa-k-text: #7FB3F2; --ksa-k-border: rgba(74, 144, 226, 0.32);
  --ksa-s-bg: rgba(60, 165, 154, 0.16); --ksa-s-text: #3CC5B4; --ksa-s-border: rgba(60, 165, 154, 0.32);
  --ksa-a-bg: rgba(255, 169, 77, 0.16); --ksa-a-text: #FFA94D; --ksa-a-border: rgba(255, 169, 77, 0.32);

  /* ---- Elevation — heavier on dark ------------------------------------- */
  --shadow:    0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);

  /* ---- Scrollbars ------------------------------------------------------ */
  --rosie-thumb:       rgba(255, 255, 255, 0.16);
  --rosie-thumb-hover: var(--cyan-500);

  color-scheme: dark;
}
