/* ============================================================================
   Namentliche Abstimmungen (templates/votes.html) — seitenspezifische Styles.
   Rohwerte aus static/tokens.css, gemeinsame Bausteine aus static/portal.css.

   Zwei Altlasten sind hier bewusst VERSCHWUNDEN:
     * `.vcard { border-left: 5px solid … }` und `.mcard { border-left: 4px … }`
       — farbige Seitenstreifen als Akzent. Ein Streifen kann Farbfehlsichtigen
       nichts sagen und trägt bei 4–5px auch sonst kaum Information. Ersetzt
       durch einen ausgeschriebenen Statuspunkt mit Text.
     * Weiße Schrift auf den Abstimmungsfarben. Weiß auf #7ab800 erreicht 2,42:1,
       auf #00c1f0 2,12:1, auf #b6b6b6 2,03:1 — alle unter AA. Nur Magenta
       #d0006f trägt Weiß (5,37:1); der Rest trägt dunkle Tinte.
   ============================================================================ */

/* Textfarbe auf gefüllter Abstimmungsfarbe. Feste dunkle Tinte, kippt NICHT mit
   dem Theme — die Füllfarbe kippt schließlich auch nicht. */
:root {
  --on-vote: #1a1a2e;
  --on-vote-against: #ffffff;
}

/* ── Hero mit Suche ───────────────────────────────────────────────────────── */
.hh-hero {
  background: var(--hero-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  color: var(--hero-ink);
  margin-bottom: var(--space-md);
}
.hh-hero h1 {
  font-size: var(--text-display);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  margin-bottom: var(--space-xs);
  hyphens: auto;
  overflow-wrap: break-word;
}
.hh-hero h1 em { font-style: italic; color: var(--accent); }
.hh-hero > p {
  color: var(--hero-ink-2);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-md);
}
.hh-search {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  max-width: 560px;
  transition: border-color var(--dur-fast) var(--ease);
}
.hh-search:focus-within {
  border-color: var(--structure);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.hh-search svg { color: var(--ink-3); flex-shrink: 0; }
.hh-search input {
  border: none; outline: none; background: transparent;
  font: inherit; font-size: var(--text-base); color: var(--ink);
  width: 100%; min-width: 0;
}
.hh-search input::placeholder { color: var(--ink-3); opacity: 1; }
.hh-search button {
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-sm);
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-bold);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease);
}
.hh-search button:hover { background: var(--accent-hover); }

.hh-count {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ink-2);
  margin-bottom: var(--space-sm);
}
.hh-count b { color: var(--structure); font-variant-numeric: tabular-nums; }

/* ── Abstimmungsliste ─────────────────────────────────────────────────────── */
.vlist { display: flex; flex-direction: column; gap: var(--space-sm); }
/* .vcard ist seit der Verlinkung der Abstimmungs-Detailseiten ein <a>, kein
   <button> mehr. Die Reset-Eigenschaften (font/color/text-align/width/display)
   passen unverändert; text-decoration:none kommt dazu, sonst unterstriche der
   Browser den ganzen Karteninhalt. */
.vcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  display: block;
  text-decoration: none;
  transition: box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.vcard:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.vcard .vtop {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  flex-wrap: wrap;
}
.vdate {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Ergebnismarke. Trägt Farbe UND Text — der frühere Seitenstreifen trug nur
   Farbe. Dunkle Tinte auf allen Füllungen außer Magenta. */
.vbadge {
  font-size: var(--text-2xs);
  font-weight: var(--weight-black);
  letter-spacing: 0.03em;
  color: var(--on-vote);
  border-radius: var(--radius-xs);
  padding: 2px var(--space-xs);
}
.vbadge.-an { background: var(--vote-for); }
.vbadge.-ab { background: var(--vote-against); color: var(--on-vote-against); }
.vbadge.-x  { background: var(--vote-absent); }

.vtitle {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--ink);
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Gestapelter Balken ───────────────────────────────────────────────────── */
.vbar {
  display: flex;
  height: 12px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-inset);
}
.vbar span { display: block; height: 100%; }
.vseg-ja    { background: var(--vote-for); }
.vseg-nein  { background: var(--vote-against); }
.vseg-enth  { background: var(--vote-abstain); }
.vseg-nicht { background: var(--vote-absent); }

.vlegend {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.vlegend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: var(--space-2xs);
  vertical-align: -1px;
  /* Kontur, damit hellgraue und cyanfarbene Punkte auf heller Fläche nicht
     verschwinden. */
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}

/* ── Detailansicht ────────────────────────────────────────────────────────── */
.vback {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ink-2);
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.vback:hover { border-color: var(--structure); color: var(--structure); }

.vdetail-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.vdetail-head h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  line-height: var(--leading-snug);
  color: var(--ink);
  margin-bottom: var(--space-sm);
}
.vmeta {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: var(--weight-semi);
  margin-bottom: var(--space-sm);
}
.vmeta a { color: var(--structure); text-decoration: underline; text-underline-offset: 2px; }

