/* Fairfinanz — Quiz-Funnel (/quiz).
   Baut ausschließlich auf css/tokens.css auf: keine neuen Farben, keine neuen Schriften.
   Rezepte übernommen aus recht.css (Kopf/Fuß), rechner.css (Regler, Karte) und
   site.css (Formularfelder) — Abweichungen sind kommentiert.
   Gelb bleibt Handlung: genau EIN gefüllter Knopf pro Schritt (.btn-primaer). */

/* ---------------------------------------------------------------- Sprungmarke */

.sprung {
  position: absolute;
  top: 14px;
  left: 20px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--papier);
  color: var(--tinte);
  border: 1.5px solid var(--tinte);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}
.sprung:focus {
  transform: translateY(0);
}

/* ---------------------------------------------------------------- Kopfzeile */

.kopf {
  border-bottom: 1px solid var(--linie);
  background: var(--papier);
}

.kopf-innen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  max-width: var(--spalte);
  margin: 0 auto;
  padding: 16px var(--rand);
}

.kopf .lockup { min-height: 44px; }
.kopf .signet { width: 48px; height: 48px; }
.kopf .wortmarke { font-size: 26px; }
.kopf .zusatz { font-size: 12px; text-transform: uppercase; }

/* Telefon statt Navigation: der einzige zweite Ausgang der Zielseite. */
.kopf-tel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-height: 44px;
  justify-content: center;
  text-decoration: none;
}
.kopf-tel-label {
  font-size: 13px;
  color: var(--sekundaer);
}
.kopf-tel-nummer {
  font-weight: 700;
  font-size: 20px;
  color: var(--tinte);
  font-variant-numeric: tabular-nums;
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.kopf-tel:hover .kopf-tel-nummer { text-decoration-color: var(--tinte); }

/* ---------------------------------------------------------------- Seitenrumpf */

/* Schmale Funnel-Spalte: 720 px statt 1180 px — eine Frage, ein Blick, keine Ablenkung. */
.quiz-haupt {
  max-width: 720px;
  margin: 0 auto;
  padding: 44px var(--rand) 96px;
}

.quiz-einstieg h1 {
  font-size: clamp(29px, 4.4vw, 42px);
  margin-top: 14px;
  /* Lange Komposita (z. B. „Finanzierungseinschätzung") sonst breiter als schmale
     Handy-Viewports → liefen rechts aus dem Bild. lang="de" + hyphens trennt sauber;
     overflow-wrap bricht notfalls hart, falls die Silbentrennung fehlt. */
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}
.quiz-einstieg .lead {
  margin-top: 12px;
  max-width: 56ch;
}

/* ---------------------------------------------------------------- Fortschritt */

.q-fortschritt-zeile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
}
/* display:flex würde das hidden-Attribut sonst überstimmen — gleiche Falle wie beim
   Zurück-Knopf unten. Gilt für alles, was per JS ein- und ausgeblendet wird. */
.q-fortschritt-zeile[hidden] { display: none; }

.q-fortschritt {
  flex: 1 1 auto;
  height: 6px;
  background: var(--linie);
  border-radius: 3px;
  overflow: hidden;
}

