/* Segura Quantum design tokens (D00).
   One token set drives three themes: Quantum Dark (default), Deep Space and Scientific Light.
   Brand palette values come from the master design directive, section 4.1. Text-on-surface
   variants were lightened or darkened where needed to keep WCAG 2.2 AA contrast. */

:root {
  /* Brand palette (raw) */
  --sq-void: #030610;
  --sq-deep-space: #080d1c;
  --sq-graphite: #10182a;
  --sq-instrument: #151f33;
  --sq-cyan: #00d9ff;
  --sq-blue: #3978ff;
  --sq-violet: #875cff;
  --sq-magenta: #d946ef;
  --sq-teal: #00e5b0;
  --sq-white: #f0f5ff;
  --sq-secondary: #a0aec4;
  --sq-success: #35d49a;
  --sq-warning: #ffb547;
  --sq-critical: #ff526b;
}

:root[data-theme="quantum-dark"],
:root[data-theme="deep-space"] {
  color-scheme: dark;

  /* Semantic surfaces */
  --bg: var(--sq-void);
  --bg-2: var(--sq-deep-space);
  --surface: var(--sq-graphite);
  --surface-2: var(--sq-instrument);
  --surface-3: #1b2740;
  --surface-glass: rgb(16 24 42 / 0.72);
  --overlay: rgb(3 6 16 / 0.72);
  --line: #24314b;
  --line-strong: #34446a;
  --grid: rgb(160 174 196 / 0.07);

  /* Semantic text */
  --text: var(--sq-white);
  --text-2: var(--sq-secondary);
  --text-3: #7d8ba3;
  --text-on-accent: #020409;

  /* Semantic accents (text-safe variants on dark surfaces) */
  --accent: var(--sq-cyan);            /* computational activity */
  --interactive: #5b8fff;              /* Electric Blue, lightened for 4.5:1 text on graphite */
  --interactive-fill: var(--sq-blue);
  --quantum: #a587ff;                  /* Quantum Violet, text-safe */
  --quantum-fill: var(--sq-violet);
  --state: #e879f9;                    /* Photon Magenta, text-safe */
  --correlation: var(--sq-teal);
  --success: var(--sq-success);
  --warning: var(--sq-warning);
  --critical: #ff6b80;

  /* Gate families (symbol + color, never color alone) */
  --gate-h: var(--sq-cyan);
  --gate-pauli: var(--sq-blue);
  --gate-phase: var(--sq-violet);
  --gate-rotation: var(--sq-magenta);
  --gate-control: var(--sq-teal);
  --gate-swap: #6fa8ff;
  --gate-measure: #c7d2e4;
  --gate-reset: var(--sq-warning);
  --gate-custom: #8d9bb3;

  /* Luminous accents, used sparingly */
  --glow-cyan: 0 0 0 1px rgb(0 217 255 / 0.35), 0 0 24px rgb(0 217 255 / 0.18);
  --glow-violet: 0 0 0 1px rgb(135 92 255 / 0.4), 0 0 24px rgb(135 92 255 / 0.2);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 8px 28px rgb(0 0 0 / 0.45);
  --shadow-3: 0 24px 64px rgb(0 0 0 / 0.55);

  /* Visualization canvas tokens (read by JS through getComputedStyle) */
  --viz-wire: #3a4a6b;
  --viz-axis: #6c7d9c;
  --viz-label: #b7c3d8;
  --viz-vector: var(--sq-cyan);
  --viz-trail: var(--sq-violet);
  --viz-mixed: var(--sq-magenta);
}

:root[data-theme="deep-space"] {
  --bg: #01030a;
  --bg-2: #040815;
  --surface: #0a1122;
  --surface-2: #0e172c;
  --surface-3: #142039;
  --surface-glass: rgb(8 13 28 / 0.6);
  --line: #1b2741;
  --line-strong: #2a3a5e;
  --grid: rgb(0 217 255 / 0.06);
  --glow-cyan: 0 0 0 1px rgb(0 217 255 / 0.45), 0 0 36px rgb(0 217 255 / 0.25);
  --viz-wire: #2b3a5c;
}

/* Scientific Light is the default: a light grey workspace (requested 2026-12-05). */
:root,
[data-theme="scientific-light"] {
  color-scheme: light;
  --bg: #e9ecf0;
  --bg-2: #e1e5ea;
  --surface: #f7f8fa;
  --surface-2: #eef1f4;
  --surface-3: #e2e7ed;
  --surface-glass: rgb(247 248 250 / 0.85);
  --overlay: rgb(14 22 40 / 0.38);
  --line: #cfd6df;
  --line-strong: #b2bdca;
  --grid: rgb(16 24 42 / 0.055);
  --text: #0c1426;
  --text-2: #424f66;
  --text-3: #56637a;
  --text-on-accent: #ffffff;
  --accent: #006f88;
  --interactive: #2259d6;
  --interactive-fill: #2a62e0;
  --quantum: #6a3fe0;
  --quantum-fill: #7448f0;
  --state: #a21caf;
  --correlation: #00876a;
  --success: #12845c;
  --warning: #9a5b00;
  --critical: #c8243f;
  --gate-h: #0091b0;
  --gate-pauli: #2a62e0;
  --gate-phase: #7448f0;
  --gate-rotation: #b02ac4;
  --gate-control: #00876a;
  --gate-swap: #3d6fd0;
  --gate-measure: #46546d;
  --gate-reset: #a86400;
  --gate-custom: #66748d;
  --glow-cyan: 0 0 0 1px rgb(0 127 153 / 0.35);
  --glow-violet: 0 0 0 1px rgb(106 63 224 / 0.35);
  --shadow-1: 0 1px 2px rgb(16 24 42 / 0.08);
  --shadow-2: 0 8px 24px rgb(16 24 42 / 0.1);
  --shadow-3: 0 20px 48px rgb(16 24 42 / 0.16);
  --viz-wire: #b9c5d8;
  --viz-axis: #66748d;
  --viz-label: #2b3850;
  --viz-vector: #007f99;
  --viz-trail: #6a3fe0;
  --viz-mixed: #a21caf;
}

/* Theme-independent scales */
:root {
  /* Typography */
  --font-display: "Space Grotesk", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --font-math: "Cambria Math", "STIX Two Math", "Latin Modern Math", Cambria, serif;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-md: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: clamp(2rem, 3.2vw, 2.75rem);
  --text-hero: clamp(2.6rem, 5.6vw, 4.75rem);

  /* Space, radius, motion */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 112px;
  --radius-1: 3px;
  --radius-2: 6px;
  --radius-3: 10px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 420ms;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 0ms;
    --dur-2: 0ms;
    --dur-3: 0ms;
  }
}
