/*
  Spenden- und Patenschaftsformular, Stiftung Mittagskinder
  Einbau in Kirby: siehe KONFIGURATION.md

  - Alles hängt an .mk-form. Nichts wirkt außerhalb des Formulars.
  - Responsiv per Container Query: Das Formular richtet sich nach der Breite
    seiner Spalte, nicht nach dem Bildschirm. Es passt so in jede Spalte der Seite.
  - Größen in px, damit eine andere Grundschrift der Seite nichts verschiebt.
*/

.mk-form {
  --mk-gruen: #008000;       /* wie h1/h2 in main.css, 5,1 : 1 auf Weiß */
  --mk-blau: #005fa3;        /* wie a und .btn_continue in main.css, 6,6 : 1 auf Weiß */
  --mk-blau-dunkel: #00467a;
  --mk-blau-hell: #eef5fb;
  --mk-text: #000;          /* wie body in main.css */
  --mk-grau: #404040;        /* Hinweistext, 10,4 : 1 auf Weiß */
  --mk-rand-dunkel: #595959; /* Feldrand bei Hover */
  --mk-ring: rgba(0, 95, 163, .22); /* weicher Fokusring um Felder, zusätzlich zum blauen Rand */
  --mk-rand: #8a8a8a;        /* Feldrand, 3,4 : 1 (WCAG 1.4.11). main.css nimmt #ccc, das hat nur 1,6 : 1 */
  --mk-linie: #ccc;          /* Trennlinien wie .faq_block und Tabellen in main.css */
  --mk-flaeche: #f9f7f8;     /* Hinterlegte Kästen wie blockquote und Seitenleiste in main.css */
  --mk-fehler: #b00020;      /* Fehlertext, 7,0 : 1 auf Weiß */
  --mk-fehler-hell: #fdecee;
  --mk-fokus: #1a1a1a;       /* Fokusrahmen, 17 : 1 auf Weiß (WCAG 1.4.11, 2.4.7) */
  --mk-radius: 4px;          /* fast eckig wie Felder, .btn und #sepa in main.css, leicht gerundet (Daniel 11.11.) */
  --mk-spalte: 520px;        /* größte Breite der Eingabefelder */

  container-type: inline-size;
  container-name: mkform;
  color: var(--mk-text);
  font: 16px/1.5 Helvetica, Arial, sans-serif;
  text-align: left;
}
.mk-form *, .mk-form *::before, .mk-form *::after { box-sizing: border-box; }
.mk-form ::selection { background: var(--mk-blau-hell); color: var(--mk-text); }
.mk-form input, .mk-form textarea { caret-color: var(--mk-blau); }
.mk-form a { color: var(--mk-blau); text-decoration: underline; text-underline-offset: 2px; }
.mk-form a:hover { color: var(--mk-blau-dunkel); }
.mk-form :focus-visible { outline: 3px solid var(--mk-fokus); outline-offset: 2px; }
.mk-form a:focus-visible { outline: 3px solid var(--mk-fokus) !important; }   /* Website setzt a:focus mit !important */
.mk-form [hidden] { display: none !important; }
/* Website-Regeln aufheben, die sonst ins Formular greifen (main.css: li/dd unterstrichen, ul ohne Punkte, h2 grün und groß) */
.mk-form li, .mk-form dd { text-decoration: none; }
.mk-form h2 { letter-spacing: normal; padding: 0; }

/* ---------- Rahmen: 1:1 wie heute main #spenden_form in main.css. Optional, siehe KONFIGURATION.md ----------
   main.css: #spenden_form { max-width: 750px; padding-left: 50px } + main #spenden_form { background:#fff; border-radius:15px }
   ≤ 768 px: padding 0 20px. Die dortige margin-top: 150px ist ein Fehler (Leerraum am Handy) und fehlt hier bewusst. */
