:root {
    --header-height: 78px;
}

.site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 5000;
    width: 100%;
    min-height: var(--header-height);
    color: var(--white);
    background-color: transparent;
    transition:
        background-color 220ms ease,
        box-shadow 220ms ease,
        backdrop-filter 220ms ease,
        -webkit-backdrop-filter 220ms ease;
}

.site-header.is-scrolled,
.site-header.is-menu-open,
.site-header.site-header-solid {
    background-color: rgb(18 38 31 / 97%);
    box-shadow: 0 8px 28px rgb(0 0 0 / 20%);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.site-navigation {
    display: flex;
    width: min(100% - 40px, var(--content-width));
    min-height: var(--header-height);
    margin: 0 auto;
    gap: 30px;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    position: relative;
    z-index: 5002;
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 850;
    letter-spacing: -0.025em;
    line-height: 1.1;
    text-decoration: none;
    text-shadow: 0 2px 12px rgb(0 0 0 / 30%);
}

.site-menu {
    display: flex;
    gap: 26px;
    align-items: center;
}

.site-menu > a,
.site-dropdown-toggle {
    display: inline-flex;
    min-height: 44px;
    padding: 8px 0;
    align-items: center;
    color: var(--white);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 720;
    text-decoration: none;
}

.site-menu > a:hover,
.site-menu > a:focus-visible,
.site-dropdown-toggle:hover,
.site-dropdown-toggle:focus-visible {
    color: #f2d48b;
}

.site-menu > a:focus-visible,
.site-dropdown-toggle:focus-visible,
.menu-toggle:focus-visible {
    outline: 3px solid rgb(211 164 73 / 55%);
    outline-offset: 4px;
}

.site-dropdown {
    position: relative;
}

.site-dropdown-toggle {
    gap: 7px;
}

.site-dropdown-arrow {
    display: inline-block;
    font-size: 0.7rem;
    transition: transform 180ms ease;
}

.site-dropdown.is-open .site-dropdown-arrow {
    transform: rotate(180deg);
}

.site-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    visibility: hidden;
    width: min(280px, calc(100vw - 32px));
    padding: 10px;
    background: rgb(255 253 248 / 98%);
    border: 1px solid rgb(36 74 58 / 16%);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgb(0 0 0 / 22%);
    opacity: 0;
    transform: translateY(-8px);
    transition:
        visibility 180ms ease,
        opacity 180ms ease,
        transform 180ms ease;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.site-dropdown:hover .site-dropdown-panel,
.site-dropdown:focus-within .site-dropdown-panel,
.site-dropdown.is-open .site-dropdown-panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.site-dropdown-panel a {
    display: flex;
    gap: 10px;
    min-height: 45px;
    padding: 10px 12px;
    align-items: center;
    color: var(--forest-dark);
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 720;
    text-decoration: none;
}

.site-dropdown-panel a:hover,
.site-dropdown-panel a:focus-visible {
    color: var(--forest-dark);
    background: var(--sand);
}

.site-dropdown-separator {
    height: 1px;
    margin: 7px 4px;
    background: var(--border);
}

.menu-toggle {
    position: relative;
    z-index: 5003;
    display: none;
    width: 46px;
    height: 46px;
    padding: 9px;
    color: var(--white);
    background: rgb(18 38 31 / 48%);
    border: 1px solid rgb(255 255 255 / 38%);
    border-radius: 11px;
    cursor: pointer;
    appearance: none;
}

.menu-toggle-line {
    position: absolute;
    left: 10px;
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    pointer-events: none;
    transition:
        top 190ms ease,
        transform 190ms ease,
        opacity 150ms ease;
}

.menu-toggle-line:nth-child(1) {
    top: 14px;
}

.menu-toggle-line:nth-child(2) {
    top: 21px;
}

.menu-toggle-line:nth-child(3) {
    top: 28px;
}

.menu-toggle.is-open .menu-toggle-line:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}

.menu-toggle.is-open .menu-toggle-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-open .menu-toggle-line:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

body.menu-open {
    overflow: hidden;
}

