/*
 * Responsieve floating header
 * Desktop en tablet blijven gecentreerd; op telefoons gebruiken we vaste
 * veilige zijranden zodat de header nooit buiten de zichtbare viewport valt.
 */
.site-header {
    position: fixed;
    z-index: 50;
    top: max(16px, env(safe-area-inset-top, 0px));
    left: 50%;
    right: auto;
    width: min(1380px, calc(100% - 48px));
    min-width: 0;
    min-height: 64px;
    margin: 0;
    padding: 10px 12px 10px 20px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    background: rgba(7, 16, 14, .82);
    box-shadow: 0 14px 45px rgba(0, 0, 0, .28);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
    backdrop-filter: blur(20px) saturate(135%);
    isolation: isolate;
}

.site-header .logo {
    min-width: 0;
    flex: 0 1 auto;
    white-space: nowrap;
}

.site-header .logo-copy {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-header .main-nav {
    min-width: 0;
    margin-left: auto;
}

.site-header .menu-toggle {
    flex: 0 0 auto;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
}

.site-header .menu-toggle:focus-visible,
.site-header a:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

/* Tablet en compacte laptop. */
@media (max-width: 1024px) {
    .site-header {
        top: max(12px, env(safe-area-inset-top, 0px));
        width: calc(100% - 32px);
        min-height: 62px;
        gap: 14px;
        padding: 10px 11px 10px 18px;
        border-radius: 17px;
    }

    .site-header .menu-toggle {
        display: flex;
        width: 42px;
        height: 42px;
        padding: 10px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 7px;
        border: 1px solid rgba(255, 255, 255, .1);
        background: rgba(255, 255, 255, .04);
        cursor: pointer;
    }

    .site-header .menu-toggle span {
        display: block;
        width: 20px;
        height: 1.5px;
        flex: 0 0 auto;
        background: currentColor;
        transition: transform .25s ease, opacity .25s ease;
    }

    .site-header .menu-toggle.active span:first-child {
        transform: translateY(4.25px) rotate(45deg);
    }

    .site-header .menu-toggle.active span:last-child {
        transform: translateY(-4.25px) rotate(-45deg);
    }

    .site-header .main-nav {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        left: 0;
        display: flex;
        margin: 0;
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        max-height: calc(100dvh - 100px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 17px;
        background: rgba(7, 16, 14, .97);
        box-shadow: 0 18px 45px rgba(0, 0, 0, .35);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity .2s ease, transform .2s ease, visibility .2s;
    }

    .site-header .main-nav.open {
        display: flex;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .site-header .main-nav a {
        width: 100%;
        min-height: 46px;
        display: flex;
        align-items: center;
        padding: 11px 13px;
        border-radius: 10px;
    }

    .site-header .main-nav > a:not(.nav-cta):hover {
        background: rgba(255, 255, 255, .045);
    }

    .site-header .nav-cta {
        justify-content: center;
        margin-top: 5px;
    }
}

/*
 * Telefoons, inclusief grotere telefoons en landscape.
 * Geen translate/viewport-breedte: left + right houden de header betrouwbaar
 * binnen safe areas van iOS en Android.
 */
@media (max-width: 767px) {
    .site-header {
        top: max(8px, calc(env(safe-area-inset-top, 0px) + 6px));
        right: max(10px, calc(env(safe-area-inset-right, 0px) + 10px));
        left: max(10px, calc(env(safe-area-inset-left, 0px) + 10px));
        width: auto;
        max-width: none;
        min-height: 54px;
        padding: 7px 7px 7px 13px;
        gap: 8px;
        transform: none;
        border-radius: 16px;
        background: rgba(7, 16, 14, .92);
        box-shadow: 0 10px 32px rgba(0, 0, 0, .34);
    }

    .site-header .logo {
        max-width: calc(100% - 48px);
        gap: 8px;
    }

    .site-header .logo-mark {
        width: 25px;
        height: 25px;
        flex: 0 0 25px;
    }

    .site-header .logo-mark i {
        width: 11px;
        height: 11px;
        border-width: 1.5px;
    }

    .site-header .logo-copy {
        font-size: clamp(11px, 3.7vw, 13px);
        letter-spacing: -.01em;
    }

    .site-header .menu-toggle {
        width: 38px;
        height: 38px;
        padding: 8px;
        border-radius: 11px;
    }

    .site-header .menu-toggle span {
        width: 18px;
    }

    .site-header .main-nav {
        top: calc(100% + 8px);
        padding: 8px;
        border-radius: 16px;
    }
}

/* Zeer smalle telefoons en vergrote systeemtekst. */
@media (max-width: 359px) {
    .site-header {
        right: max(7px, calc(env(safe-area-inset-right, 0px) + 7px));
        left: max(7px, calc(env(safe-area-inset-left, 0px) + 7px));
        padding-left: 10px;
    }

    .site-header .logo {
        gap: 6px;
    }

    .site-header .logo-copy {
        font-size: 11px;
    }
}

/* Compacte landscapeweergave op telefoons. */
@media (max-width: 767px) and (max-height: 500px) {
    .site-header {
        top: max(5px, calc(env(safe-area-inset-top, 0px) + 3px));
        min-height: 48px;
        padding-block: 5px;
    }

    .site-header .menu-toggle {
        width: 36px;
        height: 36px;
    }

    .site-header .main-nav {
        max-height: calc(100dvh - 70px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header .main-nav,
    .site-header .menu-toggle span {
        transition: none;
    }
}
