/* =========================================
   Block: Header (kss/lswn-header)
   ========================================= */

:root {
    /* Reale Höhe des fixierten Headers (gemessen, inkl. Padding) — für
       andere Blöcke, die eigenen fixierten/gepinnten Inhalt haben und
       wissen müssen, wo der Header endet (z. B. kss/lswn-offers). */
    --lswn-header-h: 80px;
}

.lswn-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px var(--lswn-edge);
    background-color: transparent;
    transition: background-color .5s ease, box-shadow .5s ease, padding .3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.lswn-header.is-tucked {
    background-color: rgba(249, 229, 229, .94);
    box-shadow: 0 1px 0 rgba(176, 134, 47, .3);
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Eingeloggte Admins sehen die WP-Adminleiste (ebenfalls position:fixed;
   top:0, aber mit sehr hohem z-index) — der Header muss darunter beginnen,
   sonst überlappen sich beide. WP setzt dafür automatisch die Klasse
   "admin-bar" auf <body>, wenn die Leiste sichtbar ist. */
body.admin-bar .lswn-header { top: 32px; }
body.admin-bar .lswn-header__nav,
body.admin-bar .lswn-header::before { top: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar .lswn-header { top: 46px; }
    body.admin-bar .lswn-header__nav,
    body.admin-bar .lswn-header::before { top: 46px; }
}

/* Der von WordPress automatisch erzeugte <header class="wp-block-template-part">
   -Wrapper um diesen Block enthält ausschließlich position:fixed-Kinder
   (.lswn-header + das Kontakt-Modal) und hat dadurch keinen In-Flow-Inhalt.
   Ohne eigenen Block-Formatting-Context "kollabiert" sein Margin mit dem
   nächsten Element im Fluss und wandert bis vor <body> — sichtbar als heller
   Spalt über dem Header. Eingeloggt verdeckt die WP-Adminleiste genau diese
   Zeile, ausgeloggt nicht — daher fiel der Bug erst dort auf. display:flow-root
   kappt das Kollabieren, ohne Layout/Optik zu verändern (der Wrapper hat
   ohnehin keine eigene sichtbare Box). */
header.wp-block-template-part:has(.lswn-header) {
    display: flow-root;
}

/* --- Marke --- */

.lswn-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    transition: transform .5s cubic-bezier(.2, .7, .3, 1);
    transform-origin: left center;
}
.is-tucked .lswn-header__brand { transform: scale(.9); }
.lswn-header__mark { width: 34px; height: 34px; flex: none; }
.lswn-header__brand-name {
    font-family: var(--lswn-serif);
    font-weight: 400;
    font-size: 20px;
    letter-spacing: .08em;
    color: var(--lswn-wine);
    white-space: nowrap;
}
.lswn-header__brand img { max-height: 42px; width: auto; display: block; }

/* --- Menü (Desktop) --- */

.lswn-header__nav { flex: 1; display: flex; justify-content: center; }
.lswn-header__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: clamp(14px, 2vw, 32px);
    transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.is-tucked .lswn-header__menu { transform: scale(.94); }

/* Nur im mobilen Slide-in-Panel sichtbar (siehe Media Query weiter unten) —
   im horizontalen Desktop-Menü wäre eine zweite Icon-Reihe neben den
   Textlinks unpassend. */
.lswn-header__social {
    display: none;
    list-style: none;
    padding: 0;
}
.lswn-header__social a {
    display: inline-flex;
    color: var(--lswn-ink-soft);
    transition: color .3s;
}
.lswn-header__social a:hover { color: var(--lswn-wine); }
.lswn-header__social svg { width: 19px; height: 19px; }

.lswn-header__item { position: relative; list-style: none; }

/* Link + Untermenü-Toggle-Button als Geschwister nebeneinander (kein
   verschachteltes <button> in <a> — das wäre ungültiges HTML) */
