/*
 * Design tokens: every colour, radius, shadow and font used by the UI.
 * Components only reference these variables, so the whole look (and dark mode) changes here.
 *
 * Theme selection:
 *   - follows the OS setting (prefers-color-scheme) by default
 *   - <html data-theme="light|dark"> forces one (set by js/theme.js, saved in localStorage)
 */

/* [data-ink-theme] lets one live element (the question pills) take a theme's colours on its own
   while the ink transition passes over it (js/ink/transition.js). */
:root, [data-ink-theme="light"] {
  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-w: 268px;

  /* Light palette */
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --border: #e4e6ef;
  --scroll-thumb: rgba(79, 70, 229, 0.2);
  --scroll-thumb-hover: rgba(79, 70, 229, 0.42);
  --text: #151833;
  --text-2: #4a4f6a;
  --muted: #7a7f99;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: #eef0ff;
  --primary-ink: #ffffff;
  --success: #12a150;
  --success-soft: #e7f7ee;
  --warning: #c27803;
  --warning-soft: #fff6e0;
  --warning-border: rgba(194, 120, 3, 0.35);
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --code-bg: #0f1226;
  --code-text: #e3e6ff;
  --shadow-sm: 0 1px 2px rgba(20, 24, 51, 0.06);
  --shadow: 0 1px 2px rgba(20, 24, 51, 0.04), 0 8px 24px rgba(20, 24, 51, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 51, 0.12);
  --chart-grid: #eceef5;
  --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Dark palette: applied when the OS prefers dark (unless forced light) or when forced dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e1a;
    --bg-elev: #12152a;
    --surface: #151931;
    --surface-2: #1c2140;
    --border: #262c4d;
  --scroll-thumb: rgba(138, 144, 176, 0.26);
  --scroll-thumb-hover: rgba(129, 140, 248, 0.55);
    --scroll-thumb: rgba(138, 144, 176, 0.26);
    --scroll-thumb-hover: rgba(129, 140, 248, 0.55);
    --text: #e9ebfa;
    --text-2: #b9bed8;
    --muted: #8a90b0;
    --primary: #8b8cff;
    --primary-2: #b18cff;
    --primary-soft: #23264d;
    --primary-ink: #0c0e1a;
    --success: #45d483;
    --success-soft: #133325;
    --warning: #f5b544;
    --warning-soft: #3a2c10;
    --warning-border: rgba(245, 181, 68, 0.35);
    --danger: #ff7a6b;
    --danger-soft: #3d1a17;
    --code-bg: #0a0c18;
    --code-text: #dfe3ff;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --chart-grid: #232846;
    --gradient: linear-gradient(135deg, #6d6bff 0%, #a77bff 100%);
  }
}
:root[data-theme="dark"], [data-ink-theme="dark"] {
  --bg: #0c0e1a;
  --bg-elev: #12152a;
  --surface: #151931;
  --surface-2: #1c2140;
  --border: #262c4d;
  --text: #e9ebfa;
  --text-2: #b9bed8;
  --muted: #8a90b0;
  --primary: #8b8cff;
  --primary-2: #b18cff;
  --primary-soft: #23264d;
  --primary-ink: #0c0e1a;
  --success: #45d483;
  --success-soft: #133325;
  --warning: #f5b544;
  --warning-soft: #3a2c10;
  --warning-border: rgba(245, 181, 68, 0.35);
  --danger: #ff7a6b;
  --danger-soft: #3d1a17;
  --code-bg: #0a0c18;
  --code-text: #dfe3ff;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --chart-grid: #232846;
  --gradient: linear-gradient(135deg, #6d6bff 0%, #a77bff 100%);
}