.q-balken {
  height: 100%;
  width: var(--fortschritt, 0%);
  background: var(--tinte);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.q-schrittzahl {
  flex: 0 0 auto;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Bühne */

.q-karte {
  margin-top: 18px;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 36px 40px 40px;
}

.q-karte h2 {
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.25;
  margin: 0;
}
.q-karte h2:focus {
  outline: none;
}

.q-frage-hinweis {
  margin: 10px 0 0;
}

/* Auftritt je Schritt — richtungsabhaengig. Vorwaerts kommt der Schritt von rechts,
   rueckwaerts von links; js/quiz.js setzt dafuer .ist-rueckwaerts an der Buehne.
   Nur transform und opacity, also kein Layout und kein Sprung. 0.22 s liegt am
   unteren Rand der Hausspanne — der Schritt soll da sein, nicht auftreten. */
.q-schritt {
  animation: q-auftritt-vor 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}
.ist-rueckwaerts .q-schritt {
  animation-name: q-auftritt-zurueck;
}
@keyframes q-auftritt-vor {
  from { opacity: 0; transform: translate3d(14px, 0, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes q-auftritt-zurueck {
  from { opacity: 0; transform: translate3d(-14px, 0, 0); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .q-schritt { animation: none; }
  .q-balken { transition: none; }
}

/* ---------------------------------------------------------------- Kacheln */

.q-kacheln {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 26px;
}

.q-kachel {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  text-align: left;
  color: var(--tinte);
  background: var(--papier);
  border: 1.5px solid var(--sekundaer);
  border-radius: var(--radius);
  cursor: pointer;
  /* Zustandswechsel dauern, statt zu springen (150-300 ms ist die Hausspanne).
     Nur Farbe und transform — beides ist compositor-freundlich und loest kein
     Layout aus. Der Rahmenwechsel bleibt bewusst ungetweent: er veraendert
     zusammen mit dem Innenabstand die Kastenmasse, und eine getweente Kante
     zappelt subpixelweise. */
  transition: background-color 0.16s ease-out, border-color 0.16s ease-out,
              transform 0.12s ease-out;
}
.q-kachel:hover {
  border-color: var(--tinte);
  border-width: 2px;
  /* Der dickere Rand darf das Raster nicht bewegen: Ausgleich über Innenabstand. */
  padding: 13.5px 17.5px;
}

/* DRUCK-FEEDBACK — im Baufi-Bestand fehlt es komplett, und das ist dort ein echter
   Mangel: Auf dem Handy gibt es kein :hover. Wer eine Kachel antippt, bekommt bis
   zum Schrittwechsel (rund 250 ms) gar keine Antwort — die Seite wirkt kaputt und
   man tippt ein zweites Mal. Feedback gehoert auf den Druck, nicht auf das
   Loslassen. Befund gehoert zurueck ins Fairfinanz-Repo portiert. */
.q-kachel:active {
  transform: scale(0.985);
  background: var(--flaeche2);
  border-color: var(--tinte);
}
.q-zurueck:active { transform: translateY(1px); }
.q-kachel:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}
.q-kachel.ist-gewaehlt {
  border-color: var(--tinte);
  border-width: 2px;
  padding: 13.5px 17.5px;
  background: var(--flaeche2);
  box-shadow: inset 0 0 0 1px var(--tinte);
}

.q-kachel-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--tinte);
}

/* ---------------------------------------------------------------- Regler */

.q-regler-wert {
  margin: 26px 0 0;
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 32px);
  color: var(--tinte);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.q-regler {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 10px 0 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.q-regler::-webkit-slider-runnable-track {
  height: 4px;
  background:
    linear-gradient(var(--akzent), var(--akzent)) left center / var(--fortschritt, 0%) 4px no-repeat,
    var(--sekundaer);
  border-radius: 2px;
}
.q-regler::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border: none;
  border-radius: 50%;
  background: var(--tinte);
}
.q-regler::-moz-range-track {
  height: 4px;
  background:
    linear-gradient(var(--akzent), var(--akzent)) left center / var(--fortschritt, 0%) 4px no-repeat,
    var(--sekundaer);
  border-radius: 2px;
}
.q-regler::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--tinte);
}
.q-regler:focus { outline: none; }
.q-regler:focus-visible {
  outline: 2px solid var(--tinte);
  outline-offset: 4px;
  border-radius: 4px;
}

.q-skala {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: var(--t-klein);
  color: var(--sekundaer);
}

/* ---------------------------------------------------------------- Felder */

.q-felder { margin-top: 26px; }

.feld { margin-bottom: 22px; }
.feld > label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.feld input[type="text"],
.feld input[type="email"],
.feld input[type="tel"] {
  width: 100%;
  font: inherit;
  color: var(--tinte);
  background: var(--papier);
  border: 1.5px solid var(--sekundaer);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-height: 52px;
}
.feld input[aria-invalid="true"] {
  border-color: var(--fehler);
  border-width: 2px;
}
.feld-hinweis { margin-top: 6px; }
.feld-fehler {
  margin-top: 8px;
  font-size: var(--t-klein);
  font-weight: 600;
  color: var(--fehler);
}

.feld-einwilligung {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 26px;
}
.feld-einwilligung input {
  width: 26px;
  height: 26px;
  margin: 2px 0 0;
  accent-color: var(--tinte);
}
.feld-einwilligung label {
  font-size: var(--t-klein);
  line-height: 1.55;
  color: var(--sekundaer);
}
.feld-einwilligung .feld-fehler { grid-column: 2; }

.q-datenhinweis {
  margin-top: 18px;
}
.q-datenhinweis a { color: var(--tinte); }

/* ---------------------------------------------------------------- Knöpfe */

.q-weiter {
  margin-top: 28px;
  width: 100%;
  min-height: 60px;
}

.q-zurueck-zeile {
  margin: 14px 0 0;
  min-height: 44px;
}
.q-zurueck {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  font: inherit;
  font-weight: 600;
  color: var(--tinte);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
.q-zurueck:hover { text-decoration-color: var(--tinte); }
.q-zurueck[hidden] { display: none; }
.q-zurueck:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
  border-radius: 2px;
}

.q-beruhigung {
  margin-top: 10px;
  text-align: center;
}

.q-meldung {
  margin-top: 18px;
  font-weight: 600;
  line-height: 1.55;
}
.q-meldung:empty { margin-top: 0; }
.q-meldung.ist-fehler {
  padding: 16px 18px;
  background: var(--papier);
  border-left: 3px solid var(--fehler);
  color: var(--tinte);
}
.q-meldung a { color: var(--tinte); }

/* ---------------------------------------------------------------- Ergebnis */

.q-ergebnis-kopf .kicker { margin-bottom: 10px; }

.q-ergebnis-rahmen {
  margin: 18px 0 0;
  padding: 16px 18px;
  background: var(--papier);
  border-left: 3px solid var(--tinte);
}

.q-ergebnis-punkte {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.q-ergebnis-punkte li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 12px;
  line-height: 1.55;
}
.q-ergebnis-punkte li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 12px;
  height: 7px;
  border-left: 2.5px solid var(--tinte);
  border-bottom: 2.5px solid var(--tinte);
  transform: rotate(-45deg);
}

