/* ================= MOBILE OVERRIDES (Max Width 768px) ================= */

@media (max-width: 768px) {
    
    /* --- 1. Navigation Fix --- */
    .nav-links.desktop-only {
        display: none;
    }

    .hamburger {
        display: block;
        cursor: pointer;
        background: none;
        border: none;
        position: relative; 
        z-index: 1001; 
        padding: 10px; /* Easier to tap */
    }

    .hamburger .bar {
        display: block;
        width: 25px;
        height: 2px;
        margin: 5px auto;
        background-color: var(--color-text-primary);
        transition: all 0.3s ease-in-out;
    }

    /* Animate Hamburger to X */
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Full Screen Mobile Menu */
    .nav-links-overlay {
        position: fixed;
        left: -100%;
        top: 0;
        width: 100%;
        height: 100vh; /* Fallback */
        height: 100dvh; /* Dynamic height for mobile browsers */
        background-color: var(--color-primary);
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding-top: 100px; /* Reduced from 140px to fit short screens */
        z-index: 999;
        overflow-y: auto; 
    }

    .nav-links-overlay.active {
        left: 0;
    }

    .nav-links-inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        min-height: 100%;
        padding-bottom: 60px; 
    }

    .nav-links-inner a {
        font-size: 1.3rem; /* Slightly smaller for better fit */
        margin: 12px 0;
        color: var(--color-text-primary);
        font-weight: 500;
        text-transform: uppercase;
        opacity: 0;
        transform: translateY(20px);
        transition: 0.3s;
    }

    .nav-links-overlay.active .nav-links-inner a {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger Animations */
    .nav-links-overlay.active .nav-links-inner a:nth-child(1) { transition-delay: 0.1s; }
    .nav-links-overlay.active .nav-links-inner a:nth-child(2) { transition-delay: 0.15s; }
    .nav-links-overlay.active .nav-links-inner a:nth-child(3) { transition-delay: 0.2s; }
    .nav-links-overlay.active .nav-links-inner a:nth-child(4) { transition-delay: 0.25s; }
    .nav-links-overlay.active .nav-links-inner a:nth-child(5) { transition-delay: 0.3s; }
    .nav-links-overlay.active .nav-links-inner a:nth-child(6) { transition-delay: 0.35s; }

    /* --- 2. General Layout & Grid Fixes --- */
    .container {
        padding: 0 20px;
        width: 100%;
    }

    .section-padding {
        padding: 60px 0;
    }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .process-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 20px;
    }

    .process-card {
        margin-top: 0;
        text-align: center;
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }

    /* --- 3. Typography Adjustments --- */
    .section-header {
        margin-bottom: 40px;
    }

    .section-header h2 {
        font-size: 2rem; /* Reduced from 2.2rem */
        line-height: 1.2;
    }

    .hero h1 {
        font-size: 2.5rem;
        line-height: 1.1;
    }

    .hero p {
        font-size: 1rem;
        padding: 0 10px;
    }

    /* --- 4. About Us Section Fixes --- */
    #about .hero {
        height: auto !important;
        min-height: auto; 
        padding-top: 120px; 
        padding-bottom: 60px;
    }

    #about .hero-content h2 {
        margin-top: 20px;
        font-size: 2rem;
    }

    .about-wrapper {
        flex-direction: column;
        gap: 30px;
    }

    .about-image {
        width: 100%;
        margin-bottom: 10px;
    }

    .about-decoration {
        display: none; /* Hide on mobile to prevent overflow */
    }

    .about-text {
        text-align: center;
    }

    .about-stats {
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
    }

    /* --- 5. Sustainability Section Fixes --- */
    .sus-row {
        flex-direction: column !important;
        gap: 30px;
        margin-bottom: 50px;
        text-align: center;
    }

    .sus-row:nth-child(even) {
        flex-direction: column !important;
    }

    .sus-text {
        width: 100%;
    }

    .sus-text h3::after {
        margin: 10px auto 0 auto;
    }

    .sus-image-group {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .sus-image-group img {
        width: 48%; /* Keep side-by-side on standard mobile */
    }

    /* --- 6. Sliders & Stack Effect --- */
    .slider-container {
        height: auto; 
        aspect-ratio: 1 / 1; /* Square for mobile */
        max-height: 60vh;
    }

    .slider-container:has(#exhibitionTrack),
    .slider-container.horizontal-mobile {
        height: 400px !important;
        aspect-ratio: auto !important;
    }

    .slide-caption h3 {
        font-size: 1.8rem;
    }

    .stack-arena {
        height: 350px;
    }

    .card-stack-item {
        width: 200px;
        height: 130px;
    }

    .brand-reveal {
        font-size: 2.5rem;
    }

    /* --- 7. Feedback Form --- */
    .feedback-section {
        padding: 40px 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    img.icon-box {
        width: 50px;           /* Slightly smaller on mobile devices */
    }

    /* ================= SUSTAINABILITY (VERTICAL STACK LAYOUT) ================= */

    .sus-block {
        margin-bottom: 40px;
    }

    .sus-content {
        text-align: left; /* Keep left align or change to center if preferred */
    }

    .sus-images {
        /* 1. Allow wrapping */
        display: flex !important;
        flex-wrap: wrap !important; /* This is the key: allows items to drop to the next line */
        
        /* 2. Center them when wrapped */
        justify-content: center !important;
        align-items: center !important;
        
        /* 3. Handle spacing */
        gap: 20px !important; /* Adds space between the stacked images */
        
        /* 4. Ensure container handles the height */
        height: auto !important;
        width: 100% !important;
        
        /* 5. Prevent horizontal scroll on the container itself */
        overflow-x: hidden !important;
    }
    
    .sus-images img {
        /* 6. Do NOT force resize. Keep original dimensions. */
        width: auto !important;
        height: auto !important;
        max-width: 100% !important; /* Only shrink if the image is WIDER than the screen itself */
        
        /* 7. Reset positioning */
        margin: 0 !important;
        position: static !important; /* Removes absolute positioning if present */
    }
}

/* ================= ULTRA SMALL MOBILE (360px width or less) ================= */

@media (max-width: 380px) {

    /* Tighter container to prevent edge touching */
    .container {
        padding: 0 16px;
    }

    /* Shrink Headings further */
    .section-header h2 {
        font-size: 1.75rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    /* Stack Sustainability Images Vertically */
    /* On 360px, side-by-side images are too small */
    .sus-image-group {
        flex-direction: column;
        gap: 15px;
    }

    .sus-image-group img {
        width: 100%; /* Full width images */
        max-width: 280px; /* Prevent them getting huge */
    }

    /* Adjust About Stats */
    .about-stats {
        gap: 15px;
    }
    
    .stat-item h4 {
        font-size: 2rem;
    }

    /* Fix Navigation for Short Screens (645px height) */
    .nav-links-overlay {
        padding-top: 90px;
    }
    
    .nav-links-inner a {
        font-size: 1.1rem;
        margin: 10px 0;
    }

    /* Adjust Stack Effect */
    .brand-reveal {
        font-size: 2rem;
    }
    
    .card-stack-item {
        width: 180px;
        height: 110px;
    }
}

@media (max-width: 480px) {
    
    /* 1. The Container: Force vertical stacking, no scrolling */
    .sus-images {
        display: flex;
        flex-direction: column; /* Stacks images top-to-bottom */
        flex-wrap: wrap !important; /* Allows wrapping */
        align-items: center; /* Centers images */
        justify-content: center;
        overflow-x: hidden !important; /* FORCE hides the scrollbar */
        width: 100%;
        gap: 20px; /* Space between the stacked images */
    }

    /* 2. The Images: Resize to fit the width */
    .sus-images img {
        /* Make image take full width of container, but respect padding */
        width: 100% !important; 
        max-width: 280px !important; /* Cap width so they don't look huge */
        
        /* Let height adjust automatically to keep the picture looking right */
        height: auto !important; 
        max-height: none !important; /* Remove height limits so they don't squish */
        
        /* Ensure padding/border doesn't add to width */
        box-sizing: border-box; 
        margin: 0 auto; /* Center align */
    }
}