/* Colors — Stellar Surface
   ────────────────────────────────────────────────────────────────────────
   THE SEMANTIC ALLOWLIST. Generated UI may ONLY use these roles:
     • primary  — blue. Actions, navigation, selection, general data viz.
     • surface  — zinc. Structure: backgrounds, borders, muted text.
     • text     — text color tiers (mapped onto surface shades).
     • severity — RESERVED warm colors. Express severity ONLY. Never chrome,
                  never data viz, never categorical tags.

   FORBIDDEN: every dormant ramp (cyan, fuchsia, gray, indigo, lime, neutral,
   pink, purple, rose, sky, slate, stone, teal, violet, yellow). There is NO
   categorical "accent" role yet — categorical tags use primary, not violet.
   ──────────────────────────────────────────────────────────────────────── */

:root {
  /* ── Primary (blue) ─────────────────────────────────────────── */
  --p-primary-50:  #eff6ff;
  --p-primary-100: #dbeafe;
  --p-primary-200: #bfdbfe;
  --p-primary-300: #93c5fd;
  --p-primary-400: #60a5fa;
  --p-primary-500: #3b82f6;
  --p-primary-600: #2563eb;
  --p-primary-700: #1d4ed8;
  --p-primary-800: #1e40af;
  --p-primary-900: #1e3a8a;
  --p-primary-950: #172554;

  /* ── Surface (zinc) ─────────────────────────────────────────── */
  --p-surface-0:   #ffffff;
  --p-surface-50:  #fafafa;
  --p-surface-100: #f4f4f5;
  --p-surface-200: #e4e4e7;
  --p-surface-300: #d4d4d8;
  --p-surface-400: #a1a1aa;
  --p-surface-500: #71717a;
  --p-surface-600: #52525b;
  --p-surface-700: #3f3f46;
  --p-surface-800: #27272a;
  --p-surface-900: #18181b;
  --p-surface-950: #09090b;

  /* Plain surface aliases — many components/cards reference --surface-N directly
     (without the p- prefix). Map them so those references resolve. */
  --surface-0:   var(--p-surface-0);
  --surface-50:  var(--p-surface-50);
  --surface-100: var(--p-surface-100);
  --surface-200: var(--p-surface-200);
  --surface-300: var(--p-surface-300);
  --surface-400: var(--p-surface-400);
  --surface-500: var(--p-surface-500);
  --surface-600: var(--p-surface-600);
  --surface-700: var(--p-surface-700);
  --surface-800: var(--p-surface-800);
  --surface-900: var(--p-surface-900);
  --surface-950: var(--p-surface-950);

  /* ── Severity (RESERVED warm) ───────────────────────────────── */
  --severity-critical: #ef4444; /* red    */
  --severity-high:     #f97316; /* orange */
  --severity-medium:   #f59e0b; /* amber  */
  /* low / informational sit OUTSIDE the warm band — use primary/surface */
  --severity-low:      var(--p-primary-500);
  --severity-info:     var(--p-surface-400);

  /* Derived severity shades — all computed from the three base warm tokens so
     nothing new enters the palette. soft = tinted fill, strong = readable text. */
  --severity-critical-soft:   color-mix(in srgb, var(--severity-critical) 10%, var(--p-surface-0));
  --severity-critical-strong: color-mix(in srgb, var(--severity-critical) 78%, var(--p-surface-950));
  --severity-high-soft:       color-mix(in srgb, var(--severity-high) 12%, var(--p-surface-0));
  --severity-high-strong:     color-mix(in srgb, var(--severity-high) 80%, var(--p-surface-950));
  --severity-medium-soft:     color-mix(in srgb, var(--severity-medium) 14%, var(--p-surface-0));
  --severity-medium-strong:   color-mix(in srgb, var(--severity-medium) 82%, var(--p-surface-950));

  /* ── Semantic bridge tokens (light is the default theme) ────── */
  --app-bg:           var(--p-surface-50);   /* app canvas              */
  --surface-card:     var(--p-surface-0);    /* raised card / panel bg  */
  --surface-sunken:   var(--p-surface-100);  /* wells, table headers    */
  --surface-hover:    var(--p-surface-100);  /* row / item hover        */
  --surface-border:   var(--p-surface-200);  /* hairline dividers       */
  --surface-border-strong: var(--p-surface-300);

  --text-color:       var(--p-surface-700);  /* #3f3f46 default body    */
  --text-strong:      var(--p-surface-900);  /* headings / emphasis     */
  --text-muted:       var(--p-surface-500);  /* #71717a secondary       */
  --text-disabled:    var(--p-surface-400);
  --text-on-primary:  var(--p-surface-0);

  --focus-ring:       var(--p-primary-500);
  --selection-bg:     var(--p-primary-50);
  --selection-border: var(--p-primary-500);
}

