/* Color tokens for light & dark palettes.
   :root = light defaults, prefers-color-scheme = system dark,
   [data-theme] = explicit user override (wins regardless of system setting). */

:root {
  --color-bg: #fafafa;
  --color-bg-alt: #e9ecf1;
  --color-bg-elevated: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-accent: #d4a017;
  --color-accent-contrast: #141414;
  --color-border: #e0e0e0;
  --color-focus: #2563eb;
  --color-glass: rgba(255, 255, 255, 0.62);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0a0a0a;
    --color-bg-alt: #141a24;
    --color-bg-elevated: #161616;
    --color-text: #e0e0e0;
    --color-text-muted: #909090;
    --color-accent: #d4a017;
    --color-accent-contrast: #141414;
    --color-border: #2a2a2a;
    --color-focus: #6ea8fe;
    --color-glass: rgba(22, 22, 22, 0.64);
  }
}

:root[data-theme="light"] {
  --color-bg: #fafafa;
  --color-bg-alt: #e9ecf1;
  --color-bg-elevated: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-accent: #d4a017;
  --color-accent-contrast: #141414;
  --color-border: #e0e0e0;
  --color-focus: #2563eb;
  --color-glass: rgba(255, 255, 255, 0.62);
}

:root[data-theme="dark"] {
  --color-bg: #0a0a0a;
  --color-bg-alt: #141a24;
  --color-bg-elevated: #161616;
  --color-text: #e0e0e0;
  --color-text-muted: #909090;
  --color-accent: #d4a017;
  --color-accent-contrast: #141414;
  --color-border: #2a2a2a;
  --color-focus: #6ea8fe;
  --color-glass: rgba(22, 22, 22, 0.64);
}

/* Prefer the OS/browser accent color where the browser exposes it as a CSS
   system color (Chrome/Edge 93+, Firefox 92+, Safari 15.4+). Falls back to
   the gold tone above in browsers that don't support it. Matches the
   specificity of the [data-theme] overrides above so it still wins when an
   explicit light/dark theme is selected, not just in "system" mode. */
@supports (color: AccentColor) {
  :root,
  :root[data-theme="light"],
  :root[data-theme="dark"] {
    --color-accent: AccentColor;
    --color-accent-contrast: AccentColorText;
    --color-focus: AccentColor;
  }
}

