/* Winzerhöfle homepage design tokens */
:root {
    --cream: #f6f1e8;
    --sand: #e8e1d3;
    --sage: #6f866b;
    --sage-text: #3f563f;
    --sage-cta: #4c654b;
    --ink: #1f2922;
    --muted: #596158;
    --border: #d6cdbd;
    --overlay: rgba(17, 26, 19, 0.68);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --wrapper: 1120px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--sage-text);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

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

a:focus-visible {
    outline: 3px solid var(--sage);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
}

.wrapper {
    width: min(calc(100% - 32px), var(--wrapper));
    margin-right: auto;
    margin-left: auto;
}

.skip-link {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-md);
    z-index: 10;
    padding: var(--space-sm) var(--space-md);
    color: var(--ink);
    background: var(--cream);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* === Gemeinsamer Header und Hauptnavigation (Phase 2) === */

.site-header {
    position: static; /* Immer normaler Dokumentfluss, nie sticky (D-11). */
    background: var(--cream);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
    min-height: 72px;
    padding: var(--space-sm) 0;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
}

.site-logo img {
    display: block;
    width: auto;
    height: 54px;
}

.main-nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-xs) var(--space-md);
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav-list li {
    min-width: 0;
}

.main-nav-list a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: var(--space-sm) var(--space-sm);
    color: var(--ink);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    text-transform: none; /* Satzfall-Labels, nie KAPITÄLCHEN (UI-SPEC) */
    text-underline-offset: 6px;
}

.main-nav-list a:hover {
    color: var(--sage-text);
    text-decoration: underline;
    text-decoration-color: var(--sage);
    text-decoration-thickness: 2px;
}

.main-nav-list li.is-active > a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--sage);
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
}

.nav-cta-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-left: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    color: #fff;
    background: var(--sage-cta);
    border-radius: 8px;
    font-weight: 600; /* Dezenter, vom Textlink klar unterscheidbarer CTA (D-12) */
    white-space: nowrap;
    text-decoration: none;
}

.nav-cta-link:hover {
    background: #384d39;
}

button:focus-visible {
    outline: 3px solid var(--sage);
    outline-offset: 2px;
}

/* === Mobile-Menü-Enhancement (Plan 02-02) ===
   Aktiv nur, wenn site.js die Klasse .nav-enhanced gesetzt und den
   kompakten Schalter eingefügt hat. Ohne JavaScript (bzw. vor der
   Skript-Ausführung) bleibt die Linkliste eine normale, sichtbare Liste. */

.menu-toggle {
    display: none; /* Nur im erweiterten mobilen Zustand sichtbar (<=719px). */
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: var(--space-sm) var(--space-md);
    color: var(--ink);
    background: var(--sand);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    white-space: normal; /* Label darf auch bei starker Vergroesserung umbrechen. */
    overflow-wrap: anywhere; /* Langes Label bricht statt zu kippen. */
}

/* Fokus-Ringe bleiben im erweiterten Zustand sichtbar und unabhaengig von
   Hover — unabhängig von den globalen Basisregeln abgesichert. */
.nav-enhanced .menu-toggle:focus-visible,
.nav-enhanced .main-nav-list a:focus-visible {
    outline: 3px solid var(--sage);
    outline-offset: 2px;
}

@media only screen and (max-width: 719px) {
    /* Erweiterter kompakter Kopf: Logo und Schalter in einer Zeile,
       darunter das helle, im Dokumentfluss liegende Panel. */
    .header-inner.nav-enhanced {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-sm);
    }

    .nav-enhanced .menu-toggle {
        display: inline-flex;
    }

    .nav-enhanced.nav-open .menu-toggle {
        color: var(--sage-text);
        border-color: var(--sage);
    }

    /* Panel-Zeile: volle Breite, nur bei geöffnetem Zustand gerendert. */
    .nav-enhanced .main-nav {
        flex-basis: 100%;
        min-width: 0; /* Flex-Overflow-Schutz im schmalen Querformat. */
    }

    .nav-enhanced:not(.nav-open) .main-nav {
        display: none;
    }

    .nav-enhanced .main-nav-list {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: var(--space-xs);
        width: 100%;
        margin: 0;
        padding: var(--space-md);
        overflow-wrap: anywhere;
        background: var(--sand);
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .nav-enhanced .main-nav-list li {
        width: 100%;
    }

    .nav-enhanced .main-nav-list a {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
    }

    .nav-enhanced .nav-cta {
        margin-top: var(--space-xs);
    }

    .nav-enhanced .nav-cta-link {
        justify-content: center;
        margin-left: 0;
        width: 100%;
        white-space: normal; /* "Besuch planen" darf natuerlich umbrechen. */
        overflow-wrap: anywhere;
    }
}

