/* Responsive Design - Light Theme */

/* Extra Small Screens (< 640px) */
@media (max-width: 639px) {
    /* Typography */
    h1, .h1 { font-size: var(--font-size-3xl); }
    h2, .h2 { font-size: var(--font-size-2xl); }
    h3, .h3 { font-size: var(--font-size-xl); }
    
    /* Spacing */
    :root {
        --spacing: 0.75rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-2xl: 3rem;
        --spacing-3xl: 4rem;
    }
    
    /* Containers */
    .container {
        padding: 0 var(--spacing);
    }
    
    /* Grid */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons */
    .btn, .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    /* Cards */
    .card {
        padding: var(--spacing-lg);
    }
}

/* Small Screens (640px - 767px) */
@media (min-width: 640px) and (max-width: 767px) {
    /* Typography */
    h1, .h1 { font-size: var(--font-size-4xl); }
    h2, .h2 { font-size: var(--font-size-3xl); }
    
    /* Spacing */
    :root {
        --spacing: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2.5rem;
        --spacing-2xl: 3.5rem;
    }
}

/* Medium Screens (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Typography */
    h1, .h1 { font-size: var(--font-size-5xl); }
    h2, .h2 { font-size: var(--font-size-4xl); }
    
    /* Spacing */
    :root {
        --spacing: 1.25rem;
        --spacing-lg: 2rem;
        --spacing-xl: 3rem;
    }
    
    /* Grid */
    .grid-sm {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Screens (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    /* Typography */
    h1, .h1 { font-size: var(--font-size-6xl); }
    h2, .h2 { font-size: var(--font-size-5xl); }
    
    /* Containers */
    .container-lg {
        max-width: 1200px;
    }
    
    /* Grid */
    .grid-lg {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Screens (1280px and up) */
@media (min-width: 1280px) {
    /* Typography */
    h1, .h1 { font-size: var(--font-size-6xl); }
    h2, .h2 { font-size: var(--font-size-5xl); }
    
    /* Containers */
    .container-xl {
        max-width: 1400px;
    }
    
    /* Grid */
    .grid-xl {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* High DPI adjustments */
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    nav,
    footer,
    .no-print {
        display: none !important;
    }
    
    .card,
    .hero-section {
        break-inside: avoid;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border: oklch(0.60 0.02 265);
        --border-light: oklch(0.65 0.015 265);
        --shadow: none;
    }
    
    .card,
    .btn {
        border: 2px solid var(--border);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --surface: oklch(0.18 0.02 265);
        --surface-light: oklch(0.22 0.025 265);
        --text-secondary: oklch(0.70 0.02 265);
        --border: oklch(0.28 0.02 265);
        --nav-bg: oklch(0.16 0.015 265);
    }
}

/* Focus Visibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Focus Ring Hide for Screen Readers */
:focus:not(:focus-visible) {
    outline: none;
}

/* Touch Targets */
.btn,
input[type="submit"],
input[type="button"],
button,
a.btn {
    min-height: 44px;
    min-width: 44px;
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-tap-highlight-color: transparent;
    }
}

/* PWA */
@media (display-mode: standalone) {
    body {
        padding-top: var(--nav-height);
    }
}

/* Orientation */
@media (orientation: portrait) {
    /* Portrait-specific styles */
}

@media (orientation: landscape) {
    /* Landscape-specific styles */
}

/* Color Schemes */
@media (prefers-color-scheme: light) {
    :root {
        --surface: var(--surface);
        --surface-light: var(--surface-light);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --surface: var(--surface);
        --surface-light: var(--surface-light);
    }
}

/* Device Specific Styles */
/* iPad */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    :root {
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }
}

/* iPhone X+ */
@media (max-width: 414px) {
    :root {
        --spacing: 0.75rem;
        --spacing-lg: 1.25rem;
    }
}

/* Large Phone */
@media (min-width: 415px) and (max-width: 480px) {
    :root {
        --spacing: 0.875rem;
        --spacing-lg: 1.5rem;
    }
}

/* Tablet Landscape */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    :root {
        --spacing: 1.25rem;
    }
}

/* Wide Desktop */
@media (min-width: 1600px) {
    :root {
        --spacing: 1.5rem;
        --spacing-lg: 2.5rem;
        --spacing-xl: 4rem;
    }
    
    .container-xl {
        max-width: 1600px;
    }
}

/* Column Wrapping */
@media (max-width: 768px) {
    .grid,
    .grid-md,
    .grid-lg,
    .grid-xl {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .grid,
    .grid-sm {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid,
    .grid-sm,
    .grid-md {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .grid,
    .grid-sm,
    .grid-md,
    .grid-lg {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Flex Direction */
@media (max-width: 768px) {
    .flex-col-mobile {
        flex-direction: column !important;
    }
}

@media (min-width: 769px) {
    .flex-row-desktop {
        flex-direction: row !important;
    }
}

/* Text Alignment */
@media (max-width: 639px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
}

@media (min-width: 640px) {
    .text-center-desktop {
        text-align: center !important;
    }
    
    .text-left-desktop {
        text-align: left !important;
    }
}

/* Hide Elements */
@media (max-width: 639px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 640px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show Elements */
@media (max-width: 639px) {
    .show-mobile {
        display: block !important;
    }
}

@media (min-width: 640px) {
    .show-desktop {
        display: block !important;
    }
}
