/* ── FORM — Formular (Modul), meist rechts in split-sticky ───────────
   Felder in .form-row stehen nebeneinander (mobil untereinander),
   ein .form-field allein geht über die volle Breite.
   Variante: .form--panel  hebt das Formular mit einer leicht aufgehellten,
             halbtransparenten Fläche ab (ohne Rand).
   Auswahl per Klick: <fieldset class="form-field form-group"> mit .form-chips;
   darin .form-chip mit checkbox (mehrere) oder radio (eine). Pflicht-Gruppe:
   data-required am fieldset (mindestens eine Auswahl).
   Schieberegler: .form-range mit data-steps="Stufe 1|Stufe 2|…"; der Regler
   wählt eine Stufe, .form-range-value zeigt sie, ein hidden-Feld schickt sie mit.
   Optional im Fuß: .form-progress zeigt mit kleinem Ring, wie viele
   Pflichtangaben schon da sind („2/4 Pflichtangaben“).
   Umschalter kompakt: <fieldset class="form-switch form-switch--compact" data-form="formId"> im Formular,
   gleiches Markup wie der große Umschalter, kleiner (Titel t-lead, Unterzeile t-xs). Mobil bleiben beide nebeneinander.
   Umschalter für Zielgruppen: <fieldset class="form-switch" data-form="formId">
   mit Radio-Karten in .form-switch-options (.form-switch-option, input mit form="formId"), darf auch
   außerhalb des Formulars stehen. Elemente mit data-for="wert" (im Formular
   und in derselben Section) erscheinen nur, wenn dieser Wert gewählt ist;
   versteckte Pflichtfelder zählen nicht. Direktlink: seite.html#wert wählt die
   Zielgruppe; passt der Hash zu keiner, hakt er eine Checkbox mit gleichem
   value an (#audit → value="Audit").
   data-bg="rot" an einer Option: Seitenhintergrund wechselt zu Rot / Dunkelrot.
   Hervorgehobene Checkbox: <label class="form-highlight"> mit checkbox,
   .form-highlight-box, Titel und Text; [data-month-end] darin zeigt den
   letzten Tag des aktuellen Monats (form.js).
   Variante: .form--enter  Formular fährt beim Laden von oben rechts herein, danach erscheinen
             die Felder nacheinander (nur für Formulare im ersten Bildschirm, z. B. Audit).
   Fuß: .form-foot mit Versprechen links (ul.form-promise t-small, je li mit Haken-svg) und Button rechts.
   Darunter optional .form-bottom: Trennlinie, Hinweise links (form-note), Pflichtfeld/Ring rechts.
   Pflichtfeld: required am Input, * im Label. Nach dem Absenden ersetzt
   .form-success das Formular (Logik in form.js, Versand noch nicht angebunden).
   Schrift: form-highlight-title t-lead · form-highlight-text t-small ·
            form-switch-legend label t-micro · form-switch-title t-h4 ·
            form-switch-sub t-small · form-label t-xs · form-note t-xs · form-chip t-small · form-range-value t-small · form-success-h t-h3 · form-success-p t-body
   UI: Eingabefelder (.form-input), Haken im Chip, Schieberegler, Ring,
       Icon und Haken der Umschalt-Karte, Kästchen der hervorgehobenen Checkbox                                    */
