/* tokens.css — foundation-ui platform design tokens (the shared floor).
 *
 * These are the GENERIC app-shell tokens: palette, semantic mapping, layout
 * dimensions, typography, radii/shadows/motion. Dark is the default (:root);
 * light comes from themes.css [data-theme="light"].
 *
 * CONTRACT (see docs/theming.md):
 *   - A consumer RE-SKINS by overriding these token VALUES in its own stylesheet
 *     loaded AFTER this file — never by redeclaring the shell's .fui-* selectors.
 *   - App-specific tokens (marker pills, badge kinds, dependency-graph hues,
 *     datagrid --dg-* aliases) are NOT here — they live in the consumer's own
 *     override stylesheet. foundation-ui owns only the shell floor.
 *   - No raw #hex / rgb() outside this file + themes.css (A1/A3 platform rule).
 */

:root {
  /* ── Catppuccin Mocha palette (dark default) ── */
  --base:     #1e1e2e;
  --mantle:   #181825;
  --crust:    #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --overlay2: #9399b2;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --text:     #cdd6f4;

  --rosewater: #f5e0dc;
  --flamingo:  #f2cdcd;
  --pink:      #f5c2e7;
  --mauve:     #cba6f7;
  --red:       #f38ba8;
  --maroon:    #eba0ac;
  --peach:     #fab387;
  --yellow:    #f9e2af;
  --green:     #a6e3a1;
  --teal:      #94e2d5;
  --sky:       #89dceb;
  --sapphire:  #74c7ec;
  --blue:      #89b4fa;
  --lavender:  #b4befe;

  /* ── Semantic mapping (shell chrome reads only these, never raw palette) ── */
  --bg:            var(--base);
  --bg-alt:        var(--mantle);
  --bg-card:       var(--surface0);
  --bg-card-hover: var(--surface1);
  --bg-hover:      var(--surface0); /* header/menu hover surface (shell chrome) */
  --bg-input:      var(--mantle);

  --fg:        var(--text);
  --fg-muted:  var(--overlay1);
  --fg-subtle: var(--subtext0);

  --border:        var(--surface1);
  --border-strong: var(--surface2);

  --accent:    var(--blue);
  --accent-fg: var(--base);
  --success:   var(--green);
  --warning:   var(--yellow);
  --danger:    var(--red);
  --info:      var(--sky);

  /* RGB triplets — for rgba(var(--X-rgb), opacity) tints. CSS cannot derive
   * rgb from a #hex var, so every tinted surface declares its triplet. */
  --accent-rgb:   137, 180, 250;
  --success-rgb:  166, 227, 161;
  --warning-rgb:  249, 226, 175;
  --danger-rgb:   243, 139, 168;
  --info-rgb:     137, 220, 235;
  --fg-muted-rgb: 127, 132, 156;
  --fg-rgb:       205, 214, 244;

  /* ── Layout dimensions (shell geometry) ── */
  --header-h:       56px;
  --footer-h:       32px;
  --sidebar-w:      260px;
  --sidebar-w-mini: 64px;
  --chat-panel-w:   320px;
  --ctx-panel-w:    300px;
  --content-pad:    20px;

  /* ── Typography ── */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --fs-xs:  11px;
  --fs-sm:  12px;
  --fs-md:  14px;
  --fs-lg:  16px;
  --fs-xl:  20px;
  --fs-2xl: 28px;
  --lh:     1.5;

  /* ── Radii ── */
  --r-xs:   4px;
  --r-sm:   4px;
  --r-md:   6px;
  --r-lg:   10px;
  --r-pill: 999px;

  /* ── Shadows / scrim (black-with-opacity is universal; tokenized so the
   *    "no raw rgb() literals" rule holds) ── */
  --shadow-rgb: 0, 0, 0;
  --crust-rgb:  0, 0, 0;
  --shadow-sm: 0 1px 2px  rgba(var(--shadow-rgb), 0.30);
  --shadow-md: 0 4px 12px rgba(var(--shadow-rgb), 0.35);
  --shadow-lg: 0 12px 32px rgba(var(--shadow-rgb), 0.45);


  /* ── Data-visualisation categorical ramp (--viz-cat-N) ───────────────────
   * DELIBERATELY NOT the UI palette. The Catppuccin hues above are chosen to
   * sit quietly behind text; as chart series they fail colourblind separation
   * badly — measured on this very surface, eight of them come out at ΔE 4.1
   * for NORMAL vision, i.e. nobody can tell them apart. A chart palette has a
   * different job and gets its own ramp.
   *
   * These eight are validated (OKLab ΔE, protan/deutan/tritan simulated) against
   * this surface: worst adjacent CVD ΔE 8.4, worst adjacent normal-vision 19.3,
   * all ≥3:1 contrast. Order is FIXED — assign slots in sequence, never cycle,
   * and never generate a 9th hue: fold to "Other" or facet.
   *
   * CAP FOR SIMULTANEOUS MARKS: adjacent-pair safety (stacked bars, treemap
   * blocks) holds for all eight. Where every pair can touch — a graph, a
   * scatter, a bubble chart — only the FIRST THREE clear the floors; the
   * fourth puts yellow next to orange (ΔE 4.8 deutan). Past three on such a
   * surface, fold or facet. */
  --viz-cat-1: #3987e5; /* blue    */
  --viz-cat-2: #d95926; /* orange  */
  --viz-cat-3: #199e70; /* aqua    */
  --viz-cat-4: #c98500; /* yellow  */
  --viz-cat-5: #d55181; /* magenta */
  --viz-cat-6: #008300; /* green   */
  --viz-cat-7: #9085e9; /* violet  */
  --viz-cat-8: #e66767; /* red     */
  --viz-other: var(--fg-subtle); /* the 9th+ series, and anything past the cap */

  /* Ink for a label sitting ON a categorical fill (all eight are mid-lightness,
   * so one ink works for the whole ramp rather than per-slot guesswork). */
  --viz-on-cat: #ffffff;

  /* ── Motion ── */
  --t-fast: 120ms ease;
  --t-med:  200ms ease;
}
