/* De analysepagina: de kaart met tijdlijn.
   Bouwt voort op site.css. Het blauw is de kleur van de lokale partijen. */

:root {
  --blauw: #1b4fa8;
  --blauw-donker: #123a80;
  --zee: #f4f4f4;
  --land: #e6e6e6;
}

/* ---------- Kaartverhaal ---------- */
.kaartverhaal { position: relative; display: flex; flex-direction: column; gap: 18px; padding: 28px 0 24px; border-top: 1px solid var(--inkt); border-bottom: 1px solid var(--inkt); }
.kv-kop { display: flex; flex-direction: column; gap: 10px; }
.kv-kop h2 { font-weight: 800; font-size: clamp(28px, 3.6vw, 46px); line-height: 1.08; letter-spacing: -.01em; }
.kv-kop p { max-width: 720px; font-size: 17px; line-height: 1.5; color: var(--grijs); }
.kv-melding { font-size: 17px; font-weight: 600; }

/* Twee kaarten naast elkaar */
.kv-kaarten { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 8px 28px; }
.kv-kaart { display: grid; grid-row: span 2; grid-template-rows: subgrid; min-width: 0; }
.kv-cijfer { display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-end; gap: 2px 14px; min-height: 62px; }
.kv-cijfer .naam { font-weight: 800; font-size: 20px; }
.kv-cijfer strong { font-weight: 800; font-size: clamp(42px, 4.8vw, 64px); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--rood); }
.kv-kaart.lokaal .kv-cijfer strong { color: var(--blauw); }
.kv-cijfer .bij { font-size: 14px; line-height: 1.35; color: var(--grijs); }