/* Frank + Rückruf-Zusage: Foto klein und freundlich, kein Hero. */
.q-frank {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 28px;
  padding: 20px;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}
.q-frank img {
  flex: 0 0 auto;
  width: 84px;
  height: auto;
  border-radius: var(--radius);
}
.q-frank p { margin: 0; }
.q-frank .q-frank-name {
  font-weight: 700;
  color: var(--tinte);
}

.q-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}
.q-aktionen .btn { flex: 1 1 240px; }

/* ---------------------------------------------------------------- Ohne JS */

.q-ohne-js h2 { margin-bottom: 12px; }
.q-ohne-js a { color: var(--tinte); }

/* ---------------------------------------------------------------- Fußzeile */

.fuss {
  background: var(--flaeche2);
  border-top: 1px solid var(--linie);
  margin-top: 40px;
}

.fuss-innen {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 40px;
  max-width: var(--spalte);
  margin: 0 auto;
  padding: 56px var(--rand) 40px;
}

.fuss .signet { width: 48px; height: 48px; }
.fuss .wortmarke { font-size: 24px; }
.fuss .zusatz { font-size: 12px; text-transform: uppercase; }
.fuss address {
  font-style: normal;
  margin-top: 18px;
  color: var(--sekundaer);
  font-size: var(--t-klein);
  line-height: 1.6;
}

.fuss-titel {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sekundaer);
  margin: 0 0 8px;
}