/* ── Dark theme — opt in with .stellar-dark (or [data-theme="dark"]) ──
   Surface shades invert; primary lightens one tier for contrast.        */
.stellar-dark,
[data-theme="dark"] {
  --app-bg:           var(--p-surface-950);
  --surface-card:     var(--p-surface-900);
  --surface-sunken:   var(--p-surface-800);
  --surface-hover:    var(--p-surface-800);
  --surface-border:   var(--p-surface-800);
  --surface-border-strong: var(--p-surface-700);

  --text-color:       var(--p-surface-100);
  --text-strong:      var(--p-surface-0);
  --text-muted:       var(--p-surface-400);
  --text-disabled:    var(--p-surface-600);

  --selection-bg:     var(--p-primary-950);
}
/* Typography — Stellar Surface
   Inter for product UI (headings + body). System monospace for code, IDs,
   hashes, IPs and other machine data. NOT JetBrains Mono. */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Menlo", "Monaco", "SF Mono", Consolas, monospace;

  /* Type scale (rem) — from theme variables.scss */
  --text-xs:   0.75rem;   /* 12px — meta, table dense, captions */
  --text-sm:   0.875rem;  /* 14px — default UI / table body     */
  --text-base: 1rem;      /* 16px — body copy                   */
  --text-lg:   1.125rem;  /* 18px — large controls              */
  --text-xl:   1.25rem;   /* 20px — card titles                 */
  --text-2xl:  1.5rem;    /* 24px — section headings            */
  --text-3xl:  1.875rem;  /* 30px — page titles                 */
  --text-4xl:  2.25rem;   /* 36px — display / counters          */

  /* Weights */
  --font-regular:  400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  /* Line heights */
  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.5;

  /* Letter spacing — Inter at small sizes reads better slightly tightened */
  --tracking-tight:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.02em;   /* uppercase eyebrows / overlines */
}
/* Spacing, radius & sizing — Stellar Surface
   Match these. Do not invent paddings. Form-field + nav padding come straight
   from the theme; the scale is a 4px base step. */

:root {
  /* Spacing scale (4px base) */
  --space-0:  0;
  --space-1:  0.25rem;  /* 4px  */
  --space-2:  0.5rem;   /* 8px  */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */

  /* Form-field padding (from theme — do not invent) */
  --field-padding-x:    0.75rem;
  --field-padding-y:    0.5rem;
  --field-padding-x-sm: 0.625rem;
  --field-padding-y-sm: 0.375rem;
  --field-padding-x-lg: 0.875rem;
  --field-padding-y-lg: 0.625rem;

  /* List option + nav item padding */
  --list-option-padding: 0.5rem 0.75rem;
  --nav-item-padding:    0.5rem 0.75rem;

  /* Radius */
  --radius-none: 0;
  --radius-xs:   2px;
  --radius-sm:   4px;
  --radius-md:   6px;   /* default control radius */
  --radius-lg:   8px;   /* cards / panels         */
  --radius-xl:   12px;  /* modals / large surfaces */
  --radius-full: 9999px;

  /* Control heights (derived from field padding + line height) */
  --control-h-sm: 30px;
  --control-h:    36px;
  --control-h-lg: 44px;
}
/* Elevation & motion — Stellar Surface
   The platform is flat and structural: borders do most of the separation work,
   shadows are used sparingly and only on overlays/raised surfaces. */

