/* ============================================================
   WAHLSTUPS — „Stimmzettel“
   Kühles Papierweiß, Tuschschwarz, Briefwahl-Rot als einziger
   harter Akzent, Dienststempel-Blau für Amtliches. Das zentrale
   Motiv ist der Kreis, in den du dein Kreuz machst.
   Kein amtliches Dokument — und sagt das auch.
   ============================================================ */

/* ---------- Schriften (lokal, alle OFL 1.1 — siehe fonts/LICENSES.md) ---------- */
@font-face {
  font-family: "Staatliches";
  src: url("../fonts/staatliches-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Libre Franklin";
  src: url("../fonts/libre-franklin-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Franklin";
  src: url("../fonts/libre-franklin-var-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Spline Sans Mono";
  src: url("../fonts/spline-sans-mono-var.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- Grundwerte ---------- */
:root {
  --papier: #f4f2ec;      /* Stimmzettel: kühles, leicht graues Weiß */
  --papier-hi: #fbfaf6;
  --papier-lo: #e9e6dd;
  --tusche: #16151a;      /* Tusche, ins Blauschwarze */
  --tusche-soft: rgba(22, 21, 26, .64);
  --tusche-faint: rgba(22, 21, 26, .38);
  --linie: rgba(22, 21, 26, .28);
  --linie-zart: rgba(22, 21, 26, .14);
  --rot: #c92c1e;         /* Briefwahl-Rot — der einzige harte Akzent */
  --rot-tief: #a92416;
  --blau: #2b4a8f;        /* Dienststempel-Blau — Amtliches, Links */
  --disp: "Staatliches", "Arial Narrow", sans-serif;
  --body: "Libre Franklin", "Helvetica Neue", sans-serif;
  --mono: "Spline Sans Mono", "Courier New", monospace;
  --schatten: 0 18px 40px -18px rgba(22, 21, 26, .35), 0 2px 6px -2px rgba(22, 21, 26, .18);
  --radius: 3px;          /* Papier hat kaum Rundungen */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--papier-lo);
  color: var(--tusche);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Papierkorn — Druckrauschen über allem, dezent */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0 0.10 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--rot); color: var(--papier-hi); }

/* ---------- Der Zettel (zentrale Bühne) ---------- */
.zettel-buehne {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(.75rem, 3vw, 2.5rem);
}

.zettel {
  position: relative;
  width: 100%;
  max-width: 680px;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Abgeschnittene Ecke oben rechts — wie beim Musterstimmzettel */
.zettel::before {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 34px; height: 34px;
  background: var(--papier-lo);
  border-left: 1px solid var(--linie);
  border-bottom: 1px solid var(--linie);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

/* ---------- Kopfzeile ---------- */
.kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 3px double var(--linie);
  padding-bottom: .75rem;
  margin-bottom: 1.25rem;
}

.marke {
  font-family: var(--disp);
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  letter-spacing: .04em;
  line-height: 1;
  color: var(--tusche);
  text-decoration: none;
}
.marke .stups { color: var(--rot); }

.kopf-meta {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tusche-soft);
  text-align: right;
}

/* ---------- Typo-Bausteine ---------- */
.display {
  font-family: var(--disp);
  font-weight: 400;
  letter-spacing: .03em;
  line-height: 1.05;
}

h1.display { font-size: clamp(2rem, 7vw, 3.2rem); }
h2.display { font-size: clamp(1.4rem, 5vw, 2rem); }

.vorschrift {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tusche-soft);
}

.fliess { color: var(--tusche-soft); max-width: 52ch; }

a { color: var(--blau); text-underline-offset: 3px; }

/* ---------- Buttons ---------- */
.knopf {
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 56px;
  padding: .8rem 1.8rem;
  font-family: var(--disp);
  font-size: 1.25rem;
  letter-spacing: .06em;
  color: var(--papier-hi);
  background: var(--rot);
  border: 1px solid var(--rot-tief);
  border-radius: var(--radius);
  box-shadow: 0 3px 0 var(--rot-tief);
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--rot-tief); }
.knopf:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

.knopf--nebensache {
  background: transparent;
  color: var(--tusche);
  border: 1px solid var(--linie);
  box-shadow: 0 3px 0 var(--linie-zart);
  font-size: 1.05rem;
}

/* ---------- Stimmzettel-Zeilen (Themenauswahl) ----------
   Kompakt: Titel + genau EINE Teaser-Zeile (Ellipsis), damit 10 Themen
   ohne Scrollen auf einen Tablet-Screen passen. */
.zeilen { list-style: none; display: grid; gap: .4rem; }

.zeile {
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) 40px;
  align-items: center;
  gap: .7rem;
  width: 100%;
  text-align: left;
  padding: .5rem .8rem;
  min-height: 52px;
  background: var(--papier-hi);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.zeile:hover { border-color: var(--tusche); }
.zeile[aria-pressed="true"] { border-color: var(--tusche); background: var(--papier); }
.zeile:focus-visible, .wahl:focus-visible, .knopf:focus-visible {
  outline: 3px solid var(--blau);
  outline-offset: 2px;
}

.zeile-nr {
  font-family: var(--mono);
  font-weight: 600;
  font-size: .9rem;
  color: var(--tusche-faint);
  text-align: right;
}

.zeile-text { min-width: 0; }
.zeile-titel { display: block; font-weight: 650; font-size: 1rem; line-height: 1.3; }
.zeile-teaser {
  display: block;
  font-size: .8rem;
  color: var(--tusche-soft);
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variante für Info-Listen (z. B. /mitmachen): Teaser darf umbrechen */
.zeile--frei { cursor: default; }
.zeile--frei .zeile-teaser { white-space: normal; }

/* Der Kreis fürs Kreuz */
.kreis { width: 36px; height: 36px; justify-self: end; }
.kreis circle {
  fill: var(--papier-hi);
  stroke: var(--tusche);
  stroke-width: 2.5;
}
.kreis .kreuz {
  stroke: var(--rot);
  stroke-width: 4.5;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}
.zeile[aria-pressed="true"] .kreuz {
  animation: kreuzen .28s ease-out forwards;
}
.zeile[aria-pressed="true"] .kreuz.k2 { animation-delay: .14s; }
@keyframes kreuzen { to { stroke-dashoffset: 0; } }

/* ---------- Parameterfrage: Antwort-Optionen ---------- */
.wahlen { display: grid; gap: .55rem; }

.wahl {
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: .9rem;
  min-height: 60px;
  padding: .75rem 1rem;
  background: var(--papier-hi);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 550;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease;
}
.wahl:hover { border-color: var(--tusche); }
.wahl .punkt {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border: 2px solid var(--tusche);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--disp);
  color: var(--rot);
  font-size: 1.25rem;
  line-height: 1;
}
.wahl--leer { border-style: dashed; color: var(--tusche-soft); font-weight: 450; }

/* ---------- Fortschritt ---------- */
.schritt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}
.schritt .balken {
  flex: 1;
  height: 3px;
  margin-left: 1rem;
  background: var(--linie-zart);
  position: relative;
}
.schritt .balken i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--rot);
  transition: width .3s ease;
}

