/**
 * SpeedSight Design Tokens
 * Global design system variables
 */

:root {
    /* Primary Colors */
    --color-accent: #00C2FF;
    --color-accent-glow: rgba(0, 194, 255, 0.22);
    --color-accent-hover: #00A8E0;
    --color-accent-pressed: #008FBF;
    
    /* Background Colors */
    --color-bg-primary: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
    --color-bg-tertiary: #F3F4F6;
    --color-surface: #FFFFFF;
    --color-surface-elevated: #FFFFFF;
    
    /* Text Colors */
    --color-text-primary: #111827;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-text-inverse: #FFFFFF;
    --color-text-accent: #00C2FF;
    
    /* Border Colors */
    --color-border-primary: #E5E7EB;
    --color-border-secondary: #D1D5DB;
    --color-border-accent: #00C2FF;
    
    /* Status Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    
    /* Semantic Colors */
    --color-crown: #FFD700;
    --color-recommended: #8B5CF6;
    
    /* Typography - Fonts */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-reader-latin: 'Roboto Slab', serif;
    --font-reader-jp: 'Noto Sans JP', sans-serif;
    
    /* Typography - Sizes */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    --font-size-5xl: 3rem;        /* 48px */
    --font-size-6xl: 3.75rem;     /* 60px */
    --font-size-7xl: 4.5rem;      /* 72px */
    
    /* Typography - Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Typography - Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 2.5rem;    /* 40px */
    --space-3xl: 3rem;      /* 48px */
    --space-4xl: 4rem;      /* 64px */
    --space-5xl: 5rem;      /* 80px */
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Glow Effects */
    --glow-radius: 8px;
    --glow-color: var(--color-accent-glow);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 12px var(--glow-color);
    --shadow-glow-lg: 0 0 24px var(--glow-color);
    
    /* Z-index Scale */
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1100;
    --z-overlay: 1200;
    --z-modal: 1300;
    --z-toast: 1400;
    --z-tooltip: 1500;
    
    /* Transitions */
    --transition-fast: 120ms ease-out;
    --transition-base: 200ms ease-out;
    --transition-slow: 350ms ease-out;
    --transition-bounce: 350ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Animation Durations */
    --duration-instant: 90ms;
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 350ms;
    --duration-slower: 500ms;
    --duration-pulse: 1600ms;
    
    /* Timing Functions */
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-in-cubic: cubic-bezier(0.32, 0, 0.67, 0);
    
    /* Breakpoints (for JavaScript usage) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    
    /* Component Specific */
    --upload-cta-size: clamp(56px, 15vw, 80px);
    --reader-word-size: clamp(2rem, 8vw, 4.5rem);
    --play-button-size: 64px;
    --control-button-size: 48px;
    
    /* Layout */
    --max-content-width: 1200px;
    --header-height: 60px;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
}

/* Dark Mode Tokens */
[data-theme="dark"] {
    /* Background Colors */
    --color-bg-primary: #0F1724;
    --color-bg-secondary: #1A2332;
    --color-bg-tertiary: #252F42;
    --color-surface: #1A2332;
    --color-surface-elevated: #252F42;
    
    /* Text Colors */
    --color-text-primary: #F9FAFB;
    --color-text-secondary: #D1D5DB;
    --color-text-tertiary: #9CA3AF;
    --color-text-inverse: #111827;
    
    /* Border Colors */
    --color-border-primary: #374151;
    --color-border-secondary: #4B5563;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
}

/* System Font Stack for Optimal Performance */
@supports (font-variation-settings: normal) {
    :root {
        --font-ui: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --color-border-primary: #000000;
        --color-border-secondary: #000000;
    }
    
    [data-theme="dark"] {
        --color-border-primary: #FFFFFF;
        --color-border-secondary: #FFFFFF;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    :root {
        --transition-fast: 0ms;
        --transition-base: 0ms;
        --transition-slow: 0ms;
        --duration-instant: 0ms;
        --duration-fast: 0ms;
        --duration-base: 0ms;
        --duration-slow: 0ms;
        --duration-slower: 0ms;
        --duration-pulse: 0ms;
    }
}

/* Color Scheme Meta */
:root {
    color-scheme: light dark;
}

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="light"] {
    color-scheme: light;
}
