/*
=====================================================
 EF22 FRAMEWORK
 HEADER.CSS
 Version 5.1
=====================================================
*/

/* ==========================================
   HEADER
   Liegt über der Seite (fixed). Den Platz am
   Seitenanfang hält .header-space frei – so
   rutscht nichts nach, wenn der Header beim
   Scrollen kleiner wird.
========================================== */

.header {

    position: fixed;

    top: 0;

    left: 0;

    right: 0;

    z-index: var(--z-header);

    width: 100%;

    background: var(--color-black);

}

.header-space {

    height: var(--header-height);

}

/* Sprungziele (z. B. #verwaltung) und Tastatur-
   Fokus landen unter dem kompakten Header,
   nicht dahinter. */
html {

    scroll-padding-top: var(--header-height-compact);

}

/* Beim Nachmessen der Höhen (header.js) keine
   Animation, sonst misst es Zwischenstände. */
.header--measuring,
.header--measuring * {

    transition: none !important;

}

/* ==========================================
   HEADER INNER
========================================== */

.header-inner {

    position: relative;

    display: flex;

    flex-direction: column;

    align-items: center;

    width: 100%;

    padding:
        var(--space-md)
        var(--space-md)
        var(--space-lg);

    transition:
        padding .30s ease;

}

/* ==========================================
   LOGO
========================================== */

.header-logo {

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    text-decoration: none;

}

.header-logo img {

    display: block;

    width: auto;

    height: 72px;

    transition:
        height .30s ease;

}

/* ==========================================
   NAVIGATION
========================================== */

.header-navigation {

    margin-top: var(--space-md);

    opacity: 1;

    visibility: visible;

    transition:
        opacity .25s ease,
        visibility .25s ease;

}

.header-navigation ul {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: var(--space-lg);

    margin: 0;

    padding: 0;

    list-style: none;

}

.header-navigation li {

    display: flex;

    align-items: center;

}

.header-navigation a {

    position: relative;

    display: inline-flex;

    align-items: center;

    color: var(--color-white);

    text-decoration: none;

    font-size: var(--font-size-sm);

    font-weight: 600;

    white-space: nowrap;

}

/* ==========================================
   ACTIVE LINK
========================================== */

.header-navigation a.active::after {

    content: "";

    position: absolute;

    left: 0;

    bottom: -7px;

    width: 100%;

    height: 2px;

    border-radius: 999px;

    background: var(--color-primary);

}

/* ==========================================
   GRÜNER VERLAUF BEIM ÜBERFAHREN
   Mit der Maus über einen Menüpunkt: das Grün
   läuft gleichmäßig von links nach rechts über
   den Schriftzug. Technik: ein Verlauf grün/weiß
   (doppelt so breit wie der Text) liegt hinter
   der Schrift und wird nur in der Schrift
   sichtbar (background-clip: text); beim
   Überfahren wandert er nach rechts.
   - nur bei Geräten mit Maus – am Handy bliebe
     ein angetippter Punkt sonst grün „hängen“
   - auch bei Tastatur-Fokus
   - ohne Animation bei „Bewegung reduzieren“
   - Browser ohne background-clip: text zeigen
     die Schrift weiter weiß, ohne Effekt
========================================== */

@media (hover: hover) and (pointer: fine) {

    @supports ((background-clip: text) or (-webkit-background-clip: text)) {

        .header-navigation a {

            background-image: linear-gradient(
                to right,
                var(--color-primary) 45%,
                var(--color-white) 55%
            );

            background-size: 220% 100%;

            background-position: 100% 0;

            -webkit-background-clip: text;

            background-clip: text;

            color: transparent;

            -webkit-text-fill-color: transparent;

            transition: background-position .45s ease;

        }

        .header-navigation a:hover,
        .header-navigation a:focus-visible {

            background-position: 0 0;

        }

    }

}

@media (prefers-reduced-motion: reduce) {

    .header-navigation a {

        transition: none;

    }

}

/* ==========================================
   BURGER
========================================== */

.header-burger {

    display: none;

    align-items: center;

    justify-content: center;

    flex-direction: column;

    gap: 5px;

    width: 48px;
    height: 48px;

    margin: 0;
    padding: 0;

    border: none;

    background: transparent;

    cursor: pointer;

}

.header-burger span {

    display: block;

    width: 24px;
    height: 3px;

    border-radius: 999px;

    background: var(--color-white);

    transition:
        transform .30s ease,
        opacity .30s ease;

}

/* ==========================================
   OVERLAY
========================================== */

.header-overlay {

    position: fixed;

    inset: 0;

    z-index: -1;

    background: var(--color-black-45);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity .30s ease,
        visibility .30s ease;

}

/* ==========================================
   COMPACT
========================================== */

.header.compact .header-inner {

    flex-direction: row;

    justify-content: space-between;

    padding:
        var(--space-sm)
        var(--space-md);

}

.header.compact .header-logo img {

    height: 46px;

}

.header.compact .header-navigation {

    position: absolute;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

}

.header.compact .header-burger {

    display: flex;

}

/* ==========================================
   MENU OPEN
========================================== */

.header.compact.expanded .header-overlay {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}

.header.compact.expanded .header-navigation {

    position: absolute;

    top: calc(100% + var(--space-sm));

    right: var(--space-md);

    z-index: 20;

    display: block;

    width: min(
        260px,
        calc(100vw - (2 * var(--space-md)))
    );

    margin: 0;

    padding: var(--space-xl);

    background: var(--color-black);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}

.header.compact.expanded .header-navigation ul {

    display: flex;

    flex-direction: column;

    align-items: flex-end;

    gap: var(--space-lg);

}

/* ==========================================
   BURGER ANIMATION
========================================== */

.header.compact.expanded
.header-burger span:nth-child(1) {

    transform:
        translateY(8px)
        rotate(45deg);

}

.header.compact.expanded
.header-burger span:nth-child(2) {

    opacity: 0;

}

.header.compact.expanded
.header-burger span:nth-child(3) {

    transform:
        translateY(-8px)
        rotate(-45deg);

}

/* ==========================================
   TABLET / DESKTOP
========================================== */

@media (min-width: 769px) {

    :root {

        --header-height: 154px;

    }

    .header-inner {

        max-width: var(--container-width);

        margin: 0 auto;

        padding-left: var(--space-xl);
        padding-right: var(--space-xl);

    }

    .header-navigation ul {

        gap: var(--space-xl);

    }

    .header-navigation a {

        font-size: var(--font-size-md);

    }

    .header.compact.expanded
    .header-navigation {

        right: var(--space-xl);

    }

}


/* ==========================================
   APP-MODUS
   Vom Home-Bildschirm gestartet (Klasse is-app
   setzt framework.php): kein Header, die Seite
   beginnt direkt mit dem Hero.
========================================== */

.is-app .header,
.is-app .header-space {

    display: none;

}

.is-app {

    --header-height: 0px;

    --header-height-compact: 0px;

}
