/* ============================================================
   Site-Part: Header — Variante D „Original-Treue" (27.08.2026)
   Konfigurierbar über ACF Options-Seite „Header".
   Stil folgt den Design-Tokens (page-builder/assets/tokens.css).

   Aufbau:
     1. Meldungszeile (optional, Amber)
     2. Meta-Zeile (Metamenü · CTA Ersteinschätzung · Suche)
     3. Hauptzeile (Logo · Hauptmenü 1. Ebene · Burger)
   Mobil: Offcanvas (Dark-Gradient) mit kompletter Hierarchie
   als Akkordeon + Meta + CTA.
   ============================================================ */

@import "../../assets/tokens.css" layer(sdc-tokens);

/* ---------- Header-Rahmen ---------- */
.as-site-header {
    background: var(--as-color-white);
    border-bottom: 1px solid var(--as-color-border);
    position: relative;
    z-index: 100;
}

.as-site-header--sticky {
    position: sticky;
    top: 0;
}

.as-site-header__inner {
    max-width: var(--as-container-max);
    margin: 0 auto;
    padding: 0 var(--as-container-pad);
}

/* ---------- 1. Meldungszeile (nur wenn befüllt) ---------- */
.as-site-header__notice {
    background: var(--as-color-notice);
    color: var(--as-color-navy-deep);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.55rem 1rem;
}

.as-site-header__notice a {
    color: var(--as-color-navy-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 700;
}

.as-site-header__notice a:hover {
    color: var(--as-color-accent-brand);
}

/* ---------- 2. Meta-Zeile ---------- */
.as-site-header__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-height: 40px;
    border-bottom: 1px solid var(--as-color-border);
}

.as-site-header__meta-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.as-site-header__meta-menu a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--as-radius-btn);
    font-family: var(--as-font-sans);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: var(--as-color-navy-deep);
    transition: background 0.3s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1)), color 0.3s;
}

.as-site-header__meta-menu a:hover,
.as-site-header__meta-menu a:focus {
    background: #eef4fb;
    color: var(--as-color-accent-brand);
}

/* Icons in der Meta-Zeile (z. B. Kalender „Akademie & Termine") — 16px wie im freigegebenen Sketch 004 */
.as-site-header__meta-menu svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* CTA „Ersteinschätzung" */
.as-site-header__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--as-color-accent-brand);
    color: var(--as-color-white);
    border-radius: var(--as-radius-btn);
    padding: 0.55rem 1.1rem;
    font-family: var(--as-font-sans);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.7s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1)), transform 0.3s;
}

.as-site-header__cta:hover {
    background: var(--as-color-accent-light);
}

.as-site-header__cta:active {
    transform: translateY(3px);
}

.as-site-header__cta svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Suche (expandierend) */
.as-site-header__search {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--as-radius-btn);
}

.as-site-header__search-icon {
    display: inline-flex;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--as-color-navy-deep);
}

.as-site-header__search-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.as-site-header__search input[type="search"] {
    border: 0;
    outline: 0;
    font-family: var(--as-font-body);
    font-size: 0.8rem;
    color: var(--as-color-navy-deep);
    background: transparent;
    width: 0;
    padding: 0;
    transition: width 0.45s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.as-site-header__search input[type="search"]::placeholder {
    color: var(--as-color-text-muted);
}

.as-site-header__search:focus-within {
    background: #f0f6fc;
    box-shadow: 0 0 0 2px rgba(5, 106, 180, 0.25);
}

.as-site-header__search:focus-within input[type="search"] {
    width: 150px;
    padding: 0 0.25rem;
}

/* ---------- 3. Hauptzeile ---------- */
.as-site-header__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
    min-height: 96px;
}

.as-site-header__brand {
    display: block;
    flex-shrink: 0;
}

.as-site-header__logo-img {
    display: block;
    height: 56px;
    width: auto;
}

.as-site-header__nav ul {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.as-site-header__nav a {
    display: block;
    padding: 0.85rem 1.1rem;
    font-family: var(--as-font-sans);
    font-weight: 500;
    font-size: 1rem;
    color: var(--as-color-navy-deep);
    text-decoration: none;
    border-radius: var(--as-radius-btn);
    transition: background 0.3s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1)), color 0.3s;
}

