/* ========================================
   NAVIGATION STYLES
   Unified Source of Truth
   ======================================== */

:root {
    --nav-height: 90px;
}

header {
    background: var(--lavender-mist);
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    box-shadow: none;
    transition: box-shadow 800ms cubic-bezier(0.23, 1, 0.32, 1), 
                background 800ms cubic-bezier(0.23, 1, 0.32, 1);
}

header.is-sticky {
    box-shadow: 0 2px 12px var(--lavender-accent);
    background: rgba(244, 244, 255, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.page {
    width: 100%;
    padding-inline: var(--px-mobile, 20px);
    height: var(--nav-height);
    display: flex;
    align-items: center;
}

.nav-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: clamp(24px, 3vw, 48px);
    flex: 1 1 auto;
    min-width: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.5vw, 18px);
    flex: 0 0 auto;
}

/* Brand / Logo */
.brand-group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(16px, 1.5vw, 24px);
    height: clamp(16px, 1.5vw, 24px);
    overflow: visible;
    /* Pull leftward to align the visible diamond with the page padding edge.
       The SVG viewBox has ~23% internal whitespace before the drawn shape. */
    margin-left: calc(-0.23 * clamp(16px, 1.5vw, 24px));
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateY(1px);
    animation: logoRotate 12s linear infinite;
}

@keyframes logoRotate {
    0%   { transform: translateY(1px) rotate(0deg); }
    100% { transform: translateY(1px) rotate(360deg); }
}

/* Primary Navigation */
.primary-nav {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
}

.primary-nav ul {
    display: flex;
    gap: clamp(12px, 1.5vw, 32px);
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    flex: 0 1 auto;
}

.primary-nav a {
    font-family: var(--neue-haas);
    letter-spacing: 0.05em;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--onyx);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 800ms cubic-bezier(0.23, 1, 0.32, 1);
    padding: 0.2em 0.5em;
    position: relative;
    z-index: 1;
}

.primary-nav a::before {
    content: none;
}

.primary-nav a .nav-link-label {
    display: inline-block;
    position: relative;
    white-space: nowrap;
}

.primary-nav a .nav-link-label::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40%;
    background: var(--lime, #D1FF5C);
    z-index: -1;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 800ms cubic-bezier(0.23, 1, 0.32, 1);
}

.primary-nav a:hover::before,
.primary-nav a:focus-visible::before,
.primary-nav a.is-active::before {
    transform: none;
}


.primary-nav a:hover .nav-link-label::after,
.primary-nav a:focus-visible .nav-link-label::after,
.primary-nav a.is-active .nav-link-label::after {
    transform: scaleX(1);
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a.is-active {
    color: var(--onyx);
}

/* Language Toggle */
.language-toggle {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.language-toggle__button {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.language-toggle__pill {
    position: relative;
    display: flex;
    align-items: center;
    width: clamp(64px, 8.5vw, 84px);
    height: clamp(28px, 3.7vw, 36px);
    border-radius: 4px;
    background: var(--lavender-mist, #F4F4FF);
    border: 1px solid var(--lavender-accent, #9392EE);
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.language-toggle__slider {
    position: absolute;
    top: 1px;
    left: 1px;
    width: calc(50% + 1px);
    height: calc(100% - 2px);
    border-radius: 3px;
    background: var(--lavender-accent, #9392EE);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 1;
}

.language-toggle__button[data-active-lang="de"] .language-toggle__slider {
    transform: translateX(calc(100% - 4px));
}

.language-toggle__labels {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.language-toggle__label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--neue-haas), sans-serif;
    font-size: clamp(10px, 1.3vw, 13px);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.language-toggle__label--en {
    color: var(--onyx, #07090F);
}

.language-toggle__label--de {
    color: var(--onyx, #07090F);
}

.language-toggle__button[data-active-lang="de"] .language-toggle__label--en {
    color: var(--onyx, #07090F);
}

.language-toggle__button[data-active-lang="de"] .language-toggle__label--de {
    color: var(--onyx, #07090F);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: clamp(40px, 5vw, 56px);
    height: clamp(40px, 5vw, 56px);
    margin-left: clamp(16px, 3vw, 32px);
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    transition: transform 800ms cubic-bezier(0.23, 1, 0.32, 1);
}

.hamburger.is-active {
    transform: rotate(90deg);
}

.hamburger__icon {
    width: 24px;
    height: 24px;
    transition: opacity 800ms cubic-bezier(0.23, 1, 0.32, 1);
    position: absolute;
    pointer-events: none; /* clicks go straight to the <button> */
}

.hamburger__icon--close {
    opacity: 0;
}

.hamburger.is-active .hamburger__icon {
    opacity: 0;
}

.hamburger.is-active .hamburger__icon--close {
    opacity: 1;
}

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

@media (max-width: 991px) {
    .hamburger {
        display: flex;
        z-index: 11;
    }

    .nav-left {
        flex: 1 1 auto;
        max-width: none;
        justify-content: flex-start;
        gap: 16px;
    }

    .nav-actions {
        flex: 0 0 auto;
        margin-left: 0;
        justify-content: flex-end;
        gap: clamp(12px, 1.5vw, 18px);
    }

    .primary-nav {
        display: flex;
        /* Use absolute (not fixed) so backdrop-filter on header.is-sticky
           doesn't create a new containing block that collapses the nav to 0 height */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100vh - var(--nav-height));
        background: var(--lavender-accent);
        flex-direction: column;
        align-items: center;
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
        transform: translateX(-100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 800ms cubic-bezier(0.23, 1, 0.32, 1),
                    visibility 0s linear 800ms;
        z-index: 9;
        padding: 0;
    }

    .primary-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        transition: transform 800ms cubic-bezier(0.23, 1, 0.32, 1),
                    visibility 0s linear 0s;
    }

    .primary-nav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding-top: 32px;
        margin: 0;
        align-items: center;
    }

    .primary-nav li {
        display: flex;
        justify-content: center;
        width: 100%;
        border-bottom: 1px solid var(--lime);
    }

    .primary-nav a {
        font-size: var(--h4);
        width: 100%;
        text-align: center;
        padding: 1.5em;
    }
}

@media (max-width: 480px) {
    :root {
        --nav-height: 72px;
    }

    .primary-nav a {
        font-size: var(--h5);
    }
}
