/* Kernbohrungen Meier, Anfrage in Schritten (Startseite und preisanfrage.html)
   Ohne JavaScript stehen alle Schritte untereinander. anfrage-stufen.js
   setzt die Klasse ist-stufen und zeigt dann einen Schritt nach dem anderen. */

/* Handy: Überschrift, Formular, darunter Telefon. Breit: links Text und Telefon, rechts das Formular. */
.stufen-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
}
.stufen-intro .section__title { margin-bottom: 0.35em; }
.stufen-intro .section__lead { max-width: 46ch; }
.stufen-layout > .stufen { order: 2; }
.stufen-layout > .stufen-direkt { order: 3; }
@media (min-width: 1000px) {
  .stufen-layout {
    grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(48px, 5vw, 120px);
    row-gap: 0;
    align-items: start;
  }
  .stufen-layout > .stufen-intro { grid-column: 1; grid-row: 1; }
  .stufen-layout > .stufen-direkt { grid-column: 1; grid-row: 2; margin-top: 22px; }
  .stufen-layout > .stufen { grid-column: 2; grid-row: 1 / span 2; }
}
.stufen-direkt {
  margin: 0;
  max-width: 46ch;
  color: var(--color-graphite);
  font-size: 1rem;
  line-height: 1.6;
}
.stufen-direkt a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.stufen-direkt a:hover { text-decoration: underline; }

/* ---------- Formular ---------- */
.stufen {
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 44px);
  max-width: 1200px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.stufen__kopf { margin: 0 0 26px; }
.stufen__kopf[hidden] { display: none; }
.stufen__stand {
  margin: 0 0 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-muted);
}
.stufen__balken {
  height: 6px;
  border-radius: 3px;
  background: var(--color-bg-alt);
  overflow: hidden;
}
.stufen__balken span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--color-primary);
  transition: width 0.35s var(--ease-out);
}

/* Ein Schritt */
.stufe {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.stufe + .stufe {
  margin-top: 44px;
  padding-top: 34px;
  border-top: 1px solid var(--color-line);
}
.ist-stufen .stufe { display: none; margin: 0; padding: 0; border: 0; }
.ist-stufen .stufe.ist-aktiv { display: block; }

.stufe__frage {
  float: left;
  width: 100%;
  margin: 0 0 22px;
  padding: 0;
  font-size: clamp(1.35rem, 2.3vw, 1.9rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-ink);
  text-wrap: balance;
}
.stufe__frage:focus { outline: none; }
.stufe__frage ~ * { clear: both; }

.stufe__felder {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Teile, die nur für eine Leistung gelten */
.pfad {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pfad[hidden],
[data-pfad][hidden],
[data-wenn][hidden],
[data-wenn-nicht][hidden] { display: none; }
.stufe > .pfad + .pfad { margin-top: 26px; }
.pfad__titel {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}
.ist-stufen .pfad__titel { display: none; }
.ist-stufen .stufe > .pfad + .pfad { margin-top: 0; }

/* Antworten zum Antippen */
.wahl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: none;
}
.wahl__feld {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1.5px solid var(--color-line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.wahl__feld[hidden] { display: none; }
.wahl__feld:hover { border-color: var(--color-primary); }
.wahl__feld input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  position: relative;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  border: 1.5px solid #A9ADBB;
  border-radius: 50%;
  background: #fff;
}
.wahl__feld input:checked { border-color: var(--color-primary); }
.wahl__feld input:checked::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--color-primary);
}
.wahl__feld input:focus-visible {
  outline: 3px solid rgba(39, 53, 132, 0.35);
  outline-offset: 3px;
}
.wahl__feld:has(input:checked) {
  border-color: var(--color-primary);
  background: #EEF0F9;
}
.wahl__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.wahl__text strong {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-ink);
}
.wahl__text small {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--color-muted);
}

.stufe__masshinweis { margin: -4px 0 0; font-size: 0.86rem; }

/* Fehlerhinweis je Schritt */
.stufe__fehler {
  clear: both;
  margin: 10px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #FDECEC;
  color: #7A1C1C;
  font-size: 0.95rem;
  line-height: 1.5;
}
.stufe__fehler[hidden] { display: none; }
.stufe [aria-invalid="true"],
.stufe .form-field input[aria-invalid="true"] { border-color: #B42318; }
.wahl[aria-invalid="true"] .wahl__feld,
.form-radio-row[aria-invalid="true"] .form-radio { border-color: #B42318; }

/* Weiter und Zurück */
.stufe__nav {
  clear: both;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 30px;
}
.stufe__nav--nur-js { display: none; }
.ist-stufen .stufe__nav--nur-js { display: flex; }
.stufe__zurueck {
  display: none;
  margin-right: auto;
  padding: 12px 4px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}
.ist-stufen .stufe__zurueck { display: inline-block; }
.stufe__zurueck:hover { text-decoration: underline; }
.stufe__zurueck:focus-visible {
  outline: 3px solid rgba(39, 53, 132, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
}
.stufe .form-note { margin-top: 14px; }

@media (max-width: 600px) {
  .stufen { padding: 20px 16px 24px; }
  .wahl__feld { padding: 14px 14px; gap: 12px; }
  .stufe__nav .btn { flex: 1 1 auto; }
  .stufe__nav .btn--lg { padding: 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .stufen__balken span,
  .wahl__feld { transition: none; }
}
.stufe__felder > .stufe__fehler,
.pfad > .stufe__fehler { margin-top: -8px; }

/* Beim Weg „Leistungsverzeichnis oder Pläne“ steht das Feld für die Unterlagen oben */
.stufen[data-weg="lv"] .stufe__felder > [data-upload="unterlage"],
.stufen[data-weg="lv"] .stufe__felder > [data-upload="unterlage"] + .stufe__fehler { order: -1; }