.vbar-lg { height: 26px; border-radius: var(--radius-sm); }
.vtally {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}
/* Zahl in Tinte, Farbe im Punkt daneben. Farbiger Text auf heller Fläche wäre
   bei Grün (2,42:1) und Cyan (2,12:1) unlesbar — deshalb trägt die Farbe hier
   nur den 10px-Punkt, nicht die Ziffern. */
.vtally .vt { display: block; }
.vtally .n {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  display: block;
}
.vtally .l {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--ink-3);
  font-weight: var(--weight-semi);
  font-size: var(--text-xs);
  margin-top: var(--space-3xs);
}
.vtally .l .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}

.sec-label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
  margin: var(--space-lg) 0 var(--space-sm);
}

/* ── Fraktionsaufschlüsselung ─────────────────────────────────────────────
   Die große erzählende Grafik dieser Seite: eine Zeile je Fraktion, jeweils mit
   eigenem gestapeltem Balken UND ausgeschriebenen Zahlen. Kein Kartenrahmen —
   die Zeilen liegen in EINER Fläche, getrennt durch 1px-Linien. Karte in Karte
   ist verboten. */
.frak-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.frak-hint {
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: var(--weight-semi);
  margin: calc(-1 * var(--space-2xs)) 0 var(--space-xs);
}
.frak-row {
  display: grid;
  /* Breit genug, dass die Zählzeile in EINER Zeile steht. Bei 150px brach sie
     um, wodurch die Zeilen unterschiedlich hoch wurden und die Balken nicht
     mehr auf einer Linie lagen. */
  grid-template-columns: minmax(210px, 250px) 1fr 96px;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--line);
}
.frak-row:last-child { border-bottom: none; }
.frak-name { font-weight: var(--weight-black); font-size: var(--text-sm); color: var(--ink); }
/* Schiene, in der der auf die größte Fraktion skalierte Balken sitzt. */
.vbar-track { width: 100%; }

/* Geschlossenheit. Der Prozentwert steht NIE allein — darunter die Rohzahlen
   und die Richtung, aus denen er entsteht. Eine abgeleitete Kennzahl ohne ihre
   Rechengrundlage wäre in einem Archiv eine Behauptung. */
.frak-geschl { text-align: right; }
.fg-wert {
  display: block;
  font-size: var(--text-md);
  font-weight: var(--weight-black);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.fg-wert.fg-leer { color: var(--ink-3); }
.fg-regel {
  display: block;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-3xs);
}
.frak-hint b { color: var(--ink-2); font-weight: var(--weight-bold); }
.frak-name .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: var(--space-2xs);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}
.frak-counts {
  font-size: var(--text-2xs);
  color: var(--ink-3);
  font-weight: var(--weight-semi);
  margin-top: var(--space-3xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Filterchips ──────────────────────────────────────────────────────────── */
.vfilters { display: flex; gap: var(--space-xs); flex-wrap: wrap; margin: var(--space-2xs) 0 var(--space-sm); }
.vchip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: var(--space-2xs) var(--space-sm);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.vchip i {
  width: 10px; height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}
.vchip:hover { border-color: var(--structure); }
.vchip[aria-pressed='true'] {
  background: var(--structure);
  color: var(--on-structure);
  border-color: var(--structure);
}

/* ── Abgeordnetenraster ───────────────────────────────────────────────────
   Statt des früheren farbigen Seitenstreifens trägt jede Kachel einen
   Statuspunkt und das ausgeschriebene Abstimmungsverhalten. */
.mgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--space-xs);
}
.mcard {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
}
.mava {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
}
.mava-ph {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: var(--weight-black);
  font-size: var(--text-xs);
  flex-shrink: 0;
}
/* Muss schrumpfen dürfen, sonst drückt ein langer Name das Abstimmungslabel
   aus der Kachel. */
.mid { min-width: 0; }
.mname {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.mfrak {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.mvote {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-2xs);
  font-weight: var(--weight-black);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  white-space: nowrap;
}
.mvote .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.18);
}
.mvote.-Ja .dot { background: var(--vote-for); }
.mvote.-Nein .dot { background: var(--vote-against); }
.mvote.-Enthaltung .dot { background: var(--vote-abstain); }
.mvote.-nicht_abgestimmt .dot { background: var(--vote-absent); }

