

/* ==========================================================================
   MOBILE REVOLUTION - "Dynamic Island Dock" & Immersive UI
   ========================================================================== */

/* Hide standard header on mobile */
@media (max-width: 1023px) {
    header.desktop-header {
        display: none !important;
    }
    
    /* SCROLL SNAP PHYSICS - The "App-like" Feel */
    html {
        scroll-snap-type: y mandatory;
        scroll-behavior: smooth;
    }
    
    body {
        overscroll-behavior-y: none; /* Prevent bounce at top/bottom */
    }
    
    section, .hero, .product, .our-story, .vision, .gallery, .contact {
        scroll-snap-align: start;
        scroll-snap-stop: always; /* Force stop at each section */
        min-height: 100dvh; /* Dynamic viewport height */
    }

    /* --- PRODUCT CARDS --- */
    .product {
        position: relative;
        overflow: hidden;
    }
    
    .product-content {
        transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    }
    
    /* When scrolling into view */
    .product:not(.in-view) .product-content {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    
    .product.in-view .product-content {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    /* --- GALLERY FLOW REVOLUTION --- */
    .gallery {
        position: relative; /* Context for indicator */
    }

    .gallery-grid {
        display: flex !important; /* Override grid */
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 16px !important;
        padding: 0 24px 40px 24px !important; /* Padding for scroll end */
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        height: auto !important;
        min-height: 400px;
        align-items: center;
        scrollbar-width: none; /* Hide scrollbar Firefox */
    }
    
    /* Hide scrollbar Webkit */
    .gallery-grid::-webkit-scrollbar {
        display: none;
    }
    
    .gallery-item {
        flex: 0 0 85vw !important; /* Almost full width */
        height: 60vh !important;
        scroll-snap-align: center;
        border-radius: 24px !important;
        overflow: hidden;
        position: relative;
        transform: scale(0.95);
        transition: transform 0.4s ease;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    
    /* Active item in center pops up */
    .gallery-item.is-visible {
        transform: scale(1);
    }
    
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Overlay on images */
    .gallery-item::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
        opacity: 0.8;
    }
    
    .gallery-overlay {
        position: absolute;
        bottom: 20px;
        left: 20px;
        z-index: 2;
        opacity: 1 !important; /* Always visible on mobile style */
        transform: none !important;
        text-align: left !important;
    }
    
    .gallery-title {
        font-size: 1.5rem !important;
        margin-bottom: 4px !important;
    }
    
    .gallery-location {
        font-size: 0.9rem !important;
        opacity: 0.8;
    }

    /* GALLERY INDICATOR (Dots) */
    .mobile-gallery-indicator {
        position: absolute;
        bottom: 110px; /* Above dock */
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(8px);
        border-radius: 20px;
        z-index: 10;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .gallery.in-view .mobile-gallery-indicator {
        opacity: 1;
    }
    
    .gallery-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    }
    
    .gallery-dot.active {
        background: #fff;
        transform: scale(1.3);
        width: 18px; /* Pill shape for active */
        border-radius: 10px;
    }

    /* iOS Style Gallery Modal */
    .gallery-modal {
        background: #000 !important; /* Pitch black for immersion */
    }
    
    .gallery-modal .modal-content {
        padding: 0 !important;
        justify-content: center;
    }
    
    .gallery-modal img {
        width: 100% !important;
        height: auto !important;
        max-height: 80vh !important;
        object-fit: contain !important;
    }
    
    /* Dismiss gesture hint */
    .modal-mobile-handle {
        position: absolute;
        top: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 10px;
        z-index: 10;
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 1024px) {
    .mobile-dock-container,
    .mobile-menu-overlay,
    .mobile-gallery-indicator {
        display: none !important;
    }
}

/* --- MOBILE DOCK (Floating Bottom Bar) --- */
.mobile-dock-container {
    position: fixed;
    bottom: 24px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 9999;
    pointer-events: none; /* Let clicks pass through around the dock */
    padding: 0 20px;
}

.mobile-dock {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 
        0 10px 40px -10px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform-origin: bottom center;
}

.dock-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dock-item:active {
    transform: scale(0.9);
}

.dock-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.dock-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.dock-center {
    margin: 0 8px;
}

/* DOCK LANGUAGE TOGGLE */
.dock-lang-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.dock-lang-toggle .lang-current {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.05em;
}

.dock-lang-toggle svg {
    color: rgba(255, 255, 255, 0.6);
}

.dock-lang-toggle:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.dock-main-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -4px rgba(255, 255, 255, 0.3);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 10;
    margin-top: -20px; /* Pop out effect */
}

.dock-main-btn:active {
    transform: scale(0.92);
}

.dock-icon img {
    width: 32px;
    height: auto;
    filter: brightness(0); /* Make logo black */
}

.dock-close-icon {
    position: absolute;
    color: #000;
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
    transition: all 0.4s ease;
}

/* Menu Open State for Dock */
body.menu-open .dock-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0.5);
}

body.menu-open .dock-close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

body.menu-open .mobile-dock {
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
}

/* Floating FAB style for menu button when dock is hidden/morphed */
body.menu-open .dock-main-btn {
    transform: scale(1.1);
    background: #fff;
    z-index: 10001; /* Above overlay (10000) */
    position: fixed;
    bottom: 34px;
    left: 50%;
    margin-left: -28px; /* Center perfectly */
    pointer-events: auto !important; /* MUST stay clickable */
}

/* --- IMMERSIVE OVERLAY MENU --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 10, 20, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    opacity: 0;
    transform: scale(1.1);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* CLOSE BUTTON */
.menu-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

body.menu-open .menu-close-btn {
    opacity: 1;
    transform: scale(1);
}

.menu-close-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.2);
}

.menu-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    padding-bottom: 120px; /* Space for the button */
}

.menu-links {
    display: flex;
    flex-direction: column;
    gap: 32px;
    text-align: center;
    width: 100%;
}

.menu-link {
    text-decoration: none;
    color: #fff;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.link-text {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.link-sub {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
    font-weight: 500;
}

.menu-footer {
    position: absolute;
    bottom: 120px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease 0.3s;
}

.menu-lang-selector {
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 100px;
}

.menu-lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-lang-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-portal-btn {
    color: #fff;
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    transition: all 0.3s ease;
}

/* OPEN STATES */
body.menu-open {
    overflow: hidden; /* Prevent scrolling when menu is open */
}

body.menu-open .mobile-menu-overlay {
    pointer-events: auto;
    opacity: 1;
}

body.menu-open .menu-backdrop {
    opacity: 1;
    transform: scale(1);
}

body.menu-open .menu-link {
    opacity: 1;
    transform: translateY(0);
}

body.menu-open .menu-footer {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Animations */
body.menu-open .menu-link:nth-child(1) { transition-delay: 0.1s; }
body.menu-open .menu-link:nth-child(2) { transition-delay: 0.15s; }
body.menu-open .menu-link:nth-child(3) { transition-delay: 0.2s; }
body.menu-open .menu-link:nth-child(4) { transition-delay: 0.25s; }
body.menu-open .menu-link:nth-child(5) { transition-delay: 0.3s; }

/* Active States for Links */
.menu-link.active .link-text {
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
}

.menu-link.active .link-sub {
    color: #38bdf8;
}

/* --- ADJUSTMENTS FOR SAFE AREAS (iPhone X+) --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-dock-container {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
    
    body.menu-open .dock-main-btn {
        bottom: calc(34px + env(safe-area-inset-bottom));
    }
}
