/**
 * Menu mobile — panneau hors du header, ouverture via #menu-toggle (CSS pur)
 */

.menu-toggle {
    position: fixed;
    left: -9999px;
    top: 0;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 61, 86, 0.65);
    z-index: 9998;
    cursor: pointer;
}

/* Masquer le tiroir mobile sur desktop */
.nav-menu--mobile {
    display: none;
}

.nav-menu--desktop {
    display: block;
}

@media (max-width: 768px) {
    .nav-menu--desktop {
        display: none !important;
    }

    .nav-menu--mobile {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: min(320px, 90vw) !important;
        height: 100% !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #0f3d56 !important;
        z-index: 9999 !important;
        flex-direction: column !important;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4) !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #menu-toggle:checked ~ .nav-overlay,
    .nav-overlay.is-open {
        display: block !important;
    }

    #menu-toggle:checked ~ .nav-menu--mobile,
    .nav-menu--mobile.is-open {
        transform: translateX(0) !important;
    }

    #menu-toggle:checked ~ .header .hamburger span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    #menu-toggle:checked ~ .header .hamburger span:nth-child(2) {
        opacity: 0;
    }

    #menu-toggle:checked ~ .header .hamburger span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    body:has(#menu-toggle:checked),
    body.menu-open {
        overflow: hidden;
    }

    .nav-menu--mobile .nav-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        flex-shrink: 0;
    }

    .nav-menu--mobile .nav-menu-title {
        color: #fff;
        font-weight: 600;
        font-size: 1.05rem;
    }

    .nav-menu--mobile .nav-menu-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .nav-menu--mobile .nav-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0.5rem 0 !important;
        flex: 1 !important;
    }

    .nav-menu--mobile .nav-list li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-menu--mobile .nav-link {
        display: block !important;
        padding: 1rem 1.25rem !important;
        color: #fff !important;
        font-size: 1.05rem !important;
    }

    .nav-menu--mobile .nav-link.active {
        color: #f39c12 !important;
        background: rgba(255, 255, 255, 0.06);
    }

    .nav-menu--mobile .nav-menu-footer {
        display: block;
        padding: 1.25rem;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .nav-menu--mobile .nav-menu-footer .btn-full {
        width: 100%;
        justify-content: center;
    }

    .hamburger {
        display: flex !important;
        cursor: pointer;
        z-index: 10001;
        position: relative;
    }

    .btn-nav-desktop {
        display: none !important;
    }

    .header {
        overflow: visible !important;
        z-index: 1000 !important;
    }
}

@media (min-width: 769px) {
    .nav-menu--mobile,
    .nav-overlay,
    .menu-toggle {
        display: none !important;
    }

    .hamburger {
        display: none !important;
    }

    .header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .nav-menu--desktop {
        flex: 1;
        display: flex !important;
        justify-content: center;
    }

    .nav-menu--desktop .nav-list {
        display: flex;
        flex-direction: row;
        gap: 1.5rem;
        justify-content: center;
    }
}
