/* Formulare – Felder, Auswahl, Kacheln, Sterne, Fehlermeldungen. */

.formular {
  max-width: 44rem;
}

/* Auf hellen Flächen steht das Formular als eigene Karte. */
.abschnitt--hell .formular,
.zeile--farbig .formular {
  max-width: none;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  border: 1px solid var(--linie);
  border-radius: var(--radius-gross);
  background: var(--rein-weiss);
  box-shadow: var(--schatten-karte);
}

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

.feld {
  margin-bottom: var(--abstand-m);
}

.feld[hidden],
.feldgruppe[hidden] {
  display: none;
}

.feld__name {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.feld__pflicht {
  color: #b3261e;
}

.formular input[type="text"],
.formular input[type="email"],
.formular input[type="tel"],
.formular input[type="url"],
.formular input[type="date"],
.formular input[type="number"],
.formular select,
.formular textarea {
  width: 100%;
  padding: 0.8em 1em;
  border: 1px solid var(--linie);
  border-radius: var(--radius-feld);
  background: var(--weiss);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.formular input::placeholder,
.formular textarea::placeholder {
  color: #8fa3b5;
}

.formular textarea {
  resize: vertical;
  min-height: 9rem;
}

.formular select {
  appearance: none;
  padding-right: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2302203b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7em center;
  background-size: 1.3em;
  cursor: pointer;
}

@media (hover: hover) {
  .formular input:hover, .formular select:hover, .formular textarea:hover {
  border-color: #b3c4d1;
  }
}

.formular input:focus,
.formular select:focus,
.formular textarea:focus {
  border-color: var(--blau);
  outline: 0;
  /* Kräftig genug für WCAG 1.4.11 (mind. 3:1 gegen Weiß) – die zarte
     Fassung mit 0.18 kam rechnerisch nur auf 1,36:1. */
  box-shadow: 0 0 0 3px rgba(15, 74, 126, 0.55);
}

/* Dateiauswahl: der eingebaute Knopf sieht in jedem Browser anders aus. */
.formular input[type="file"] {
  width: 100%;
  padding: 0.7em 0.9em;
  border: 1px dashed var(--linie);
  border-radius: var(--radius);
  background: var(--weiss);
  font: inherit;
  font-size: 0.94rem;
  cursor: pointer;
}

.formular input[type="file"]::file-selector-button {
  margin-right: 0.9em;
  padding: 0.45em 1em;
  border: 0;
  border-radius: var(--radius);
  background: var(--hell);
  color: var(--blau);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ------------------------------------------------------- Spaltengruppe */

/* Vorname und Nachname gehören nebeneinander. Der Anteil kommt aus dem
   Formularmodell, damit auch 30/70 möglich bleibt. */
.feldgruppe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0 var(--abstand-s);
}

.feldgruppe__spalte {
  min-width: 0;
}

@media (max-width: 520px) {
  .feldgruppe {
    grid-template-columns: 1fr;
  }
}

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

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.5rem;
}

.kachel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 3.1rem;
  padding: 0.6em 0.9em;
  border: 1px solid var(--linie);
  border-radius: var(--radius-feld);
  background: var(--rein-weiss);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
              box-shadow 0.15s ease;
}

/* Das Optionsfeld selbst bleibt bedienbar, nur unsichtbar – so greifen
   Tastatur und Screenreader weiterhin. */
.kachel input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

@media (hover: hover) {
  .kachel:hover {
  border-color: #b3c4d1;
  }
}

.kachel:has(input:focus-visible) {
  outline: 3px solid var(--blau-hell);
  outline-offset: 2px;
}

.kachel:has(input:checked) {
  border-color: var(--blau);
  background: rgba(15, 74, 126, 0.07);
  box-shadow: inset 0 0 0 1px var(--blau);
}

.kachel__haken {
  display: none;
  line-height: 0;
  color: var(--blau);
}

.kachel__haken svg {
  width: 1.1em;
  height: 1.1em;
}

.kachel:has(input:checked) .kachel__haken {
  display: block;
}

.kachel__text {
  font-weight: 700;
  font-size: 0.95rem;
}

/* -------------------------------------------------------- Auswahllisten */

