/**
 * Mobile & Tablet Header Optimizations
 * Specific improvements for touch devices and smaller screens
 */

/* iPad Portrait and Landscape Optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .site-header {
        /* iPad gets a slightly taller header for better touch targets */
        .header-main {
            padding: 1.25rem 0;
        }
        
        .header-main-content {
            padding: 0 1.5rem;
            gap: 1.5rem;
        }
        
        /* Logo sizing for iPad */
        .site-branding .logo-image {
            width: 200px;
            max-height: 52px;
        }
        
        .site-branding .site-tagline {
            font-size: 0.72rem;
            display: block; /* Show tagline on iPad */
        }
        
        /* CTA button optimization for iPad */
        .adventure-cta {
            padding: 0.65rem 1.1rem;
            font-size: 0.9rem;
            
            .cta-text {
                display: inline; /* Show text on iPad */
            }
        }
        
        /* Search toggle for iPad */
        .search-toggle {
            padding: 0.6rem;
        }
        
        .search-toggle-icon {
            font-size: 1.3rem;
        }
    }
}

/* Mobile Portrait Optimizations */
@media (max-width: 767px) {
    .site-header {
        /* Minimize header height on mobile */
        position: fixed; /* Keep header always visible */
        top: 0;
        left: 0;
        right: 0;
        
        .header-main {
            padding: 0.6rem 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        }
        
        /* Adjust body padding to account for fixed header */
        + .site-content {
            padding-top: 80px;
        }
    }
    
    /* Logo adjustments for mobile */
    .site-branding {
        .logo-image {
            width: 150px;
            max-height: 38px;
        }
        
        .site-tagline {
            display: none;
        }
    }
    
    /* Mobile-specific touch improvements */
    .header-actions {
        .search-toggle,
        .mobile-menu-toggle {
            -webkit-tap-highlight-color: transparent;
            tap-highlight-color: transparent;
        }
    }
    
    /* Mobile navigation improvements */
    .mobile-nav-overlay {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        
        .mobile-nav-content {
            /* Ensure content doesn't get cut off */
            max-height: 100vh;
            padding-bottom: 2rem;
            
            /* Safe area insets for notched devices */
            padding-top: max(2rem, env(safe-area-inset-top) + 1rem);
            padding-left: max(2rem, env(safe-area-inset-left) + 1rem);
            padding-right: max(2rem, env(safe-area-inset-right) + 1rem);
        }
    }
    
    /* Mobile search reveal adjustments */
    .header-search-reveal {
        &.active {
            max-height: 140px;
        }
        
        .search-reveal-content {
            padding: 0 1rem;
            flex-direction: column;
            gap: 0.75rem;
        }
        
        .search-form {
            width: 100%;
        }
        
        .search-field {
            font-size: 16px; /* Prevent zoom on iOS */
        }
    }
}

/* iPhone SE and smaller screens */
@media (max-width: 375px) {
    .site-header {
        .header-main-content {
            padding: 0 0.75rem;
            gap: 0.5rem;
        }
        
        .site-branding .logo-image {
            width: 130px;
            max-height: 34px;
        }
        
        .adventure-cta {
            padding: 0.4rem;
            min-width: 40px;
            
            .cta-text {
                display: none;
            }
            
            .cta-icon {
                font-size: 0.95rem;
            }
        }
    }
    
    .mobile-nav-overlay .mobile-nav-content {
        padding: 1rem 0.75rem;
        
        .mobile-nav-header {
            margin-bottom: 1.5rem;
            
            .mobile-nav-title {
                font-size: 1.1rem;
            }
        }
        
        .mobile-nav-item {
            padding: 0.6rem;
            min-height: 50px;
        }
    }
}

/* Landscape mobile optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .site-header {
        .header-main {
            padding: 0.5rem 0;
        }
        
        .site-branding .logo-image {
            max-height: 32px;
        }
    }
    
    .mobile-nav-overlay .mobile-nav-content {
        padding: 1rem;
        
        .mobile-nav-header {
            margin-bottom: 1rem;
        }
        
        .mobile-nav-item {
            padding: 0.5rem 0;
            min-height: 48px;
        }
        
        .mobile-nav-footer {
            margin-top: 1rem;
            padding-top: 1rem;
        }
    }
}

/* Touch interaction improvements */
@media (hover: none) and (pointer: coarse) {
    /* For touch devices only */
    .header-actions button,
    .mobile-nav-item,
    .adventure-cta {
        /* Remove hover effects on touch devices */
        &:hover {
            transform: none;
        }
        
        /* Add active states for better touch feedback */
        &:active {
            transform: scale(0.95);
            transition: transform 0.1s ease;
        }
    }
    
    .mobile-nav-item:active {
        background-color: rgba(201, 204, 104, 0.1);
    }
    
    .search-toggle:active,
    .mobile-menu-toggle:active {
        background-color: rgba(201, 204, 104, 0.15);
    }
}

/* High DPI screen optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .site-branding .logo-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .hamburger,
    .hamburger::before,
    .hamburger::after {
        /* Ensure hamburger lines are crisp on retina */
        transform: translateZ(0);
    }
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
    .header-main-content *,
    .mobile-nav-overlay *,
    .header-search-reveal * {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    
    .mobile-nav-content {
        transform: translateX(0) !important;
    }
    
    .mobile-nav-overlay.active .mobile-nav-content {
        transform: translateX(0) !important;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) {
    .site-header {
        background-color: #1a1a1a;
        border-bottom-color: rgba(255, 255, 255, 0.1);
        
        .header-main-content {
            color: #ffffff;
        }
        
        .site-branding .site-tagline {
            color: #cccccc;
        }
        
        .mobile-nav-overlay .mobile-nav-content {
            background-color: #1a1a1a;
            color: #ffffff;
        }
        
        .hamburger,
        .hamburger::before,
        .hamburger::after {
            background-color: #ffffff;
        }
    }
}