/*
 * Vector-First Design Standard v1.0 — Design tokens.
 * Source of truth: Marketing/Website/Vector-First-Design-Standard.html.
 * Light + dark themes mandatory; no per-org color customization
 * (per DEC-2026-04-27-009).
 */

:root {
  /* Type stack — bRRAIn brand fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Monaco, monospace;

  /* Spacing scale — 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96 / 128 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Type scale */
  --fs-xs: 0.75rem;     /* 12px — captions, footnotes */
  --fs-sm: 0.875rem;    /* 14px — secondary text, labels */
  --fs-base: 1rem;      /* 16px — body */
  --fs-md: 1.125rem;    /* 18px — emphasized body */
  --fs-lg: 1.25rem;     /* 20px — section heading */
  --fs-xl: 1.5rem;      /* 24px — small display */
  --fs-2xl: 2rem;       /* 32px — display */
  --fs-3xl: 3rem;       /* 48px — large display */
  --fs-4xl: 4.5rem;     /* 72px — hero */

  /* Line heights */
  --lh-tight: 1.1;
  --lh-base: 1.6;
  --lh-comfortable: 1.7;

  /* Letter spacing */
  --ls-tight: -0.04em;
  --ls-base: 0;
  --ls-wide: 0.05em;
  --ls-eyebrow: 0.14em;

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* Border alphas — neutral palette only (color customization forbidden) */
  --border-strong: 0.20;
  --border-base: 0.10;
  --border-soft: 0.08;

  /* Surface alphas */
  --surface-raised: 0.02;
  --surface-glass: 0.80;

  /* Text alphas (used with currentColor + opacity recipes) */
  --text-primary: 1;
  --text-secondary: 0.55;
  --text-muted: 0.32;

  /* State colors — limited semantic palette per Vector-First.
     These are status pills only; chrome is strict black/white. */
  --status-ok: #4ade80;     /* green-400 */
  --status-warn: #fbbf24;   /* amber-400 */
  --status-alert: #f87171;  /* red-400 */
  --status-info: #60a5fa;   /* blue-400 */

  /* Motion */
  --easing: cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --motion-fast: 0.15s var(--easing);
  --motion-base: 0.2s var(--easing);
  --motion-slow: 0.4s var(--easing);

  /* Layout — content widths */
  --width-content: 1200px;
  --width-form: 480px;
  --width-prose: 720px;

  /* z-index ladder */
  --z-base: 1;
  --z-sticky: 10;
  --z-overlay: 100;
  --z-modal: 1000;
  --z-toast: 10000;
}

/* The Vector-First design has only two surfaces: pure black (#000)
   on dark and pure white (#fff) on light. Everything else is alphas
   over those two. These two tokens are the *only* color literals the
   SDK exposes; consumers must not redefine them. */
:root {
  --bg-dark: #000000;
  --fg-dark: #ffffff;
  --bg-light: #ffffff;
  --fg-light: rgba(0, 0, 0, 0.90);
}

/* ============================================================
   bRRAIn brand tokens — extension layer
   Source of truth: ai-memory/projects/bRRAIn_AI_Training/assets/
   design-system/{BRAND.md,tokens.css,CLAUDE.md}.

   Per the design-system hand-off CLAUDE.md these tokens win for
   console + marketplace. They are additive on top of the existing
   Vector-First tokens above so existing components keep working
   while new UI work uses the richer naming.
   ============================================================ */