.as-site-header__nav a:hover,
.as-site-header__nav a:focus {
    background: #eef4fb;
    color: var(--as-color-accent-brand);
}

.as-site-header__nav .current-menu-item > a,
.as-site-header__nav .current_page_item > a {
    color: var(--as-color-accent-brand);
    position: relative;
}

.as-site-header__nav .current-menu-item > a::after,
.as-site-header__nav .current_page_item > a::after {
    content: "";
    display: block;
    height: 3px;
    width: 100%;
    background: var(--as-color-accent-brand);
    border-radius: 2px;
    margin-top: 4px;
}

/* ---------- Burger (mobil) ---------- */
.as-site-header__toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 0;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    flex-shrink: 0;
}

.as-site-header__toggle-bar {
    display: block;
    height: 3px;
    background: var(--as-color-navy-deep);
    border-radius: 2px;
    transition: transform 0.3s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1)), opacity 0.3s;
}

.as-site-header__toggle[aria-expanded="true"] .as-site-header__toggle-bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.as-site-header__toggle[aria-expanded="true"] .as-site-header__toggle-bar:nth-child(2) {
    opacity: 0;
}

.as-site-header__toggle[aria-expanded="true"] .as-site-header__toggle-bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ---------- Offcanvas (mobil) ---------- */
.as-site-header__offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(420px, 100vw);
    background: var(--as-gradient-dark);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1));
    overflow-y: auto;
    padding: 5.5rem 2rem 2.5rem;
    color: var(--as-color-white);
}

.as-site-header__offcanvas.is-open,
.as-site-header__offcanvas:target {
    transform: translateX(0);
}

.as-site-header__offcanvas-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    border: 0;
    color: var(--as-color-white);
    font-size: 2.1rem;
    line-height: 1;
    cursor: pointer;
}

.as-site-header__offcanvas ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.as-site-header__offcanvas > .as-site-header__offcanvas-menu > li > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--as-color-white);
    font-family: var(--as-font-sans);
    font-weight: 500;
    font-size: 1.1rem;
    text-decoration: none;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.as-site-header__offcanvas .caret {
    transition: transform 0.3s var(--as-ease, cubic-bezier(0.22, 1, 0.36, 1));
    font-size: 0.85rem;
}

.as-site-header__offcanvas li.open > a .caret {
    transform: rotate(180deg);
}

.as-site-header__offcanvas ul ul {
    display: none;
    padding: 0 0 0.5rem 1.1rem;
}

.as-site-header__offcanvas li.open > ul {
    display: block;
}

.as-site-header__offcanvas ul ul a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 400;
    font-family: var(--as-font-body);
    padding: 0.55rem 0;
    border-bottom: 0;
}

.as-site-header__offcanvas-meta {
    margin: 1.25rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.as-site-header__offcanvas-meta a {
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--as-font-body);
    font-size: 0.95rem;
    text-decoration: none;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.as-site-header__offcanvas-meta svg {
    width: 16px;
    height: 16px;
    fill: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.as-site-header__cta--offcanvas {
    margin-top: 1.5rem;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.as-site-header__offcanvas-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--as-radius-btn);
    padding: 0.4rem 0.75rem;
    align-items: center;
}

.as-site-header__offcanvas-search input[type="search"] {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--as-color-white);
    font-family: var(--as-font-body);
    font-size: 0.95rem;
    min-width: 0;
}

.as-site-header__offcanvas-search input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.as-site-header__offcanvas-search .as-site-header__search-icon {
    color: rgba(255, 255, 255, 0.8);
}

/* Backdrop */
.as-site-header__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 40, 75, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.as-site-header__backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .as-site-header__nav,
    .as-site-header__meta {
        display: none;
    }

    .as-site-header__toggle {
        display: flex;
    }

    .as-site-header__main {
        min-height: 72px;
    }
}

@media (max-width: 560px) {
    .as-site-header__logo-img {
        height: 44px;
    }

    .as-site-header__main {
        min-height: 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .as-site-header * {
        transition: none !important;
    }
}