.fuss-liste {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fuss-liste a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  color: var(--tinte);
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
.fuss-liste a:hover { text-decoration-color: var(--tinte); }

.fuss-schluss { border-top: 1px solid var(--linie); }
.fuss-schluss-innen {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  max-width: var(--spalte);
  margin: 0 auto;
  padding: 22px var(--rand) 30px;
}
.fuss-schluss p { margin: 0; }

/* ---------------------------------------------------------------- Mobil */

@media (max-width: 780px) {
  .kopf-innen,
  .fuss-schluss-innen {
    padding-left: var(--rand-mobil);
    padding-right: var(--rand-mobil);
  }

  .quiz-haupt {
    padding: 18px var(--rand-mobil) 64px;
  }

  /* ---------- Der Vorspann muss die Frage nicht überholen (04.08.2026) ----------
     Gemessen bei 390×745: Kicker, Überschrift und Lead schoben die erste
     Antwortkachel auf y=484 — unterhalb der Falz, und darunter lag auch noch das
     Einwilligungsblatt. Von 16 Sitzungen beantworteten 5 die erste Frage.

     Der Kicker wiederholt, was die Überschrift schon sagt. Und das Versprechen der
     Lead-Zeile („Kostenlos und unverbindlich …") steht auf dem Handy unverändert
     unter der Karte in .q-beruhigung — es verschwindet also nicht, es rückt nur
     dorthin, wo es nicht im Weg steht. */
  .quiz-einstieg .kicker,
  .quiz-einstieg .lead {
    display: none;
  }

  .quiz-einstieg h1 {
    font-size: 26px;
    margin-top: 0;
  }

  .q-fortschritt-zeile {
    margin-top: 16px;
  }

  .q-karte {
    padding: 20px 18px 24px;
  }

  .q-kacheln {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
  }

  /* Klickflächen mobil mindestens 52 px — 58 hält die WCAG-Grenze und bringt
     gegenüber 64 px zwei statt einer Kachel über das Einwilligungsblatt. */
  .q-kachel { min-height: 58px; padding: 12px 16px; }
  .q-zurueck,
  .fuss-liste a { min-height: 52px; }

  .fuss-innen {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 44px var(--rand-mobil) 32px;
  }

  .q-frank { align-items: flex-start; }
}

@media (max-width: 480px) {
  .kopf-tel-label { display: none; }
}

/* ---------------------------------------------------------------------------
   Statisches Vorbild des ersten Schritts (tools/quiz-vorbild.py)

   Vorher tauschte js/quiz.js beim Start den kompletten Inhalt von #q-buehne aus —
   auf dem Handy ist das der gesamte Bereich über der Falz. Gemessen am 2026-07-28:
   CLS 0,208 aus einer einzigen Verschiebung. Jetzt steht dieselbe Karte schon im
   HTML; der Austausch ersetzt Gleiches durch Gleiches und verschiebt nichts.

   Sichtbar nur mit JavaScript: ohne JS wären es tote Knöpfe. js/js-flag.js setzt
   .js synchron im <head>, also vor der ersten Malung — und nimmt es nach 1.500 ms
   wieder weg, wenn quiz.js sich nicht meldet. Dann erscheint der ehrliche Ausweg.
   --------------------------------------------------------------------------- */
.q-vorbild { display: none; }
/* display:contents statt block: der Wrapper darf keinen eigenen Kasten bilden,
   sonst bleibt eine Restverschiebung, wenn quiz.js ihn durch die Karte ohne
   Wrapper ersetzt (gemessen: 0,0205 mit block, 0 mit contents). */
html.js .q-vorbild { display: contents; }
html.js .q-ohne-js { display: none; }

/* Die Fortschrittszeile steht IMMER — auch ohne JavaScript, wo dann eine leere
   6-px-Spur zu sehen ist. Der Grund ist ein Fallstrick: js/js-flag.js nimmt die
   Klasse .js nach 1,5 s wieder weg, wenn sich js/reveal.js nicht meldet — und auf
   dieser Seite meldet es sich nie, weil sie reveal.js gar nicht laedt. Alles, was
   hier an html.js haengt, verschwindet also nach 1,5 s wieder. Eine Regel
   `html:not(.js) .q-fortschritt-zeile { display: none }` hat die Buehne deshalb
   genau dann um 34 px nach oben gezogen (gemessen: Ruck 0,0205). Platz, der
   bleiben soll, darf nicht an dieser Klasse haengen. */
