/* ==========================================================================
   KGR-Wahl – HOME-TEASER (ohne Rahmen, Logo bündig)
   ========================================================================== */

.kgr-wahl figure > a.kgrw-link {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 14px;
  overflow: hidden;
}

/* Gemeinsame Basis der Overlays */
.kgrw-layer {
  position: absolute;
  z-index: 2;
  opacity: 0;
  transform: translateY(16px) scale(.985);
  filter: blur(6px);
  transition:
    opacity 900ms cubic-bezier(.22,.61,.36,1),
    transform 900ms cubic-bezier(.22,.61,.36,1),
    filter 900ms cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform, filter;
  pointer-events: none;
}

/* Logo: bündig unten rechts */
.kgrw-badge {
  right: 70px;
  bottom: 0;
  width: clamp(120px, 15vw, 260px);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.25));
}

/* Headline: oben links (kleiner) */
.kgrw-headline {
  left: clamp(16px, 3vw, 36px);
  top: clamp(4px, 1vw, 16px);
  width: min(55%, 520px);
}

/* Hashtag: unten links */
.kgrw-hashtag {
  left: clamp(16px, 3vw, 36px);
  bottom: clamp(16px, 2.8vw, 34px);
  width: min(50%, 520px);
}

/* gestaffeltes Einblenden */
.kgrw-visible .kgrw-badge   { opacity: 1; transform: none; filter: drop-shadow(0 4px 12px rgba(0,0,0,.25)); transition-delay: .05s; }
.kgrw-visible .kgrw-headline{ opacity: 1; transform: none; filter: none;                                   transition-delay: .45s; }
.kgrw-visible .kgrw-hashtag { opacity: 1; transform: none; filter: none;                                   transition-delay: .90s; }

/* Responsive */
@media (max-width: 900px) {
  .kgrw-headline { width: min(70%, 400px); }
  .kgrw-hashtag  { width: min(72%, 520px); }
  .kgrw-badge    { width: clamp(100px, 22vw, 200px); }
}
@media (max-width: 600px) {
  .kgrw-headline { width: 80%; top: clamp(10px, 2vw, 20px); }
  .kgrw-hashtag  { width: 84%; bottom: clamp(10px, 2vw, 20px); }
  .kgrw-badge    { width: clamp(100px, 30vw, 180px); }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .kgrw-layer {
    transition: none !important;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
  }
}

/* ==========================================================================
   KGR-Wahl – AUSWERTUNGSTABELLE
   Ziel:
   - Desktop: volle Tabelle; Kopf kleiner & mehrzeilig; saubere Breiten
   - „Kompakt“: nur 1. + letzte Spalte (per JS-Klasse .kgr-compact)
   - Mobile (≤768px): Card-View, alle Felder
   ========================================================================== */

/* Block-Heading-Abstände */
.kgr-wahl-auswertung .blocks h1 { margin-bottom: .4rem; }
.kgr-wahl-auswertung .blocks h4 { margin-top: 0; color: #666; font-weight: 400; }

/* Scroller-Wrapper (für horizontales Scrollen bei Bedarf) */
.kgr-wahl-auswertung .kgr-table-scroller {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.08); /* EIN sauberer Schatten */
  padding: 0;
  margin-bottom: 2rem; /* Luft unter dem Block */
}

/* Innerer Wrap (sauberer Clip, keine Extra-Layer) */
.kgr-wahl-auswertung .kgr-table-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

/* Tabelle */
.kgr-wahl-auswertung .kgr-table {
  width: 100%;
  min-width: 640px;               /* Platz für alle Spalten */
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;            /* damit Breiten greifen */
  font-size: clamp(14px, 1.8vw, 16px);
}

/* Kopfzeile – kompakt & mehrzeilig */
.kgr-wahl-auswertung .kgr-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f7f7f7;
  text-align: left;
  font-weight: 400;
  letter-spacing: .02em;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  cursor: pointer; user-select: none;
  font-size: .8em;
  line-height: 1.25;
  white-space: normal;            /* Umbruch zulassen */
  word-break: break-word;         /* lange Wörter umbrechen */
  max-width: 12rem;
}

/* Sort-Indikator */
.kgr-wahl-auswertung .kgr-table thead th::after { content: "↕"; font-size: .9em; opacity: .35; margin-left: .5rem; }
.kgr-wahl-auswertung .kgr-table thead th[aria-sort="ascending"]::after  { content: "▲"; opacity: .9; }
.kgr-wahl-auswertung .kgr-table thead th[aria-sort="descending"]::after { content: "▼"; opacity: .9; }

