/*
 * Responsive-Schicht für die Funnel-Seiten (index, 5a–8a)
 * ---------------------------------------------------------
 * Die Seiten kommen unverändert aus dem Design-Tool und sind für eine feste Leinwand von 1520×880 px gebaut.
 * Der Worker hängt diese Datei beim Ausliefern an jede Seite an. Sie passt die Leinwand an den Bildschirm an:
 *
 *   gross    ≥ 1280 px   Leinwand füllt das Fenster, Inhalt max. 1200 px breit (wie im Design)
 *   laptop   900–1279 px  z.B. HP EliteBook (1920×1200 bei 150 % = 1280×800)
 *   handy    < 900 px     alles untereinander, die Seite scrollt normal
 *
 * Die Regeln greifen über die Inline-Stile der Seite (Attribut-Selektoren) und brauchen deshalb !important.
 * Neue Exporte aus dem Design-Tool einfach in public/ ersetzen: diese Datei bleibt gültig, solange die
 * Grundstruktur gleich bleibt. Die automatischen Tests melden, wenn eine Seite wieder seitlich scrollt.
 */

:root {
  --o-gutter: clamp(16px, 3vw, 36px);
}

/* ---------- Leinwand (5a–8a): statt fix 1520×880 das ganze Fenster ---------- */
[style*="width: 1520px"] {
  width: 100% !important;
  max-width: 1520px;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 600px;
  padding-left: var(--o-gutter) !important;
  padding-right: var(--o-gutter) !important;
}
/* 8a hat keine feste Höhe */
[style*="width: 1520px"]:not([style*="height: 880px"]) {
  height: auto !important;
  min-height: 100dvh;
}

/* ---------- Landing (index): keine Mindestbreite ---------- */
[style*="min-width: 1240px"] {
  min-width: 0 !important;
  min-height: 0 !important;
}

/* ---------- Laptop: etwas kompakter, damit ein Schritt ohne Scrollen passt ---------- */
@media (max-width: 1279px), (max-height: 820px) {
  [style*="width: 1520px"] {
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }
}

/* ---------- Handy und Tablet ---------- */
@media (max-width: 899px) {
  /* Leinwand: normale Seite, die als Ganzes scrollt */
  [style*="width: 1520px"] {
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
    padding: 16px !important;
  }
  /* Innere Scrollbereiche auflösen (die Seite scrollt als Ganzes) */
  [style*="width: 1520px"] [style*="overflow-y: auto"],
  [style*="width: 1520px"] [style*="min-height: 0px"] {
    overflow: visible !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    min-height: auto !important;
  }
  /* Formular und Zusammenfassung untereinander */
  [style*="flex-wrap: nowrap"] {
    flex-wrap: wrap !important;
  }
  [style*="min-width: min(100%, 520px)"] {
    min-width: 0 !important;
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
  [style*="width: 1520px"] [style*="flex: 0 1 auto"][style*="max-width: 100%"] {
    width: 100% !important;
  }
  /* «Zurück / Weiter»-Leiste klebt am unteren Bildschirmrand, solange das Formular sichtbar ist */
  [style*="position: sticky"][style*="bottom: -24px"] {
    bottom: 0 !important;
    margin-bottom: 0 !important;
    padding: 12px 0 !important;
  }
  /* Raster: zweispaltig und mehr wird einspaltig */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: repeat(2,"],
  [style*="grid-template-columns: repeat(3,"],
  [style*="grid-template-columns: minmax(0px, 1fr) 560px"],
  [style*="grid-template-columns: minmax(0px, 1fr) 250px"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  [style*="grid-template-columns: repeat(4,"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  /* Vergleichstabelle (5a) darf bleiben, aber enger */
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 0.9fr 1fr 1fr !important;
    font-size: 13px;
  }
  /* Grosszügige Seitenränder der Landing verkleinern */
  [style*="max-width: 1240px"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  [style*="max-width: 1240px"][style*="padding: 64px"],
  [style*="max-width: 1240px"][style*="padding: 56px"] {
    padding-top: 32px !important;
    padding-bottom: 32px !important;
  }
  /* Lange Zeilen mit Chips dürfen umbrechen */
  [style*="flex-wrap: nowrap"][style*="gap: 4px"] {
    flex-wrap: wrap !important;
  }
  /* Landing: Zeilen (Navigation, Buttons, Fusszeile) dürfen umbrechen */
  [style*="min-width: 1240px"] [style*="display: flex"]:not([style*="flex-direction: column"]) {
    flex-wrap: wrap !important;
  }
  [style*="min-width: 1240px"] header [style*="gap: 28px"] {
    gap: 12px 20px !important;
  }
  /* Landing: Illustration «Das bist du» (fix 560×410) verkleinert */
  [style*="width: 560px"][style*="height: 410px"] {
    zoom: 0.7;
    justify-self: center;
  }
  /* Grosse Titel */
  h1 {
    font-size: clamp(30px, 8.5vw, 44px) !important;
    line-height: 1.12 !important;
  }
  h2 {
    font-size: clamp(20px, 5.6vw, 26px) !important;
  }
}

@media (max-width: 459px) {
  [style*="width: 560px"][style*="height: 410px"] { zoom: 0.62; }
}
@media (max-width: 379px) {
  [style*="width: 560px"][style*="height: 410px"] { zoom: 0.55; }
}

@media (max-width: 520px) {
  [style*="grid-template-columns: repeat(4,"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  [style*="width: 1520px"] {
    padding: 12px !important;
  }
}

/* ---------- AVB (avb.html): Inhaltsverzeichnis darf auf dem Handy seitlich wischen, ohne die Seite zu verbreitern ---------- */
.page .grid > * { min-width: 0; }
