/* ============================================================================
   Kortscore, ITN-Rechner (/itn-rechner/)
   ============================================================================
   Nur auf dieser Seite geladen, zusätzlich zu styles.css (Tokens, Schriften,
   Nav, Footer). Maße und Farben aus dem Design Web.dc.html im App-Repo
   (itn-rechner/design/screens/). Wo ein Token aus styles.css denselben Wert
   hat, steht das Token; die übrigen Werte stammen aus der Design-Spezifikation
   der App (DESIGN.md) und stehen unten als eigene Variablen.

   Reihenfolge wie auf der Seite: Hero, Rechner, So rechnet der ÖTV, Bald als
   App, Kortscore-Band, Rechtshinweis, dann die schmalen Bildschirme.
   ========================================================================= */

.itn {
  --itn-green-on-dark: #7fd3a1;  /* sinkender ITN (Verbesserung) auf Dunkel */
  --itn-red-on-dark:   #f2b8b5;  /* steigender ITN auf Dunkel                */
  --itn-error:         #b3261e;  /* ungültiges Feld                          */
  --itn-placeholder:   #8a867c;

  font-size: 16px;
  line-height: 1.5;
}

/* Alles mit data-itn-only und die Zustände des Ergebnisses schaltet
   itn-rechner.js über hidden. Die Klassen unten setzen display selbst, das
   würde hidden sonst überstimmen. */
.itn [hidden] { display: none !important; }

/* Nur für Screenreader: Legenden der Umschalter, Tabellenüberschrift. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.itn .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.itn__shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 40px var(--gutter) 0;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.itn__eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.itn__title {
  margin: 14px 0 0;
  max-width: 760px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}
.itn__title em { font-style: normal; color: var(--accent-text); }

.itn__lead {
  margin-top: 20px;
  max-width: 620px;
  font-size: 18px;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.itn__h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}

/* ── Rechner ────────────────────────────────────────────────────────────────
   Weiße Karte, links die Eingaben, rechts das dunkle Ergebnis. flex-wrap
   stapelt beide, sobald die linke Seite ihre 420px nicht mehr bekommt.
   ───────────────────────────────────────────────────────────────────────── */
.calc {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.calc__in {
  flex: 1 1 420px;
  min-width: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Segmentierte Umschalter: echte Radiogruppen (fieldset + legend), damit
   Pfeiltasten und Screenreader wie gewohnt funktionieren. Das Radio selbst
   ist unsichtbar, die Fläche daneben zeigt den Zustand. */
.seg {
  margin: 0;
  padding: 4px;
  border: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border-radius: 12px;
  background: var(--bg-alt);
}
.seg__opt { position: relative; display: block; }
.seg__opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg__opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.seg__opt input:checked + span {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(22, 21, 15, 0.12);
  font-weight: 600;
  color: var(--text);
}
.seg__opt input:hover:not(:checked) + span { color: var(--text); }
.seg__opt input:focus-visible + span {
  outline: 2px solid var(--accent-text);
  outline-offset: 1px;
}

.calc__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.field input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 1.5px solid var(--text);
  border-radius: 12px;
  background: var(--surface);
  padding: 0 16px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.field input:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
.field input[aria-invalid="true"] { border-color: var(--itn-error); }

/* Eine Person im Einzel: ITN-Feld, darunter ihr Jugend-Häkchen. */
.calc__person {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.check--field {
  min-height: 40px;
  gap: 10px;
  font-size: 14px;
}
.check--field input { width: 20px; height: 20px; }

/* Checkbox-Gruppen: Kurzformat und Sicherheit. */
.calc__checks {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text-secondary);
  cursor: pointer;
}
.check input {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}
/* Checkbox mit Erklärung darunter (Kurzformat), wie Titel und Untertitel
   der Schalter in der App. */
.check__text { display: flex; flex-direction: column; gap: 2px; }
.check__hint,
.calc__hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}
.calc__hint { margin: 0; }
.calc__hint--fields { margin-top: -6px; }

/* Das Ergebnis: dunkle Fläche, große Mono-Werte. Ein sinkender ITN ist eine
   Verbesserung, deshalb grün mit Pfeil nach unten, ein steigender rötlich mit
   Pfeil nach oben. Die Pfeile tragen die Richtung auch ohne Farbe. */
.calc__out {
  flex: 1 1 360px;
  min-width: 0;
  padding: 32px;
  background: var(--bg-dark);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc__valid { display: flex; flex-direction: column; gap: 16px; }

/* Doppel: die beiden Teamschnitte als kleine Mono-Zeile über dem Ergebnis. */
.calc__teams {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--surface-dark);
  font-size: 14px;
  color: var(--text-on-dark-muted);
}
.calc__teams .mono { color: var(--text-on-dark); font-weight: 600; }

.calc__case { display: flex; flex-direction: column; gap: 4px; }
.calc__case--win {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-dark);
}

.calc__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
}
.calc__case--win .calc__label { color: var(--accent); }

.calc__row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.calc__value {
  font-weight: 600;
  font-size: 52px;
  line-height: 1.05;
}
.calc__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.calc__delta svg { flex-shrink: 0; }
.calc__delta--down { color: var(--itn-green-on-dark); }
.calc__delta--up   { color: var(--itn-red-on-dark); }