.lswn-header__row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lswn-header__link {
    display: inline-block;
    padding: 12px 0;
    font-size: 13px;
    letter-spacing: .06em;
    color: var(--lswn-ink);
    position: relative;
    text-decoration: none;
    cursor: pointer;
}
.lswn-header__link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 6px;
    height: 1px;
    width: 100%;
    background: var(--lswn-gold);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.lswn-header__link:hover::after,
.lswn-header__item--current > .lswn-header__row > .lswn-header__link::after { transform: scaleX(1); transform-origin: left; }

.lswn-header__submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--lswn-gold);
    flex: none;
}
.lswn-header__caret { width: 8px; height: 8px; opacity: .65; pointer-events: none; }

/* Erstes Dropdown (".sub") */
.lswn-header__submenu {
    position: absolute;
    top: 100%;
    left: -22px;
    min-width: 250px;
    list-style: none;
    margin: 0;
    background: var(--lswn-parch);
    border: 1px solid rgba(176, 134, 47, .42);
    border-radius: var(--lswn-radius-sm);
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .36s ease, transform .36s cubic-bezier(.2, .7, .3, 1), visibility .36s;
    box-shadow: 0 16px 34px -24px rgba(86, 36, 47, .5);
    z-index: 10;
}
.lswn-header__item:hover > .lswn-header__submenu,
.lswn-header__item:focus-within > .lswn-header__submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.lswn-header__submenu .lswn-header__row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 26px;
    transition: transform .42s cubic-bezier(.2, .7, .3, 1);
}
.lswn-header__submenu .lswn-header__link {
    padding: 9px 0;
    font-size: 14.5px;
    color: var(--lswn-ink-soft);
    transition: color .3s ease;
}
.lswn-header__submenu .lswn-header__link::after { display: none; }
.lswn-header__submenu .lswn-header__row:hover { transform: translateX(8px); }
.lswn-header__submenu .lswn-header__row:hover .lswn-header__link { color: var(--lswn-wine); }
.lswn-header__submenu .lswn-header__caret { width: 7px; height: 7px; transform: rotate(-90deg); }

/* Flyout ab zweiter Ebene (".sub-nested") */
.lswn-header__subnested {
    position: absolute;
    top: -12px;
    left: 100%;
    margin-left: 8px;
    min-width: 220px;
    list-style: none;
    margin-block: 0;
    background: var(--lswn-parch);
    border: 1px solid rgba(176, 134, 47, .42);
    border-radius: var(--lswn-radius-sm);
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: opacity .36s ease, transform .36s cubic-bezier(.2, .7, .3, 1), visibility .36s;
    box-shadow: 0 16px 34px -24px rgba(86, 36, 47, .5);
}
.lswn-header__item--sub:hover > .lswn-header__subnested,
.lswn-header__item--sub:focus-within > .lswn-header__subnested {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
.lswn-header__subnested .lswn-header__row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 26px;
    transition: transform .42s cubic-bezier(.2, .7, .3, 1);
}
.lswn-header__subnested .lswn-header__link { padding: 9px 0; font-size: 14px; color: var(--lswn-ink-soft); }
.lswn-header__subnested .lswn-header__row:hover { transform: translateX(8px); }
.lswn-header__subnested .lswn-header__row:hover .lswn-header__link { color: var(--lswn-wine); }
.lswn-header__item--current > .lswn-header__row > .lswn-header__link { color: var(--lswn-wine); }

/* --- CTA --- */

.lswn-header__cta {
    flex: none;
    font-size: 13px;
    padding: 12px 28px;
    border: 1px solid var(--lswn-gold);
    border-radius: var(--lswn-radius-pill);
    color: var(--lswn-wine);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
    transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.is-tucked .lswn-header__cta { transform: scale(.94); }
.lswn-header__cta span { position: relative; z-index: 2; transition: color .45s ease; }
.lswn-header__cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--lswn-wine);
    transform: translateY(101%);
    transition: transform .55s cubic-bezier(.2, .7, .3, 1);
}
.lswn-header__cta:hover::before { transform: translateY(0); }
.lswn-header__cta:hover span { color: var(--lswn-parch); }

/* --- Burger (mobil) --- */