.form         { display: flex; flex-direction: column; gap: clamp(14px,1.6vw,20px); }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px,1.6vw,20px); }
.form-field   { display: flex; flex-direction: column; gap: 6px; }
.form-label   { font-weight: 600; color: var(--mid); letter-spacing: .04em; }
.form-input { /* UI: Eingabefeld */
  width: 100%; padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink); font-family: var(--f); font-size: var(--fs-body);
  outline: none; transition: border-color .2s;
}
input.form-input, select.form-input { height: calc(1.5em + 30px); line-height: 1.5; } /* Auswahl gleich hoch wie Textfeld */
.form-input::placeholder { color: var(--mute); }
.form-input:focus { border-color: var(--orange); }
.form-input.is-invalid { border-color: var(--red); }
select.form-input {
  appearance: none; cursor: pointer; padding-right: 44px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 16px center / 16px no-repeat;
}
select.form-input option { background: var(--bg); color: var(--ink); }
textarea.form-input { resize: vertical; min-height: 140px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.form-note { color: var(--mute); }
ul.form-promise { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--mid); }
.form-promise li { display: flex; align-items: center; gap: 6px; }
.form-promise svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--orange); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; } /* UI: Haken */
.form-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; margin-top: clamp(4px,1vw,12px); padding-top: clamp(14px,1.6vw,20px); border-top: 1px solid var(--line); }
/* Einfahren von oben rechts, Felder danach gestaffelt */
.form--enter { animation: formEnter 1s .2s var(--ease-out) both; transform-origin: top right; }
.form--enter > * { animation: formFieldIn .6s var(--ease-out) both; }
.form--enter > :nth-child(1) { animation-delay: .55s; }
.form--enter > :nth-child(2) { animation-delay: .62s; }
.form--enter > :nth-child(3) { animation-delay: .69s; }
.form--enter > :nth-child(4) { animation-delay: .76s; }
.form--enter > :nth-child(5) { animation-delay: .83s; }
.form--enter > :nth-child(6) { animation-delay: .9s; }
.form--enter > :nth-child(n+7) { animation-delay: .97s; }
@keyframes formEnter {
  from { opacity: 0; transform: translate(64px, -48px) rotate(2.5deg) scale(.94); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}
@keyframes formFieldIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.form--panel:has(> .form-bottom) { padding-bottom: clamp(16px,1.8vw,24px); } /* Hinweise sitzen nah am unteren Rand */
.form-link { color: var(--ink); text-underline-offset: 3px; }
.form-link:hover { color: var(--orange); }
[data-for][hidden] { display: none !important; }

/* Hervorgehobene Checkbox (z. B. kostenloses Audit) */
.form-highlight {
  position: relative; display: flex; align-items: flex-start; gap: 16px; cursor: pointer;
  padding: clamp(16px, 1.8vw, 24px); border: 1px solid var(--orange); background: rgba(244,156,36,.08);
  transition: background .3s;
}
.form-highlight:hover { background: rgba(244,156,36,.13); }
.form-highlight input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.form-highlight-box { /* UI: Kästchen */
  width: 26px; height: 26px; flex-shrink: 0; margin-top: 2px; border: 1.5px solid var(--orange); border-radius: 4px;
  background: no-repeat center / 0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23140600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  transition: background-color .2s, background-size .2s;
}
.form-highlight input:checked + .form-highlight-box { background-color: var(--orange); background-size: 16px; }
.form-highlight input:focus-visible + .form-highlight-box { outline: 2px solid var(--orange); outline-offset: 3px; }
.form-highlight-body  { display: flex; flex-direction: column; gap: 4px; }
.form-highlight-title { font-weight: 700; color: var(--ink); line-height: 1.35; }
.form-highlight-title [data-month-end] { color: var(--orange); white-space: nowrap; }
.form-highlight-text  { color: var(--mid); }

/* Umschalter: zwei große Radio-Karten (aktive Karte orange umrandet) */
.form-switch { border: 0; margin: 0 0 var(--head-gap); padding: 0 var(--gutter); min-width: 0; }
/* Variante kompakt: Umschalter als Chips im Formular (fieldset.form-group.form-switch--compact mit .form-chips + radio) */
.form-switch--compact { padding: 0; margin: 0; }
.form-switch--compact .form-switch-legend { margin-bottom: 10px; }
.form-switch--compact .form-switch-options { gap: 12px; }
.form-switch--compact .form-switch-card { gap: 12px; padding: 12px 16px; padding-right: 48px; }
.form-switch--compact .form-switch-card::after { right: 14px; width: 22px; height: 22px; }
.form-switch--compact .form-switch-option input:checked + .form-switch-card::after { background-size: 11px; }
.form-switch--compact .form-switch-icon { width: 26px; height: 26px; }
.form-switch--compact .form-switch-body { gap: 0; }
.form-switch-legend  { padding: 0; margin-bottom: 14px; font-weight: 700; color: var(--mute); }
.form-switch-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 24px); }
.form-switch-option { position: relative; cursor: pointer; display: block; }
.form-switch-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.form-switch-card {
  position: relative; height: 100%; display: flex; align-items: center; gap: clamp(14px, 1.8vw, 24px);
  padding: clamp(18px, 2vw, 28px); padding-right: clamp(56px, 5vw, 80px);
  border: 1px solid var(--line); transition: border-color .3s, background .3s;
}
.form-switch-card::after { /* UI: Haken-Kreis */
  content: ''; position: absolute; right: clamp(16px, 1.8vw, 28px); top: 50%; translate: 0 -50%;
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); box-sizing: border-box;
  background: no-repeat center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23140600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  background-size: 0; transition: background-color .3s, border-color .3s;
}
.form-switch-icon { /* UI: Line-Icon */
  width: clamp(36px, 3.5vw, 48px); height: clamp(36px, 3.5vw, 48px); flex-shrink: 0;
  fill: none; stroke: var(--mute); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s;
}
.form-switch-body  { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-switch-title { font-weight: 700; color: var(--mute); transition: color .3s; }
.form-switch-sub   { color: var(--mute); }
.form-switch-option:hover .form-switch-card { border-color: var(--mute); }
.form-switch-option:hover .form-switch-title { color: var(--ink); }
.form-switch-option input:focus-visible + .form-switch-card { outline: 2px solid var(--orange); outline-offset: 3px; }
.form-switch-option input:checked + .form-switch-card { border-color: var(--orange); background: rgba(244,156,36,.08); }
.form-switch-option input:checked + .form-switch-card::after { background-color: var(--orange); border-color: var(--orange); background-size: 14px; }
.form-switch-option input:checked + .form-switch-card .form-switch-icon  { stroke: var(--orange); }
.form-switch-option input:checked + .form-switch-card .form-switch-title { color: var(--ink); }
@media (max-width: 640px) {
  .form-switch-options { grid-template-columns: 1fr; gap: 10px; }
  .form-switch-sub { display: none; }
  .form-switch--compact .form-switch-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .form-switch--compact .form-switch-card { padding: 10px 12px; padding-right: 40px; }
  .form-switch--compact .form-switch-icon { display: none; }
}
@media (max-width: 400px) { /* schmale Handys: Haken-Kreis klein in die Ecke, damit „Publisher“ Platz hat */
  .form-switch--compact .form-switch-card { padding-right: 28px; }
  .form-switch--compact .form-switch-card::after { top: 8px; right: 8px; translate: none; width: 16px; height: 16px; }
  .form-switch--compact .form-switch-option input:checked + .form-switch-card::after { background-size: 9px; }
}

/* Variante: abgehobene Fläche */
.form--panel { padding: clamp(24px, 3vw, 44px); background: rgba(240,237,231,.05); border-radius: 4px; }

/* Auswahl-Chips */
.form-group  { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-group .form-label { padding: 0; margin-bottom: 8px; }
.form-chips  { display: flex; flex-wrap: wrap; gap: 8px; }
.form-chip   { position: relative; cursor: pointer; }
.form-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.form-chip span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 100px;
  color: var(--mid); transition: color .2s, border-color .2s, background .2s;
}
.form-chip:hover span { border-color: var(--mute); color: var(--ink); }
.form-chip input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.form-chip input:checked + span {
  color: var(--green); border-color: var(--green); background: var(--green-06);
  animation: form-chip-pop .25s ease-out;
}
.form-chip input:checked + span::before { content: '✓'; font-size: .8em; font-weight: 700; line-height: 1; } /* UI: Haken */
.form-group.is-invalid .form-chip span { border-color: var(--red); }
@keyframes form-chip-pop { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* Schieberegler mit Stufen (Wert setzt form.js über --p) */
.form-range       { gap: 4px; }
.form-range-head  { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.form-range-value { color: var(--green); font-weight: 600; }
.form-range-input { /* UI: Regler */
  --p: 0%;
  appearance: none; -webkit-appearance: none; width: 100%; height: 24px; margin: 0;
  background: transparent; cursor: pointer; outline: none;
}
.form-range-input::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--green) var(--p), var(--line) var(--p));
}
.form-range-input::-moz-range-track    { height: 4px; border-radius: 4px; background: var(--line); }
.form-range-input::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--green); }
.form-range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px;
  border-radius: 50%; background: var(--green); border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px var(--green); transition: transform .15s;
}
.form-range-input::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--green);
  border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--green);
}
.form-range-input:hover::-webkit-slider-thumb,
.form-range-input:active::-webkit-slider-thumb { transform: scale(1.15); }
.form-range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--green), 0 0 0 4px var(--green-30); }
.form-range-input:focus-visible::-moz-range-thumb     { box-shadow: 0 0 0 1px var(--green), 0 0 0 4px var(--green-30); }

/* Fortschritt der Pflichtangaben: Mini-Ring vor dem Text (füllt form.js über --p) */
.form-progress { display: flex; align-items: center; gap: 8px; }
.form-progress-ring { /* UI: Ring */
  --p: 0%;
  display: none; width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  background: conic-gradient(var(--green) var(--p), var(--line) 0);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px);
          mask: radial-gradient(circle, transparent 5px, #000 5.5px);
}
.form-progress.is-on .form-progress-ring { display: block; }
.form-progress.is-done .form-progress-text { color: var(--green); }
@media (prefers-reduced-motion: reduce) {
  .form-chip input:checked + span { animation: none; }
  .form-range-input::-webkit-slider-thumb { transition: none; }
}

.form-success { display: none; padding: clamp(28px,3vw,44px); border: 1px solid var(--line); background: var(--card); }
.form-success-h { font-weight: 700; margin-bottom: 10px; }
.form-success-p { color: var(--mid); }
.form.is-sent { display: none; }
.form.is-sent + .form-success { display: block; }

@media (max-width: 860px) {
  .form-row { grid-template-columns: 1fr; }
}