.mk-rahmen { background: #fff; border-radius: 15px; max-width: 750px; margin: 0 auto; padding: 0 10px 0 50px; }
@media (max-width: 768px) { .mk-rahmen { padding: 0 20px; } }
.mk-rahmen .mk-einleitung { font: 16px/1.5 Helvetica, Arial, sans-serif; margin: 0 0 20px; max-width: 60ch; }
.mk-rahmen .mk-einleitung p { margin: 0 0 12px; }
.mk-form { padding-bottom: 40px; }

/* ---------- Raster ---------- */
.mk-form .mk-raster { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.mk-form .mk-haupt { min-width: 0; }

/* ---------- Fortschritt ---------- */
.mk-form .mk-schritte { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 8px; max-width: var(--mk-spalte); }
.mk-form .mk-schritte li { flex: 1 1 0; min-width: 0; margin: 0; font-size: 15px; line-height: 1.3; color: var(--mk-grau); padding-top: 10px; border-top: 4px solid var(--mk-linie); overflow-wrap: break-word; }
.mk-form .mk-schritte li::before { content: none; }
.mk-form .mk-schritte li[aria-current="step"] { color: var(--mk-text); font-weight: 700; border-color: var(--mk-blau); }
.mk-form .mk-schritte li.mk-erledigt { border-color: var(--mk-gruen); }
.mk-form .mk-schritte .mk-nr { display: block; font-size: 13px; font-weight: 400; }
.mk-form .mk-schritt-knopf { display: block; width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; text-transform: none; letter-spacing: normal; cursor: pointer; }
.mk-form .mk-schritt-knopf:disabled { cursor: default; opacity: 1; }
.mk-form .mk-schritt-knopf:not(:disabled) { color: var(--mk-grau); text-decoration: underline; text-underline-offset: 3px; }
.mk-form .mk-schritt-knopf:not(:disabled) .mk-nr { color: var(--mk-grau); }
@media (min-width: 996px) { .mk-form .mk-schritt-knopf:not(:disabled) { text-decoration: none; } .mk-form .mk-schritt-knopf:not(:disabled):hover { text-decoration: underline; } }
.mk-form.mk-ohne-js .mk-schritte { display: none; }

/* ---------- Grundbausteine ---------- */
.mk-form form { margin: 0; }
.mk-form fieldset { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.mk-form legend { float: none; width: auto; font-size: 19px; line-height: 1.3; font-weight: 700; margin: 0 0 12px; padding: 0; color: var(--mk-text); }
.mk-form .mk-schritt > h2 { font-size: 22px; line-height: 1.25; margin: 0 0 16px; color: var(--mk-text); }
.mk-form .mk-schritt > h2:focus { outline: none; }

.mk-form .mk-feld { margin: 0 0 22px; max-width: var(--mk-spalte); }
.mk-form .mk-feld.mk-kurz { max-width: 220px; }
.mk-form .mk-zeile { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); max-width: var(--mk-spalte); }
.mk-form .mk-zeile .mk-feld { max-width: none; }
@container mkform (min-width: 440px) {
  .mk-form .mk-zeile.mk-name { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-form .mk-zeile.mk-plz-ort { grid-template-columns: 120px minmax(0, 1fr); }
}

.mk-form label, .mk-form .mk-label { display: block; float: none; width: auto; font-weight: 700; margin: 0 0 6px; padding: 0; color: var(--mk-text); }
.mk-form .mk-optional { font-weight: 400; color: var(--mk-grau); }
/* Pflichtfeld: rotes Sternchen, für Screenreader aria-hidden; dort sagt required „erforderlich“ */
.mk-form .mk-stern { color: var(--mk-fehler); font-weight: 700; }
.mk-form .mk-pflicht-hinweis { color: var(--mk-grau); font-size: 16px; margin: 0 0 16px; }
.mk-form .mk-hinweis { display: block; color: var(--mk-grau); font-size: 15px; line-height: 1.4; font-weight: 400; margin: -2px 0 8px; }
.mk-form p.mk-hinweis { margin: 0 0 16px; max-width: var(--mk-spalte); }

.mk-form input[type=text], .mk-form input[type=email], .mk-form input[type=tel], .mk-form select, .mk-form textarea {
  display: block; width: 100%; max-width: 100%; margin: 0;
  font: inherit; font-size: 16px; line-height: 1.4;   /* 16 px: kein Zoom beim Antippen am iPhone */
  color: var(--mk-text); background-color: #fff;
  border: 1px solid var(--mk-rand); border-radius: var(--mk-radius);
  padding: 11px 14px; min-height: 48px; box-shadow: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.mk-form input[type=text]:hover, .mk-form input[type=email]:hover, .mk-form input[type=tel]:hover, .mk-form select:hover, .mk-form textarea:hover { border-color: var(--mk-rand-dunkel); }
.mk-form select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mk-text) 50%), linear-gradient(135deg, var(--mk-text) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
.mk-form textarea { min-height: 120px; resize: vertical; }
/* Fokus: blauer Rand (6,6 : 1) plus heller Ring. Transparente Outline bleibt für den Windows-Kontrastmodus */
.mk-form input:not([type=checkbox]):not([type=radio]):focus, .mk-form select:focus, .mk-form textarea:focus { border-color: var(--mk-blau); box-shadow: 0 0 0 1px var(--mk-blau), 0 0 0 5px var(--mk-ring); outline: 2px solid transparent; outline-offset: 0; }

/* ---------- Fehler: Meldung unter dem Feld, nie darüber ---------- */
.mk-form .mk-fehlerhaft input:not([type=checkbox]):not([type=radio]), .mk-form .mk-fehlerhaft select { border-color: var(--mk-fehler); box-shadow: inset 0 0 0 1px var(--mk-fehler); }
.mk-form .mk-fehlertext { display: none; color: var(--mk-fehler); font-weight: 700; font-size: 15px; line-height: 1.4; margin: 6px 0 0; }
.mk-form .mk-fehlerhaft .mk-fehlertext { display: flex; gap: 6px; }
.mk-form .mk-fehlertext::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--mk-fehler); color: #fff; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }

.mk-form .mk-fehlerliste { border: 3px solid var(--mk-fehler); border-radius: var(--mk-radius); padding: 14px 16px; margin: 0 0 20px; background: var(--mk-fehler-hell); max-width: var(--mk-spalte); }
.mk-form .mk-fehlerliste h2 { font-size: 18px; margin: 0 0 8px; color: var(--mk-fehler); }
.mk-form .mk-fehlerliste ul { margin: 0; padding-left: 20px; list-style: disc; }
.mk-form .mk-fehlerliste a { color: var(--mk-fehler); font-weight: 700; }

/* ---------- Auswahlkarten statt 13-px-Kreise ----------
   Spalten richten sich nach der Textlänge (em), nicht nach festen Breiten.
   So bricht kein Wort mitten durch, auch nicht bei vergrößerter Schrift am Handy. */
.mk-form .mk-karten { display: grid; gap: 10px; max-width: var(--mk-spalte); }
.mk-form .mk-karten.mk-zwei { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14em), 1fr)); }
.mk-form .mk-karten.mk-betrag { grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5em), 1fr)); }
/* Rhythmus: nie ein Wort trennen (nowrap), sonst zwei Karten je Zeile */
.mk-form .mk-karten.mk-rhythmus { display: flex; flex-wrap: wrap; }
.mk-form .mk-karten.mk-rhythmus .mk-karte { flex: 1 1 calc(50% - 5px); }   /* zwei je Zeile; passt ein Wort nicht, rutscht die Karte allein in die Zeile */
.mk-form .mk-karten.mk-rhythmus b { white-space: nowrap; }
.mk-form .mk-karte { position: relative; display: block; margin: 0; font-weight: 400; }
.mk-form .mk-karte input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.mk-form .mk-karte .mk-inhalt { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 56px; height: 100%; padding: 11px 15px 11px 45px; border: 1px solid var(--mk-rand); border-radius: var(--mk-radius); background: #fff; line-height: 1.3; overflow-wrap: break-word; }
.mk-form .mk-karte .mk-inhalt::before { content: ""; position: absolute; left: 12px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border: 2px solid var(--mk-rand); border-radius: 50%; background: #fff; }
.mk-form .mk-karte input:checked + .mk-inhalt { border-color: var(--mk-blau); background: var(--mk-blau-hell); box-shadow: inset 0 0 0 1px var(--mk-blau); }
.mk-form .mk-karte input:checked + .mk-inhalt::before { border-color: var(--mk-blau); background: radial-gradient(circle, var(--mk-blau) 0 45%, #fff 50%); }
.mk-form .mk-karte input:focus-visible + .mk-inhalt { outline: 3px solid var(--mk-fokus); outline-offset: 2px; }
.mk-form .mk-karte b { font-size: 17px; }
.mk-form .mk-karte small { color: var(--mk-grau); font-size: 15px; }
.mk-form .mk-karten.mk-betrag .mk-inhalt { padding-left: 10px; padding-right: 10px; align-items: center; text-align: center; }
.mk-form .mk-karten.mk-betrag .mk-inhalt::before { display: none; }
.mk-form .mk-fehlerhaft .mk-karte .mk-inhalt { border-color: var(--mk-fehler); }

.mk-form .mk-aufklapp { margin: 12px 0 0; padding: 12px 14px; background: var(--mk-flaeche); max-width: var(--mk-spalte); }
.mk-form .mk-aufklapp .mk-feld { margin-bottom: 0; }
.mk-form .mk-aufklapp.mk-firma { margin: -4px 0 20px; }
.mk-form .mk-euro { position: relative; }
.mk-form .mk-euro input { padding-right: 40px; }
.mk-form .mk-euro .mk-einheit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--mk-grau); pointer-events: none; }
.mk-form .mk-datum { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; max-width: 340px; }
.mk-form .mk-rechnung { font-size: 16px; color: var(--mk-grau); margin: 8px 0 0; }

/* ---------- Häkchen ---------- */
.mk-form .mk-check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; margin: 0 0 16px; font-weight: 400; cursor: pointer; max-width: var(--mk-spalte); }
.mk-form .mk-check input { -webkit-appearance: none; appearance: none; display: grid; place-content: center; width: 20px; height: 20px; margin: 2px 0 0; border: 1.5px solid var(--mk-rand); border-radius: 3px; background: #fff; cursor: pointer; transition: background-color .15s, border-color .15s; }
.mk-form .mk-check input::before { content: ""; width: 5px; height: 10px; margin-top: -2px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform .12s ease-out; }
.mk-form .mk-check:hover input { border-color: var(--mk-rand-dunkel); }
.mk-form .mk-check input:checked { background: var(--mk-blau); border-color: var(--mk-blau); }
.mk-form .mk-check input:checked::before { transform: rotate(45deg) scale(1); }
.mk-form .mk-fehlerhaft .mk-check input, .mk-form .mk-check input[aria-invalid=true] { border-color: var(--mk-fehler); border-width: 2px; }
.mk-form .mk-check.mk-fett { font-weight: 700; }
.mk-form .mk-check + .mk-fehlertext { margin: -10px 0 14px 32px; }

.mk-form details { margin: 4px 0 16px; max-width: var(--mk-spalte); }
.mk-form details summary { display: block; position: relative; min-height: 44px; padding: 10px 0 10px 18px; list-style: none; cursor: pointer; color: var(--mk-blau); text-decoration: underline; text-underline-offset: 2px; }
.mk-form details summary::-webkit-details-marker { display: none; }
.mk-form details summary::before { content: ""; position: absolute; left: 1px; top: 18px; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; }
.mk-form details[open] summary::before { top: 16px; transform: rotate(45deg); }
.mk-form details summary:hover { color: var(--mk-blau-dunkel); }
.mk-form details > div { margin: 4px 0 0; font-size: 16px; color: var(--mk-grau); }
.mk-form details > div:not(:has(textarea)) { padding: 12px 14px; background: var(--mk-flaeche); }

/* ---------- Knöpfe: am Handy volle Breite, Hauptknopf oben ---------- */
.mk-form .mk-aktionen { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 8px; margin-top: 8px; max-width: var(--mk-spalte); }
@container mkform (min-width: 440px) {
  .mk-form .mk-aktionen { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 24px; }
  .mk-form .mk-aktionen .mk-knopf:not(.mk-zurueck) { align-self: auto; }
}
/* wie .btn_continue in main.css: eckig, 53 px hoch, 1.2rem, Text links, weißes Dreieck rechts, Hover dunkler */
.mk-form .mk-aktionen .mk-knopf:not(.mk-zurueck) { align-self: stretch; }
.mk-form .mk-knopf { display: inline-flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin: 0; font: inherit; font-size: 19.2px; font-weight: 400; line-height: 1.2; text-align: left; text-transform: none; letter-spacing: normal; min-height: 53px; padding: 12px 15px; border-radius: var(--mk-radius); border: 2px solid var(--mk-blau); background: var(--mk-blau); color: #fff; cursor: pointer; }
@container mkform (min-width: 440px) {
  .mk-form .mk-knopf { width: auto; min-width: 200px; }
  .mk-form .mk-knopf.mk-zurueck { min-width: 0; }
}
/* Pfeil: Winkel aus zwei Rändern, kein Bild nötig */
.mk-form .mk-knopf::after { content: ""; flex: none; width: 10px; height: 10px; margin-right: 4px; border: solid currentColor; border-width: 2.5px 2.5px 0 0; transform: rotate(45deg); transition: transform .15s ease-out; }
.mk-form .mk-knopf:hover { background: var(--mk-blau-dunkel); border-color: var(--mk-blau-dunkel); }
.mk-form .mk-knopf:active { transform: translateY(1px); }
@media (prefers-reduced-motion: no-preference) { .mk-form .mk-knopf:hover::after { transform: translateX(3px) rotate(45deg); } .mk-form .mk-knopf.mk-zurueck:hover::after { transform: translateX(-3px) rotate(-135deg); } }   /* dunkler statt opacity .8 wie main.css: so bleibt der Kontrast über 4,5 : 1 */
.mk-form .mk-knopf.mk-zurueck { flex-direction: row-reverse; justify-content: flex-end; gap: 12px; width: auto; min-width: 0; min-height: 48px; padding: 10px 4px; border-color: transparent; background: transparent; color: var(--mk-blau); font-size: 17px; text-decoration: underline; text-underline-offset: 3px; }
.mk-form .mk-knopf.mk-zurueck:hover { background: transparent; border-color: transparent; color: var(--mk-blau-dunkel); }
.mk-form .mk-knopf.mk-zurueck::after { width: 8px; height: 8px; border-width: 2px 2px 0 0; margin: 0 0 0 4px; transform: rotate(-135deg); }
.mk-form.mk-ohne-js .mk-weiter, .mk-form.mk-ohne-js .mk-zurueck { display: none; }
.mk-form.mk-js .mk-absenden { display: none; }
.mk-form.mk-js .mk-schritt.mk-letzter .mk-absenden { display: inline-flex; }

/* ---------- Überblick vor dem Absenden ---------- */
.mk-form .mk-pruefen { border: 1px solid var(--mk-linie); border-radius: var(--mk-radius); margin: 0 0 20px; max-width: var(--mk-spalte); }
.mk-form .mk-pruefen:empty { display: none; }
.mk-form .mk-pruefen dl { margin: 0; }
.mk-form .mk-pruefen .mk-z { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--mk-linie); }
.mk-form .mk-pruefen .mk-z:last-child { border-bottom: 0; }
.mk-form .mk-pruefen dt { font-size: 15px; color: var(--mk-grau); grid-column: 1; margin: 0; }
.mk-form .mk-pruefen dd { margin: 0; grid-column: 1; overflow-wrap: anywhere; }
.mk-form .mk-pruefen dd.mk-aktion { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.mk-form .mk-pruefen .mk-aendern { background: none; border: 0; color: var(--mk-blau); text-decoration: underline; font: inherit; cursor: pointer; padding: 10px 4px; min-height: 44px; }

.mk-form .mk-alternativ { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid var(--mk-linie); font-size: 16px; color: var(--mk-grau); max-width: var(--mk-spalte); }

/* ---------- Hilfsklassen ---------- */
.mk-form .mk-nur-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mk-form .mk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mk-form .mk-danke h2 { color: var(--mk-gruen); font-size: 28px; margin: 0 0 8px; }
@media (prefers-reduced-motion: no-preference) { .mk-form { scroll-behavior: smooth; } }