:root {
  /* ---- Canvas / Surfaces ---- */
  --bg-canvas:    #000000;
  --bg-surface:   rgba(255, 255, 255, 0.03);
  --bg-elevated:  rgba(255, 255, 255, 0.06);
  --bg-input:     rgba(255, 255, 255, 0.03);
  --bg-overlay:   rgba(0, 0, 0, 0.80);

  /* ---- Foreground (opacity-driven) ---- */
  --fg1: rgba(255, 255, 255, 1.00);
  --fg2: rgba(255, 255, 255, 0.85);
  --fg3: rgba(255, 255, 255, 0.55);
  --fg4: rgba(255, 255, 255, 0.32);
  --fg5: rgba(255, 255, 255, 0.18);

  /* ---- Borders ---- */
  --border-subtle:  rgba(255, 255, 255, 0.10);
  --border-default: rgba(255, 255, 255, 0.25);
  --border-strong-bw: rgba(255, 255, 255, 0.60);

  /* ---- Brand cyan (the system signature — charts, backdrop, neural pulses) ---- */
  --brand-cyan:        #00ebff;
  --brand-cyan-soft:   rgba(0, 235, 255, 0.10);
  --brand-cyan-border: rgba(0, 235, 255, 0.25);

  /* ---- Primary accent (CTAs, active nav, workspace pill) ----
     Per BRAND.md §"One accent: #00ebff (neural cyan)" the system has a
     single accent — neural cyan. The violet seen in Screens.html is the
     `accentId: "violet"` tweaks-panel default, NOT a brand decision.
     Aliases --brand-cyan above so chart-stroke / backdrop / CTA all read
     as one signature. */
  --accent:           #00ebff;
  --accent-soft:      rgba(0, 235, 255, 0.12);
  --accent-border:    rgba(0, 235, 255, 0.35);
  --accent-border-hi: rgba(0, 235, 255, 0.60);

  --success: #4ade80;
  --warning: #fbbf24;
  --danger:  #ef4444;
  --info:    #60a5fa;

  /* ---- KPI per-tile accent palette ----
     The Console Overview KPI strip carries six discrete tile accents
     (one per tile). Drawn from the operator-screen reference. */
  --kpi-violet:  #a78bfa;
  --kpi-amber:   #fbbf24;
  --kpi-cyan:    #00ebff;
  --kpi-lime:    #a3e635;
  --kpi-magenta: #ec4899;
  --kpi-green:   #4ade80;

  /* ---- Type scale (px) ---- */
  --t-display: 72px;
  --t-h1:      48px;
  --t-h2:      32px;
  --t-h3:      24px;
  --t-lead:    20px;
  --t-body:    16px;
  --t-small:   14px;
  --t-label:   13px;
  --t-caption: 12px;
  --t-micro:   11px;

  /* ---- Letter spacing ---- */
  --tracking-tight:  -0.04em;
  --tracking-snug:   -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.14em;

  /* ---- Line height ---- */
  --lh-tight:   1.1;
  --lh-snug:    1.4;
  --lh-normal:  1.6;
  --lh-relaxed: 1.8;

  /* ---- Spacing (4-pt) ---- */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-7:  48px;
  --sp-8:  64px;
  --sp-9:  80px;
  --sp-10: 120px;

  /* ---- Radii (small; vector / hard-edged) ---- */
  --r-xs:   2px;
  --r-sm:   4px;
  --r-md:   8px;
  --r-pill: 9999px;
  --r-app:  8px;

  /* ---- Inset / structural shadows ---- */
  --shadow-focus-cyan:    inset 0 0 0 2px rgba(0, 235, 255, 0.10);
  --shadow-focus-ring:    0 0 0 2px rgba(0, 235, 255, 0.35);
  --shadow-card-hover:    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  --shadow-glow-card:     inset 0 0 0 1px rgba(0, 235, 255, 0.25),
                          0 0 32px -8px rgba(0, 235, 255, 0.20);

  /* ---- Backdrop blurs ---- */
  --blur-nav:   blur(16px);
  --blur-modal: blur(24px);

  /* ---- Brain backdrop (Cortex shell) ----
     Two stacked radial washes that breathe behind app-shell content,
     plus a vignette. See .brain-backdrop in brand.css. */
  --brain-glow-inner: radial-gradient(ellipse 60% 55% at 50% 52%, rgba(0, 235, 255, 0.18) 0%, transparent 60%);
  --brain-glow-outer: radial-gradient(ellipse 80% 70% at 50% 60%, rgba(0, 235, 255, 0.06) 0%, transparent 70%);
  --brain-vignette:   radial-gradient(ellipse 100% 100% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);

  /* ---- Motion (alongside existing --motion-* tokens) ---- */
  --ease-out:    cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
  --dur-instant: 100ms;
  --dur-fast:    200ms;
  --dur-med:     300ms;
  --dur-slow:    500ms;
}