/* Ab 720px gilt ausschließlich die Desktop-Zeile: Der kompakte Schalter ist
   nie sichtbar, die Linkliste bleibt eine normale Reihe im Dokumentfluss. */
@media only screen and (min-width: 720px) {
    .menu-toggle {
        display: none;
    }

    .site-header .main-nav-list {
        flex-wrap: wrap; /* Einzelreihe, wenn der Platz es erlaubt (UI-SPEC). */
    }
}

.hero {
    position: relative;
    min-height: 360px;
    height: min(70svh, 760px);
    overflow: hidden;
    color: #fff;
    isolation: isolate;
}

.hero-image,
.hero-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-image {
    z-index: -2;
    object-fit: cover;
    object-position: 50% 45%;
}

.hero-overlay {
    z-index: -1;
    background: linear-gradient(90deg, var(--overlay), rgba(17, 26, 19, 0.18));
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
}

.hero-content h1 {
    max-width: 12ch;
    margin: 0 0 var(--space-md);
    color: #fff;
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 600;
    line-height: 1.1;
}

.hero-content p {
    max-width: 36rem;
    margin: 0 0 var(--space-xl);
    font-size: 16px;
}

.hero-content a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 44px;
    padding: var(--space-sm) var(--space-lg);
    color: #fff;
    background: var(--sage-cta);
    font-weight: 600;
    text-decoration: none;
}

.hero-content a:hover {
    background: #384d39;
}

#main-content {
    min-height: 1px;
}

.visit-section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-3xl);
}

.section-intro {
    margin-bottom: var(--space-lg);
}

.eyebrow {
    margin: 0 0 var(--space-xs);
    color: var(--sage-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

h2 {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.visitor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
}

.visitor-card,
.visitor-error {
    min-width: 0;
    padding: var(--space-xl);
    overflow-wrap: anywhere;
    background: var(--sand);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.visitor-card h2,
.visitor-error h2 {
    margin-bottom: var(--space-md);
}

.visitor-details {
    margin: 0;
}

.visitor-details dt {
    margin-bottom: var(--space-xs);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.visitor-details dd,
.visitor-card address,
.visitor-error p {
    max-width: 100%;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 16px;
    font-style: normal;
    line-height: 1.5;
}

.visitor-error {
    background: #f1e4d7;
    border-left: 4px solid var(--sage);
}

.footer {
    padding: var(--space-xl) 0;
    background: var(--sand);
    color: var(--muted);
}

.footer .wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
}

.footer p {
    margin-top: 0;
}

.footer img {
    width: 32px;
}

/* Existing wine detail tables and two-column content remain compatible. */
.columns-2 {
    display: flex;
    flex-direction: row;
    gap: var(--space-xl);
}

.columns-2 > div {
    min-width: 200px;
}

table.naehrwerte {
    max-width: 60rem;
    border-collapse: collapse;
    border: 1px solid var(--border);
}

table.naehrwerte td,
table.naehrwerte th {
    padding: var(--space-sm);
    border-top: 1px solid var(--border);
}

table.naehrwerte th {
    background: var(--sand);
    color: var(--ink);
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.wein-detail .columns-2 > div.info {
    width: 70%;
}

.wein-detail .columns-2 > .wein-detail-image {
    flex-basis: 33.333%;
    min-width: 0;
}

@media only screen and (max-width: 719px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .main-nav-list {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .nav-cta-link {
        margin-left: 0;
    }

    .hero {
        height: min(70svh, 520px);
    }

    .hero-image {
        object-position: 58% 42%;
    }

    .hero-content {
        padding-bottom: var(--space-xl);
    }

    .visit-section {
        padding-top: var(--space-xl);
    }

    .visitor-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .visitor-card,
    .visitor-error {
        padding: var(--space-lg);
    }

    .footer .wrapper {
        align-items: center;
        flex-direction: column;
    }

    .columns-2 {
        display: block;
    }

    .wein-detail .columns-2 > div.info {
        width: auto;
    }
}

@media only screen and (min-width: 720px) and (max-width: 1023px) {
    .wrapper {
        max-width: 960px;
    }

    .hero {
        height: max(560px, 70svh);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    /* Das erweiterte mobile Menü nutzt bewusst keine essentiellen
       Transitionen: Das Panel wird ohne Animation ein-/ausgeblendet.
       Die folgenden Regeln sichern das ausdrücklich ab. */
    .nav-enhanced .menu-toggle,
    .nav-enhanced .main-nav-list a {
        transition: none;
    }
}

/* === Phase 3: Subpage page-title (D-17; Display role, capped) === */

.page-title,
.content h1 {
    margin: 0 0 var(--space-lg);
    color: var(--ink);
    font-size: clamp(28px, 4.5vw, 40px);
    font-weight: 600;
    line-height: 1.1;
}

/* === Phase 3: Subpage content padding (D-09) ===
   Width cap + centered margins + vertical/horizontal rhythm on main;
   the footer band below stays full-width. */

#main-content.subpage {
    width: min(calc(100% - 32px), var(--wrapper));
    margin-right: auto;
    margin-left: auto;
    padding-top: var(--space-2xl);
    padding-right: var(--space-md);
    padding-bottom: var(--space-2xl);
    padding-left: var(--space-md);
}

@media only screen and (min-width: 720px) {
    #main-content.subpage {
        padding-top: var(--space-3xl);
        padding-right: var(--space-xl);
        padding-bottom: var(--space-3xl);
        padding-left: var(--space-xl);
    }
}

@media only screen and (min-width: 720px) and (max-width: 1023px) {
    #main-content.subpage {
        max-width: 960px;
    }
}

/* === Phase 3: Wine card grid (D-10/D-12/D-13) === */

ul.wein-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    list-style: none;
    margin: 0;
    padding: 0;
}

.wein-grid li {
    display: flex;
    min-width: 0;
}

@media only screen and (min-width: 720px) {
    ul.wein-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-md);
    }
}

