/*
|--------------------------------------------------------------------------
| Navigation
|--------------------------------------------------------------------------
| Desktop: horizontale Navigation mit Dropdowns
| Mobile: Off-Canvas Navigation
|--------------------------------------------------------------------------
*/


/*
|--------------------------------------------------------------------------
| Basis
|--------------------------------------------------------------------------
*/

.navigation {
    display: flex;
    align-items: center;
    margin-left: auto;
}


/*
|--------------------------------------------------------------------------
| Desktop Navigation
|--------------------------------------------------------------------------
*/

.navigation-menu {
    display: flex;
    align-items: center;
    gap: clamp(20px, 2.5vw, 40px);
}

.navigation-item {
    position: relative;
}

.navigation-link {
    display: flex;
    align-items: center;
    gap: 7px;

    padding-block: 22px;

    color: var(--color-header-text);

    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;

    white-space: nowrap;
}

.navigation-link:hover {
    color: var(--color-primary);
}


/*
|--------------------------------------------------------------------------
| Pfeile
|--------------------------------------------------------------------------
*/

.navigation-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 1.1em;
    line-height: 1;

    transition: transform 0.2s ease;
}

/* Erste Dropdown-Ebene zeigt nach unten */

.navigation-menu > .navigation-item > .navigation-link .navigation-arrow {
    transform: rotate(90deg);
}


/*
|--------------------------------------------------------------------------
| Dropdown
|--------------------------------------------------------------------------
*/

.navigation-dropdown {
    position: absolute;

    top: 100%;
    left: 0;

    z-index: 100;

    min-width: 220px;

    padding: 8px;

    background: var(--color-surface);

    border: 1px solid var(--color-border);
    border-radius: 10px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.12);

    opacity: 0;
    visibility: hidden;

    transform: translateY(8px);

    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0.18s ease;
}


/*
|--------------------------------------------------------------------------
| Dropdown öffnen
|--------------------------------------------------------------------------
*/

.navigation-item:hover > .navigation-dropdown,
.navigation-item:focus-within > .navigation-dropdown {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);
}


/*
|--------------------------------------------------------------------------
| Dropdown Links
|--------------------------------------------------------------------------
*/

.navigation-dropdown .navigation-link {
    width: 100%;

    padding: 11px 14px;

    color: var(--color-text);

    border-radius: 7px;
}

.navigation-dropdown .navigation-link:hover {
    color: var(--color-primary);
    background: var(--color-surface-soft);
}


/*
|--------------------------------------------------------------------------
| Weitere Dropdown-Ebenen
|--------------------------------------------------------------------------
*/

.navigation-dropdown .navigation-dropdown {
    top: -9px;
    left: calc(100% + 8px);

    transform: translateX(8px);
}

.navigation-dropdown
.navigation-item:hover > .navigation-dropdown,
.navigation-dropdown
.navigation-item:focus-within > .navigation-dropdown {
    transform: translateX(0);
}


/*
|--------------------------------------------------------------------------
| Hamburger
|--------------------------------------------------------------------------
*/

.navigation-toggle {
    display: none;

    width: 44px;
    height: 44px;

    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 5px;

    cursor: pointer;
}

.navigation-toggle span {
    display: block;

    width: 25px;
    height: 2px;

    background: var(--color-header-text);

    border-radius: 2px;
}


/*
|--------------------------------------------------------------------------
| Mobile Drawer
|--------------------------------------------------------------------------
*/

.navigation-drawer,
.navigation-overlay {
    display: none;
}


