/* ============================================================
   Design Tokens — Druid Learning Hub
   Single source of truth for colors, spacing, typography, shadows.
   ============================================================ */

:root {
    /* ---- Brand Colors ---- */
    --color-primary: #4F46E5;
    --color-primary-hover: #4338CA;
    --color-primary-light: #EEF2FF;
    --color-primary-50: #EEF2FF;
    --color-primary-100: #E0E7FF;
    --color-primary-200: #C7D2FE;
    --color-primary-500: #6366F1;
    --color-primary-600: #4F46E5;
    --color-primary-700: #4338CA;
    --color-primary-800: #3730A3;

    /* ---- Semantic Colors ---- */
    --color-success: #059669;
    --color-success-light: #ECFDF5;
    --color-warning: #D97706;
    --color-warning-light: #FFFBEB;
    --color-error: #DC2626;
    --color-error-light: #FEF2F2;
    --color-info: #2563EB;
    --color-info-light: #EFF6FF;

    /* ---- Neutrals ---- */
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
    --color-bg-tertiary: #F3F4F6;
    --color-surface: #FFFFFF;
    --color-surface-hover: #F9FAFB;
    --color-border: #E5E7EB;
    --color-border-strong: #D1D5DB;
    --color-text: #111827;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-text-inverse: #FFFFFF;

    /* ---- Gamification ---- */
    --color-xp: #F59E0B;
    --color-streak: #EF4444;

    /* ---- Typography ---- */
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* ---- Spacing ---- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* ---- Borders ---- */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ---- Shadows ---- */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* ---- Transitions ---- */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* ---- Z-Index Scale ---- */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* ---- Layout ---- */
    --nav-height: 56px;
    --container-max: 1280px;
    --sidebar-width: 280px;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --color-primary: #818CF8;
    --color-primary-hover: #A5B4FC;
    --color-primary-light: rgba(99, 102, 241, 0.15);

    --color-success: #34D399;
    --color-success-light: rgba(52, 211, 153, 0.15);
    --color-warning: #FBBF24;
    --color-warning-light: rgba(251, 191, 36, 0.15);
    --color-error: #F87171;
    --color-error-light: rgba(248, 113, 113, 0.15);
    --color-info: #60A5FA;
    --color-info-light: rgba(96, 165, 250, 0.15);

    --color-bg: #0D1117;
    --color-bg-secondary: #161B22;
    --color-bg-tertiary: #21262D;
    --color-surface: #161B22;
    --color-surface-hover: #21262D;
    --color-border: #30363D;
    --color-border-strong: #484F58;
    --color-text: #E6EDF3;
    --color-text-secondary: #8B949E;
    --color-text-tertiary: #6E7681;
    --color-text-inverse: #0D1117;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-primary: #818CF8;
        --color-primary-hover: #A5B4FC;
        --color-primary-light: rgba(99, 102, 241, 0.15);
        --color-success: #34D399;
        --color-success-light: rgba(52, 211, 153, 0.15);
        --color-warning: #FBBF24;
        --color-warning-light: rgba(251, 191, 36, 0.15);
        --color-error: #F87171;
        --color-error-light: rgba(248, 113, 113, 0.15);
        --color-info: #60A5FA;
        --color-info-light: rgba(96, 165, 250, 0.15);
        --color-bg: #0D1117;
        --color-bg-secondary: #161B22;
        --color-bg-tertiary: #21262D;
        --color-surface: #161B22;
        --color-surface-hover: #21262D;
        --color-border: #30363D;
        --color-border-strong: #484F58;
        --color-text: #E6EDF3;
        --color-text-secondary: #8B949E;
        --color-text-tertiary: #6E7681;
        --color-text-inverse: #0D1117;
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
        --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
    }
}