/* Light mode — recolour foreground hierarchy + canvas + brain wash. */
html[data-theme="light"] {
  --bg-canvas:    #ffffff;
  --bg-surface:   rgba(0, 0, 0, 0.02);
  --bg-elevated:  rgba(0, 0, 0, 0.05);
  --bg-input:     rgba(0, 0, 0, 0.03);
  --bg-overlay:   rgba(255, 255, 255, 0.95);

  --fg1: rgba(0, 0, 0, 0.90);
  --fg2: rgba(0, 0, 0, 0.85);
  --fg3: rgba(0, 0, 0, 0.55);
  --fg4: rgba(0, 0, 0, 0.32);
  --fg5: rgba(0, 0, 0, 0.18);

  --border-subtle:    rgba(0, 0, 0, 0.10);
  --border-default:   rgba(0, 0, 0, 0.25);
  --border-strong-bw: rgba(0, 0, 0, 0.60);

  --brain-glow-inner: radial-gradient(ellipse 60% 55% at 50% 52%, rgba(0, 235, 255, 0.10) 0%, transparent 60%);
  --brain-glow-outer: radial-gradient(ellipse 80% 70% at 50% 60%, rgba(0, 235, 255, 0.04) 0%, transparent 70%);
  --brain-vignette:   radial-gradient(ellipse 100% 100% at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.10) 100%);
}

/* ============================================================
   Style layer — vector, glass, paper, civic (SIDI-E23-S09)

   Four styles for a surface, each a full set of token values for the
   light and the dark theme. A consumer picks one with
   html[data-look="..."] and maps these onto the base tokens; Sidi's
   mapping is apps/sidi/web/styles/themes.css, which holds var() only.
   The colour recipes live here, because a recipe that needs
   color-mix() or a literal cannot sit in an app that lints for both.

   Every value derives from two flips (--sty-ground, --sty-ink) and the
   existing brand tokens, so one recipe serves both themes. The only
   literals are the light-theme text colours below: the design system's
   --accent is 1.31:1 on white and the status colours are 1.5-2:1, so
   they cannot be text on a light canvas. Each is at least 4.5:1 on the
   canvas and the raised surface of every style (tested in
   apps/sidi/tools/webtest/styles_browser_test.go).
   ============================================================ */