@media (max-width: 820px) {
    :root {
        --header-height: 70px;
    }

    .site-navigation {
        width: min(100% - 30px, var(--content-width));
    }

    .site-logo {
        max-width: calc(100% - 70px);
        font-size: 1.08rem;
    }

    .menu-toggle {
        display: block;
        flex: 0 0 auto;
    }

    .site-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 5001;
        display: flex;
        visibility: hidden;
        width: min(360px, 88vw);
        padding:
            calc(var(--header-height) + 30px)
            24px
            35px;
        gap: 4px;
        overflow-y: auto;
        align-items: stretch;
        flex-direction: column;
        background:
            linear-gradient(
                160deg,
                #173329,
                #12261f
            );
        box-shadow: -15px 0 45px rgb(0 0 0 / 30%);
        opacity: 0;
        pointer-events: none;
        transform: translateX(105%);
        transition:
            visibility 240ms ease,
            opacity 240ms ease,
            transform 240ms ease;
    }

    .site-menu.is-open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    .site-menu > a,
    .site-dropdown-toggle {
        width: 100%;
        min-height: 52px;
        padding: 12px 10px;
        justify-content: space-between;
        border-bottom: 1px solid rgb(255 255 255 / 10%);
        font-size: 1rem;
    }

    .site-dropdown {
        width: 100%;
    }

    .site-dropdown-panel {
        position: static;
        display: none;
        visibility: visible;
        width: 100%;
        margin: 0;
        padding: 6px 0 10px 14px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        transform: none;
        transition: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .site-dropdown:hover .site-dropdown-panel,
    .site-dropdown:focus-within .site-dropdown-panel {
        display: none;
    }

    .site-dropdown.is-open .site-dropdown-panel,
    .site-dropdown.is-open:hover .site-dropdown-panel,
    .site-dropdown.is-open:focus-within .site-dropdown-panel {
        display: grid;
    }

    .site-dropdown-panel a {
        color: rgb(255 255 255 / 86%);
        background: transparent;
    }

    .site-dropdown-panel a:hover,
    .site-dropdown-panel a:focus-visible {
        color: var(--white);
        background: rgb(255 255 255 / 8%);
    }

    .site-dropdown-separator {
        background: rgb(255 255 255 / 12%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header,
    .site-menu,
    .menu-toggle-line,
    .site-dropdown-arrow,
    .site-dropdown-panel {
        transition: none;
    }
}

/*
 * Vollflächige mobile Navigation
 */
@media (max-width: 820px) {
    :root {
        --header-height: 72px;
    }

    .site-header {
        min-height: var(--header-height);
    }

    .site-navigation {
        width: 100%;
        min-height: var(--header-height);
        padding-right: max(18px, env(safe-area-inset-right));
        padding-left: max(18px, env(safe-area-inset-left));
    }

    .site-logo {
        z-index: 5004;
        max-width: calc(100% - 72px);
        color: var(--white);
        font-size: clamp(1rem, 4.5vw, 1.2rem);
        line-height: 1.15;
        white-space: normal;
    }

    .menu-toggle {
        z-index: 5005;
        display: block;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
    }

    /*
     * Das Menü belegt den gesamten sichtbaren Bildschirm.
     */
    .site-menu {
        position: fixed;
        inset: 0;
        z-index: 5001;
        display: flex;
        visibility: hidden;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        margin: 0;
        padding:
            calc(
                var(--header-height) +
                28px +
                env(safe-area-inset-top)
            )
            max(24px, env(safe-area-inset-right))
            calc(36px + env(safe-area-inset-bottom))
            max(24px, env(safe-area-inset-left));
        gap: 6px;
        overflow-x: hidden;
        overflow-y: auto;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        color: var(--white);
        background:
            linear-gradient(
                160deg,
                #173329 0%,
                #12261f 58%,
                #0d1f19 100%
            );
        box-shadow: none;
        opacity: 0;
        pointer-events: none;
        overscroll-behavior: contain;
        transform: translateX(100%);
        transition:
            visibility 260ms ease,
            opacity 260ms ease,
            transform 260ms ease;
        -webkit-overflow-scrolling: touch;
    }

    .site-menu.is-open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    /*
     * Hauptlinks mit großzügigen Touch-Flächen.
     */
    .site-menu > a,
    .site-dropdown-toggle {
        width: 100%;
        min-height: 58px;
        padding: 14px 12px;
        justify-content: space-between;
        color: var(--white);
        background: transparent;
        border: 0;
        border-bottom: 1px solid rgb(255 255 255 / 13%);
        border-radius: 0;
        font-size: clamp(1.05rem, 4.8vw, 1.22rem);
        font-weight: 750;
        line-height: 1.25;
        text-align: left;
    }

    .site-menu > a:hover,
    .site-menu > a:focus-visible,
    .site-dropdown-toggle:hover,
    .site-dropdown-toggle:focus-visible {
        color: #f2d48b;
        background: rgb(255 255 255 / 5%);
    }

    /*
     * Der Dropdown-Bereich nimmt ebenfalls die volle Breite ein.
     */
    .site-dropdown {
        width: 100%;
    }

    .site-dropdown-arrow {
        margin-left: auto;
        font-size: 0.78rem;
    }

    .site-dropdown-panel {
        position: static;
        display: none;
        visibility: visible;
        width: 100%;
        margin: 0;
        padding: 8px 0 12px 14px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        transform: none;
        transition: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    /*
     * Die Desktop-Hover-Regeln auf Touch-Geräten deaktivieren.
     */
    .site-dropdown:hover .site-dropdown-panel,
    .site-dropdown:focus-within .site-dropdown-panel {
        display: none;
    }

    .site-dropdown.is-open .site-dropdown-panel,
    .site-dropdown.is-open:hover .site-dropdown-panel,
    .site-dropdown.is-open:focus-within .site-dropdown-panel {
        display: grid;
    }

    .site-dropdown-panel a {
        display: flex;
        gap: 12px;
        width: 100%;
        min-height: 52px;
        padding: 12px 14px;
        align-items: center;
        color: rgb(255 255 255 / 88%);
        background: transparent;
        border-radius: 10px;
        font-size: clamp(0.98rem, 4.3vw, 1.1rem);
        font-weight: 680;
        line-height: 1.25;
    }

    .site-dropdown-panel a:hover,
    .site-dropdown-panel a:focus-visible {
        color: var(--white);
        background: rgb(255 255 255 / 9%);
    }

    .site-dropdown-separator {
        height: 1px;
        margin: 7px 10px;
        background: rgb(255 255 255 / 12%);
    }

    /*
     * Etwas Abstand nach dem letzten Link.
     */
    .site-menu > :last-child {
        margin-bottom: 20px;
    }

    body.menu-open {
        overflow: hidden;
        touch-action: none;
    }
}

/*
 * Besonders schmale Smartphones.
 */
@media (max-width: 380px) {
    :root {
        --header-height: 68px;
    }

    .site-navigation {
        padding-right: 14px;
        padding-left: 14px;
    }

    .site-logo {
        max-width: calc(100% - 64px);
        font-size: 0.98rem;
    }

    .menu-toggle {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .menu-toggle-line {
        left: 9px;
    }

    .site-menu {
        padding:
            calc(
                var(--header-height) +
                22px +
                env(safe-area-inset-top)
            )
            18px
            calc(28px + env(safe-area-inset-bottom));
    }

    .site-menu > a,
    .site-dropdown-toggle {
        min-height: 54px;
        padding: 12px 9px;
        font-size: 1rem;
    }

    .site-dropdown-panel {
        padding-left: 8px;
    }

    .site-dropdown-panel a {
        min-height: 48px;
        padding: 10px;
        font-size: 0.94rem;
    }
}

/*
 * Smartphones im Querformat:
 * kleinere Abstände, damit alle Links gut erreichbar bleiben.
 */
@media (
    max-width: 920px
) and (
    max-height: 520px
) and (
    orientation: landscape
) {
    :root {
        --header-height: 62px;
    }

    .site-navigation {
        min-height: var(--header-height);
    }

    .site-menu {
        padding:
            calc(
                var(--header-height) +
                12px +
                env(safe-area-inset-top)
            )
            max(24px, env(safe-area-inset-right))
            calc(20px + env(safe-area-inset-bottom))
            max(24px, env(safe-area-inset-left));
        gap: 2px;
    }

    .site-menu > a,
    .site-dropdown-toggle {
        min-height: 46px;
        padding: 9px 12px;
        font-size: 0.98rem;
    }

    .site-dropdown-panel a {
        min-height: 42px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/*
 * Einheitliches Verhalten auf allen Seiten
 */

/*
 * Seiten ohne großes Hero-Bild benötigen Platz für
 * den fest positionierten Header.
 */
.has-solid-header {
    padding-top: var(--header-height);
}

/*
 * Sprungmarken dürfen nicht unter dem Header verschwinden.
 */
#neu,
#karte,
#orte,
#projekt,
#social-media {
    scroll-margin-top: calc(var(--header-height) + 20px);
}

/*
 * Einheitliche Höhe auf allen Seiten.
 */
.site-header,
.site-navigation {
    min-height: var(--header-height);
}

/*
 * Alte Seitenregeln dürfen den gemeinsamen Header
 * nicht verändern.
 */
.site-header .site-navigation {
    padding-top: 0;
    padding-bottom: 0;
}

.site-header .site-menu {
    margin: 0;
}

/*
 * Vollflächige mobile Navigation.
 */
@media (max-width: 820px) {
    :root {
        --header-height: 72px;
    }

    .site-header {
        min-height: var(--header-height);
    }

    .site-navigation {
        width: 100%;
        min-height: var(--header-height);
        padding-right: max(18px, env(safe-area-inset-right));
        padding-left: max(18px, env(safe-area-inset-left));
    }

    .site-logo {
        z-index: 5004;
        max-width: calc(100% - 72px);
        color: var(--white);
        font-size: clamp(1rem, 4.5vw, 1.2rem);
        line-height: 1.15;
        white-space: normal;
    }

    .menu-toggle {
        z-index: 5005;
        display: block;
        width: 48px;
        height: 48px;
        flex: 0 0 48px;
    }

    .site-menu {
        position: fixed;
        inset: 0;
        z-index: 5001;
        display: flex;
        visibility: hidden;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        margin: 0;
        padding:
            calc(
                var(--header-height) +
                28px +
                env(safe-area-inset-top)
            )
            max(24px, env(safe-area-inset-right))
            calc(36px + env(safe-area-inset-bottom))
            max(24px, env(safe-area-inset-left));
        gap: 6px;
        overflow-x: hidden;
        overflow-y: auto;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        color: var(--white);
        background:
            linear-gradient(
                160deg,
                #173329 0%,
                #12261f 58%,
                #0d1f19 100%
            );
        box-shadow: none;
        opacity: 0;
        pointer-events: none;
        overscroll-behavior: contain;
        transform: translateX(100%);
        transition:
            visibility 260ms ease,
            opacity 260ms ease,
            transform 260ms ease;
        -webkit-overflow-scrolling: touch;
    }

    .site-menu.is-open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }

    .site-menu > a,
    .site-dropdown-toggle {
        width: 100%;
        min-height: 58px;
        padding: 14px 12px;
        justify-content: space-between;
        color: var(--white);
        background: transparent;
        border: 0;
        border-bottom: 1px solid rgb(255 255 255 / 13%);
        border-radius: 0;
        font-size: clamp(1.05rem, 4.8vw, 1.22rem);
        font-weight: 750;
        line-height: 1.25;
        text-align: left;
    }

    .site-dropdown {
        width: 100%;
    }

    .site-dropdown-arrow {
        margin-left: auto;
    }

    .site-dropdown-panel {
        position: static;
        display: none;
        visibility: visible;
        width: 100%;
        margin: 0;
        padding: 8px 0 12px 14px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        transform: none;
        transition: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .site-dropdown:hover .site-dropdown-panel,
    .site-dropdown:focus-within .site-dropdown-panel {
        display: none;
    }

    .site-dropdown.is-open .site-dropdown-panel,
    .site-dropdown.is-open:hover .site-dropdown-panel,
    .site-dropdown.is-open:focus-within .site-dropdown-panel {
        display: grid;
    }

    .site-dropdown-panel a {
        display: flex;
        gap: 12px;
        width: 100%;
        min-height: 52px;
        padding: 12px 14px;
        align-items: center;
        color: rgb(255 255 255 / 88%);
        background: transparent;
        border-radius: 10px;
        font-size: clamp(0.98rem, 4.3vw, 1.1rem);
        font-weight: 680;
        line-height: 1.25;
    }

    .site-dropdown-panel a:hover,
    .site-dropdown-panel a:focus-visible {
        color: var(--white);
        background: rgb(255 255 255 / 9%);
    }

    .site-dropdown-separator {
        background: rgb(255 255 255 / 12%);
    }

    .site-menu > :last-child {
        margin-bottom: 20px;
    }

    body.menu-open {
        overflow: hidden;
        touch-action: none;
    }

    .has-solid-header {
        padding-top: var(--header-height);
    }
}

@media (max-width: 380px) {
    :root {
        --header-height: 68px;
    }

    .site-navigation {
        padding-right: 14px;
        padding-left: 14px;
    }

    .site-logo {
        max-width: calc(100% - 64px);
        font-size: 0.98rem;
    }

    .menu-toggle {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .site-menu {
        padding:
            calc(
                var(--header-height) +
                22px +
                env(safe-area-inset-top)
            )
            18px
            calc(28px + env(safe-area-inset-bottom));
    }

    .site-menu > a,
    .site-dropdown-toggle {
        min-height: 54px;
        padding: 12px 9px;
        font-size: 1rem;
    }

    .site-dropdown-panel a {
        min-height: 48px;
        padding: 10px;
        font-size: 0.94rem;
    }
}
