/* =========================================================
   Gemeinderatswahl Graz 2026 — Auswertung
   Neutral · modern · datenbasiert
   ========================================================= */

:root {
    --ink:        #14181d;
    --ink-2:      #3a4250;
    --ink-3:      #6b7585;
    --line:       #e6e9ee;
    --line-2:     #d6dbe2;
    --bg:         #ffffff;
    --bg-tint:    #f6f7f9;
    --bg-deep:    #0e1116;
    --accent:     #B40E1E;
    --pos:        #1f9d63;
    --neg:        #c0392b;
    --radius:     16px;
    --shadow:     0 1px 2px rgba(20,24,29,.04), 0 12px 32px -16px rgba(20,24,29,.22);
    --maxw:       1100px;
    --serif:      "Fraunces", Georgia, serif;
    --sans:       "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.55;
}

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Masthead ---------- */
.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.masthead__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}
.brand__mark {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .12em;
    background: var(--ink);
    color: #fff;
    padding: 5px 8px;
    border-radius: 6px;
}
.brand__txt {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .01em;
    color: var(--ink-2);
}
.topnav {
    display: flex;
    gap: 26px;
}
.topnav a {
    text-decoration: none;
    color: var(--ink-3);
    font-size: 14px;
    font-weight: 500;
    transition: color .15s;
}
.topnav a:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
    padding: 76px 0 64px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(180,14,30,.06), transparent 60%),
        var(--bg);
}
.hero__kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-3);
    text-transform: none;
}
.hero__kicker .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(180,14,30,.14);
}
.hero__title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(40px, 7vw, 76px);
    line-height: 1.02;
    letter-spacing: -.02em;
    margin: 20px 0 22px;
    max-width: 14ch;
}
.hero__title .hl { color: var(--accent); }
.hero__lead {
    font-size: clamp(17px, 2.1vw, 21px);
    color: var(--ink-2);
    max-width: 60ch;
    margin: 0 0 38px;
}
.hero__lead strong { color: var(--ink); font-weight: 600; }

.hero__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.stat {
    background: var(--bg);
    padding: 20px 22px;
}
.stat__val {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -.01em;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.stat__delta {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
}
.stat__delta.up { color: var(--pos); }
.stat__delta.down { color: var(--neg); }
.stat__lbl {
    margin-top: 9px;
    font-size: 13px;
    color: var(--ink-3);
    font-weight: 500;
}
.hero__stand {
    margin-top: 22px;
    font-size: 13px;
    color: var(--ink-3);
}

/* ---------- Blocks ---------- */
.block { padding: 76px 0; border-bottom: 1px solid var(--line); }
.block--tint { background: var(--bg-tint); }
.block__head { max-width: 64ch; margin-bottom: 36px; }
.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 12px;
}
.block__head h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: -.015em;
    line-height: 1.08;
    margin: 0 0 14px;
}
.block__sub {
    font-size: 16px;
    color: var(--ink-2);
    margin: 0;
}
.block__sub strong { color: var(--ink); }

/* ---------- Chart cards ---------- */
.chart-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 28px;
}
.block--tint .chart-card { box-shadow: 0 1px 2px rgba(20,24,29,.04); }

/* ---------- Bar chart (Ergebnis) ---------- */
.barrow {
    display: grid;
    grid-template-columns: 86px 1fr 132px;
    align-items: center;
    gap: 18px;
    padding: 11px 0;
}
.barrow + .barrow { border-top: 1px solid var(--line); }
.barrow__name {
    font-weight: 700;
    font-size: 14px;
    text-align: right;
    letter-spacing: .01em;
}
.barrow__lane { width: 100%; min-width: 0; }
.barrow__bar {
    height: 30px;
    border-radius: 7px;
    width: 0;
    transition: width 1.05s cubic-bezier(.22,1,.36,1);
    min-width: 3px;
}
.barrow__meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    white-space: nowrap;
}
.barrow__pct {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 19px;
    letter-spacing: -.01em;
}
.barrow__chg {
    font-size: 12.5px;
    font-weight: 600;
}
.barrow__chg.up { color: var(--pos); }
.barrow__chg.down { color: var(--neg); }
.barrow__chg.flat { color: var(--ink-3); }

