/* ==========================================================================
   Nocturne Design System — color, type, spacing tokens
   Default theme is dark ("Nocturne"); a light variant is provided for
   users who prefer it. Semantic color roles follow docs/REQUIREMENTS.md
   section 20: blue=current, green=visited/correct, yellow=attention,
   red=error, gray=unvisited, purple=special/algorithm state.
   ========================================================================== */

:root {
  /* Typography */
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --border-width: 1px;

  /* Motion */
  --dur-fast: 120ms;
  --dur-med: 280ms;
  --dur-slow: 480ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic algorithm-state colors (theme independent) */
  --state-current-h: 217;
  --state-visited-h: 158;
  --state-attention-h: 42;
  --state-error-h: 357;
  --state-unvisited-h: 224;
  --state-special-h: 260;
}

/* ---------------------------------------------------------------------- */
/* Nocturne (dark) — default theme                                        */
/* ---------------------------------------------------------------------- */
:root,
:root[data-theme="dark"] {
  --bg-app: #0a0d14;
  --bg-surface: #111521;
  --bg-elevated: #171c2b;
  --bg-elevated-hover: #1d2335;
  --bg-inset: #0d1119;

  --border-subtle: #232a3d;
  --border-strong: #323b55;

  --text-primary: #e8ecf6;
  --text-secondary: #a4adc4;
  --text-muted: #6b7590;

  --accent-primary: #6c8dff;
  --accent-primary-strong: #8aa4ff;
  --on-accent: #08101f;

  --color-current: #4f8dfd;
  --color-current-bg: rgba(79, 141, 253, 0.16);
  --color-visited: #3ecf8e;
  --color-visited-bg: rgba(62, 207, 142, 0.16);
  --color-attention: #f5c451;
  --color-attention-bg: rgba(245, 196, 81, 0.18);
  --color-error: #f2555a;
  --color-error-bg: rgba(242, 85, 90, 0.16);
  --color-unvisited: #5a6379;
  --color-unvisited-bg: rgba(90, 99, 121, 0.18);
  --color-special: #a78bfa;
  --color-special-bg: rgba(167, 139, 250, 0.18);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.45);

  --code-bg: #0c1019;
  --code-active-line: rgba(108, 141, 255, 0.16);
  --code-active-border: #6c8dff;

  color-scheme: dark;
}

/* ---------------------------------------------------------------------- */
/* Light theme                                                            */
/* ---------------------------------------------------------------------- */
:root[data-theme="light"] {
  --bg-app: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-elevated-hover: #eef1f8;
  --bg-inset: #eef1f7;

  --border-subtle: #e1e5f0;
  --border-strong: #c7cede;

  --text-primary: #171b26;
  --text-secondary: #4b5468;
  --text-muted: #7c8499;

  --accent-primary: #3f63e0;
  --accent-primary-strong: #2f4fc4;
  --on-accent: #ffffff;

  --color-current: #2f6fe0;
  --color-current-bg: rgba(47, 111, 224, 0.12);
  --color-visited: #1f9d63;
  --color-visited-bg: rgba(31, 157, 99, 0.14);
  --color-attention: #b5860a;
  --color-attention-bg: rgba(181, 134, 10, 0.14);
  --color-error: #d4383e;
  --color-error-bg: rgba(212, 56, 62, 0.12);
  --color-unvisited: #8b93a7;
  --color-unvisited-bg: rgba(139, 147, 167, 0.16);
  --color-special: #7c5cd6;
  --color-special-bg: rgba(124, 92, 214, 0.14);

  --shadow-card: 0 1px 2px rgba(20, 24, 40, 0.08);
  --shadow-elevated: 0 8px 24px rgba(20, 24, 40, 0.12);

  --code-bg: #f7f8fc;
  --code-active-line: rgba(47, 111, 224, 0.1);
  --code-active-border: #3f63e0;

  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-med: 0ms;
    --dur-slow: 0ms;
  }
}
