/* ===== PREVENT HORIZONTAL SCROLL ON MOBILE ===== */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

@media (max-width: 1024px) {
    html, body {
        overflow-x: hidden !important;
        position: relative;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Prevent any element from causing horizontal overflow */
    *, *::before, *::after {
        max-width: 100vw;
    }
    
    /* Common overflow culprits */
    .container,
    .section-wrap,
    .ab-hero,
    .ab-hero-inner,
    .hero-section,
    .hero-content,
    nav,
    .site-nav,
    .nav-inner,
    header,
    main,
    section,
    footer {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    /* Fix for elements that might extend beyond viewport */
    img, video, iframe, canvas, svg {
        max-width: 100%;
        height: auto;
    }
    
    /* Ensure rows don't overflow */
    .row {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
}

/* ===== PROFESSIONAL MOBILE NAV — shared across all pages ===== */
@media (max-width: 1024px) {
    /* Hamburger button */
    .nav-hamburger {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    .nav-hamburger:hover {
        background: rgba(139,92,246,0.15);
        border-color: rgba(139,92,246,0.3);
        transform: scale(1.05);
    }
    .nav-hamburger:active {
        transform: scale(0.95);
    }
    .nav-hamburger span {
        width: 20px;
        height: 2px;
        background: linear-gradient(90deg, #fff, rgba(255,255,255,0.7));
        border-radius: 2px;
        transition: all 0.3s ease;
        transform-origin: center;
    }
    /* Animate hamburger → X when overlay open */
    body:has(.nav-overlay.open) .nav-hamburger span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    body:has(.nav-overlay.open) .nav-hamburger span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    body:has(.nav-overlay.open) .nav-hamburger span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Overlay - dark backdrop */
    .nav-overlay {
        background: rgba(10,15,13,0.85);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        justify-content: flex-end;
        padding: 0;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
        overflow: hidden;
    }
    .nav-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* Slide-in panel with vibrant gradient background */
    .nav-overlay-inner {
        width: 100%;
        max-width: 380px;
        height: 100vh;
        background: linear-gradient(165deg, 
            rgba(88,28,135,0.95) 0%, 
            rgba(49,46,129,0.92) 25%,
            rgba(30,58,95,0.9) 50%,
            rgba(17,94,89,0.88) 75%,
            rgba(20,83,45,0.85) 100%);
        border-left: 1px solid rgba(139,92,246,0.4);
        padding: 80px 2rem 2rem;
        align-items: flex-start;
        gap: 0.5rem;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        overflow: hidden;
        box-shadow: -10px 0 40px rgba(139,92,246,0.3);
    }
    .nav-overlay.open .nav-overlay-inner {
        transform: translateX(0);
    }
    
    /* Animated gradient overlay on panel */
    .nav-overlay-inner::before {
        content: '';
        position: absolute;
        inset: 0;
        background: 
            radial-gradient(ellipse 120% 80% at 0% 0%, rgba(139,92,246,0.4) 0%, transparent 50%),
            radial-gradient(ellipse 100% 60% at 100% 100%, rgba(34,211,238,0.3) 0%, transparent 40%),
            radial-gradient(ellipse 80% 80% at 50% 50%, rgba(249,115,22,0.15) 0%, transparent 50%);
        animation: navPanelGradient 10s ease-in-out infinite alternate;
        pointer-events: none;
        z-index: 0;
    }
    
    @keyframes navPanelGradient {
        0% { 
            opacity: 0.7;
            transform: scale(1) rotate(0deg);
        }
        50% {
            opacity: 1;
            transform: scale(1.1) rotate(2deg);
        }
        100% { 
            opacity: 0.8;
            transform: scale(1.05) rotate(-2deg);
        }
    }
    
    /* Ensure menu items stay above animated background */
    .nav-overlay-inner > * {
        position: relative;
        z-index: 2;
    }
    
    /* Floating glowing orbs */
    .nav-overlay-inner::after {
        content: '';
        position: absolute;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(139,92,246,0.4) 0%, transparent 70%);
        top: 20%;
        right: -50px;
        animation: navOrb1 8s ease-in-out infinite;
        pointer-events: none;
        z-index: 1;
    }
    
    @keyframes navOrb1 {
        0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
        50% { transform: translate(-30px, 40px) scale(1.2); opacity: 0.9; }
    }

    /* Menu items */
    .nav-overlay-inner a {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
        font-size: 1.35rem;
        font-weight: 600;
        color: rgba(255,255,255,0.75);
        letter-spacing: -0.01em;
        padding: 1rem 0;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        transition: all 0.25s ease;
        position: relative;
        text-align: left;
    }
    .nav-overlay-inner a:last-of-type {
        border-bottom: none;
    }
    .nav-overlay-inner a::before {
        content: '';
        position: absolute;
        left: -2rem;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 0;
        background: linear-gradient(180deg, #8b5cf6, #22d3ee);
        border-radius: 2px;
        transition: height 0.3s ease;
    }
    .nav-overlay-inner a:hover {
        color: #fff;
        padding-left: 0.5rem;
    }
    .nav-overlay-inner a:hover::before {
        height: 60%;
    }

    /* Active link in mobile menu */
    .nav-overlay-inner a.active {
        color: #fff !important;
        padding-left: 0.5rem;
    }
    .nav-overlay-inner a.active::before {
        height: 60% !important;
    }
    .nav-overlay-inner a.active::after {
        content: '';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 6px;
        height: 6px;
        background: linear-gradient(135deg, #8b5cf6, #22d3ee);
        border-radius: 50%;
    }

    /* CTA button inside mobile menu */
    .nav-overlay-inner a.nav-cta-btn {
        background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(34,211,238,0.15)) !important;
        border: 1px solid rgba(139,92,246,0.4);
        border-radius: 12px;
        padding: 1rem 1.5rem !important;
        margin-top: 1rem;
        text-align: center;
        color: #fff !important;
        font-weight: 700;
    }
    .nav-overlay-inner a.nav-cta-btn:hover {
        background: linear-gradient(135deg, rgba(139,92,246,0.35), rgba(34,211,238,0.25)) !important;
        border-color: rgba(139,92,246,0.6);
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(139,92,246,0.25);
    }

    /* Show close button with stylish design */
    .nav-overlay-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 2.5rem;
        right: 1.5rem;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(255,255,255,0.15);
        border: 1px solid rgba(255,255,255,0.25);
        color: #fff;
        font-size: 1.2rem;
        cursor: pointer;
        transition: all 0.3s ease;
        z-index: 10001;
    }
    .nav-overlay-close:hover {
        background: rgba(139,92,246,0.4);
        border-color: rgba(139,92,246,0.6);
        transform: rotate(90deg) scale(1.1);
        box-shadow: 0 0 20px rgba(139,92,246,0.5);
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .nav-overlay-inner {
        max-width: 100%;
        padding: 80px 1.5rem 1.5rem;
    }
    .nav-overlay-inner a {
        font-size: 1.2rem;
        padding: 0.875rem 0;
    }
    .nav-hamburger {
        width: 40px;
        height: 40px;
    }
}

/* ===== MOBILE NAV FIXES FOR ALL PAGES ===== */
@media (max-width: 1024px) {
    /* Ensure nav stays above all content */
    .site-nav {
        z-index: 1000 !important;
        position: fixed !important;
    }
    
    /* Ensure overlay is above everything */
    .nav-overlay {
        z-index: 9999 !important;
    }
    
    /* Ensure all nav menu items are visible in overlay */
    .nav-overlay-inner a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Hero sections should not overlap with fixed nav */
    .ab-hero,
    .hero-section,
    .leadership-hero,
    .investors-hero,
    section.hero {
        position: relative;
        z-index: 1;
    }
    
    /* Ensure hero content stays below nav */
    .ab-hero-inner,
    .hero-content,
    .leadership-hero-content,
    .investors-hero-content,
    .ph-inner {
        position: relative;
        z-index: 2;
    }
}

@media (max-width: 768px) {
    /* Add more top padding to hero sections on mobile to prevent overlap */
    .ab-hero {
        padding-top: 120px !important;
    }
    
    .leadership-hero-content,
    .investors-hero-content {
        padding-top: 100px !important;
    }
    
    section.hero {
        padding-top: 120px !important;
    }
}

@media (max-width: 480px) {
    /* Even more padding on very small screens */
    .ab-hero {
        padding-top: 100px !important;
    }
    
    .leadership-hero-content,
    .investors-hero-content {
        padding-top: 90px !important;
    }
    
    section.hero {
        padding-top: 100px !important;
    }
}