/* Zellen */
.kgr-wahl-auswertung .kgr-table tbody td {
  padding: 16px;
  border-top: 1px solid #f0f0f0;
  vertical-align: middle;
}
.kgr-wahl-auswertung .kgr-table tbody tr:nth-child(even) { background: #fafafa; }
.kgr-wahl-auswertung .kgr-table tbody tr:hover          { background: #f2f7ff; }

/* sanfter Einflug Zeile-für-Zeile */
@keyframes kgrRowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.kgr-wahl-auswertung .kgr-table tbody tr.kgr-anim {
  animation: kgrRowIn .45s ease-out both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

/* ---------- Spaltenbreiten & Ausrichtung (Desktop) ---------- */

/* Standard: alle Spalten sichtbar */
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) thead th:nth-child(1),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) tbody td:nth-child(1) {
  /* Name – viel Platz */
  width: 56%;
}
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) thead th:nth-child(2),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) tbody td:nth-child(2),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) thead th:nth-child(3),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) tbody td:nth-child(3) {
  /* Dettingen / Kappishäusern */
  width: 14%;
  text-align: right;
  white-space: nowrap;
}
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) thead th:nth-child(4),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) tbody td:nth-child(4) {
  /* Summe */
  width: 16%;
  text-align: right;
  white-space: nowrap;
}

/* Kompaktmodus: nur 1. + letzte Spalte */
.kgr-wahl-auswertung .kgr-table.kgr-compact th:not(:first-child):not(:last-child),
.kgr-wahl-auswertung .kgr-table.kgr-compact td:not(:first-child):not(:last-child) { display: none; }
.kgr-wahl-auswertung .kgr-table.kgr-compact thead th:first-child,
.kgr-wahl-auswertung .kgr-table.kgr-compact tbody td:first-child { width: auto; }
.kgr-wahl-auswertung .kgr-table.kgr-compact thead th:last-child,
.kgr-wahl-auswertung .kgr-table.kgr-compact tbody td:last-child  { width: 18ch; text-align: right; white-space: nowrap; }

/* auf sehr breiten Screens: Name darf noch etwas wachsen */
@media (min-width: 1280px) {
  .kgr-wahl-auswertung .kgr-table:not(.kgr-compact) thead th:nth-child(1),
  .kgr-wahl-auswertung .kgr-table:not(.kgr-compact) tbody td:nth-child(1) { width: 60%; }
}

/* --- FIX: Kopfzeilen dürfen immer umbrechen --- */
.kgr-wahl-auswertung .kgr-table thead th {
  white-space: normal !important;   /* überschreibt evtl. älteres nowrap */
  word-break: break-word;
  hyphens: auto;
  overflow: visible;
  max-width: none;                  /* keine zusätzliche Kappung */
  font-size: 0.85em;                /* gern etwas kleiner */
  line-height: 1.25;
}

/* --- FIX: sinnvollere Spaltenverteilung (Desktop, voller Modus) --- */
.kgr-wahl-auswertung .kgr-table { table-layout: fixed; }

.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) th:nth-child(1),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) td:nth-child(1) {
  width: 46%;   /* Name */
}
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) th:nth-child(2),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) td:nth-child(2) {
  width: 22%;   /* Dettingen */
  text-align: right;
  white-space: normal;             /* sicherheitshalber */
}
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) th:nth-child(3),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) td:nth-child(3) {
  width: 22%;   /* Kappishäusern */
  text-align: right;
  white-space: normal;             
}
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) th:nth-child(4),
.kgr-wahl-auswertung .kgr-table:not(.kgr-compact) td:nth-child(4) {
  width: 10%;   /* Summe */
  text-align: right;
  white-space: nowrap;             /* Summe bleibt einzeilig */
}



/* ---------- Mobile: Card-View (≤768px) – alle Felder sichtbar ---------- */
@media (max-width: 768px) {
  .kgr-wahl-auswertung .kgr-table-scroller {
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }
  .kgr-wahl-auswertung .kgr-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }
  .kgr-wahl-auswertung .kgr-table thead { display: none; }
  .kgr-wahl-auswertung .kgr-table tbody,
  .kgr-wahl-auswertung .kgr-table tr,
  .kgr-wahl-auswertung .kgr-table td {
    display: block; width: 100%;
  }
  .kgr-wahl-auswertung .kgr-table tr {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.06);
    overflow: hidden;
  }
  .kgr-wahl-auswertung .kgr-table td {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #f3f3f3;
    text-align: left; /* Zahlen links in der Card */
    white-space: normal;
  }
  .kgr-wahl-auswertung .kgr-table td:last-child { border-bottom: 0; }
  .kgr-wahl-auswertung .kgr-table td::before {
    content: attr(data-label);
    display: block;
    font-size: .85em;
    color: #6b7280;
    margin-bottom: 4px;
    letter-spacing: .02em;
  }
}