:root {
  --sty-ground: var(--bg-dark);
  --sty-ink:    var(--fg-dark);

  /* Text colours: on a dark canvas the brand colours are bright enough. */
  --sty-signal:       var(--brand-cyan);
  --sty-success-text: var(--success);
  --sty-warning-text: var(--warning);
  --sty-danger-text:  var(--status-alert);
  --sty-info-text:    var(--info);

  /* How much ink the faint text keeps, per style. The pastel and natural palettes raise it: their
     raised surfaces are darker than a white one, and the faint text must stay 4.5:1 on them. */
  --sty-vector-fg3-pct: 62%;
  --sty-glass-fg3-pct:  66%;
  --sty-paper-fg3-pct:  64%;
  --sty-civic-fg3-pct:  70%;

  /* vector: the base. Pure ground, neutral alphas, hard edges. */
  --sty-vector-canvas:      var(--sty-ground);
  --sty-vector-surface:     color-mix(in srgb, var(--sty-ink) 3%, transparent);
  --sty-vector-elevated:    color-mix(in srgb, var(--sty-ink) 6%, transparent);
  --sty-vector-input:       color-mix(in srgb, var(--sty-ink) 3%, transparent);
  --sty-vector-border:      color-mix(in srgb, var(--sty-ink) 10%, transparent);
  --sty-vector-border-def:  color-mix(in srgb, var(--sty-ink) 25%, transparent);
  --sty-vector-border-hi:   color-mix(in srgb, var(--sty-ink) 60%, transparent);
  --sty-vector-fg1:         color-mix(in srgb, var(--sty-ink) 95%, transparent);
  --sty-vector-fg2:         color-mix(in srgb, var(--sty-ink) 85%, transparent);
  --sty-vector-fg3:         color-mix(in srgb, var(--sty-ink) var(--sty-vector-fg3-pct), transparent);
  --sty-vector-accent:      var(--sty-signal);
  --sty-vector-radius-sm:   2px;
  --sty-vector-radius-md:   4px;
  --sty-vector-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sty-vector-heading-weight: 600;
  --sty-vector-heading-tracking: var(--tracking-snug);
  --sty-vector-blur:        none;

  /* glass: a cyan wash over the ground, translucent surfaces, rounded, blurred. */
  --sty-glass-canvas:       color-mix(in srgb, var(--sty-ground) 92%, var(--brand-cyan));
  --sty-glass-surface:      color-mix(in srgb, var(--sty-ink) 6%, transparent);
  --sty-glass-elevated:     color-mix(in srgb, var(--sty-ink) 10%, transparent);
  --sty-glass-input:        color-mix(in srgb, var(--sty-ink) 8%, transparent);
  --sty-glass-border:       color-mix(in srgb, var(--sty-signal) 30%, transparent);
  --sty-glass-border-def:   color-mix(in srgb, var(--sty-signal) 50%, transparent);
  --sty-glass-border-hi:    color-mix(in srgb, var(--sty-ink) 60%, transparent);
  --sty-glass-fg1:          var(--sty-ink);
  --sty-glass-fg2:          color-mix(in srgb, var(--sty-ink) 88%, transparent);
  --sty-glass-fg3:          color-mix(in srgb, var(--sty-ink) var(--sty-glass-fg3-pct), transparent);
  --sty-glass-accent:       var(--sty-signal);
  --sty-glass-radius-sm:    8px;
  --sty-glass-radius-md:    16px;
  --sty-glass-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sty-glass-heading-weight: 500;
  --sty-glass-heading-tracking: var(--tracking-normal);
  --sty-glass-blur:         var(--blur-nav);

  /* paper: a warm ground, serif, soft edges, ink that is warm too. */
  --sty-paper-canvas:       color-mix(in srgb, var(--sty-ground) 92%, var(--kpi-amber));
  --sty-paper-surface:      color-mix(in srgb, var(--kpi-amber) 5%, transparent);
  --sty-paper-elevated:     color-mix(in srgb, var(--sty-ink) 7%, transparent);
  --sty-paper-input:        color-mix(in srgb, var(--sty-ink) 3%, transparent);
  --sty-paper-border:       color-mix(in srgb, var(--sty-ink) 14%, var(--kpi-amber) 8%);
  --sty-paper-border-def:   color-mix(in srgb, var(--sty-ink) 30%, var(--kpi-amber) 10%);
  --sty-paper-border-hi:    color-mix(in srgb, var(--sty-ink) 62%, transparent);
  --sty-paper-fg1:          color-mix(in srgb, var(--sty-ink) 92%, var(--kpi-amber));
  --sty-paper-fg2:          color-mix(in srgb, var(--sty-ink) 82%, var(--kpi-amber));
  --sty-paper-fg3:          color-mix(in srgb, var(--sty-ink) var(--sty-paper-fg3-pct), transparent);
  --sty-paper-accent:       color-mix(in srgb, var(--kpi-amber) 50%, var(--sty-ink));
  --sty-paper-radius-sm:    2px;
  --sty-paper-radius-md:    3px;
  --sty-paper-font:         var(--font-serif);
  --sty-paper-heading-weight: 600;
  --sty-paper-heading-tracking: var(--tracking-normal);
  --sty-paper-blur:         none;

  /* civic: a cool official ground, firm borders, strong headings. */
  --sty-civic-canvas:       color-mix(in srgb, var(--sty-ground) 95%, var(--info));
  --sty-civic-surface:      color-mix(in srgb, var(--info) 5%, transparent);
  --sty-civic-elevated:     color-mix(in srgb, var(--sty-ink) 8%, transparent);
  --sty-civic-input:        color-mix(in srgb, var(--sty-ink) 4%, transparent);
  --sty-civic-border:       color-mix(in srgb, var(--sty-ink) 22%, transparent);
  --sty-civic-border-def:   color-mix(in srgb, var(--sty-ink) 45%, transparent);
  --sty-civic-border-hi:    color-mix(in srgb, var(--sty-ink) 70%, transparent);
  --sty-civic-fg1:          color-mix(in srgb, var(--sty-ink) 98%, transparent);
  --sty-civic-fg2:          color-mix(in srgb, var(--sty-ink) 90%, transparent);
  --sty-civic-fg3:          color-mix(in srgb, var(--sty-ink) var(--sty-civic-fg3-pct), transparent);
  --sty-civic-accent:       color-mix(in srgb, var(--info) 60%, var(--sty-ink));
  --sty-civic-radius-sm:    4px;
  --sty-civic-radius-md:    6px;
  --sty-civic-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sty-civic-heading-weight: 700;
  --sty-civic-heading-tracking: var(--tracking-normal);
  --sty-civic-blur:         none;
}

