/* Seitenweite Regeln: kein seitliches Verrutschen, gut lesbare Überschriften auf dem Handy,
   Kontaktformular, Kontakt-Fenster, Galerie mit Lightbox, aufklappbare Termine, Auswahlliste. */

/* Kein horizontales Scrollen, egal welches Element zu breit wäre */
html, body { overflow-x: clip; }
img, video, svg, iframe { max-width: 100%; }
h1, h2, h3, h4 { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
p, li, address, td { overflow-wrap: break-word; }

/* Handy: große Überschriften etwas kleiner, damit sie nicht über vier Zeilen laufen */
@media (max-width: 600px) {
    h1[style*="font-size"] { font-size: clamp(32px, 9.5vw, 42px) !important; }
    h2[style*="font-size: 44px"], h2[style*="font-size: 40px"], h2[style*="font-size: 36px"], h2[style*="clamp("] { font-size: clamp(24px, 7vw, 30px) !important; line-height: 1.15 !important; }
    h3[style*="font-size: 26px"], h3[style*="font-size: 28px"] { font-size: 22px !important; }
    p[style*="font-size: 24px"] { font-size: 20px !important; }
    .recht h2 { font-size: 24px; }
}

/* Kopfbereiche: auf dem Handy erst das Bild, dann der Text */
@media (max-width: 899px) {
    .fg-hero > .fg-hero-bild { order: -1; }
    .fg-hero { gap: 32px !important; padding-top: 32px !important; }
    .fg-hero-bild img { max-height: 62vh; }
}

/* Kontaktformular */
.kf { display: flex; flex-direction: column; gap: 16px; }
.kf-zeile { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.kf-feld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kf label { font-weight: 700; font-size: 16px; }
.kf input[type=text], .kf input[type=email], .kf textarea { font: inherit; font-size: 17px; padding: 14px 16px; border: 1px solid #CFC6B6; border-radius: 14px; background: #fff; color: #26302A; width: 100%; box-sizing: border-box; }
.kf textarea { resize: vertical; min-height: 140px; }
.kf input:focus-visible, .kf textarea:focus-visible, .kf button:focus-visible, .kf a:focus-visible { outline: 2px solid #4A3D78; outline-offset: 2px; }
.kf [aria-invalid="true"] { border-color: #A3483A; }
.kf-fehler { margin: -6px 0 0; font-size: 15px; font-weight: 700; color: #A3483A; }
.kf-falle { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.kf-fuss { display: flex; justify-content: flex-end; }
.kf .kf-hinweis { margin: 0; font-size: 15px; line-height: 1.5; color: #4E5650; text-align: right; }
.kf button { font: inherit; font-weight: 700; color: #fff; background: #3D5A47; border: 0; border-radius: 999px; padding: 16px 32px; cursor: pointer; }
.kf button:hover { background: #2F4A39; }
.kf button[disabled] { opacity: .6; cursor: wait; }
.kf-meldung { margin: 0; padding: 14px 18px; border-radius: 14px; font-weight: 700; }
.kf-meldung[data-art=erfolg] { background: #E6EFE1; color: #26302A; }
.kf-meldung[data-art=fehler] { background: #F7E3E1; color: #7A2E24; }
[hidden] { display: none !important; }

/* Kontakt-Fenster */
.kd { border: 0; padding: 0; border-radius: 24px; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: #F6F1E8; color: #26302A; box-shadow: 0 24px 64px rgba(38, 48, 42, .3); }
.kd::backdrop { background: rgba(38, 48, 42, .55); }
.kd[open] { animation: kd-auf .22s ease-out; }
@keyframes kd-auf { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.kd-innen { position: relative; padding: clamp(22px, 5vw, 36px); }
.kd-zu { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 999px; border: 1px solid #E2D9C8; background: #fff; color: #26302A; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.kd-dach { margin: 0 48px 8px 0; font-size: 14px; font-weight: 700; color: #4A3D78; text-transform: uppercase; letter-spacing: .08em; }
.kd-titel { margin: 0 48px 8px 0; font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(26px, 6vw, 34px); line-height: 1.15; }
.kd-text { margin: 0 0 20px; }
.kd-whatsapp { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 20px; padding: 12px 22px; border-radius: 999px; background: #1F7A4D; color: #fff; text-decoration: none; font-weight: 700; }
.kd-whatsapp:hover { background: #17633E; color: #fff; }
@media (prefers-reduced-motion: reduce) { .kd[open] { animation: none; } }

/* Galerie mit Lightbox */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.galerie button { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 18px; overflow: hidden; display: block; }
.galerie img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; transition: transform .3s; }
.galerie button:hover img { transform: scale(1.03); }
.galerie button:focus-visible { outline: 3px solid #4A3D78; outline-offset: 3px; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; }
.lightbox::backdrop { background: rgba(20, 24, 21, .9); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; animation: kd-auf .2s ease-out; }
.lightbox img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 120px); border-radius: 12px; object-fit: contain; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox figcaption { color: #E9E4DA; font-size: 16px; text-align: center; padding: 0 16px; }
.lightbox-knopf { position: fixed; width: 48px; height: 48px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .92); color: #26302A; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox-zu { top: 16px; right: 16px; }
.lightbox-zurueck { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-weiter { right: 12px; top: 50%; transform: translateY(-50%); }

/* Aufklappbare Termine (public/js/site.js). Ohne JavaScript sind alle Termine offen. */
.termin { background: #fff; border-radius: 20px; overflow: hidden; }
.termin-kopf { width: 100%; font: inherit; color: #26302A; background: none; border: 0; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.termin-kopf:focus-visible { outline: 2px solid #4A3D78; outline-offset: -2px; border-radius: 20px; }
.termin-kurz { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.termin-datum { font-size: 14px; font-weight: 700; color: #4A3D78; text-transform: uppercase; letter-spacing: .06em; }
.termin-titel { font-family: 'Fraunces', serif; font-weight: 600; font-size: 21px; line-height: 1.25; }
.termin-pfeil { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 999px; background: #F6F1E8; display: flex; align-items: center; justify-content: center; transition: transform .3s ease; }
.termin-kopf[aria-expanded="true"] .termin-pfeil { transform: rotate(180deg); }
.termin-inhalt { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
.termin-inhalt > div { overflow: hidden; min-height: 0; }
.termin.ist-zu .termin-inhalt { grid-template-rows: 0fr; }
.termin.ist-zu .termin-inhalt > div { visibility: hidden; transition: visibility 0s .3s; }
.termin-text { padding: 0 20px 22px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .termin-kopf { padding: 22px 28px; } .termin-text { padding: 0 28px 26px; } .termin-titel { font-size: 23px; } }
@media (prefers-reduced-motion: reduce) { .termin-pfeil, .termin-inhalt { transition: none; } }

/* Eigene Auswahlliste (z. B. Firmenauswahl auf „Berater werden“) */
.auswahl { position: relative; }
.auswahl-knopf { width: 100%; font: inherit; font-size: 17px; font-weight: 700; color: #26302A; background: #fff; border: 1px solid #CFC6B6; border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; text-align: left; }
.auswahl-knopf svg { flex: 0 0 auto; transition: transform .2s; }
.auswahl-knopf[aria-expanded="true"] svg { transform: rotate(180deg); }
.auswahl-knopf:focus-visible, .auswahl-liste [role=option]:focus-visible { outline: 2px solid #4A3D78; outline-offset: 2px; }
.auswahl-liste { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid #E2D9C8; border-radius: 16px; box-shadow: 0 12px 32px rgba(38, 48, 42, .16); transform-origin: top; animation: auswahl-auf .18s ease-out; }
@keyframes auswahl-auf { from { opacity: 0; transform: scaleY(.92); } to { opacity: 1; transform: none; } }
.auswahl-liste [role=option] { padding: 12px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.auswahl-liste [role=option]:hover, .auswahl-liste [role=option].ist-markiert { background: #F6F1E8; }
.auswahl-liste [role=option][aria-selected="true"] { color: #3D5A47; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .auswahl-liste { animation: none; } }

/* Fußzeile */
.fz-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 32px 24px; }
.fz-titel { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #CFE0C6; }
.fz-liste { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.fz-liste a { color: #E9E4DA; text-decoration: none; }
.fz-liste a:hover { color: #ffffff; text-decoration: underline; }

/* Sprungmarken oben auf einer Seite (z. B. Produkte): auf dem Handy ordentlich in zwei Spalten */
.sprungnavi { display: flex; flex-wrap: wrap; gap: 10px; }
.sprungnavi a { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; color: #3D5A47; text-decoration: none; font-weight: 700; font-size: 16px; padding: 10px 18px; border-radius: 999px; border: 2px solid #3D5A47; background: #fff; }
.sprungnavi a::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); flex: 0 0 auto; }
.sprungnavi a:hover { background: #3D5A47; color: #fff; }
@media (max-width: 600px) {
    .sprungnavi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .sprungnavi a { min-width: 0; border-radius: 14px; border-width: 1px; border-color: #CFC6B6; padding: 12px; font-size: 14px; overflow-wrap: anywhere; hyphens: auto; }
    .sprungnavi a:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Produktbilder: auf dem Handy quadratisch und nicht bildschirmfüllend */
@media (max-width: 600px) {
    :is(.produktbild, img[src*="/media/cellagon-"], img[src*="/media/sissi-joe-"], img[src*="/media/liebe-die-natur-"], img[src*="/media/birkengold-"]):not([style*="max-width: 45%"]):not([style*="max-width: 31%"]):not([style*="max-width: 30%"]) { width: 100% !important; max-width: 280px !important; height: auto !important; aspect-ratio: 1 / 1 !important; object-fit: contain !important; margin-left: auto; margin-right: auto; display: block; }
}
