/* Mobile Optimizations - Enhanced for Better UX */

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap target sizes */
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better button spacing */
    .btn {
        padding: 16px 24px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Larger form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px; /* Prevent zoom */
        padding: 14px 16px;
    }
    
    /* Better spacing for links */
    .nav-link {
        padding: 16px 0;
    }
}

/* Enhanced Mobile Styles */
@media (max-width: 768px) {
    /* Improved touch scrolling */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
    }
    
    /* Better mobile navigation */
    .mobile-toggle {
        width: 44px;
        height: 44px;
        padding: 10px;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-menu {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    
    /* Prevent horizontal scroll */
    .container {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Mobile-optimized sections */
    section {
        padding: var(--spacing-xl) 0;
    }
    
    /* Better mobile typography */
    h1 { font-size: clamp(1.75rem, 8vw, 2.5rem); }
    h2 { font-size: clamp(1.5rem, 6vw, 2rem); }
    h3 { font-size: clamp(1.25rem, 5vw, 1.5rem); }
    
    p, li {
        font-size: 16px;
        line-height: 1.7;
    }
    
    /* Mobile form optimizations */
    .contact-form {
        padding: var(--spacing-lg);
    }
    
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    /* Stacked buttons on mobile */
    .hero-cta {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
        padding: 0 var(--spacing-md);
    }
    
    .hero-cta .btn {
        width: 100%;
    }
    
    /* Mobile card layouts */
    .criteria-grid,
    .process-grid,
    .faq-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    /* Touch-friendly cards */
    .criteria-card,
    .process-step,
    .faq-item {
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.2s ease;
    }
    
    .criteria-card:active,
    .process-step:active {
        transform: scale(0.98);
    }
    
    /* Mobile images */
    .hero-image-wrapper {
        max-width: 280px;
        margin: 0 auto var(--spacing-lg);
    }
    
    .holding-images {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    /* Improved mobile footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .footer-links {
        justify-content: center;
    }
}

/* Small mobile devices */
@media (max-width: 375px) {
    /* Even smaller typography */
    .hero-title {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    /* Compact spacing */
    :root {
        --spacing-xs: 0.375rem;
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-2xl: 3rem;
    }
    
    /* Smaller buttons */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing */
    .hero {
        padding: calc(var(--spacing-lg) + 60px) 0 var(--spacing-lg);
    }
    
    section {
        padding: var(--spacing-lg) 0;
    }
    
    /* Side-by-side stats in landscape */
    .hero-stats {
        flex-wrap: nowrap;
    }
    
    /* Hide hero image in landscape to save space */
    .hero-image-wrapper {
        display: none;
    }
}

/* High resolution mobile screens */
@media (-webkit-min-device-pixel-ratio: 3),
       (min-resolution: 288dpi) {
    /* Sharper borders and shadows */
    .card,
    .criteria-card,
    .process-step {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12),
                    0 1px 2px rgba(0, 0, 0, 0.24);
    }
}

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

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Fix iOS button styles */
    input[type="submit"],
    input[type="button"],
    button {
        -webkit-appearance: none;
        border-radius: 0;
    }
}

/* Performance optimizations */
@media (max-width: 768px) {
    /* Disable hover effects on mobile */
    .btn:hover,
    .nav-link:hover,
    .card:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Optimize animations */
    * {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    /* Hardware acceleration for smooth scrolling */
    .nav-menu,
    .container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Mobile-specific classes */
body.is-mobile {
    -webkit-tap-highlight-color: transparent;
}

body.no-hover *:hover {
    transform: none !important;
    box-shadow: none !important;
}

body.is-scrolling * {
    pointer-events: none !important;
}

body.is-scrolling .navbar {
    pointer-events: auto !important;
}

/* Reduced motion */
body.reduce-motion * {
    animation: none !important;
    transition: none !important;
}

/* Save data mode */
body.save-data img {
    filter: blur(5px);
    transition: filter 0.3s;
}

body.save-data img.loaded {
    filter: none;
}

/* Tap feedback */
.tapped {
    transform: scale(0.95) !important;
    opacity: 0.8;
}

/* Font loading optimization */
body:not(.fonts-loaded) {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.fonts-loaded {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}