html[data-theme="light"] {
  --sty-ground: var(--bg-light);
  --sty-ink:    var(--bg-dark);

  --sty-signal:       #00657a;
  --sty-success-text: #0b6b3a;
  --sty-warning-text: #8a5a00;
  --sty-danger-text:  #b3261e;
  --sty-info-text:    #1a56b0;
}

/* ============================================================
   Palettes and accents (SIDI-E23-S06)

   Pastel and natural are light grounds of their own: they ride
   html[data-theme="light"] and add html[data-palette]. They change the
   two flips every style derives from, and the light text colours, so
   each stays at least 4.5:1 on the canvas and the raised surfaces of
   every style. The accent is html[data-accent]: five colours, each in
   two forms, because the brand accent is 1.31:1 on a light ground and
   no text can take it. --sty-signal is the one a style reads.
   Contrast of every style x theme x accent is tested in
   apps/sidi/tools/webtest/appearance_browser_test.go.
   ============================================================ */
:root {
  --sty-acc-cyan:   var(--brand-cyan);
  --sty-acc-violet: #a78bfa;
  --sty-acc-amber:  #fbbf24;
  --sty-acc-lime:   #a3e635;
  --sty-acc-red:    #ff6b6b;
}

html[data-theme="light"] {
  --sty-acc-cyan:   #00657a;
  --sty-acc-violet: #5b34c9;
  --sty-acc-amber:  #7a4a00;
  --sty-acc-lime:   #3d6b00;
  --sty-acc-red:    #b3261e;
}

html[data-theme="light"][data-palette="pastel"],
html[data-theme="light"][data-palette="natural"] {
  --sty-vector-fg3-pct: 82%;
  --sty-glass-fg3-pct:  84%;
  --sty-paper-fg3-pct:  82%;
  --sty-civic-fg3-pct:  84%;

  --sty-success-text: #14502a;
  --sty-warning-text: #6a4000;
  --sty-danger-text:  #8f1d17;
  --sty-info-text:    #123f78;

  --sty-acc-cyan:   #004f60;
  --sty-acc-violet: #4a2aa8;
  --sty-acc-amber:  #664000;
  --sty-acc-lime:   #2f5000;
  --sty-acc-red:    #8f1d17;
}

html[data-theme="light"][data-palette="pastel"] {
  --sty-ground: #f0e8fb;
  --sty-ink:    #1c1230;
}

html[data-theme="light"][data-palette="natural"] {
  --sty-ground: #eadfcc;
  --sty-ink:    #1c1208;
}

html[data-accent="cyan"]   { --sty-signal: var(--sty-acc-cyan); }
html[data-accent="violet"] { --sty-signal: var(--sty-acc-violet); }
html[data-accent="amber"]  { --sty-signal: var(--sty-acc-amber); }
html[data-accent="lime"]   { --sty-signal: var(--sty-acc-lime); }
html[data-accent="red"]    { --sty-signal: var(--sty-acc-red); }
