/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* When secondary header is visible, soften the primary header shadow and add bottom border */
    .nav-container.secondary-active {
        box-shadow: none; /* fade to none using existing transitions */
        border-bottom: 1px solid #c8c7ba;
        /* Turn off box-shadow animation to prevent color flashing at the seam */
        transition: box-shadow 0s, background-color 0.3s ease;
    }

    .text-box.expanded {
        width: 95vw !important;
        height: 80vh !important;
        border-radius: 16px !important;
    }

    .text-box.expanded .text-box-content {
        padding: 30px 20px !important;
    }

    .text-box.expanded .text-box-title {
        font-size: 28px !important;
        margin-bottom: 15px !important;
    }

    .text-box.expanded .text-box-description {
        font-size: 14px !important;
        margin-top: 15px !important;
    }

    .close-button {
        top: 0 !important;
        right: 0 !important;
        width: 35px !important;
        height: 35px !important;
        font-size: 20px !important;
    }
    /* Remove extra red outline on mobile taps */
    .close-button:focus-visible {
        outline: none !important;
        outline-offset: 0 !important;
    }

    .scroll-hint {
        bottom: 10px;
    }
    /* Keep scroll hint text on a single line on mobile */
    .scroll-hint span {
        white-space: nowrap;
    }
    
    /* Top scroll hint hidden on mobile */
    .top-scroll-hint {
        display: none;
    }
    
    .scroll-arrow {
        font-size: 4vw;
    }

    .click-indicator {
        font-size: 11px;
        padding: 5px 10px;
        top: -30px;
    }

    /* Secondary header (mobile-only) */
    .secondary-header {
        position: fixed;
        left: 0;
        right: 0;
        z-index: var(--z-secondary-header);
        display: flex;
        justify-content: center;
        box-sizing: border-box;
        padding: 10px 25px; /* match .nav-container on mobile */
        /* base background moved to tint layer for glass effect */
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
        transform: translateY(-100%);
        transition: transform 0.35s ease, opacity 0.25s ease;
        pointer-events: none; /* disabled until shown */
        margin: 1.4vh;
        opacity: 0; /* hidden until JS positions and reveals it */
        /* Sharp top corners, true half-circle bottom starting at top corners */
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 50% 100%; /* x-radius 50% of width, y-radius 100% of height */
        border-bottom-right-radius: 50% 100%;
    }
    /* Glass layers for secondary header to match main header */
    .secondary-header.liquidGlass-wrapper .liquidGlass-effect {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 50% 100%;
        border-bottom-right-radius: 50% 100%;
    }
    .secondary-header.liquidGlass-wrapper .liquidGlass-tint {
        background: rgba(174, 187, 170, 0.65);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 50% 100%;
        border-bottom-right-radius: 50% 100%;
    }
    .secondary-header.liquidGlass-wrapper .liquidGlass-shine {
        box-shadow: inset 2px 2px 2px rgba(255, 255, 255, 0.4),
                    inset -1px -1px 1px rgba(0, 0, 0, 0.12),
                          0 3px 14px rgba(0, 0, 0, 0.12);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 50% 100%;
        border-bottom-right-radius: 50% 100%;
    }
    .secondary-header.liquidGlass-wrapper .liquidGlass-text {
        position: relative;
        z-index: 1;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .secondary-header.show {
        transform: translateY(-10%);
        pointer-events: auto;
        opacity: 1;
    }
    .secondary-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-weight: 700;
        letter-spacing: 0.2px;
        text-decoration: none;
        color: var(--secondary-color);
        padding: 10px 14px;
        transform: translateY(-10%);
        line-height: 1.05;
        transition: transform 0.15s ease;
        background: none !important;
        white-space: nowrap;
    }

    .logo-container {
        width: 90vw;
        height: 90vw
    }

    .text-box {
        width: 45vw;
        aspect-ratio: 1.8;
        padding: 1vw !important;
    }

    .text-box-title {
        font-size: 5vw !important;
    }

    .text-box.expanded {
        height: 75vh !important;
    }

    /* Stack ordering: mobile nav should sit above text boxes but below header */
    .mobile-nav {
        z-index: var(--z-mobile-nav);
    }

    /* Ensure front text boxes sit just under the mobile nav when on small viewports */
    .text-box.is-front {
        z-index: calc(var(--z-mobile-nav) - 1);
    }

    .scroll-hint {
        font-size: 4vw;
        letter-spacing: 1px;
    }
    /* Re-affirm no-wrap on very small screens */
    .scroll-hint span {
        white-space: nowrap;
    }
    
    /* Top scroll hint for very small screens */
    .top-scroll-hint {
        font-size: 3.5vw;
        letter-spacing: 0.5px;
    }
    
    .top-scroll-hint span {
        white-space: nowrap;
    }

    .text-box-nav {
        display: none;
    }

    .site-credit-desktop {
        display: none;
    }
    .text-box-nav {
        display: none;
    }
    /* Ensure reasonable text-box travel distance */
    :root { --text-box-max-travel: 200px; }

    .cookie-text {
        font-size: 3.4vw;
    }
    .cookie-accept {
        font-size: 3.4vw;
        padding: 1vw;
    }
    .cookie-popup {
        padding: 1vw !important;
        border-radius: 1vh;
        bottom: 2vw;
        right: 2vw;
        gap: 1vw;
    }
}