/* Kannatuskatsaukset (/kannatuskatsaus/), pages generated by scripts/kannatuskatsaus.py.
   Layout only; tokens come from accessibility-theme.css. Party colours arrive per row as
   --cd (dark theme) and --cl (light theme) from js/party-colors.js. */
body[data-page="katsaus"] { margin:0; min-height:100vh; display:flex; flex-direction:column; background:var(--pk-bg-dark); color:var(--pk-text-dark); font-family:Roboto,sans-serif; --kk-muted:var(--pk-text-muted-dark); --kk-border:#373737; --kk-surface:#1b1b1b; --kk-track:#262626; }
html[data-theme="light"] body[data-page="katsaus"] { background:var(--pk-bg-light); color:var(--pk-text-light); --kk-muted:var(--pk-text-muted-light); --kk-border:#d4d4d4; --kk-surface:#fff; --kk-track:#e6e6e6; }
.katsaus [style*="--cd"] { --c:var(--cd); }
html[data-theme="light"] .katsaus [style*="--cl"] { --c:var(--cl); }
.katsaus { flex:1; padding:10px 20px 48px; }
.katsaus a { color:inherit; text-underline-offset:3px; }
.katsaus :focus-visible { outline:2px solid currentColor; outline-offset:3px; }
.kk-article, .katsaus > .kk-header, .kk-archive { max-width:72ch; margin-left:auto; margin-right:auto; }
.kk-header { margin:14px auto 8px; }
.kk-kicker { margin:0 0 10px; font-size:.8rem; color:var(--kk-muted); letter-spacing:.02em; }
.kk-kicker a { text-decoration:none; }
.kk-kicker a:hover { text-decoration:underline; }
.kk-header h1 { margin:0 0 12px; font-size:var(--pk-page-title-size); line-height:1.08; letter-spacing:-.015em; }
.kk-lead { margin:0; font-size:1.08rem; line-height:1.6; }
.kk-draft { margin:14px 0 0; padding:8px 12px; border:1px dashed var(--kk-border); border-radius:6px; font-size:.85rem; color:var(--kk-muted); }
.kk-section { margin-top:28px; padding-top:20px; border-top:1px solid var(--kk-border); }
.kk-section h2 { margin:0 0 10px; font-size:1.2rem; }
.kk-section h3 { margin:18px 0 6px; font-size:.95rem; }
.kk-section p, .kk-section li { line-height:1.65; }
.kk-note { color:var(--kk-muted); font-size:.8rem; line-height:1.55; }

/* Poll bars: name, bar with the previous poll as a tick, value, change. */
.kk-figure { margin:20px 0 0; padding:16px 16px 6px; background:var(--kk-surface); border-radius:var(--pk-card-radius); }
.kk-figure-title { font-weight:700; font-size:.9rem; margin-bottom:12px; }
.kk-bars { list-style:none; margin:0; padding:0; display:grid; gap:7px; }
.kk-bars li { display:grid; grid-template-columns:minmax(0,10.5em) minmax(0,1fr) 3em 3.4em; gap:10px; align-items:center; font-size:.85rem; line-height:1.2; }
.kk-short { display:none; }
.kk-track { position:relative; height:18px; background:var(--kk-track); border-radius:2px; }
.kk-track b { display:block; height:100%; background:var(--c); border-radius:2px 0 0 2px; }
.kk-prev { position:absolute; top:-3px; bottom:-3px; width:2px; margin-left:-1px; background:currentColor; opacity:.75; }
.kk-value { text-align:right; font-weight:700; font-variant-numeric:tabular-nums; }
.kk-change { text-align:right; font-variant-numeric:tabular-nums; color:var(--kk-muted); }

.kk-figure + p, p + .kk-figure { margin-top:18px; }

/* Change chart: bars either side of zero over the sampling-margin band. */
.kk-changes li { grid-template-columns:minmax(0,10.5em) minmax(0,1fr) 3.2em; }
.kk-diverge { background:none; }
.kk-diverge::after { content:""; position:absolute; left:50%; top:-3px; bottom:-3px; width:1px; background:currentColor; opacity:.55; }
.kk-diverge b { position:absolute; top:0; height:100%; border-radius:0; }
.kk-band { position:absolute; top:-2px; bottom:-2px; background:var(--kk-track); opacity:.75; border-radius:2px; }
.kk-axis { display:flex; justify-content:space-between; margin:6px 0 0; font-size:.72rem; color:var(--kk-muted); font-variant-numeric:tabular-nums; }
/* Offsets in rem: the rows are .85rem, the axis text smaller, so em would not line up. */
.kk-changes + .kk-axis { margin-left:calc(8.925rem + 10px); margin-right:calc(2.72rem + 10px); }

/* Forecast ranges. */
.kk-ranges li { grid-template-columns:minmax(0,10.5em) minmax(0,1fr) 3em; }
.kk-range-track { background:none; border-bottom:1px solid var(--kk-border); border-radius:0; }
.kk-range-track b { position:absolute; top:3px; bottom:3px; background:var(--c); opacity:.38; border-radius:2px; }
.kk-median { position:absolute; top:-1px; bottom:-1px; width:3px; margin-left:-1.5px; background:var(--c); border-radius:1px; }
.kk-before { position:absolute; top:-4px; bottom:-4px; width:1px; background:currentColor; opacity:.6; }
.kk-election { position:absolute; top:50%; width:8px; height:8px; margin:-4px 0 0 -4px; transform:rotate(45deg); background:var(--kk-muted); opacity:.85; }
.kk-axis-scale { justify-content:flex-start; }
.kk-axis-pad { flex:0 0 calc(8.925rem + 10px); }
.kk-axis-pad2 { flex:0 0 calc(2.55rem + 10px); }
.kk-axis-ticks { position:relative; flex:1; height:1.2em; }
.kk-axis-ticks span { position:absolute; transform:translateX(-50%); }

/* Line charts (trend, government). Party colours via --c; the blocs in neutral greys. */
.kk-chart { display:block; width:100%; height:auto; overflow:visible; }
.kk-chart text { font-family:Roboto,sans-serif; fill:currentColor; }
.kk-tick { font-size:12px; text-anchor:end; fill:var(--kk-muted) !important; font-variant-numeric:tabular-nums; }
.kk-tick-x { text-anchor:middle; }
.kk-grid { stroke:var(--kk-border); stroke-width:1; }
.kk-line { fill:none; stroke:var(--c); stroke-width:3; stroke-linejoin:round; stroke-linecap:round; }
.kk-dot-own { fill:var(--c); }
.kk-dot-other { fill:var(--c); opacity:.3; }
.kk-dot-now { fill:var(--c); stroke:currentColor; stroke-width:2; }
.kk-end-name { font-size:14px; font-weight:700; fill:var(--c) !important; }
.kk-end-value { font-size:14px; font-variant-numeric:tabular-nums; }
.kk-bloc-name { font-size:14px; font-weight:700; }
.kk-chart .kk-short { display:none; }
.kk-gov, .kk-opp { fill:none; stroke-width:3; stroke-linejoin:round; stroke-linecap:round; }
.kk-gov { stroke:currentColor; }
.kk-opp { stroke:var(--kk-muted); stroke-dasharray:7 5; }
.kk-gov-dot { fill:currentColor; }
.kk-opp-dot { fill:var(--kk-muted); }
.kk-chart .kk-opp-text { fill:var(--kk-muted); }

.kk-details { margin-top:14px; }
.kk-details summary { cursor:pointer; font-size:.85rem; color:var(--kk-muted); }

/* Trend and forecast table. */
.kk-table-wrap { overflow-x:auto; margin-top:16px; }
.kk-table { width:100%; border-collapse:collapse; font-size:.85rem; font-variant-numeric:tabular-nums; }
.kk-table caption { text-align:left; font-weight:700; padding-bottom:8px; }
.kk-table th, .kk-table td { padding:7px 8px; border-bottom:1px solid var(--kk-border); text-align:right; white-space:nowrap; }
.kk-table thead th { font-weight:500; color:var(--kk-muted); font-size:.75rem; vertical-align:bottom; white-space:normal; }
.kk-table th[scope="row"], .kk-table thead th:first-child { text-align:left; }
.kk-swatch { display:inline-block; width:10px; height:10px; border-radius:2px; background:var(--c); margin-right:8px; }
.kk-range { color:var(--kk-muted); }

/* Events around the fieldwork. */
.kk-events { list-style:none; margin:14px 0 0; padding:0; display:grid; gap:14px; }
.kk-events li { padding-left:12px; border-left:2px solid var(--kk-border); }
.kk-events time { font-variant-numeric:tabular-nums; font-size:.8rem; color:var(--kk-muted); }
.kk-timing { font-size:.75rem; color:var(--kk-muted); margin:0 8px 0 4px; }
.kk-timing::before { content:"· "; }
.kk-events a { display:block; font-weight:700; margin-top:2px; }
.kk-events p { margin:4px 0 0; font-size:.9rem; }
.kk-method ul { padding-left:1.1em; font-size:.9rem; }

/* Archive. */
.kk-archive { list-style:none; padding:0; margin-top:24px; }
.kk-archive li { padding:16px 0; border-top:1px solid var(--kk-border); }
.kk-archive time { font-size:.8rem; color:var(--kk-muted); }
.kk-archive a { display:block; font-size:1.15rem; font-weight:700; margin:4px 0 6px; }
.kk-archive p { margin:0; line-height:1.55; color:var(--kk-muted); }

@media (max-width: 600px) {
  .katsaus { padding:6px 14px 40px; }
  .kk-figure { padding:12px 10px 4px; }
  .kk-bars li { grid-template-columns:3.2em minmax(0,1fr) 2.6em 3em; gap:7px; font-size:.8rem; }
  .kk-long { display:none; }
  /* The charts are drawn 640 wide; on a phone that is about half size, so the text doubles. */
  .kk-chart .kk-long { display:none; }
  .kk-chart .kk-short { display:inline; }
  .kk-chart .kk-tick { font-size:20px; }
  .kk-end-name, .kk-end-value, .kk-bloc-name { font-size:24px; }
  .kk-changes li, .kk-ranges li { grid-template-columns:3.2em minmax(0,1fr) 3em; }
  .kk-changes + .kk-axis { margin-left:calc(2.56rem + 7px); margin-right:calc(2.4rem + 7px); }
  .kk-axis-pad { flex-basis:calc(2.56rem + 7px); }
  .kk-axis-pad2 { flex-basis:calc(2.4rem + 7px); }
  .kk-short { display:inline; }
}

/* pinna.html, the Bluesky bot's help page. */
.kk-pinna { display:block; width:96px; height:96px; margin:6px 0 14px 0; }
.pinna-examples { padding-left:1.1em; }
/* The way to Pinna: a clear, neutral button (no Bluesky blue, which would read as a party colour). */
.kk-article .pinna-bluesky, .pinna-bluesky { display:inline-flex; align-items:center; gap:12px; margin:20px 0 4px; padding:12px 18px 12px 16px; border-radius:12px; background:#ededed; color:#141414; text-decoration:none; transition:background-color 120ms ease, transform 120ms ease; }
.kk-article .pinna-bluesky:hover { background:#fff; color:#141414; }
.pinna-bluesky:active { transform:translateY(1px); }
.pinna-bluesky svg { flex:0 0 auto; }
.pinna-bluesky-text { display:flex; flex-direction:column; line-height:1.25; }
.pinna-bluesky-text b { font-size:1.02rem; font-weight:700; }
.pinna-bluesky-text span { font-size:.85rem; opacity:.7; }
.pinna-bluesky-arrow { margin-left:6px; font-size:1.2rem; transition:transform 120ms ease; }
.pinna-bluesky:hover .pinna-bluesky-arrow { transform:translateX(3px); }
.kk-article .pinna-bluesky-small { margin:4px 0 0; padding:8px 14px 8px 12px; gap:10px; border-radius:10px; }
.pinna-bluesky-small .pinna-bluesky-text b { font-size:.92rem; }
html[data-theme="light"] .kk-article .pinna-bluesky { background:#1d1d1d; color:#fff; }
html[data-theme="light"] .kk-article .pinna-bluesky:hover { background:#000; color:#fff; }
.pinna-examples q { quotes:"”" "”"; }
.kk-section q { quotes:"”" "”"; }