:root {
  /* Shadows — soft, zinc-tinted, never heavy */
  --shadow-xs: 0 1px 2px 0 rgb(9 9 11 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(9 9 11 / 0.08), 0 1px 2px -1px rgb(9 9 11 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(9 9 11 / 0.08), 0 2px 4px -2px rgb(9 9 11 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(9 9 11 / 0.10), 0 4px 6px -4px rgb(9 9 11 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(9 9 11 / 0.12), 0 8px 10px -6px rgb(9 9 11 / 0.10);

  /* Focus ring */
  --ring-width: 2px;
  --ring-offset: 2px;
  --ring-color: var(--p-primary-500);

  /* Motion — quick, functional, no bounce */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1); /* @kind other */
  --ease-out:      cubic-bezier(0, 0, 0.2, 1);    /* @kind other */
  --duration-fast:   120ms; /* @kind other */
  --duration-normal: 180ms; /* @kind other */
  --duration-slow:   240ms; /* @kind other */
}

/* Shared utility keyframe — referenced by spinners (Button loading, etc.) */
@keyframes stellar-spin {
  to { transform: rotate(360deg); }
}

/* Indeterminate progress sweep */
@keyframes stellar-progress {
  0%   { left: -35%; }
  100% { left: 100%; }
}

/* Skeleton shimmer */
@keyframes stellar-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Overlay fade-in (dialogs, popovers, toasts) */
@keyframes stellar-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* Horizon layer: every value the Stellar Surface / High Fidelity kits could not supply. Each is a candidate token. */
@layer hz {
  :root {
    --hz-ground: color-mix(in oklab, var(--p-surface-950) 86%, var(--p-primary-950)); /* kit's darkest ground is neutral surface-950; the cinematic look needs a blue-black step below it (pass 4: 10% â 14% blue) */
    --hz-ground-depth: var(--hz-vignette), radial-gradient(90% 70% at 38% -12%, color-mix(in oklab, var(--p-primary-900) 30%, transparent), transparent 62%), var(--hz-starfield), var(--hz-texture); /* kit has no atmosphere / depth token. Pass 4: three planes, back to front: grid, stars, atmosphere, vignette */
    --hz-panel: linear-gradient(180deg, color-mix(in oklab, var(--p-primary-300) 6%, transparent), transparent 72px), color-mix(in oklab, var(--p-surface-900) 58%, transparent); /* kit cards are opaque; panels sit IN the ground as dark glass. Pass 4: faint top light */
    --hz-panel-raised: linear-gradient(180deg, color-mix(in oklab, var(--p-primary-300) 5%, transparent), transparent 120px), color-mix(in oklab, var(--p-surface-900) 80%, transparent); /* docked co-pilot: one step up from --hz-panel */
    --hz-hairline: color-mix(in oklab, var(--p-surface-400) 15%, transparent); /* finest dark-mode border is opaque surface-800; too heavy at this density */
    --hz-hairline-strong: color-mix(in oklab, var(--p-surface-400) 28%, transparent); /* inputs, proposal cards, focused structure */
    --hz-row-selected: color-mix(in oklab, var(--p-primary-500) 13%, transparent); /* dark selection-bg (primary-950, opaque) reads muddy on a translucent panel */
    --hz-glow-live: 0 0 0 1px color-mix(in oklab, var(--p-primary-400) 45%, transparent), 0 0 18px color-mix(in oklab, var(--p-primary-500) 30%, transparent); /* kit elevation is drop shadows only; no emissive "this is live" treatment */
    --hz-glow-critical: 0 0 10px color-mix(in oklab, var(--severity-critical) 55%, transparent); /* new-detection emphasis; severity-only */
    --hz-tracking-eyebrow: 0.16em; /* kit tracking-wide is 0.02em; micro-labels need more air on dark (pass 4: 0.12 â 0.16) */
    --hz-weight-display: 300; /* kit weights start at 400; the lead line uses a light display weight */
    --hz-viz-edge: color-mix(in oklab, var(--p-surface-400) 24%, transparent); /* no data-viz tokens for graph edges / grid rings */
    --hz-viz-sweep: color-mix(in oklab, var(--p-primary-400) 20%, transparent); /* threat-map sweep wedge */
    --hz-motion-sweep: 14s; /* kit motion tops out at 240ms; ambient loops need their own durations */
    --hz-motion-pulse: 2.4s;
    --hz-motion-dash: 1.4s;
    --hz-ease-ambient: cubic-bezier(.45, 0, .55, 1); /* kit easings are UI-transition curves, not loops */
    /* Pass 4 Â· cinematic layer, shared by Workbench, Assemble, Investigate */
    --hz-grid-fine: color-mix(in oklab, var(--p-surface-400) 4%, transparent); /* kit has no texture tokens; the far plane needs a grid that sits just above the ground */
    --hz-grid-major: color-mix(in oklab, var(--p-primary-400) 6%, transparent); /* every fifth line, tinted with the one accent so the far plane reads as an instrument, not graph paper */
    --hz-star: color-mix(in oklab, var(--p-surface-200) 34%, transparent); /* star points behind the grid; kit has no particle colour */
    --hz-texture: linear-gradient(var(--hz-grid-fine) 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(90deg, var(--hz-grid-fine) 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(var(--hz-grid-major) 1px, transparent 1px) 0 0 / 120px 120px, linear-gradient(90deg, var(--hz-grid-major) 1px, transparent 1px) 0 0 / 120px 120px; /* 24px fine + 120px major grid; kit has no background-pattern token */
    --hz-starfield: radial-gradient(1.2px 1.2px at 8% 14%, var(--hz-star), transparent) 0 0 / 520px 380px, radial-gradient(1.2px 1.2px at 61% 37%, var(--hz-star), transparent) 0 0 / 520px 380px, radial-gradient(1.6px 1.6px at 34% 72%, var(--hz-star), transparent) 0 0 / 520px 380px, radial-gradient(1.2px 1.2px at 86% 88%, var(--hz-star), transparent) 0 0 / 520px 380px, radial-gradient(1.2px 1.2px at 23% 46%, var(--hz-star), transparent) 130px 90px / 760px 540px, radial-gradient(1.6px 1.6px at 74% 12%, var(--hz-star), transparent) 130px 90px / 760px 540px, radial-gradient(1.2px 1.2px at 52% 63%, var(--hz-star), transparent) 130px 90px / 760px 540px; /* two offset tiles of points so the repeat does not show at 1600px */
    --hz-vignette: radial-gradient(130% 100% at 50% 30%, transparent 55%, color-mix(in oklab, var(--p-surface-950) 70%, transparent)); /* darkens the frame edges so the eye settles on the centre; it only ever darkens, so it costs no contrast */
    --hz-glass-edge: inset 0 1px 0 color-mix(in oklab, var(--p-surface-0) 9%, transparent), inset 0 -32px 48px -32px color-mix(in oklab, var(--p-surface-950) 70%, transparent), 0 24px 48px -28px color-mix(in oklab, var(--p-surface-950) 90%, transparent); /* kit elevation is an outer drop shadow built for light UI; dark glass needs a lit top edge, an inner floor shadow and a soft lift off the ground */
    --hz-bracket: color-mix(in oklab, var(--p-surface-300) 42%, transparent); /* decorative instrument marks (corner brackets, ruler majors, boot grid); never used for text */
    --hz-brackets: linear-gradient(var(--hz-bracket), var(--hz-bracket)) left 4px top 4px / 8px 1px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) left 4px top 4px / 1px 8px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) right 4px top 4px / 8px 1px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) right 4px top 4px / 1px 8px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) left 4px bottom 4px / 8px 1px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) left 4px bottom 4px / 1px 8px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) right 4px bottom 4px / 8px 1px no-repeat, linear-gradient(var(--hz-bracket), var(--hz-bracket)) right 4px bottom 4px / 1px 8px no-repeat; /* four 8px corner brackets inset 4px, as background layers so they cost no markup; key panels only */
    --hz-ruler-x: repeating-linear-gradient(90deg, var(--hz-hairline-strong) 0 1px, transparent 1px 8px) left bottom / 100% 3px no-repeat, repeating-linear-gradient(90deg, var(--hz-bracket) 0 1px, transparent 1px 80px) left bottom / 100% 7px no-repeat; /* registration ruler along the top bar edge: minor every 8px, major every 80px */
    --hz-ruler-y: repeating-linear-gradient(180deg, var(--hz-hairline-strong) 0 1px, transparent 1px 8px) right top / 3px 100% no-repeat, repeating-linear-gradient(180deg, var(--hz-bracket) 0 1px, transparent 1px 80px) right top / 7px 100% no-repeat; /* the same ruler down the rail's right edge */
    --hz-glow-selected: inset 0 0 0 1px color-mix(in oklab, var(--p-primary-400) 34%, transparent), inset 0 0 24px color-mix(in oklab, var(--p-primary-500) 14%, transparent); /* inner glow for the selected live row; --hz-glow-live is outer and would bleed into neighbouring rows */
    --hz-glow-line: drop-shadow(0 0 3px color-mix(in oklab, var(--p-primary-400) 75%, transparent)); /* emissive stroke for live and selected paths in SVG; box-shadow does not apply to strokes */
    --hz-motion-particle: 2.6s; /* time for one particle to travel one live edge; read by the logic classes for SVG motion */
    --hz-tracking-wide: 0.24em; /* the screen eyebrow above the headline; kit has nothing wider than 0.02em */
  }
}
