/* ==========================================================
   Mobile menu — load AFTER your main stylesheet
   ========================================================== */

/* overlay (created by script.js) */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 30, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}
.nav-overlay.show {
    opacity: 1;
    visibility: visible;
}

body.no-scroll,
body.menu-open {
    overflow: hidden;
    touch-action: none;
}

/* desktop: burger hidden */
.burger {
    display: none;
}

@media (max-width: 960px) {
    /*
     * IMPORTANT: backdrop-filter / transform / filter on the header turn
     * position:fixed children into "header-sized" boxes. That is the most
     * common reason a mobile menu is cut off or invisible. Remove them
     * while the menu is open.
     */
    body.menu-open .header {
        z-index: 1001;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transform: none !important;
        filter: none !important;
    }

    /* ---------- burger ---------- */
    .burger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        margin-left: auto;
        border: 0;
        border-radius: 10px;
        background: transparent;
        cursor: pointer;
        position: relative;
        z-index: 1003;
        -webkit-tap-highlight-color: transparent;
    }
    .burger span {
        display: block;
        width: 24px;
        height: 2px;
        border-radius: 2px;
        background: var(--ink, #12313a);
        transition: transform 0.3s ease, opacity 0.2s ease;
    }
    .burger.is-active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .burger.is-active span:nth-child(2) {
        opacity: 0;
    }
    .burger.is-active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* ---------- off-canvas panel ---------- */
    .nav {
        position: fixed !important;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(340px, 86vw);
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 80px 20px 28px;
        display: flex !important;
        flex-direction: column;
        gap: 20px;
        background: var(--surface, #ffffff);
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.35s ease, visibility 0.35s ease;
        z-index: 1002;
    }
    .nav.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .nav__list {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .nav__list > li {
        width: 100%;
    }

    .nav__link {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 14px 4px;
        font-size: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    }
    .nav__link .ic--sm {
        transition: transform 0.25s ease;
    }
    .nav__drop.is-open > .nav__link .ic--sm {
        transform: rotate(180deg);
    }

    /* ---------- dropdowns become accordions ---------- */
    .nav__drop .mega,
    .nav__drop:hover .mega,
    .nav__drop:focus-within .mega {
        position: static !important;
        display: none !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 6px 0 10px 12px !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: 0 !important;
        background: transparent !important;
        grid-template-columns: 1fr !important;
        pointer-events: auto !important;
    }
    .nav__drop.is-open > .mega {
        display: block !important;
    }

    .mega a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 6px;
        font-size: 0.95rem;
    }
    .mega__col {
        margin-bottom: 8px;
    }
    .mega__col h4 {
        margin: 10px 6px 4px;
        font-size: 0.75rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        opacity: 0.6;
    }
    .mega__all {
        margin-top: 6px;
        font-weight: 600;
    }

    .nav__cta {
        display: inline-flex !important;
        justify-content: center;
        width: 100%;
        margin-top: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav,
    .nav-overlay,
    .burger span {
        transition: none !important;
    }
}