/* ---------- Swing chart ---------- */
.swing {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.swingrow {
    display: grid;
    grid-template-columns: 80px 1fr 64px;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
}
.swingrow__name { font-weight: 700; font-size: 14px; }
.swingrow__lane {
    position: relative;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(192,57,43,.05), rgba(31,157,99,.05));
}
.swingrow__zero {
    position: absolute;
    left: 50%; top: -6px; bottom: -6px;
    width: 1.5px;
    background: var(--line-2);
}
.swingrow__fill {
    position: absolute;
    top: 6px; bottom: 6px;
    width: 0;
    border-radius: 5px;
    transition: width 1s cubic-bezier(.22,1,.36,1);
}
.swingrow__val {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 17px;
    text-align: right;
}
.swingrow__val.up { color: var(--pos); }
.swingrow__val.down { color: var(--neg); }

/* ---------- Seats / hemicycle ---------- */
.chart-card--seats { text-align: center; }
#chartSeats svg { max-width: 620px; width: 100%; height: auto; }
.seat {
    transition: opacity .5s ease, transform .5s ease;
    opacity: 0;
    transform: translateY(6px);
}
.seat.in { opacity: 1; transform: none; }
.seatcore {
    fill: var(--ink);
    font-family: var(--serif);
    font-weight: 600;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    margin-top: 26px;
}
.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
}
.legend__sw {
    width: 12px; height: 12px;
    border-radius: 4px;
}
.legend__item b { color: var(--ink); font-weight: 700; }

/* ---------- Coalitions ---------- */
.coalitions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.coal {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: 0 1px 2px rgba(20,24,29,.04);
}
.coal__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.coal__label { font-weight: 700; font-size: 16px; }
.coal__badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}
.coal__badge.ok { background: rgba(31,157,99,.12); color: var(--pos); }
.coal__badge.no { background: rgba(192,57,43,.10); color: var(--neg); }
.coal__seatbar {
    display: flex;
    height: 16px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--line);
    margin-bottom: 14px;
    position: relative;
}
.coal__seg { height: 100%; }
.coal__majline {
    position: absolute;
    top: -4px; bottom: -4px;
    width: 2px;
    background: var(--ink);
    opacity: .55;
}
.coal__foot {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ink-3);
}
.coal__seats {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 22px;
    color: var(--ink);
}

/* ---------- Bezirke: Insights ---------- */
.insight-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}
.insight {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(20,24,29,.04);
    border-top: 3px solid var(--ink);
}
.insight__val {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -.01em;
    margin-bottom: 6px;
}
.insight__lbl { font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.insight__lbl b { color: var(--ink-2); font-weight: 600; }

/* ---------- Wahlkarte ---------- */
.map-card { padding: 24px 24px 20px; margin-bottom: 16px; }
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    background: var(--bg);
    border: 1.5px solid var(--line-2);
    border-radius: 999px;
    padding: 6px 13px 6px 10px;
    cursor: pointer;
    transition: all .14s;
}
.chip:hover { border-color: var(--c, var(--ink-3)); }
.chip__dot { width: 10px; height: 10px; border-radius: 50%; }
.chip.is-active .chip__dot { display: none; }

