/* Header slideshow, navigation (mobile and desktop) and footer. */

/*********************************************
  Header Style
*********************************************/
header {
    position: relative;
    margin-bottom: -0.5em;
}

/* Reserves the exact 3:1 banner space before the image loads (prevents CLS). */
.header-slideshow-container {
    aspect-ratio: 3 / 1;
    overflow: hidden;
    width: 100%;
}

.header-slideshow-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-slides {
    display: none;
}

.header-slides:first-child {
    display: block;
}

.header-fade {
    animation-name: header-fade;
    animation-duration: 1.0s;
    animation-fill-mode: forwards;
}

@keyframes header-fade {
    from {opacity: .55}
    to {opacity: 1}
}

/*********************************************
  Navigation Bar Style
*********************************************/

/* ── Nav Bar ──────────────────────────────── */
nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    overflow: visible;
    margin: 0;
    background-color: var(--color-espresso);
    z-index: var(--z-nav-menu);
    will-change: transform;
}

/* Public nav slightly taller and with a hairline; the admin nav (nav.admin-nav)
   keeps its size. --nav-height is set here so the logo offset and the
   panel fallback (both descendants) see the same value. */
nav.nav-logo-left-and-menu-right {
    --nav-height: 3.25em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Glass bar: content shimmers through while scrolling. Without support
   the opaque espresso surface from above stays. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    nav.nav-logo-left-and-menu-right {
        background-color: rgba(36, 26, 19, 0.88);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }
}

nav.nav-logo-left-and-menu-right > .container {
    height: 100%;
    align-items: center;
    justify-content: space-between;
}

nav.nav-logo-left-and-menu-right > .container > div#nav-menu {
    display: flex;
    align-items: center;
}

/* ── Logo ─────────────────────────────────── */
nav #nav-logo {
    position: relative;
    display: flex;
    align-items: center;
    z-index: var(--z-nav-logo);
    /* Negative margins center the large logo on the nav bar,
       letting it overflow equally into banner (above) and section (below). */
    margin-top: calc(-1 * (var(--logo-height) - var(--nav-height)) / 2);
    margin-bottom: calc(-1 * (var(--logo-height) - var(--nav-height)) / 2);
    transition: all var(--transition-fast);
}

nav #nav-logo > a {
    display: flex;
    align-items: center;
}

nav #nav-logo #logo {
    width: auto;
    height: var(--logo-height);
    padding: 0 var(--spacing-md);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
    transition: all 0.3s var(--ease-out);
}

/* ── Logo compact (banner gone, nav fixed) ─ */
nav.is-stuck #nav-logo {
    margin-top: 0;
    margin-bottom: 0;
}

nav.is-stuck #nav-logo #logo {
    height: calc(var(--nav-height) - 0.5em);
    filter: none;
}

/* ── Hamburger Button (Mobile) ─────────────── */
#nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* border-box: content area stays 1.75em × 1.25em (bars unchanged), total ≥44px */
    width: 2.75em;
    height: 2.75em;
    padding: 0.75em 0.5em;
    margin-right: var(--spacing-sm);
    background: none;
    border: none;
    cursor: pointer;
    z-index: var(--z-nav-logo);
    flex-shrink: 0;
}

.hamburger-bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.92);
    border-radius: 2px;
    transform-origin: center;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

#nav-toggle.is-active .hamburger-bar:nth-child(1) {
    transform: translateY(calc(0.625em - 1px)) rotate(45deg);
}
#nav-toggle.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
#nav-toggle.is-active .hamburger-bar:nth-child(3) {
    transform: translateY(calc(-0.625em + 1px)) rotate(-45deg);
}

/* ── Nav List (mobile: hidden by default) */
#nav-list {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
}

#nav-list.is-open {
    display: block;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    padding: 0.5em 0;
    /* Opaque: semi-transparent children of the backdrop-filter nav are not
       blurred by Chromium, so the page content would show through legibly. */
    background-color: var(--color-espresso);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    z-index: var(--z-nav-dropdown);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.45);
}

/* ── Nav Items ────────────────────────────── */
.nav-item {
    position: relative;
}