/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
|
| Hier ist ein Breakpoint bewusst sinnvoll:
| Die Navigation wechselt nicht nur ihr Layout, sondern ihr Bedienkonzept.
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {

    /*
    |--------------------------------------------------------------------------
    | Desktop Navigation ausblenden
    |--------------------------------------------------------------------------
    */

    .navigation-menu {
        display: none;
    }


    /*
    |--------------------------------------------------------------------------
    | Hamburger
    |--------------------------------------------------------------------------
    */

    .navigation-toggle {
        display: flex;
    }


    /*
    |--------------------------------------------------------------------------
    | Overlay
    |--------------------------------------------------------------------------
    */

    .navigation-overlay {
        display: block;

        position: fixed;
        inset: 0;

        z-index: 998;

        background: rgba(0, 0, 0, 0.45);

        opacity: 0;
        visibility: hidden;

        transition:
            opacity 0.25s ease,
            visibility 0.25s ease;
    }

    .navigation-overlay.is-active {
        opacity: 1;
        visibility: visible;
    }


    /*
    |--------------------------------------------------------------------------
    | Drawer
    |--------------------------------------------------------------------------
    */

    .navigation-drawer {
        display: block;

        position: fixed;

        top: 0;
        bottom: 0;
        left: 0;

        z-index: 999;

        width: min(88vw, 380px);

        background: var(--color-surface);

        overflow: hidden;

        transform: translateX(-100%);

        transition: transform 0.3s ease;

        box-shadow:
            12px 0 35px rgba(0, 0, 0, 0.15);
    }

    .navigation-drawer.is-open {
        transform: translateX(0);
    }


    /*
    |--------------------------------------------------------------------------
    | Track
    |--------------------------------------------------------------------------
    |
    | Auf diesem Element verschieben wir später per JavaScript die Ebenen.
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-track {
        position: relative;

        width: 100%;
        height: 100%;
    }


    /*
    |--------------------------------------------------------------------------
    | Menüebene
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-level {
        position: absolute;
        inset: 0;

        width: 100%;
        height: 100%;

        overflow-y: auto;

        background: var(--color-surface);

        transition:
            transform 0.3s ease,
            visibility 0.3s ease;

        will-change: transform;
    }

    body.navigation-open {
        overflow: hidden;
    }    

    /*
    |--------------------------------------------------------------------------
    | Kopfbereich
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;

        min-height: 70px;

        padding-inline: 20px;

        border-bottom: 1px solid var(--color-border);
    }

    .navigation-drawer-title {
        font-size: 1.1rem;
        font-weight: 700;

        color: var(--color-text);
    }


    /*
    |--------------------------------------------------------------------------
    | Schließen
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 42px;
        height: 42px;

        color: var(--color-text);

        font-size: 2rem;
        font-weight: 300;
        line-height: 1;

        cursor: pointer;

        border-radius: 50%;
    }

    .navigation-drawer-close:hover {
        background: var(--color-surface-soft);
    }


    /*
    |--------------------------------------------------------------------------
    | Zurück
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-back {
        display: flex;
        align-items: center;

        gap: 7px;

        color: var(--color-text);

        font-size: 0.95rem;
        font-weight: 600;

        cursor: pointer;
    }

    .navigation-drawer-back span:first-child {
        font-size: 1.5rem;
        line-height: 1;
    }


    /*
    |--------------------------------------------------------------------------
    | Untermenü Überschrift
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-subtitle {
        padding:
            clamp(20px, 5vw, 28px)
            20px
            12px;

        color: var(--color-text);

        font-size: clamp(1.25rem, 5vw, 1.6rem);
        font-weight: 700;
        line-height: 1.2;
    }


    /*
    |--------------------------------------------------------------------------
    | Menüliste
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-list {
        padding: 8px 12px 24px;
    }

    .navigation-drawer-item {
        border-bottom: 1px solid var(--color-border);
    }


    /*
    |--------------------------------------------------------------------------
    | Links / Buttons
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-link {
        display: flex;
        align-items: center;
        justify-content: space-between;

        width: 100%;

        padding: 15px 10px;

        color: var(--color-text);

        font-size: 1rem;
        font-weight: 500;
        line-height: 1.3;

        text-align: left;

        cursor: pointer;
    }

    .navigation-drawer-link:hover {
        color: var(--color-primary);
    }


    /*
    |--------------------------------------------------------------------------
    | Pfeil
    |--------------------------------------------------------------------------
    */

    .navigation-drawer-arrow {
        margin-left: 20px;

        color: var(--color-text-muted);

        font-size: 1.5rem;
        line-height: 1;
    }
}