/**
 * Design Tokens for Mall of Midnight
 * ===================================
 * Single source of truth for the UI system.
 * Load this FIRST before other stylesheets.
 */

:root {
   /* ========================================
     COLOR PALETTE — "Neon Atrium" Dark Theme
     ======================================== */

   /* Backgrounds */
   --color-bg: #07060b;
   --color-bg-elevated: #0f1014;
   --color-surface: rgba(15, 16, 22, 0.72);
   --color-surface-solid: #171821;
   --color-surface-hover: rgba(23, 24, 33, 0.85);

   /* Text */
   --color-text: #f3f2ff;
   --color-text-muted: rgba(243, 242, 255, 0.7);
   --color-text-dim: rgba(243, 242, 255, 0.5);

   /* Borders */
   --color-border: rgba(172, 132, 255, 0.22);
   --color-border-strong: rgba(172, 132, 255, 0.4);
   --color-border-focus: rgba(172, 132, 255, 0.6);

   /* Accent Colors */
   --color-accent: #b38cff;
   --color-accent-hover: #c9a8ff;
   --color-accent-secondary: #35e3ff;

   /* Semantic Colors */
   --color-success: #2ef7a7;
   --color-warning: #ffcc66;
   --color-danger: #ff4d8d;

   /* ========================================
     SPACING SCALE (4px base unit)
     ======================================== */
   --space-0: 0;
   --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;

   /* ========================================
     TYPOGRAPHY
     ======================================== */

   /* Font Families */
   --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
   --font-body: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
   --font-narrative: "EB Garamond", Georgia, Cambria, "Times New Roman", serif;

   /* Font Sizes */
   --text-xs: 0.6875rem;
   /* 11px */
   --text-sm: 0.8125rem;
   /* 13px */
   --text-base: 0.9375rem;
   /* 15px */
   --text-md: 1rem;
   /* 16px */
   --text-lg: 1.125rem;
   /* 18px */
   --text-xl: 1.25rem;
   /* 20px */
   --text-2xl: 1.5rem;
   /* 24px */
   --text-3xl: 2.125rem;
   /* 34px */

   /* Line Heights */
   --leading-tight: 1.3;
   --leading-snug: 1.4;
   --leading-normal: 1.5;
   --leading-relaxed: 1.6;
   --leading-loose: 1.7;

   /* Font Weights */
   --font-normal: 400;
   --font-medium: 500;
   --font-semibold: 600;
   --font-bold: 700;

   /* Letter Spacing */
   --tracking-tight: -0.01em;
   --tracking-normal: 0;
   --tracking-wide: 0.02em;
   --tracking-wider: 0.06em;
   --tracking-widest: 0.12em;

   /* ========================================
     BORDER RADIUS
     ======================================== */
   --radius-sm: 6px;
   --radius-md: 10px;
   --radius-lg: 14px;
   --radius-xl: 18px;
   --radius-2xl: 22px;
   --radius-full: 999px;

   /* ========================================
     SHADOWS
     ======================================== */
   --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
   --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
   --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
   --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.45);
   --shadow-glow: 0 0 24px rgba(179, 140, 255, 0.2);
   --shadow-glow-strong: 0 0 40px rgba(179, 140, 255, 0.35);

   /* ========================================
     LAYOUT
     ======================================== */
   --max-content-width: 1320px;
   --sidebar-width: 360px;
   --header-height: 64px;
   --narrative-max-width: 74ch;

   /* ========================================
     TRANSITIONS
     ======================================== */
   --transition-fast: 150ms ease;
   --transition-normal: 250ms ease;
   --transition-slow: 400ms ease;
   --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

   /* Animation scale (for user preference) */
   --animation-scale: 1;

   /* ========================================
     Z-INDEX SCALE
     ======================================== */
   --z-base: 0;
   --z-dropdown: 10;
   --z-sticky: 20;
   --z-fixed: 30;
   --z-modal-backdrop: 40;
   --z-modal: 50;
   --z-popover: 60;
   --z-tooltip: 70;
   --z-toast: 80;
   --z-titlescreen: 100;
   --z-error-boundary: 99999;

   /* ========================================
     AAA POLISH - Premium Effects
     ======================================== */

   /* Choice Button States */
   --choice-bg: rgba(15, 16, 22, 0.65);
   --choice-bg-hover: rgba(179, 140, 255, 0.12);
   --choice-bg-active: rgba(179, 140, 255, 0.18);
   --choice-border: rgba(172, 132, 255, 0.25);
   --choice-border-hover: rgba(179, 140, 255, 0.5);
   --choice-glow: 0 0 20px rgba(179, 140, 255, 0.15);
   --choice-glow-hover: 0 0 30px rgba(179, 140, 255, 0.25);

   /* Hotkey Badge */
   --hotkey-bg: rgba(179, 140, 255, 0.15);
   --hotkey-text: var(--color-accent);
   --hotkey-border: rgba(179, 140, 255, 0.3);

   /* Focus States (Accessibility) */
   --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-accent);
   --focus-ring-inset: inset 0 0 0 2px var(--color-accent);

   /* Loading States */
   --loading-shimmer: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);

   /* Glass Morphism */
   --glass-bg: rgba(15, 16, 22, 0.75);
   --glass-backdrop: blur(16px);
   --glass-border: rgba(255, 255, 255, 0.08);

   /* Gradients */
   --gradient-accent: linear-gradient(135deg, var(--color-accent), var(--color-accent-secondary));
   --gradient-surface: linear-gradient(180deg, rgba(15, 16, 22, 0.9), rgba(7, 6, 11, 0.95));
   --gradient-glow: radial-gradient(circle at 50% 0%, rgba(179, 140, 255, 0.15), transparent 70%);
}

/* ========================================
   LIGHT THEME OVERRIDES
   ======================================== */
[data-theme="light"] {
   --color-bg: #f7f7ff;
   --color-bg-elevated: #ffffff;
   --color-surface: rgba(255, 255, 255, 0.78);
   --color-surface-solid: #ffffff;
   --color-surface-hover: rgba(255, 255, 255, 0.9);

   --color-text: #1a1822;
   --color-text-muted: rgba(26, 24, 34, 0.65);
   --color-text-dim: rgba(26, 24, 34, 0.45);

   --color-border: rgba(111, 66, 193, 0.18);
   --color-border-strong: rgba(111, 66, 193, 0.35);
   --color-border-focus: rgba(111, 66, 193, 0.5);

   --color-accent: #6f42c1;
   --color-accent-hover: #8b5cf6;
   --color-accent-secondary: #0ea5e9;
}

/* ========================================
   REDUCED MOTION PREFERENCE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
   :root {
      --animation-scale: 0;
      --transition-fast: 0ms;
      --transition-normal: 0ms;
      --transition-slow: 0ms;
      --transition-spring: 0ms;
   }
}

/* ========================================
   COLOR SCHEME VARIANTS
   ======================================== */
[data-color-scheme="blue"] {
   --color-accent: #4dabf7;
   --color-accent-hover: #74c0fc;
   --color-accent-secondary: #22d3ee;
}

[data-color-scheme="green"] {
   --color-accent: #51cf66;
   --color-accent-hover: #69db7c;
   --color-accent-secondary: #38bdf8;
}

[data-color-scheme="red"] {
   --color-accent: #ff6b6b;
   --color-accent-hover: #ff8787;
   --color-accent-secondary: #f472b6;
}

[data-color-scheme="orange"] {
   --color-accent: #ffa94d;
   --color-accent-hover: #ffc078;
   --color-accent-secondary: #facc15;
}