.kv-doek { position: relative; aspect-ratio: 3 / 2; background: var(--zee); overflow: hidden; }
.kv-doek svg { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.kv-doek .nl path { fill: var(--land); stroke: var(--zee); stroke-width: 1; vector-effect: non-scaling-stroke; }
.kv-doek .onder { fill: #dcdcdc; }
.kv-laag path { stroke: rgba(26, 26, 26, .28); stroke-width: .6; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; }
.kv-laag path.onbekend { fill: #d9d9d9; }
.kv-laag path.streep { stroke: none; pointer-events: none; }
.kv-doek .provgrens { fill: none; stroke: var(--inkt); stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.kv-doek .mg-halo { fill: none; stroke: var(--wit); stroke-width: 5; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; opacity: .9; }
.kv-doek .mg { fill: none; stroke: var(--inkt); stroke-width: 2.4; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.kv-doek .wijzer { fill: none; stroke: var(--inkt); stroke-width: 2.4; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.kv-doek text { font-family: var(--kop); font-weight: 600; fill: var(--inkt); stroke: var(--wit); stroke-width: calc(var(--k, 5) * 3.5px); stroke-linejoin: round; paint-order: stroke; text-anchor: middle; pointer-events: none; transition: opacity .5s; }
.kv-doek text.prov { font-size: calc(var(--k, 5) * 11px); letter-spacing: .1em; text-transform: uppercase; }
.kv-doek text.mgnaam { font-size: calc(var(--k, 5) * 13px); font-weight: 800; }
.kv-doek.ver text { opacity: 0; }

/* Kleurschaal in de hoek van de kaart */
.kv-schaal { position: absolute; z-index: 1; left: 10px; bottom: 10px; display: grid; grid-template-columns: 1fr 1fr 1fr auto; width: 184px; padding: 24px 8px 6px; background: rgba(255, 255, 255, .88); font-size: 12px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--inkt); pointer-events: none; }
.kv-schaal i { position: absolute; left: 8px; right: 8px; top: 8px; height: 11px; outline: 1px solid rgba(26, 26, 26, .35); }
.kv-schaal span:last-child { text-align: right; }
.kv-kaart.pvda .kv-schaal i { background: linear-gradient(90deg, #fff4f1, #fdd9d1 16.6%, #f9ad9f 33.3%, #f07765 50%, #e23c2b 66.6%, #b62215 83.3%, #78140a); }
.kv-kaart.lokaal .kv-schaal i { background: linear-gradient(90deg, #f3f7fd, #d6e3f7 16.6%, #a9c4ee 33.3%, #6e9be0 50%, #3a72cc 66.6%, #1b4fa8 83.3%, #0d2f73); }

/* Legenda */
.kv-legenda { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; font-size: 14px; line-height: 1.4; color: var(--grijs); }
.kv-legenda p { display: flex; align-items: center; gap: 7px; }
.vakje { flex: none; display: inline-block; width: 16px; height: 16px; }
.vakje.schaal-rood { background: linear-gradient(90deg, #fdd9d1, #e23c2b, #78140a); }
.vakje.schaal-blauw { background: linear-gradient(90deg, #d6e3f7, #3a72cc, #0d2f73); }
.vakje.streep { background: repeating-linear-gradient(45deg, #e23c2b 0 3px, #f6beb5 3px 6px); }
.vakje.geen { background: repeating-linear-gradient(-45deg, #c6c6c6 0 2px, #ededed 2px 6px); }
.vakje.onbekend { background: #d9d9d9; }
.vakje.rand { border: 2.4px solid var(--inkt); }

/* Tabs voor een smal scherm */
.kv-tabs { display: none; gap: 10px; }
.kv-tabs button { flex: 1; min-height: 48px; padding: 8px 10px; border: 0; border-bottom: 4px solid var(--lijn); background: none; font-weight: 800; font-size: 17px; }
.kv-tabs button[aria-pressed="true"][data-tab="pvda"] { border-bottom-color: var(--rood); color: var(--rood-donker); }
.kv-tabs button[aria-pressed="true"][data-tab="lokaal"] { border-bottom-color: var(--blauw); color: var(--blauw-donker); }

/* Tijdlijn */
.kv-tijdlijn { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 36px; }
.kv-bediening { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; }
.kv-jaar { display: flex; flex-direction: column; }
.kv-jaar-label { font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.kv-jaar strong { font-weight: 800; font-size: clamp(56px, 6.4vw, 84px); line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kv-knoppen { display: flex; gap: 8px; }
.kv-knoppen button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 2px solid var(--inkt); background: var(--wit); font-weight: 800; font-size: 17px; }
.kv-knoppen button:hover { background: var(--vlak); }
.kv-knoppen button:disabled { border-color: var(--lijn); color: #aaa; cursor: default; background: var(--wit); }
.kv-knoppen svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.kv-speel { min-width: 150px; background: var(--inkt) !important; color: var(--wit); }
.kv-speel:hover { background: #000 !important; }
.kv-speel svg { fill: currentColor; stroke: none; }
.kv-speel .pauze-icoon { display: none; }
.kv-speel.speelt .speel-icoon { display: none; }
.kv-speel.speelt .pauze-icoon { display: inline; }
.kv-stapknop { width: 48px; padding: 0 !important; }

.kv-grafiek { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kv-lijnen { position: relative; height: 122px; cursor: pointer; }
.kv-lijnen svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kv-lijnen .raster { stroke: var(--lijn); stroke-width: 1; }
.kv-lijnen .rastertekst { font-family: var(--kop); font-size: 12px; fill: #777; }
.kv-lijnen .stuk { fill: none; stroke-width: 3; stroke-linecap: round; opacity: .22; transition: opacity .6s; }
.kv-lijnen .stuk.aan { opacity: 1; }
.kv-lijnen .punt { stroke: var(--wit); stroke-width: 2; opacity: .3; transition: opacity .6s; }
.kv-lijnen .punt.aan { opacity: 1; }
.kv-lijnen .punt.hol { fill: var(--wit) !important; stroke-width: 2.5; }
.kv-lijnen .pvda { stroke: var(--rood); }
.kv-lijnen .lokaal { stroke: var(--blauw); }
.kv-lijnen .punt.pvda { fill: var(--rood); stroke: var(--wit); }
.kv-lijnen .punt.lokaal { fill: var(--blauw); stroke: var(--wit); }
.kv-lijnen .punt.hol.lokaal { stroke: var(--blauw); }
.kv-lijnen .stuk.gestippeld { stroke-dasharray: 2 7; }
.kv-lijnen .nu-lijn { stroke: var(--inkt); stroke-width: 1.5; }
.kv-lijnen .nu { transition: transform .7s cubic-bezier(.3, .7, .2, 1); }
.kv-lijnen .nu-punt { stroke: var(--wit); stroke-width: 2.5; }
.kv-lijnen .nu-tekst { font-family: var(--kop); font-weight: 800; font-size: 15px; paint-order: stroke; stroke: var(--wit); stroke-width: 4px; stroke-linejoin: round; font-variant-numeric: tabular-nums; }
.kv-lijnen .reeksnaam { font-family: var(--kop); font-weight: 800; font-size: 13px; paint-order: stroke; stroke: var(--wit); stroke-width: 4px; stroke-linejoin: round; }

.kv-jaren { display: grid; grid-template-columns: repeat(12, 1fr); }
.kv-jaren button { min-height: 44px; padding: 6px 0; border: 0; border-top: 4px solid var(--lijn); background: none; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--grijs); }
.kv-jaren button:hover { color: var(--inkt); border-top-color: #bbb; }
.kv-jaren button[aria-pressed="true"] { border-top-color: var(--inkt); color: var(--inkt); font-weight: 800; }
.kv-jaren .kort { display: none; }

/* Toelichting per stap */
.kv-stap { max-width: 820px; min-height: 3.1em; font-family: var(--lees); font-size: 20px; line-height: 1.5; transition: opacity .35s; }
.kv-stap.wissel { opacity: 0; }

/* Keuzes */
.kv-keuzes { display: flex; flex-wrap: wrap; gap: 14px 40px; }
.kv-keuze { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 15px; font-weight: 600; }
.kv-segment { display: flex; flex-wrap: wrap; gap: 6px; }
.kv-segment button { min-height: 44px; padding: 6px 14px; border: 2px solid var(--lijn); background: var(--wit); font-weight: 600; font-size: 15px; }
.kv-segment button:hover { border-color: #bbb; }
.kv-segment button[aria-pressed="true"] { border-color: var(--inkt); background: var(--inkt); color: var(--wit); }

/* Tabel en uitleg */
.kaartverhaal details { border-top: 1px solid var(--lijn); padding-top: 14px; }
.kaartverhaal summary { width: fit-content; padding: 6px 0; font-weight: 600; font-size: 17px; color: var(--rood-donker); cursor: pointer; }
.kv-tabel-rol { max-height: 420px; margin-top: 10px; overflow: auto; }
.kv-tabel table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.kv-tabel caption { padding: 4px 0 10px; text-align: left; font-weight: 800; font-size: 17px; }
.kv-tabel th, .kv-tabel td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--lijn); text-align: left; vertical-align: top; }
.kv-tabel thead th { position: sticky; top: 0; background: var(--wit); border-bottom: 2px solid var(--inkt); font-weight: 800; }
.kv-tabel td.getal, .kv-tabel th.getal { text-align: right; }
.kv-tabel tbody th { font-weight: 600; }
.kv-uitleg .lees { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; max-width: 720px; font-size: 17px; }
.kv-uitleg .bron { font-family: var(--kop); }

/* Zwevend kaartje bij een gemeente */
.kv-tip { position: absolute; z-index: 5; left: 0; top: 0; width: max-content; max-width: min(300px, calc(100% - 16px)); padding: 12px 14px; background: var(--wit); border: 2px solid var(--inkt); box-shadow: 4px 4px 0 rgba(26, 26, 26, .18); font-size: 14px; line-height: 1.4; pointer-events: none; }
.kv-tip[hidden] { display: none; }
.kv-tip .tip-naam { display: block; font-weight: 800; font-size: 17px; line-height: 1.2; }
.kv-tip .tip-jaar { display: block; margin-bottom: 8px; color: var(--grijs); }
.kv-tip .tip-rij { display: grid; grid-template-columns: 10px 1fr; gap: 0 8px; padding-top: 6px; border-top: 1px solid var(--lijn); margin-top: 6px; }
.kv-tip .tip-rij::before { content: ""; width: 10px; height: 10px; margin-top: 4px; background: var(--rood); }
.kv-tip .tip-rij.lokaal::before { background: var(--blauw); }
.kv-tip .tip-rij b { font-weight: 800; font-size: 15px; }
.kv-tip .tip-rij span { grid-column: 2; color: var(--grijs); }

@media (max-width: 760px) {
  .kv-tabs { display: flex; }
  .kv-kaarten { grid-template-columns: 1fr; }
  .kv-kaart { grid-row: auto; grid-template-rows: auto auto; gap: 8px; }
  .kv-kaarten[data-toon="pvda"] .kv-kaart.lokaal,
  .kv-kaarten[data-toon="lokaal"] .kv-kaart.pvda { display: none; }
  .kv-cijfer { min-height: 56px; }
  .kv-schaal { width: 150px; left: 6px; bottom: 6px; }
  .kv-bediening { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }
  .kv-lijnen { height: 110px; }
  .kv-jaren button { font-size: 13px; }
  .kv-jaren .lang { display: none; }
  .kv-jaren .kort { display: inline; }
  .kv-stap { font-size: 18px; min-height: 6em; }
  .kv-speel { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kv-lijnen .nu, .kv-lijnen .stuk, .kv-lijnen .punt, .kv-stap, .kv-doek text { transition: none; }
}
