/* ===========================
   CSS Variables & Design System
   =========================== */

:root {
    /* Colors - Dark Mode Default */
    --bg: #0f1724;
    --panel: #1a2332;
    --panel-hover: #222d3f;
    --text: #e6eef8;
    --text-secondary: #9aa6b2;
    --muted: #6b7684;
    --accent: #7dd3fc;
    --accent-2: #60a5fa;
    --accent-hover: #a5e7ff;
    --border: #2d3748;
    --error: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    
    /* Spacing Scale */
    --space-1: 0.25rem;    /* 4px */
    --space-2: 0.5rem;     /* 8px */
    --space-3: 1rem;       /* 16px */
    --space-4: 1.5rem;     /* 24px */
    --space-5: 2rem;       /* 32px */
    --space-6: 3rem;       /* 48px */
    --space-7: 4rem;       /* 64px */
    --space-8: 6rem;       /* 96px */
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    --text-5xl: 3rem;      /* 48px */
    
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* 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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    
    /* Layout */
    --container-max: 1200px;
    --navbar-height: 70px;
    
    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-hover: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #475569;
    --muted: #94a3b8;
    --accent: #0ea5e9;
    --accent-2: #3b82f6;
    --accent-hover: #0284c7;
    --border: #e2e8f0;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

/* ===========================
   Reset & Base Styles
   =========================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: var(--line-height-normal);
    color: var(--text);
    background-color: var(--bg);
    transition: background-color var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus Styles for Accessibility */
:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--line-height-tight);
    color: var(--text);
    margin-bottom: var(--space-3);
}

h1 {
    font-size: var(--text-5xl);
    margin-bottom: var(--space-4);
}

h2 {
    font-size: var(--text-4xl);
}

h3 {
    font-size: var(--text-3xl);
}

h4 {
    font-size: var(--text-2xl);
}

h5 {
    font-size: var(--text-xl);
}

h6 {
    font-size: var(--text-lg);
}

p {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

ul, ol {
    list-style-position: inside;
    margin-bottom: var(--space-3);
}

strong {
    font-weight: var(--font-semibold);
    color: var(--text);
}

.lead {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
    color: var(--text);
    line-height: var(--line-height-relaxed);
}

.required {
    color: var(--error);
}

/* ===========================
   Layout
   =========================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (max-width: 640px) {
    .container {
        padding: 0 var(--space-3);
    }
}

.section {
    padding: var(--space-8) 0;
}

.section-alt {
    background-color: var(--panel);
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-5);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, var(--accent), var(--accent-2));
    margin: var(--space-3) auto 0;
    border-radius: var(--radius-full);
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    margin-bottom: var(--space-5);
}

/* ===========================
   Grid Systems
   =========================== */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

@media (max-width: 1024px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   Utilities
   =========================== */

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Responsive breakpoints */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
    
    h1 {
        font-size: var(--text-4xl);
    }
    
    h2 {
        font-size: var(--text-3xl);
    }
    
    .section {
        padding: var(--space-6) 0;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .section {
        padding: var(--space-7) 0;
    }
}