.lswn-header__burger {
    display: none;
    width: 30px;
    height: 15px;
    position: relative;
    flex: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.lswn-header__burger-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--lswn-ink);
    transition: transform .3s ease, opacity .3s ease;
}
.lswn-header__burger-line:nth-child(1) { top: 0; }
.lswn-header__burger-line:nth-child(2) { top: 7px; }
.lswn-header__burger-line:nth-child(3) { bottom: 0; }
.lswn-header.is-open .lswn-header__burger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.lswn-header.is-open .lswn-header__burger-line:nth-child(2) { opacity: 0; }
.lswn-header.is-open .lswn-header__burger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Responsive: Menü wird zum Slide-in-Panel --- */

@media (max-width: 1080px) {
    .lswn-header__nav {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(340px, 84vw);
        background: var(--lswn-parch);
        box-shadow: -16px 0 40px -20px rgba(86, 36, 47, .5);
        padding: 96px 28px 32px;
        transform: translateX(100%);
        transition: transform .45s cubic-bezier(.2, .7, .3, 1);
        overflow-y: auto;
        flex-direction: column;
        justify-content: flex-start;
    }
    .lswn-header.is-open .lswn-header__nav { transform: translateX(0); }

    .lswn-header__social {
        display: flex;
        align-items: center;
        gap: 18px;
        margin: 0 0 26px;
        padding-bottom: 22px;
        border-bottom: 1px solid rgba(176, 134, 47, .22);
    }

    .lswn-header__menu {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .lswn-header__item { width: 100%; }
    .lswn-header__row { width: 100%; justify-content: space-between; padding: 0; }
    .lswn-header__link {
        width: 100%;
        padding: 12px 0;
        font-size: 15px;
    }
    .lswn-header__submenu-toggle { width: 34px; height: 40px; }

    /* Auf Touch-Geräten kein Hover — Untermenüs klappen per Klick auf (JS),
       siehe .lswn-header__item--has-children.is-expanded */
    .lswn-header__submenu,
    .lswn-header__subnested {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: rgba(176, 134, 47, .06);
        margin: 0 0 8px;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: max-height .35s ease;
    }
    .lswn-header__submenu .lswn-header__row,
    .lswn-header__subnested .lswn-header__row { padding: 0 16px; }
    .lswn-header__item--has-children.is-expanded > .lswn-header__submenu,
    .lswn-header__item--has-children.is-expanded > .lswn-header__subnested {
        max-height: 1000px;
        padding: 8px 0;
    }
    /* Auf Mobil öffnen sich Untermenüs immer als Akkordeon (kein Flyout
       mehr) — der Pfeil zeigt daher überall nach unten statt zur Seite */
    .lswn-header__submenu .lswn-header__caret,
    .lswn-header__subnested .lswn-header__caret { transform: none; }
    .lswn-header__submenu-toggle .lswn-header__caret { transition: transform .3s ease; }
    .lswn-header__item--has-children.is-expanded > .lswn-header__row .lswn-header__caret {
        transform: rotate(180deg);
    }

    .lswn-header__cta { display: none; }
    .lswn-header__burger { display: block; }

    body.lswn-header-lock { overflow: hidden; }
}

/* Overlay hinter dem aufgeklappten Panel */
@media (max-width: 1080px) {
    .lswn-header::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(61, 32, 39, .35);
        opacity: 0;
        pointer-events: none;
        transition: opacity .4s ease;
        z-index: -1;
    }
    .lswn-header.is-open::before { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .lswn-header, .lswn-header__nav, .lswn-header__menu, .lswn-header__brand,
    .lswn-header__cta, .lswn-header__submenu, .lswn-header__subnested {
        transition: none !important;
    }
}

.lswn-header__cta { cursor: pointer; font-family: inherit; }

/* --------------------------------------------------------------------------
   KONTAKT-MODAL — vom Header-CTA geöffnet ("Termin anfragen")
   -------------------------------------------------------------------------- */

.lswn-contact-modal {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .4s ease, visibility .4s;
}
.lswn-contact-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lswn-contact-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(61, 32, 39, .55);
}