/* Doppel: der neue Wert der Partner*in, klein unter dem eigenen. */
.calc__partner {
  font-size: 14px;
  color: var(--text-on-dark-muted);
}
.calc__partner .mono { color: var(--text-on-dark); font-weight: 600; }

.calc__weight,
.calc__noscript {
  font-size: 14px;
  color: var(--text-on-dark-muted);
}
.calc__invalid {
  font-size: 16px;
  color: var(--text-on-dark-muted);
}

/* Hinweis bei aktiver Jugendregel, mit grüner Kante vom Rest abgesetzt. */
.calc__note {
  padding-left: 12px;
  border-left: 2px solid var(--accent);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-on-dark);
}

.itn__disclaimer {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── So rechnet der ÖTV ─────────────────────────────────────────────────── */
.rules {
  margin-top: 96px;
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
}
.rules__copy,
.rules__side { flex: 1 1 380px; min-width: 0; }
.rules__side { display: flex; flex-direction: column; }

.rules__text { margin-top: 16px; color: var(--text-secondary); }

.rules__formula {
  margin-top: 24px;
  border-radius: 12px;
  background: var(--bg-alt);
  padding: 18px 20px;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: auto;
}
.rules__formula span { color: var(--text-secondary); }

/* Die Beispieltabelle ist eine echte Tabelle, gesetzt wie die Zeilenliste im
   Design: Kopf in Mono-Versalien mit dunkler Linie, Zeilen mit Haarlinie. */
.rules__table {
  width: 100%;
  border-collapse: collapse;
}
.rules__table th {
  padding: 0 0 10px;
  border-bottom: 1.5px solid var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-secondary);
}
.rules__table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: baseline;
}
.rules__table th:last-child,
.rules__table td:last-child {
  padding-left: 16px;
  text-align: right;
  white-space: nowrap;
}
.rules__table td.mono { font-weight: 600; }

/* styles.css nimmt Listen die Punkte, hier gehören sie dazu. */
.rules__list {
  margin-top: 20px;
  padding-left: 20px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  color: var(--text-secondary);
}

/* ── Bald als App ───────────────────────────────────────────────────────── */
.app {
  margin-top: 96px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  padding: 40px;
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.app__copy { flex: 1 1 420px; min-width: 0; }
.app__title { margin-top: 10px; }
.app__text { margin-top: 14px; color: var(--text-secondary); }

.app__form {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.app__field {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.app__field input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 20px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
}
.app__field input::placeholder { color: var(--itn-placeholder); }
.app__field input:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.app__button {
  align-self: flex-end;
  height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--on-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.app__button:hover { filter: brightness(1.15); }
.app__button:disabled { opacity: 0.6; cursor: progress; }

.app__note,
.app__msg { flex-basis: 100%; }
.app__note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.app__note a { color: var(--accent-text); }
.app__msg { font-size: 14px; font-weight: 600; }
.app__msg:empty { display: none; }
.app__msg--ok  { color: var(--accent-text); }
.app__msg--err { color: var(--itn-error); }

/* Honeypot: für Menschen unsichtbar und nicht per Tab erreichbar. Kein
   display:none, das erkennen manche Bots und lassen das Feld dann leer. */
.app__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Kortscore-Band ─────────────────────────────────────────────────────── */
.band {
  margin-top: 96px;
  background: var(--bg-dark);
  color: var(--text-on-dark);
}
.band__inner {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 72px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
}
.band__copy { flex: 1 1 460px; min-width: 0; }
.band__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 52px;
  line-height: 0.95;
  text-transform: uppercase;
}
.band__title em { font-style: normal; color: var(--accent); }
.band__text {
  margin-top: 18px;
  max-width: 520px;
  font-size: 18px;
  color: var(--text-on-dark-muted);
}

.band__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.band__button {
  display: inline-flex;
  align-items: center;
  min-height: 60px;
  padding: 10px 32px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.band__button:hover { color: var(--on-accent); filter: brightness(1.06); }
.band__button:focus-visible { outline-color: var(--accent); }
.band .storebadges { justify-content: flex-start; }

/* ── Rechtshinweis über dem Footer ──────────────────────────────────────── */
.itn__legal {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 32px var(--gutter);
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Schmale Bildschirme ────────────────────────────────────────────────────
   Bei 375px: Karte und Ergebnis untereinander mit weniger Innenabstand, die
   Felder bleiben zweispaltig, die großen Überschriften werden kleiner.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .itn__shell { padding-top: 24px; }
  .itn__lead { font-size: 17px; }

  .calc__in,
  .calc__out { padding: 24px 20px; }
  .seg__opt span { font-size: 14px; }
  .field input { font-size: 20px; padding: 0 12px; }
  .calc__value { font-size: 44px; }

  .itn__h2 { font-size: 32px; }
  .rules, .app, .band { margin-top: 64px; }
  .rules { gap: 32px; }
  .rules__formula { font-size: 14px; padding: 16px; }

  .app { padding: 28px 20px; }
  .app__button { flex: 1 1 100%; }

  .band__inner { padding-block: 56px; }
  .band__title { font-size: 40px; }
  .band__text { font-size: 17px; }
  .band__actions { width: 100%; }
  .band .storebadges { flex-direction: row; }
}
