/**
 * Mobile-First Responsive Optimizations
 * Improves mobile experience and Core Web Vitals
 */

/* Mobile-first breakpoints */
@media (max-width: 576px) {
    /* Typography optimization for mobile */
    body {
        font-size: 16px;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Touch-friendly targets */
    .btn, .btn-primary, .btn-outline {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    /* Optimized spacing for mobile */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Horizontal scroll for categories on mobile */
    .category-filter-bar__chips {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .category-filter-bar__chips::-webkit-scrollbar {
        display: none;
    }
    
    /* Sticky navbar for mobile */
    .site-navbar {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    /* Optimized images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Reduced animations for mobile performance */
    .aos-animate {
        transition: none !important;
    }
    
    /* Touch-friendly dropdowns */
    .dropdown-menu {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet optimizations */
@media (min-width: 577px) and (max-width: 991px) {
    .container {
        max-width: 720px;
    }
    
    .col-md-4, .col-md-6, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Desktop optimizations */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Core Web Vitals optimizations */
/* LCP (Largest Contentful Paint) */
.hero-content {
    contain: layout style paint;
}

/* CLS (Cumulative Layout Shift) */
img, video, iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

.ad-card {
    contain: layout;
}

/* FID (First Input Delay) */
button, a, input, select, textarea {
    touch-action: manipulation;
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .site-footer {
        background-color: #1a1a1a;
    }
}

/* Print styles */
@media print {
    .no-print, .site-navbar, .site-footer, .btn, .ad-card__actions {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .ad-card {
        page-break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
}