.lswn-contact-modal__panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 560px);
    max-height: 88vh;
    overflow-y: auto;
    background: var(--lswn-parch);
    border: 1px solid rgba(176, 134, 47, .4);
    border-radius: var(--lswn-radius-lg);
    padding: clamp(32px, 5vw, 56px);
    box-shadow: 0 40px 90px -30px rgba(61, 32, 39, .5);
    transform: translateY(28px) scale(.97);
    transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}
.lswn-contact-modal.is-open .lswn-contact-modal__panel {
    transform: translateY(0) scale(1);
}

.lswn-contact-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--lswn-gold);
}
.lswn-contact-modal__close svg { width: 18px; height: 18px; }

.lswn-contact-modal__head {
    text-align: center;
    margin-bottom: 28px;
}
.lswn-contact-modal__headline {
    font-family: var(--lswn-serif);
    font-weight: 400;
    line-height: var(--lswn-leading-heading);
    letter-spacing: var(--lswn-tracking-heading);
    font-size: clamp(24px, 3.6vw, 34px);
    color: var(--lswn-wine);
    margin: 0 0 12px;
}
.lswn-contact-modal__headline i { font-style: italic; color: var(--lswn-gold); }
.lswn-contact-modal__text {
    color: var(--lswn-ink-soft);
    font-size: 15.5px;
    line-height: 1.7;
    margin: 0 auto;
    max-width: 42ch;
}

/* --- Contact Form 7: Standard-Markup in Marken-Optik einfärben --- */
.lswn-contact-modal__form .wpcf7-form p { margin: 0 0 16px; }
.lswn-contact-modal__form .wpcf7-form label {
    display: block;
    font-size: 13.5px;
    color: var(--lswn-ink-soft);
    margin-bottom: 6px;
}
.lswn-contact-modal__form .wpcf7-form-control:not([type="submit"]) {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .6);
    border: 1px solid rgba(176, 134, 47, .4);
    border-radius: var(--lswn-radius-sm);
    color: var(--lswn-ink);
    font-family: inherit;
    font-size: 15px;
}
.lswn-contact-modal__form textarea.wpcf7-form-control { min-height: 120px; resize: vertical; }
.lswn-contact-modal__form .wpcf7-form-control:focus {
    outline: none;
    border-color: var(--lswn-gold);
}
.lswn-contact-modal__form .wpcf7-submit {
    display: inline-block;
    margin-top: 4px;
    padding: 13px 32px;
    background: var(--lswn-wine);
    color: var(--lswn-parch);
    border: 1px solid var(--lswn-wine);
    border-radius: var(--lswn-radius-pill);
    font-size: 14px;
    cursor: pointer;
    transition: background-color .35s ease;
}
.lswn-contact-modal__form .wpcf7-submit:hover { background: var(--lswn-wine-dk); }
.lswn-contact-modal__form .wpcf7-spinner { margin-left: 12px; }
.lswn-contact-modal__form .wpcf7-not-valid-tip {
    color: var(--lswn-wine-dk);
    font-size: 12.5px;
    margin-top: 4px;
}
.lswn-contact-modal__form .wpcf7-response-output {
    margin-top: 18px;
    border-radius: var(--lswn-radius-sm);
    font-size: 13.5px;
}

/* --- Dank-Ansicht nach erfolgreichem Absenden --- */
.lswn-contact-modal__success[hidden] { display: none; }
.lswn-contact-modal__success {
    text-align: center;
    padding: 12px 0 4px;
}
.lswn-contact-modal__success-kicker {
    display: block;
    font-family: var(--lswn-serif);
    font-size: 22px;
    color: var(--lswn-wine);
    margin-bottom: 14px;
}
.lswn-contact-modal__success p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--lswn-ink-soft);
    max-width: 42ch;
    margin: 0 auto;
}

body.lswn-modal-lock { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .lswn-contact-modal, .lswn-contact-modal__panel { transition: none !important; }
}
