/* ==========================================================================
   Design tokens — CSS custom properties.
   Light values on :root; dark values gated by [data-theme="dark"] and
   @media (prefers-color-scheme: dark) when no explicit override is set.
   ========================================================================== */

:root {
  /* --- Typography --- */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 28px;

  /* --- Spacing (4px scale) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* --- Radius --- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* --- Terminal (same in both themes) --- */
  --terminal-bg: #0d0d0f;
  --terminal-fg: #d4d4d8;

  /* --- Light palette (default) --- */
  --color-bg:            #ffffff;
  --color-surface:       #fafafa;
  --color-surface-2:     #f4f4f5;
  --color-border:        #e4e4e7;
  --color-border-strong: #d4d4d8;
  --color-text:          #18181b;
  --color-text-muted:    #71717a;
  --color-text-subtle:   #a1a1aa;

  --color-accent:       #3b82f6;
  --color-accent-hover: #2563eb;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger:  #ef4444;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Dark palette via @media when no explicit [data-theme] is set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg:            #09090b;
    --color-surface:       #0f0f11;
    --color-surface-2:     #18181b;
    --color-border:        #27272a;
    --color-border-strong: #3f3f46;
    --color-text:          #fafafa;
    --color-text-muted:    #a1a1aa;
    --color-text-subtle:   #71717a;

    --color-accent:       #60a5fa;
    --color-accent-hover: #3b82f6;

    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-danger:  #f87171;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

/* Explicit dark override (user-selected via toggle). */
:root[data-theme="dark"] {
  --color-bg:            #09090b;
  --color-surface:       #0f0f11;
  --color-surface-2:     #18181b;
  --color-border:        #27272a;
  --color-border-strong: #3f3f46;
  --color-text:          #fafafa;
  --color-text-muted:    #a1a1aa;
  --color-text-subtle:   #71717a;

  --color-accent:       #60a5fa;
  --color-accent-hover: #3b82f6;

  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-danger:  #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}