/* ── Nav Links ────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    min-height: 2.75em;
    color: rgba(255, 255, 255, 0.82);
    padding: var(--spacing-sm) 3em var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-family-base);
    font-size: 0.95em;
    font-weight: 500;
    letter-spacing: 0.005em;
    text-decoration: none;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-item:not(.has-dropdown) > .nav-link {
    padding-right: var(--spacing-md);
}

.nav-link:hover,
.nav-item.is-open > .nav-link {
    color: var(--color-bg-white);
    background-color: rgba(255, 255, 255, 0.08);
}

/* Current page (aria-current is set by AsbNav) */
.nav-link[aria-current="page"] {
    color: var(--color-bg-white);
}

/* ── Dropdown Toggle Buttons ──────────────── */
/* Mobile: anchored to the first row (top: 0), not centered on the li; otherwise
   the chevron moves to the middle of the sub-list when it opens.
   font-size/height as .nav-link (0.95em, min-height 2.75em). */
.dropdown-toggle {
    position: absolute;
    right: var(--spacing-xs);
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75em;
    height: 2.75em;
    font-size: 0.95em;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.82);
    transition: color var(--transition-fast);
}

/* Combined nav-link + dropdown-toggle: menu items with no standalone URL (e.g. "Länder", "Kategorien") */
button.nav-link.dropdown-toggle {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    justify-content: space-between;
    padding-right: var(--spacing-md);
}

.dropdown-toggle:hover,
.nav-item.is-open > .dropdown-toggle {
    color: var(--color-bg-white);
}

/* Thin chevron instead of the "▼" glyph: hide the character (font-size 0),
   angle from two border edges. Base position rotate(45deg) = pointing down. */
.dropdown-arrow {
    display: inline-block;
    flex-shrink: 0;
    width: 0.42rem;
    height: 0.42rem;
    margin: -0.2rem 0.15rem 0 0.35rem;
    font-size: 0;
    line-height: 0;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.25s var(--ease-out);
}

.has-dropdown.is-open > .dropdown-toggle .dropdown-arrow {
    transform: translateY(0.2rem) rotate(225deg);
}

/* ── Dropdowns (hidden by default) ─── */
.nav-dropdown {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
}

.has-dropdown.is-open > .nav-dropdown {
    display: block;
}

/* Mobile: indentation per level */
.nav-dropdown[data-level="2"] {
    background-color: #2c2119;
}
.nav-dropdown[data-level="2"] .nav-link {
    padding-left: var(--spacing-lg);
}

.nav-dropdown[data-level="3"] {
    background-color: #33271e;
}
.nav-dropdown[data-level="3"] .nav-link {
    padding-left: calc(var(--spacing-lg) + var(--spacing-md));
}

/* ── Mobile: scrollable menu ────────────────── */
/* The country and category lists are template loops of any length and quickly
   grow taller than a phone viewport. The panel hangs absolutely at the bottom edge
   of the sticky nav, so the height budget is the viewport height minus the nav's
   bottom edge. AsbNav sets --nav-panel-top to the measured value when opening (abs.js).
   Note: nav { overflow: visible } is required; with hidden/auto the panel would
   be clipped to the nav height. */
@media screen and (max-width: 819.98px) {
    #nav-list.is-open {
        max-height: calc(100vh  - var(--nav-panel-top, var(--nav-height))); /* Fallback */
        max-height: calc(100dvh - var(--nav-panel-top, var(--nav-height)));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }
}


/*********************************************
  Footer Style
*********************************************/
footer {
    padding: 1.75rem 0 calc(2.25rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--color-hairline);
    color: var(--color-text-muted);
    font-size: 0.85em;
}

footer .container {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
}

footer ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
    padding: 0;
    list-style: none;
}

footer a {
    display: inline-flex;
    align-items: center;
    min-height: 2.75em;
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--color-ink);
}

footer ul li {
    margin: 0;
}

footer .bi {
    font-size: 1.25em;
}



