/**
 * Mobile-Specific Fixes for Front Page
 * Addresses: video z-index, scroll behavior, tab overlapping
 */

/* ===================================
   MOBILE VIEWPORT FIXES
   =================================== */

@media (max-width: 768px) {
    
    /* Fix video being hidden under header */
    .header-hero-visual,
    .video-showcase,
    .hero-video {
        position: relative;
        z-index: 1 !important;
    }
    
    /* Ensure header doesn't cover content */
    .ft-header {
        position: sticky;
        top: 0;
        z-index: 1000 !important;
    }
    
    /* Add padding to first section to prevent header overlap */
    .header-hero-section {
        padding-top: 80px !important;
        margin-top: 0 !important;
    }
    
    /* Fix video container on mobile */
    .header-hero-visual {
        width: 100% !important;
        margin-top: 20px !important;
    }
    
    .video-showcase {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Disable scroll hijacking on mobile */
    body.mobile-scroll-fix {
        overflow-y: auto !important;
        position: relative !important;
        height: auto !important;
    }
    
    /* Fix horizontal scroll sections on mobile */
    .horizontal-scroll-wrapper {
        overflow-x: visible !important;
        height: auto !important;
    }
    
    .horizontal-scroll-track {
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .horizontal-slide {
        width: 100% !important;
        min-width: 100% !important;
        margin-bottom: 40px !important;
    }
    
    /* Fix Apollo section tabs on mobile */
    .apollo-sticky-section {
        height: auto !important;
        position: relative !important;
    }
    
    .apollo-sticky-container {
        position: relative !important;
        height: auto !important;
        top: auto !important;
    }
    
    .apollo-tabs {
        position: sticky !important;
        top: 70px !important;
        z-index: 100 !important;
        background: white !important;
        padding: 10px 0 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    }
    
    .apollo-tab {
        font-size: 14px !important;
        padding: 8px 12px !important;
    }
    
    .feature-content {
        position: relative !important;
        z-index: 1 !important;
        margin-top: 20px !important;
        padding: 20px !important;
    }
    
    /* Ensure tabs don't cover content */
    .feature-content.active {
        margin-top: 80px !important;
    }
    
    /* Fix section spacing on mobile */
    section {
        scroll-margin-top: 80px !important;
    }
    
    /* Smooth scroll behavior */
    html {
        scroll-behavior: smooth !important;
    }
    
    /* Fix any fixed positioning issues */
    .panel-card {
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Ensure proper stacking context */
    .hero-new-section,
    .work-your-way-cards,
    .way-card {
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Fix video controls on mobile */
    .hero-video {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Prevent content from jumping */
    .header-hero-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    .header-hero-content {
        order: 1 !important;
    }
    
    .header-hero-visual {
        order: 2 !important;
    }
}

/* ===================================
   DISABLE PROBLEMATIC SCROLL EFFECTS ON MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Disable GSAP scroll animations on mobile */
    [data-scroll-section] {
        transform: none !important;
    }
    
    /* Disable horizontal scroll on mobile */
    .horizontal-scroll-wrapper[data-horizontal-scroll] {
        overflow: visible !important;
    }
    
    /* Fix sticky sections */
    [data-sticky] {
        position: relative !important;
    }
}

/* ===================================
   TOUCH-FRIENDLY IMPROVEMENTS
   =================================== */

@media (max-width: 768px) {
    /* Larger touch targets */
    .apollo-tab,
    .mobile-menu-link,
    .theme_Btn {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Better spacing for touch */
    .apollo-tabs {
        gap: 8px !important;
    }
    
    /* Prevent text selection during touch */
    .apollo-tab,
    .mobile-menu-link {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===================================
   FIX SCROLL SNAP ON MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Disable scroll snap on mobile for better control */
    html,
    body,
    .horizontal-scroll-wrapper {
        scroll-snap-type: none !important;
    }
    
    section {
        scroll-snap-align: none !important;
    }
}

/* ===================================
   Z-INDEX HIERARCHY FOR MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Establish clear z-index hierarchy */
    .mobile-menu-overlay {
        z-index: 9999 !important;
    }
    
    .ft-header {
        z-index: 1000 !important;
    }
    
    .apollo-tabs {
        z-index: 100 !important;
    }
    
    .feature-content,
    .panel-card,
    section {
        z-index: 1 !important;
    }
    
    .cloud-layer {
        z-index: 0 !important;
    }
}