@media only screen and (min-width: 1024px) {
    ul.wein-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-lg);
    }
}

/* === Phase 3: Wine card (D-11/D-15) === */

li.wein-card-li {
    width: 100% !important;
}
.wein-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
}

.wein-card:hover {
    border-color: var(--sage);
}

.wein-card:focus-visible {
    outline: 3px solid var(--sage);
    outline-offset: 2px;
}

.wein-card-image {
    aspect-ratio: 3 / 2;
    background: var(--cream); /* D-15: no-image cream slot */
    overflow: hidden;
}

.wein-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wein-card-info {
    padding: var(--space-md);
}

.wein-card-title {
    margin: 0 0 var(--space-xs);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.wein-card-price {
    margin: 0;
    font-size: 16px;
    color: var(--muted);
}

/* === Phase 3: Wine empty state (UI-SPEC copy) === */

.wein-empty {
    padding: var(--space-2xl);
    text-align: center;
}

/* === Phase 3: Wine detail back link (D-20) === */

.wein-back-link {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    margin-bottom: var(--space-md);
    font-size: 16px;
}

/* === Phase 3: Wine detail image slot (D-19) === */

.wein-detail-image {
    aspect-ratio: 3 / 2;
    background: var(--cream);
    overflow: hidden;
}

.wein-detail-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === Phase 3: QR block (D-18, detail page only) === */

.wein-qr {
    margin-top: var(--space-xl);
}

.wein-qr img.qrcode {
    max-width: 120px;
    height: auto;
}

/* === Phase 3: Family history prose (FAM-01, body class scoped) ===
   Text-only narrative on /wir-sind-die-blass. The 40rem column override
   sits at the end of the file so it wins over the 1120px subpage cap
   (#main-content.subpage has equal specificity, earlier source order). */

.family-history #main-content {
    max-width: 40rem;
}

.family-history blockquote {
    margin: 0 0 var(--space-lg);
    padding-left: var(--space-md);
    border-left: 2px solid var(--sage);
    color: var(--ink);
    font-style: normal;
    overflow-wrap: anywhere;
}

.family-history h2 {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-md);
}

/* === Phase 3: Aktuelles event blocks (NEWS-01, body class scoped) === */

.aktuelles .event-block {
    padding: var(--space-lg);
    background: var(--sand);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: var(--space-md);
    overflow-wrap: anywhere;
}

.aktuelles .event-block h2 {
    margin-top: 0;
    margin-bottom: var(--space-sm);
}

.aktuelles .event-block .event-date {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: var(--space-sm);
}

.aktuelles .event-block p:last-child {
    margin-bottom: 0;
}

@media only screen and (min-width: 720px) {
    .aktuelles .event-block {
        padding: var(--space-xl);
    }
}

body.clean {
    background-color: #1b3f0b3d;
    color: #000;
}

body.clean h3 {
    color: #000;
}
body.clean .header-inner,
body.clean .footer {
    display: none;
}

body.clean .wein-back-link,
body.clean .media-container,
body.clean .wein-qr,
body.clean .wein-detail-image {
    display: none;
}