/* ---------- Panels / Schritte-Wechsel ---------- */
.panel { display: none; flex: 1 0 auto; flex-direction: column; }
.panel.aktiv { display: flex; animation: blattwechsel .3s ease-out; }
@keyframes blattwechsel {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.panel .fuss-aktionen {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* ---------- Ergebnis ---------- */
.ergebnis-block { margin: 1.4rem 0; }

.stempel {
  display: inline-block;
  font-family: var(--disp);
  font-size: 1rem;
  letter-spacing: .18em;
  color: var(--blau);
  border: 2.5px solid var(--blau);
  border-radius: 4px;
  padding: .15rem .7rem;
  transform: rotate(-2.5deg);
  opacity: .85;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='120' height='40' filter='url(%23r)'/%3E%3C/svg%3E");
  mask-size: 120px 40px;
}
.stempel--rot { color: var(--rot); border-color: var(--rot); transform: rotate(1.8deg); }

.partei { border: 1px solid var(--linie); border-radius: var(--radius); background: var(--papier-hi); margin-bottom: .6rem; }
.partei summary {
  list-style: none;
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: .9rem;
  align-items: center;
  padding: .8rem .95rem;
  cursor: pointer;
  min-height: 60px;
}
.partei summary::-webkit-details-marker { display: none; }
.partei .farbkante { width: 6px; height: 100%; min-height: 40px; border-radius: 2px; }
.partei-name { font-weight: 700; }
.partei-langname { display: block; font-size: .78rem; font-weight: 400; color: var(--tusche-soft); }
.prozent {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}
.prozent small { font-size: .75rem; color: var(--tusche-soft); }

.messbalken { height: 7px; margin: 0 .95rem .8rem; background: var(--linie-zart); position: relative; border-radius: 2px; overflow: hidden; }
.messbalken i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }

.partei .begruendung {
  border-top: 1px dashed var(--linie);
  padding: .8rem .95rem;
  font-size: .92rem;
}
.begruendung .thema-zeile { margin-bottom: .7rem; }
.begruendung .thema-titel { font-weight: 650; }
.begruendung .richtung { font-family: var(--mono); font-size: .8rem; }
.richtung.plus { color: #1e6b34; }
.richtung.minus { color: var(--rot); }
.richtung.null { color: var(--tusche-soft); }
.quelle { font-size: .8rem; color: var(--tusche-soft); }
.quelle a { color: var(--blau); }
.konfidenz { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tusche-faint); }

/* ---------- QR-Abschnitt (Perforationskante) ---------- */
.abschnitt {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 2px dashed var(--linie);
  position: relative;
  display: flex;
  gap: 1.2rem;
  align-items: center;
  flex-wrap: wrap;
}
.abschnitt::before {
  content: "✂";
  position: absolute;
  top: -0.85rem;
  left: 1rem;
  background: var(--papier);
  padding: 0 .4rem;
  color: var(--tusche-faint);
  font-size: 1rem;
}
.abschnitt img { width: 132px; height: 132px; border: 1px solid var(--linie); background: #fff; image-rendering: pixelated; }
.abschnitt .code { font-family: var(--mono); font-size: .8rem; color: var(--tusche-soft); word-break: break-all; }

/* ---------- Kleingedrucktes ---------- */
.kleingedruckt {
  margin-top: 1.6rem;
  padding-top: .8rem;
  border-top: 1px solid var(--linie-zart);
  font-size: .72rem;
  line-height: 1.5;
  color: var(--tusche-faint);
}
.kleingedruckt a { color: inherit; }

/* Großer Ergebnis-QR im Kiosk — muss aus Armlänge scanbar sein */
.ergebnis-qr-gross {
  width: 210px;
  height: 210px;
  border: 1px solid var(--linie);
  background: #fff;
  padding: 8px;
  image-rendering: pixelated;
}

/* ---------- Kiosk ---------- */
.kiosk .kleingedruckt { font-size: .8rem; }
.kiosk-hinweis {
  position: fixed;
  bottom: .6rem; right: .8rem;
  z-index: 96;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tusche-faint);
}

/* Startbildschirm-Bühne */
.auftakt { text-align: center; padding: 2.5rem 0 1.5rem; display: grid; gap: 1.2rem; justify-items: center; flex: 1 0 auto; align-content: center; }
.auftakt .grosskreuz { width: 110px; height: 110px; }
.auftakt .grosskreuz circle { fill: var(--papier-hi); stroke: var(--tusche); stroke-width: 2.5; }
.auftakt .grosskreuz .kreuz {
  stroke: var(--rot); stroke-width: 5; stroke-linecap: round; fill: none;
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: kreuzen 0.5s ease-out .4s forwards;
}
.auftakt .grosskreuz .kreuz.k2 { animation-delay: .65s; }
.untertitel { font-size: 1.1rem; color: var(--tusche-soft); max-width: 40ch; }

/* ---------- Startseite (Wahl-Liste) ---------- */
.wahl-liste { list-style: none; display: grid; gap: .7rem; margin-top: 1rem; }
.wahl-liste a {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--papier-hi);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.wahl-liste a:hover { border-color: var(--tusche); }
.wahl-liste .wann { font-family: var(--mono); font-size: .78rem; color: var(--tusche-soft); }

/* ---------- Responsiv ---------- */
@media (max-width: 480px) {
  .zettel { padding: 1.1rem .9rem; }
  .zeile { grid-template-columns: 1.4rem minmax(0, 1fr) 36px; }
  .kreis { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