.map-wrap { position: relative; margin-top: 10px; }
.map { width: 100%; max-width: 680px; margin: 0 auto; }
.map svg { width: 100%; height: auto; display: block; overflow: visible; }
.bez {
    stroke: #fff;
    stroke-width: 1.4;
    stroke-linejoin: round;
    cursor: pointer;
    transition: opacity .15s, filter .15s;
}
.bez:hover { opacity: .88; }
.bez.dim { opacity: .25; }
.bez.active { stroke: var(--ink); stroke-width: 2.4; }
.bez-label {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 700;
    fill: #fff;
    text-anchor: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(20,24,29,.35);
    stroke-width: 2.6px;
}
.bez-sub {
    font-family: var(--sans);
    font-size: 10px;
    font-weight: 600;
    fill: rgba(255,255,255,.92);
    text-anchor: middle;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(20,24,29,.3);
    stroke-width: 2.4px;
}
.map-tip {
    position: absolute;
    z-index: 5;
    background: var(--bg-deep);
    color: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 190px;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,.5);
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 14px));
    font-size: 13px;
}
.map-tip h4 {
    margin: 0 0 3px; font-family: var(--serif); font-size: 17px; font-weight: 600;
}
.map-tip .tip-turn { color: #9aa3ab; font-size: 12px; margin: 0 0 10px; }
.map-tip .tip-row {
    display: grid; grid-template-columns: 14px 1fr auto auto;
    align-items: center; gap: 8px; padding: 2px 0; font-variant-numeric: tabular-nums;
}
.map-tip .tip-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.map-tip .tip-row .nm { color: #cfd5dd; }
.map-tip .tip-row .pc { font-weight: 700; }
.map-tip .tip-row .dl { font-size: 11px; width: 46px; text-align: right; }
.map-tip .tip-row .dl.up { color: #51d68c; }
.map-tip .tip-row .dl.down { color: #ff7a6b; }
.map-legend {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px 16px; margin-top: 14px;
}
.map-legend .li { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.map-legend .li .sw { width: 13px; height: 13px; border-radius: 4px; }
.map-legend .scale-grad {
    width: 130px; height: 12px; border-radius: 4px;
}
.map-legend .scale-lbl { font-size: 12px; color: var(--ink-3); }

/* ---------- Heatmap ---------- */
.heat-card { padding: 24px 24px 18px; }
.heat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.seg {
    display: inline-flex;
    background: var(--bg-tint);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 3px;
}
.seg__btn {
    border: none;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: all .15s;
}
.seg__btn.is-active {
    background: var(--bg);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(20,24,29,.12);
}
.heat-scroll { overflow-x: auto; margin-top: 6px; }
.heat {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    font-size: 13.5px;
    min-width: 640px;
}
.heat th {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 8px 6px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.heat th:first-child { text-align: left; cursor: default; }
.heat th.sorted { color: var(--ink); }
.heat th .arrow { font-size: 9px; opacity: .7; }
.heat td { text-align: center; padding: 0; }
.heat td:first-child { text-align: left; }
.bz-name {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    white-space: nowrap;
}
.bz-name b { font-weight: 700; font-size: 13.5px; }
.bz-turn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ink-3);
}
.bz-turn__bar {
    width: 52px; height: 5px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}
.bz-turn__fill { height: 100%; background: var(--ink-3); border-radius: 3px; }
.heat-cell {
    border-radius: 8px;
    padding: 11px 4px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink);
    position: relative;
    transition: transform .1s;
}
.heat-cell.win {
    box-shadow: inset 0 0 0 2px rgba(20,24,29,.55);
    font-weight: 800;
}
.heat-cell .sub {
    display: block;
    font-size: 10px;
    font-weight: 600;
    opacity: .65;
    margin-top: 1px;
}
.heat-foot {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 12px;
    color: var(--ink-3);
}
.heat-foot .scale {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.heat-foot .scale i {
    width: 38px; height: 9px; border-radius: 3px; display: inline-block;
}

/* ---------- Stadtsenat / Bürgermeister ---------- */
.senat-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.card-title {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 4px;
    letter-spacing: .01em;
}
.card-sub {
    font-size: 13.5px;
    color: var(--ink-3);
    margin: 0 0 18px;
}
.senat-card { display: flex; flex-direction: column; }
.senat-seats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 22px 0 8px;
}
.senat-seat {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .45s ease, transform .45s cubic-bezier(.34,1.56,.64,1);
}
.senat-seat.in { opacity: 1; transform: none; }
.senat-card .legend { margin-top: 18px; }

.bm-card {
    background: var(--bg-deep);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px 30px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.bm-kicker {
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #9aa3ab;
    font-weight: 700;
    margin: 0 0 10px;
}
.bm-name {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 38px;
    line-height: 1.05;
    margin: 0 0 6px;
    letter-spacing: -.02em;
}
.bm-party {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    margin: 0 0 16px;
}
.bm-party::before {
    content: "";
    width: 12px; height: 12px;
    border-radius: 4px;
    background: var(--accent);
}
.bm-modus {
    font-size: 14px;
    color: #b9c0cb;
    margin: 0 0 18px;
    line-height: 1.5;
}
.bm-coal {
    border-top: 1px solid rgba(255,255,255,.12);
    padding-top: 16px;
    font-size: 13.5px;
    color: #9aa3ab;
}
.bm-coal b { color: #fff; font-size: 18px; font-family: var(--serif); font-weight: 600; }

.dhondt-card { margin-top: 0; }
.dhondt thead th, .dhondt tbody td { text-align: center; }
.dhondt thead th:first-child, .dhondt tbody td:first-child { text-align: left; }
.dh-q {
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
    font-size: 13px;
}
.dh-q.seat {
    color: var(--ink);
    font-weight: 700;
    background: rgba(31,157,99,.10);
    border-radius: 6px;
}
.dh-rank {
    display: inline-block;
    font-size: 10px;
    color: var(--pos);
    font-weight: 700;
    vertical-align: super;
    margin-left: 3px;
}

/* ---------- Table ---------- */
.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.rtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}
.rtable thead th {
    background: var(--bg-tint);
    text-align: right;
    font-weight: 600;
    color: var(--ink-3);
    font-size: 12.5px;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}
.rtable thead th:first-child { text-align: left; }
.rtable tbody td {
    padding: 13px 18px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.rtable tbody td:first-child { text-align: left; }
.rtable tbody tr:last-child td { border-bottom: none; }
.rtable tbody tr:hover { background: var(--bg-tint); }
.rt-party {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.rt-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.rt-sub { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.rt-chg.up { color: var(--pos); font-weight: 600; }
.rt-chg.down { color: var(--neg); font-weight: 600; }
.rt-chg.flat { color: var(--ink-3); }
.rtable tbody tr.is-winner td { background: rgba(180,14,30,.035); }

/* ---------- Footer ---------- */
.foot {
    background: var(--bg-deep);
    color: #aeb6c2;
    padding: 56px 0;
}
.foot__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
.foot__brand {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 20px;
    color: #fff;
    margin: 0 0 8px;
}
.foot__note { font-size: 13px; margin: 0; color: #8b94a3; }
.foot__label {
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7c8696;
    margin: 0 0 8px;
    font-weight: 700;
}
.foot__src p { margin: 0 0 6px; font-size: 13.5px; }
.foot__disclaimer { color: #79828f; margin-top: 14px; max-width: 52ch; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .topnav { display: none; }
    .hero { padding: 52px 0 44px; }
    .hero__stats { grid-template-columns: repeat(2, 1fr); }
    .coalitions { grid-template-columns: 1fr; }
    .senat-grid { grid-template-columns: 1fr; }
    .bm-name { font-size: 32px; }
    .insight-row { grid-template-columns: repeat(2, 1fr); }
    .foot__grid { grid-template-columns: 1fr; }
    .barrow { grid-template-columns: 52px 1fr 92px; gap: 10px; }
    .barrow__meta { flex-direction: column; gap: 0; align-items: flex-end; }
    .barrow__pct { font-size: 16px; }
    .swingrow { grid-template-columns: 62px 1fr 54px; gap: 10px; }
    .chart-card { padding: 22px 16px; }
    .rtable { font-size: 13px; }
    .rtable thead th, .rtable tbody td { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto; }
    .reveal, .seat { opacity: 1; transform: none; }
}
