/* ═══════════════════════════════════════════════════════════════
   Mobile & tablet header — desktop (≥992px) untouched
   Menu/overlay sit outside .site-header so nothing clips them
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 991.98px) {
    :root {
        --header-height: 88px;
    }

    .site-header .header-shell {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-header .header-bar {
        gap: 12px;
        min-height: 0;
        align-items: center;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .site-header .header-bar__brand {
        flex: 0 1 auto;
        min-width: 0;
        max-width: calc(100% - 64px);
    }

    .site-header .header-bar__actions {
        flex: 0 0 auto;
    }

    .site-header .header-bar__brand .header-brand__media {
        max-width: 100%;
    }

    .site-header .header-bar__brand .header-brand__img--default {
        max-width: 100%;
        max-height: 64px;
        width: auto;
        height: auto;
        object-fit: contain;
        object-position: left center;
    }

    .site-header.is-sticky {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .site-header.is-sticky.is-sticky-enter {
        animation: none;
        transform: none;
    }

    .site-header.is-sticky .header-bar__brand .header-brand__img--sticky {
        max-height: 40px;
        max-width: min(160px, 52vw);
    }

    /* ─── Hamburger ─── */
    .header-toggle {
        flex-shrink: 0;
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        border-radius: 14px;
        -webkit-tap-highlight-color: transparent;
    }

    .header-toggle__line {
        width: 20px;
        transform-origin: center;
    }

    .header-toggle.is-active .header-toggle__line:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .header-toggle.is-active .header-toggle__line:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* ─── Overlay (viewport layer, above page) ─── */
    .header-overlay {
        position: fixed;
        inset: 0;
        z-index: 1100;
        background: rgba(15, 22, 48, 0.55);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s;
    }

    .header-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* ─── Off-canvas drawer ─── */
    .header-mobile {
        position: fixed;
        inset: 0;
        z-index: 1101;
        width: 100%;
        height: 100%;
        height: 100dvh;
        pointer-events: none;
        visibility: hidden;
    }

    .header-mobile.is-open {
        pointer-events: auto;
        visibility: visible;
    }

    .header-mobile__backdrop {
        position: fixed;
        inset: 0;
        z-index: 0;
        background: rgba(15, 22, 48, 0.35);
        opacity: 0;
        transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .header-mobile.is-open .header-mobile__backdrop {
        opacity: 1;
    }

    .header-mobile__panel {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        bottom: 0;
        z-index: 1;
        display: flex;
        flex-direction: column;
        width: min(88vw, 340px);
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        padding:
            max(20px, env(safe-area-inset-top))
            max(20px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(24px, env(safe-area-inset-left));
        overflow: hidden;
        background: linear-gradient(
            165deg,
            rgba(26, 39, 68, 0.98) 0%,
            rgba(15, 22, 48, 0.99) 55%,
            rgba(36, 51, 102, 0.98) 100%
        );
        backdrop-filter: blur(28px) saturate(1.4);
        -webkit-backdrop-filter: blur(28px) saturate(1.4);
        border-left: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow:
            -20px 0 60px rgba(0, 0, 0, 0.35),
            inset 1px 0 0 rgba(255, 255, 255, 0.08);
        transform: translate3d(100%, 0, 0);
        opacity: 1;
        visibility: visible;
        transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform;
        pointer-events: auto;
    }

    .header-mobile.is-open .header-mobile__panel {
        transform: translate3d(0, 0, 0);
    }

    .header-mobile__glow {
        top: 8%;
        right: -40%;
        width: 90%;
        height: 40%;
        opacity: 0.85;
    }

    .header-mobile__top {
        flex-shrink: 0;
        margin-bottom: 12px;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header-mobile__label {
        flex-shrink: 0;
        margin-bottom: 16px;
    }

    .header-mobile__nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        justify-content: flex-start !important;
        padding: 8px 0 16px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
    }

    .header-mobile__nav::-webkit-scrollbar {
        width: 5px;
    }

    .header-mobile__nav::-webkit-scrollbar-track {
        background: transparent;
    }

    .header-mobile__nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.28);
        border-radius: 6px;
    }

    .header-mobile__nav::-webkit-scrollbar-button {
        display: none;
        width: 0;
        height: 0;
    }

    .header-mobile__list {
        width: 100%;
    }

    .header-mobile__link {
        align-items: center;
        min-height: 52px;
        padding: 14px 12px;
        border-radius: 14px;
        border-bottom: none;
        margin-bottom: 6px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.06);
        -webkit-tap-highlight-color: transparent;
    }

    .header-mobile__link:active {
        background: rgba(232, 81, 38, 0.15);
        border-color: rgba(232, 81, 38, 0.25);
    }

    .header-mobile__link.is-active {
        background: rgba(232, 81, 38, 0.18);
        border-color: rgba(232, 81, 38, 0.35);
    }

    .header-mobile__text {
        font-size: clamp(1.25rem, 4.5vw, 1.5rem);
    }

    .header-mobile__close {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .header-mobile__footer {
        flex-shrink: 0;
        padding-top: 20px;
        margin-top: auto;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header-mobile__footer .header-cta {
        min-height: 52px;
        padding: 16px 24px;
        font-size: 0.875rem;
    }

    body.header-locked {
        overflow: hidden !important;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    :root {
        --header-height: 96px;
    }

    .site-header .header-shell {
        padding-left: 24px;
        padding-right: 24px;
    }

    .site-header .header-bar__brand .header-brand__img--default {
        max-height: 72px;
    }

    .site-header.is-sticky .header-bar__brand .header-brand__img--sticky {
        max-height: 44px;
        max-width: 200px;
    }

    .header-mobile__panel {
        width: min(72vw, 400px);
    }

    .header-mobile__text {
        font-size: 1.625rem;
    }
}

/* Small phones */
@media (max-width: 575.98px) {
    :root {
        --header-height: 80px;
    }

    .site-header .header-bar__brand .header-brand__img--default {
        max-height: 65px;
    }

    .site-header.is-sticky .header-bar__brand .header-brand__img--sticky {
        max-height: 36px;
        max-width: min(140px, 48vw);
    }

    .header-mobile__panel {
        width: min(92vw, 100%);
    }
}

@media (max-width: 991.98px) and (prefers-reduced-motion: reduce) {
    .header-mobile__panel {
        transition-duration: 0.01ms;
    }

    .header-overlay,
    .header-mobile__backdrop {
        transition-duration: 0.01ms;
    }
}
