/* Advanced Responsive Design Enhancements */

/* Container Queries (for modern browsers) */
@container (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

/* Improved Responsive Typography */
.responsive-text {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: 1.6;
}

.responsive-heading {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
}

/* Enhanced Mobile Navigation */
@media (max-width: 768px) {
    .navbar-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-subtle);
        transform: translateY(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 -4px 20px var(--shadow-medium);
    }
    
    .navbar-menu.show {
        transform: translateY(-100%);
    }
    
    .navbar-menu ul {
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }
    
    .navbar-menu li {
        border-bottom: 1px solid var(--border-subtle);
    }
    
    .navbar-menu li:last-child {
        border-bottom: none;
    }
    
    .navbar-menu li a {
        display: block;
        padding: 1rem;
        text-align: center;
        border-radius: 0;
    }
    
    /* Mobile-first CTA styling */
    .btn-primary.mobile-cta {
        background: var(--gradient-primary);
        margin-top: 1rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 1.5rem auto;
    }
    
    .feature-grid, .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .hero {
        padding: 3rem 1.5rem;
    }
    
    .hero h1 {
        font-size: clamp(2.5rem, 5vw, 3.5rem);
    }
}

/* Large Screen Optimizations */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .feature-grid, .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-inner {
        max-width: 1200px;
    }
}

/* Ultra-wide Screen Support */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .feature-grid, .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn-primary, .btn-secondary {
        min-height: 48px;
        min-width: 48px;
        padding: 1rem 1.5rem;
    }
    
    .navbar-menu li a {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .card, .feature {
        padding: 1.5rem;
    }
    
    /* Remove hover effects for touch devices */
    .card:hover, .feature:hover {
        transform: none;
        box-shadow: 0 2px 12px var(--shadow-medium);
    }
    
    /* Enhance focus indicators for keyboard navigation */
    .card:focus-visible, .feature:focus-visible {
        outline: 3px solid var(--primary-gold);
        outline-offset: 2px;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .navbar-brand-icon {
        background-size: contain;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .navbar, .footer, .btn-primary, .btn-secondary {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 1rem;
        box-shadow: none;
        border: none;
        background: white;
    }
    
    .hero {
        background: white;
        color: black;
        border: none;
        padding: 1rem;
    }
    
    .hero h1 {
        color: black;
        text-shadow: none;
    }
    
    .card, .feature {
        border: 1px solid #ccc;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    /* Print URLs after links */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero::before {
        animation: none;
    }
    
    .hero h1 {
        animation: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-gold: #ffeb3b;
        --bg-dark: #000000;
        --bg-card: #1a1a1a;
        --text-light: #ffffff;
        --border-subtle: #666666;
    }
    
    .card, .feature {
        border-width: 2px;
    }
    
    .btn-primary, .btn-secondary {
        border-width: 2px;
        font-weight: bold;
    }
}

/* Dark Mode Override for Light Theme Preference */
@media (prefers-color-scheme: light) {
    .light-theme-auto {
        --bg-dark: #f8f9fa;
        --bg-card: #ffffff;
        --bg-subtle: #f1f3f4;
        --text-light: #212529;
        --text-muted: #6c757d;
        --border-subtle: #dee2e6;
    }
}

/* Landscape Orientation Optimizations */
@media (orientation: landscape) and (max-height: 480px) {
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero h1 {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }
    
    .navbar-menu {
        max-height: 60vh;
    }
}

/* Fold Support for Foldable Devices */
@media (spanning: single-fold-vertical) {
    .container {
        max-width: 95%;
    }
    
    .feature-grid, .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading State Optimizations */
.loading-skeleton {
    background: linear-gradient(90deg, 
        var(--bg-subtle) 25%, 
        var(--bg-card) 50%, 
        var(--bg-subtle) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Scroll Snap for Better UX */
.scroll-snap-container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
}

.scroll-snap-item {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Focus Trap for Modals */
.focus-trap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.focus-trap-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}