@media screen and (min-width: 820px) {
    /* ── Nav Desktop ──────────────────────────── */
    nav.nav-logo-left-and-menu-right > .container > div#nav-menu { align-items: center; }

    #nav-toggle { display: none; }

    #nav-list {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        position: static;
        background: none;
        box-shadow: none;
    }

    /* Nav items as a flex row: link and toggle button side by side */
    .nav-item {
        display: flex;
        align-items: stretch;
        white-space: nowrap;
    }

    #nav-list { gap: 0.15em; }

    .nav-link {
        position: relative;
        display: flex;
        align-items: center;
        min-height: 2.4em;
        align-self: center;
        padding: 0.35em 0.8em;
        border-radius: var(--radius-pill);
    }

    .nav-item:not(.has-dropdown) > .nav-link {
        padding-right: 0.8em;
    }

    /* Main item with dropdown: link + chevron look like one pill */
    #nav-list > .has-dropdown > .nav-link {
        padding-right: 0.2em;
        border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    }

    /* Current page: short orange line below the label */
    #nav-list > .nav-item > .nav-link[aria-current="page"]::after {
        content: '';
        position: absolute;
        left: 50%;
        bottom: 0.1em;
        width: 1.1em;
        height: 2px;
        border-radius: 2px;
        background: var(--color-orange);
        transform: translateX(-50%);
    }

    /* Toggle button: static, inline next to the link */
    .dropdown-toggle {
        position: static;
        transform: none;
        top: auto;
        right: auto;
        width: 1.25em;
        min-width: 24px;
        height: 2.4em;
        align-self: center;
        padding: 0 0.5em 0 0;
        border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
        transition: color var(--transition-fast), background-color var(--transition-fast);
    }

    #nav-list > .has-dropdown:hover > .nav-link,
    #nav-list > .has-dropdown:hover > .dropdown-toggle,
    #nav-list > .has-dropdown.is-open > .dropdown-toggle {
        color: var(--color-bg-white);
        background-color: rgba(255, 255, 255, 0.08);
    }

    /* Combined button override for desktop: fill full row, not just 1.25em */
    button.nav-link.dropdown-toggle {
        flex: 1;
        width: auto;
        height: auto;
        display: flex;
        justify-content: space-between;
        padding: 0.45em 0.75em;
        border-radius: 8px;
    }

    /* Levels 2 + 3: floating panels. Opaque instead of glass: as children of the
       backdrop-filter nav they would not be blurred, only see-through. */
    .nav-dropdown[data-level="2"],
    .nav-dropdown[data-level="3"] {
        position: absolute;
        width: max-content;
        min-width: 12rem;
        padding: 0.4em;
        background-color: var(--color-espresso);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 14px;
        z-index: var(--z-nav-dropdown);
        box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
    }

    /* Level 2: opens downward */
    .nav-dropdown[data-level="2"] {
        top: calc(100% + 0.35em);
        right: 0;
    }

    /* Level 3: opens to the left (the nav sits at the right edge) */
    .nav-dropdown[data-level="3"] {
        top: -0.4em;
        right: calc(100% + 0.5em);
        max-height: 70vh;
        overflow-y: auto;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }

    .nav-dropdown[data-level="2"] .nav-link,
    .nav-dropdown[data-level="3"] .nav-link {
        display: block;
        min-height: 0;
        padding: 0.45em 0.75em;
        border-radius: 8px;
        flex-grow: 1;
    }

    /* "Länder"/"Kategorien" are buttons: flex instead of block (otherwise the
       button default centers the text). Chevron in front, pointing where it opens. */
    .nav-dropdown[data-level="2"] button.nav-link.dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
    }

    /* Level-3 toggle chevron: points left (the submenu opens to the left) */
    .nav-dropdown[data-level="2"] > .has-dropdown > .dropdown-toggle .dropdown-arrow {
        order: -1;
        margin: 0 0.7rem 0 0.15rem; /* rem: .dropdown-arrow has font-size 0 */
        transform: rotate(135deg);
    }
    .nav-dropdown[data-level="2"] > .has-dropdown.is-open > .dropdown-toggle .dropdown-arrow {
        transform: rotate(-45deg);
    }
}

@media screen and (max-width: 650px) {
    :root { --logo-height: 4.2em; }
}