/* ── Zustände und Seitenzahlen (wie im Viewer) ────────────────────────────── */
.hh-loading { display: flex; flex-direction: column; gap: var(--space-sm); }
.hh-skeleton {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  height: 108px;
}
.hh-skeleton span {
  display: block; height: 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-inset);
  margin-bottom: var(--space-sm);
}
.hh-skeleton span:nth-child(1) { width: 30%; }
.hh-skeleton span:nth-child(2) { width: 88%; height: 16px; }
.hh-skeleton span:nth-child(3) { width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .hh-skeleton span { animation: hh-pulse 1.4s var(--ease) infinite; }
  @keyframes hh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
}
.hh-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--ink-2);
  font-weight: var(--weight-semi);
}
.hh-empty-title {
  display: block;
  font-size: var(--text-xl);
  font-weight: var(--weight-black);
  color: var(--ink);
  margin-bottom: var(--space-xs);
}
.hh-empty-hint { display: block; font-size: var(--text-base); color: var(--ink-3); max-width: 46ch; margin: 0 auto; }

.hh-pager { display: flex; justify-content: center; gap: var(--space-2xs); margin-top: var(--space-lg); flex-wrap: wrap; }
.hh-pager button {
  min-width: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-sm);
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-bold);
  color: var(--ink-2); cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.hh-pager button:hover:not(:disabled):not(.on) { border-color: var(--structure); color: var(--structure); }
.hh-pager button.on { background: var(--structure); color: var(--on-structure); border-color: var(--structure); }
.hh-pager button:disabled { opacity: 0.45; cursor: default; }
.hh-pager .gap { border: none; background: none; color: var(--ink-3); min-width: 20px; }

@media (max-width: 760px) {
  .frak-row { grid-template-columns: 1fr; gap: var(--space-2xs); }
  /* Gestapelt gehört der Wert nach links wie alles andere, sonst steht er
     ohne Bezug am rechten Rand. */
  .frak-geschl { text-align: left; }
  .fg-regel { display: inline; margin-left: var(--space-2xs); }
  .hh-header-inner .right { display: none; }
  .hh-hero { padding: var(--space-md); }
}

/* ── Voting-Record: Tag, Filter, Fraktions-Detail, Statistik ──────────────── */
.vtag {
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: var(--radius-pill); line-height: 1.6;
  border: 1px solid var(--line-strong);
}
.vtag.-nam  { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.vtag.-frak { background: var(--surface-inset); color: var(--ink-2); }
.vlegend-hint { color: var(--ink-3); }

/* Werkzeugleiste: Filter + Statistik-Umschalter */
.vtools {
  display: flex; flex-wrap: wrap; gap: var(--space-sm);
  align-items: center; justify-content: space-between;
  margin-bottom: var(--space-md);
}
.vart { display: inline-flex; gap: 4px; background: var(--surface-inset);
  padding: 4px; border-radius: var(--radius-pill); }
.vart button {
  border: 0; background: transparent; color: var(--ink-2);
  font: inherit; font-weight: 600; font-size: var(--text-sm);
  padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.vart button[aria-pressed="true"] { background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-hover); }
.stats-toggle {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: var(--text-sm);
  padding: 8px 16px; border-radius: var(--radius-pill); cursor: pointer;
}
.stats-toggle:hover { border-color: var(--accent); }

/* Statistik-Panel */
.stats-panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--space-lg);
  margin-bottom: var(--space-xl); }
.st-kpis { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-bottom: var(--space-md); }
.st-kpi { flex: 1 1 120px; background: var(--surface-inset);
  border-radius: var(--radius-md); padding: var(--space-md); text-align: center; }
.st-kpi b { display: block; font-size: var(--text-2xl); line-height: 1; color: var(--ink); }
.st-kpi span { font-size: var(--text-2xs); color: var(--ink-2); }
.st-list { display: flex; flex-direction: column; gap: var(--space-2xs); margin-bottom: var(--space-md); }
.st-row { display: grid; grid-template-columns: 12ch 1fr auto; gap: var(--space-sm);
  align-items: center; }
.st-lab { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm);
  font-weight: 600; color: var(--ink); min-width: 0; }
.st-lab i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.st-bar { height: 16px; background: var(--surface-inset); border-radius: var(--radius-xs);
  overflow: hidden; display: flex; }
.st-bar span { display: block; height: 100%; }
.st-val { font-size: var(--text-2xs); color: var(--ink-2); white-space: nowrap; }

/* Fraktions-Detail (nicht-namentlich) */
.fr-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.fr-col { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); overflow: hidden; }
.fr-col-h { padding: var(--space-sm) var(--space-md); font-weight: 700;
  font-size: var(--text-sm); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; }
.fr-col-h.-an { background: var(--vote-for);     color: var(--on-vote); }
.fr-col-h.-ab { background: var(--vote-against);  color: var(--on-vote-against); }
.fr-col-h.-en { background: var(--vote-abstain);  color: var(--on-vote); }
.fr-col-b { padding: var(--space-md); display: flex; flex-wrap: wrap; gap: 6px; }
.fr-chip { font-size: var(--text-2xs); font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-pill); }
.fr-none { color: var(--ink-3); }
@media (max-width: 640px) {
  .fr-cols { grid-template-columns: 1fr; }
  .st-row { grid-template-columns: 10ch 1fr; }
  .st-val { grid-column: 2; text-align: right; }
}
