/*
 * Meningsmålingene (malinger.html og maling.html). Bygger på statistikk.css:
 * toppen, kortene, nøkkeltallene og tabellene er de samme. Her ligger bare det
 * som er særegent for målingene: stolpene i partifarger, flertallslinjen og
 * diagrammene. Diagrammene tegnes på serveren som SVG.
 */

.ml-hode { padding-bottom: 30px; }
.ml-kilde { margin: 14px 0 0; font-size: 0.9rem; line-height: 1.5; color: rgba(255, 255, 255, 0.75); }
.ml-kilde a { color: #93c5fd; font-weight: 600; text-decoration: none; }
.ml-kilde a:hover { text-decoration: underline; }

.ml-parti { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--primary); white-space: nowrap; }
.ml-parti img { width: 20px; height: 20px; object-fit: contain; border-radius: 4px; }
.ml-prikk { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ── Snittet nå: stolper i partifarger ──────────────────────────── */

.ml-snitt td { padding-top: 9px; padding-bottom: 9px; }
.ml-stolpecelle { width: 42%; min-width: 140px; }
.ml-spor { position: relative; height: 14px; }
.ml-fyll {
    position: absolute; left: 0; top: 0; bottom: 0;
    border-radius: 0 4px 4px 0;
    background: var(--parti, var(--accent));
}
/* Valgresultatet 2025 som en tynn strek over stolpen. */
.ml-valgstrek {
    position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px;
    background: var(--primary); opacity: 0.6; border-radius: 1px;
}
/* Sperregrensen (4 %) som en stiplet linje gjennom alle stolpene. */
.ml-sperrestrek {
    position: absolute; top: -9px; bottom: -9px; width: 0; margin-left: -0.5px;
    border-left: 1px dashed #94a3b8;
}
.ml-endring { color: var(--primary-muted); }
.ml-under { color: var(--text-muted); font-size: 0.84rem; }
.ml-forklaring { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; font-size: 0.84rem; color: var(--text-muted); }
.ml-forklaring span { display: inline-flex; align-items: center; gap: 6px; }
.ml-forklaring i { display: inline-block; width: 2px; height: 12px; background: var(--primary); opacity: 0.6; }
.ml-forklaring i.ml-stiplet { width: 0; background: none; border-left: 1px dashed #64748b; opacity: 1; }

/* ── Flertall ───────────────────────────────────────────────────── */

.ml-flertall { padding: 4px 24px 20px; }
.ml-blokknavn { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.ml-blokknavn div:last-child { text-align: right; }
.ml-blokknavn strong { display: block; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; color: var(--primary); line-height: 1.1; }
.ml-blokknavn span { font-size: 0.88rem; color: var(--text-muted); }
.ml-salen { position: relative; display: flex; height: 34px; border-radius: 6px; overflow: hidden; background: #e2e8f0; }
.ml-salen span { display: block; height: 100%; background: var(--parti); box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.7); }
.ml-midtlinje { position: absolute; top: -6px; bottom: -6px; left: 50%; width: 2px; margin-left: -1px; background: var(--primary); }
.ml-flertall-tekst { margin: 12px 0 0; font-size: 0.92rem; line-height: 1.55; color: var(--primary-muted); }
.ml-salen-partier { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.84rem; color: var(--text-muted); }
.ml-salen-partier li { display: inline-flex; align-items: center; gap: 6px; }

/* ── Diagrammene ────────────────────────────────────────────────── */

.ml-diagram { padding: 0 16px 8px 8px; overflow-x: auto; }
.ml-diagram svg { display: block; width: 100%; min-width: 560px; height: auto; font-family: inherit; }
.ml-rutenett { stroke: #e2e8f0; stroke-width: 1; }
.ml-grunnlinje { stroke: #cbd5e1; stroke-width: 1; }
.ml-akse { fill: #64748b; font-size: 11px; }
.ml-linje { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ml-etikett { font-size: 12px; font-weight: 600; }
.ml-valgmerke { stroke: #94a3b8; stroke-dasharray: 3 3; }

.ml-smaa {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}
.ml-lite { background: var(--surface); padding: 14px 16px 10px; min-width: 0; }
.ml-lite-hode { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ml-lite-hode .ml-parti { font-size: 0.95rem; }
.ml-lite-tall { font-size: 1.15rem; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.ml-lite-under { margin: 0 0 4px; font-size: 0.8rem; color: var(--text-muted); }
.ml-lite svg { display: block; width: 100%; height: auto; }
.ml-lite .ml-akse { font-size: 10px; }
.ml-punkt { opacity: 0.35; }
.ml-lite .ml-linje { stroke-width: 2.2; }

/* ── Tabellene ──────────────────────────────────────────────────── */

.ml-malinger td, .ml-malinger th { padding-left: 8px; padding-right: 8px; }
.ml-malinger .ml-hvem { min-width: 170px; }
.ml-malinger .ml-hvem a { color: var(--primary); font-weight: 600; text-decoration: none; }
.ml-malinger .ml-hvem a:hover { color: var(--accent); text-decoration: underline; }
.ml-malinger .ml-hvem span { display: block; font-size: 0.84rem; color: var(--text-muted); }
.ml-malinger thead .ml-partikol { text-align: right; }
.ml-malinger thead .ml-partikol span { display: inline-block; border-bottom: 3px solid var(--parti, transparent); padding-bottom: 2px; }
.ml-dato { white-space: nowrap; color: var(--primary-muted); }
.ml-avvik-opp { background: #eff6ff; }
.ml-avvik-ned { background: #fff7ed; }
.ml-mer summary {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    font-size: 0.92rem; font-weight: 600; color: var(--accent);
    cursor: pointer;
}
.ml-mer summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ── Én måling ──────────────────────────────────────────────────── */

.ml-margin {
    position: absolute; top: 3px; bottom: 3px;
    background: var(--primary); opacity: 0.12; border-radius: 2px;
}
.ml-signifikant { font-weight: 600; color: var(--primary); }
.ml-artikler { margin: 0; padding: 0 24px 18px; list-style: none; }
.ml-artikler li { padding: 6px 0; font-size: 0.95rem; line-height: 1.5; }
.ml-artikler a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ml-artikler a:hover { text-decoration: underline; }
.ml-bla { display: flex; justify-content: space-between; gap: 16px; margin: 6px 0 0; font-size: 0.92rem; }
.ml-bla a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ml-bla a:hover { text-decoration: underline; }
.ml-bla small { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.84rem; }
.ml-bla .ml-eldre { text-align: right; margin-left: auto; }

@media (max-width: 900px) {
    .ml-smaa { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .ml-flertall { padding: 4px 14px 16px; }
    .ml-blokknavn strong { font-size: 1.3rem; }
    .ml-diagram { padding: 0 6px 6px 0; }
    .ml-smaa { grid-template-columns: minmax(0, 1fr); }
    .ml-lite { padding: 12px 14px 8px; }
    .ml-skjul-mobil { display: none; }
    .ml-stolpecelle { min-width: 90px; }
    .ml-mer summary { padding-left: 14px; padding-right: 14px; }
    .ml-artikler { padding: 0 14px 16px; }
}