.wahlfeld {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wahl {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.6em 0.8em;
  border: 1px solid var(--linie);
  border-radius: var(--radius-feld);
  background: var(--rein-weiss);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

@media (hover: hover) {
  .wahl:hover {
  border-color: #b3c4d1;
  }
}

.wahl input {
  margin-top: 0.35em;
  accent-color: var(--blau);
  flex-shrink: 0;
}

.wahl:has(input:checked) {
  border-color: var(--blau);
  background: rgba(15, 74, 126, 0.06);
}

.wahl img {
  display: inline-block;
  max-height: 1.6em;
  width: auto;
  vertical-align: middle;
}

/* --------------------------------------------------------------- Sterne */

/* Die Sterne stehen im Markup rückwärts (höchster Wert zuerst). Dadurch
   erreicht „~“ alle kleineren – und die Reihe wird per row-reverse wieder
   in die gewohnte Richtung gedreht. */
.sterne {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.15rem;
}

.sterne input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.sterne__stern {
  line-height: 0;
  color: var(--linie);
  cursor: pointer;
  transition: color 0.12s ease, transform 0.12s ease;
}

.sterne__stern svg {
  width: 1.7rem;
  height: 1.7rem;
}

@media (hover: hover) {
  .sterne__stern:hover {
  transform: scale(1.12);
  }
}

.sterne input:checked ~ .sterne__stern {
  color: #e0a01f;
}

@media (hover: hover) {
  .sterne__stern:hover, .sterne__stern:hover ~ .sterne__stern {
  color: #e0a01f;
  }
}

.sterne input:focus-visible + .sterne__stern {
  outline: 3px solid var(--blau-hell);
  outline-offset: 2px;
  border-radius: 3px;
}

/* -------------------------------------------------- Hinweise und Fehler */

.feld__hinweis {
  margin: 0.4rem 0 0;
  font-size: 0.87rem;
  color: var(--text-gedaempft);
}

/* Hinweis zur getroffenen Wahl (FORMULAR_HINWEISE) – etwa der Weg zu den
   Passbildterminen, die gar keine Anfrage brauchen. Er steht unter dem Feld
   und tritt zurück: ein Wink, keine Warnung. */
.feld__wink {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin: 0.6rem 0 0;
  padding: 0.65em 0.9em;
  border-radius: var(--radius-feld);
  background: var(--hell);
  font-size: 0.88rem;
  color: var(--text-gedaempft);
}

.feld__wink svg {
  flex-shrink: 0;
  width: 1.05em;
  height: 1.05em;
  margin-top: 0.3em;
  color: var(--blau);
}

.feld__wink[hidden] {
  display: none;
}

.feld--fehler input,
.feld--fehler select,
.feld--fehler textarea {
  border-color: #b3261e;
}

.feld__fehler {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin: 0.4rem 0 0;
  font-size: 0.87rem;
  color: #b3261e;
}

.feld__fehler svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.formular__hinweis {
  margin-bottom: var(--abstand-m);
  font-size: 0.95rem;
}

.formular__hinweis[hidden] {
  display: none;
}

.formular__schnitt {
  height: 1px;
  margin: var(--abstand-l) 0;
  border: 0;
  background: var(--linie);
}

.formular__fehler {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.8em 1em;
  margin-bottom: var(--abstand-m);
  border-left: 4px solid #b3261e;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(179, 38, 30, 0.08);
}

.formular__fehler svg {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
  color: #b3261e;
}

.formular__erfolg {
  padding: 0.9em 1.1em;
  border-left: 4px solid #2e7d32;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(46, 125, 50, 0.1);
}

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

.formular__fuss {
  margin-top: var(--abstand-l);
}

/* Während des Absendens dreht sich der Pfeil zum Ring. */
.formular__fuss .knopf[data-laeuft="ja"] {
  background: var(--blau-akzent);
  cursor: progress;
}

.formular__fuss .knopf[data-laeuft="ja"] svg {
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: drehen 0.7s linear infinite;
}

.formular__fuss .knopf[data-laeuft="ja"] svg path {
  display: none;
}

.formular__recht {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin-top: var(--abstand-s);
  font-size: 0.85rem;
  color: var(--text-gedaempft);
}

.formular__recht svg {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  margin-top: 0.35em;
}

/* Fängt Maschinen ab, bleibt für Menschen unsichtbar –
   display:none würde von manchen Robotern erkannt. */
.honigtopf {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
