/* AllePeilingen.com — modern & licht (approved design option B).
   White cards on #f7f8fa, red round logo accent, system font stack.
   Hand-written, no framework. Chart + ad containers have FIXED heights (CLS). */

:root {
    --bg: #f7f8fa;
    --card: #ffffff;
    --ink: #1c1e21;
    --muted: #6b7280;
    --border: #e2e4e8;
    --accent: #d22222;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    --maxw: 1080px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
}

a { color: inherit; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- header / nav ---------- */
.site-header {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
}
.site-header__logo {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 700; font-size: 1.05rem; text-decoration: none; white-space: nowrap;
}
.site-header__logo::before {
    content: ""; width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); flex: none;
}
.site-header__logo span { color: var(--muted); font-weight: 400; }
.site-header__nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-header__nav a {
    text-decoration: none; color: var(--muted); font-size: 0.95rem;
    padding: 0.35rem 0.7rem; border-radius: 999px;
}
.site-header__nav a:hover { color: var(--ink); background: var(--bg); }
.site-header__nav a[aria-current="page"] { color: var(--ink); background: var(--bg); font-weight: 600; }
.site-freshness { margin-left: auto; font-size: 0.8rem; color: var(--muted); text-align: right; white-space: nowrap; }

/* Owner request: the breadcrumb nav hugged the window's left edge (no
   container at all) -- same max-width + horizontal padding as main/the
   header/footer's own nav, so it aligns with everything below it. */
.breadcrumbs { max-width: var(--maxw); margin: 0 auto; padding: 0.75rem 1.25rem 0; font-size: 0.85rem; color: var(--muted); }

main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
h1 { font-size: 1.55rem; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
main > p { color: var(--muted); max-width: 62ch; }

/* ---------- cards & charts ---------- */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.25rem; margin: 1rem 0;
}
.chart { height: 420px; margin: 1rem 0; }
.card .chart { margin: 0.25rem 0; }
.chart--loading { display: grid; place-items: center; color: var(--muted); }
/* Plan 7 Task 7 fix: text now set per-country by charts.js's hydrate()
   (data-loading-label attribute) -- was a hardcoded Dutch literal here,
   regardless of country. nl unaffected (same text, just JS-sourced now). */
.chart--loading::after { content: attr(data-loading-label); }
.chart--error { display: grid; place-items: center; color: var(--muted); font-size: 0.9rem; }
.chart-note { color: var(--muted); font-size: 0.8rem; margin: 0.25rem 0 1rem; }

/* ---------- images (legacy news articles embed native-size images) ---------- */
img { max-width: 100%; height: auto; }

/* ---------- tables (SSR fallback + data views) ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--muted); font-size: 0.85rem; padding-bottom: 0.4rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
tbody tr:hover { background: var(--bg); }

/* ---------- seat cards ---------- */
.seat-cards td:first-child a {
    display: inline-flex; align-items: center; gap: 0.5rem;
    text-decoration: none; font-weight: 600;
}
.seat-cards td:first-child a::before {
    content: ""; width: 10px; height: 10px; border-radius: 3px;
    background: var(--party-color, var(--muted)); flex: none;
}
.delta--plus { color: #1a7f37; font-weight: 600; }
.delta--min { color: #b3261e; font-weight: 600; }
.delta--nul { color: var(--muted); }

/* ---------- small multiples ---------- */
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.multiple {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
}
.multiple h3 { margin: 0 0 0.25rem; font-size: 0.85rem; }
.multiple h3 a { text-decoration: none; }
.multiple .mini { height: 150px; }

/* ---------- feed ---------- */
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.6rem 0.9rem; margin: 0.5rem 0; font-size: 0.92rem;
}
.feed li strong { color: var(--ink); margin-right: 0.4rem; }
/* Feed posts (Bluesky WINST/VERLIES/GELIJK blocks) keep their real newlines: render them as line breaks instead of collapsing to one line (owner 2026-07-12). Text stays HTML-escaped; no <br> injected. */
.feed li span { white-space: pre-line; }
.feed li time { color: var(--muted); font-size: 0.8rem; margin-left: 0.4rem; }
.feed li a { font-size: 0.85rem; margin-left: 0.5rem; }

/* Header row: heading + Follow/Share buttons, right-aligned next to it
   (owner request: more prominent buttons). Wraps on narrow screens instead
   of squeezing/overflowing (no fixed widths anywhere below). When there is
   no feed section at all (uk / a subject page with zero related rows,
   Plan 7 D6) `.feed__links` renders standalone -- its own margin (matching
   an `h2`'s) stands in for the header row it would otherwise sit in. */
.feed__header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0.75rem; }
.feed__header h2 { margin: 0; }
.feed__header .feed__links { margin: 0; }
.feed__links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 2rem 0 0.75rem; }

/* ---------- buttons (Follow/Share on Bluesky, owner request) ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 0.9rem; border-radius: 999px;
    font-size: 0.9rem; font-weight: 600; line-height: 1.2;
    text-decoration: none; white-space: nowrap; border: 1px solid transparent;
}
.btn__icon { width: 16px; height: 16px; flex: none; fill: currentColor; }
/* Bluesky brand blue (#0085ff), not the site accent -- this button is a
   platform-branded follow action, distinct from the site's own red accent. */
.btn--bsky { background: #0085ff; color: #fff; }
.btn--bsky:hover { background: #0072d6; color: #fff; }
.btn--outline { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--outline:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- listing (index) pages ---------- */
.listing { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; padding: 0; list-style: none; }
.listing li { margin: 0; }
.listing a {
    display: block; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.7rem 1rem; text-decoration: none; font-weight: 600;
}
.listing a small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; }

/* ---------- ads: reserved heights, never inside chart cards (CLS) ---------- */
.ad-slot { display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.ad-slot--leaderboard { min-height: 100px; margin: 0.75rem auto; max-width: var(--maxw); }
.ad-slot--incontent { min-height: 250px; margin: 1.5rem 0; }

/* AdSense activation bug fix (verified live: console TagError "adsbygoogle
   .push() error: No slot size for availableWidth=0"): .ad-slot is a
   `place-items: center` grid, which sizes its items to CONTENT width -- and
   a not-yet-filled <ins> has no content, so it measured 0px wide when the
   loader processed our per-ins push. Google's responsive sizer then aborts
   the fill entirely: no iframe, data-ad-status never set, the slot stays a
   permanently empty reserved box. An explicit width makes the <ins> span
   the container (the standard responsive-unit requirement); vertical
   centering of a filled ad is unaffected. */
.ad-slot > ins.adsbygoogle { width: 100%; }

/* Owner request: an unfilled AdSense slot (data-ad-status="unfilled", set by
   Google's own script once it decides not to fill the impression) left the
   FULL reserved min-height standing as a big empty block above content --
   the CLS protection only needs to hold for a slot that actually fills.
   :has() (universal in evergreen 2026 browsers) collapses the whole
   container; the plain-selector rule right below is the no-:has() fallback
   -- it can only hide the <ins> itself (not its wrapping .ad-slot), so older
   engines still reserve the box but at least never show broken ad chrome. */
.ad-slot:has(> ins[data-ad-status="unfilled"]) { display: none; }
.ad-slot > ins[data-ad-status="unfilled"] { display: none; }

/* ---------- ad-injection guards ----------
   AdSense Auto ads can insert an <ins class="adsbygoogle"> (or a
   google_ads_iframe-hosting div) almost anywhere in the DOM, including as a
   direct child of a CSS grid or between unrelated page sections -- these
   guards CONTAIN an unexpected injection so it can't break a layout it was
   never designed into. Scoped to DIRECT children only: our own reserved
   View::adSlot() markup always nests its <ins> one level inside a wrapping
   .ad-slot div, so it is a grandchild here, never matched -- these rules
   never touch it. */
.multiples > ins.adsbygoogle,
.multiples > div[id^="google_ads"] {
    grid-column: 1 / -1; display: block; min-height: 250px; overflow: hidden;
}
main > ins.adsbygoogle,
main > div[id^="google_ads"] {
    display: block; overflow: hidden;
}

/* Round 2 (owner request): the two rules above only ever catch a DIRECT
   child of .multiples/main -- Auto ads can inject an <ins class="adsbygoogle">
   at ANY depth, anywhere in the DOM. This is the general catch-net: every
   such <ins> that is NOT one of our own reserved View::adSlot() units (always
   nested inside a wrapping .ad-slot div, so `:not(.ad-slot *)` excludes it)
   gets contained -- block layout, capped width, clipped overflow, sane
   margins. Deliberately NO min-height here (unlike .multiples's 250px above):
   that reservation is only safe where an Auto ad is KNOWN to reliably fill at
   that size; reserving space everywhere for an ad that may never render would
   itself cause the empty-gap CLS this guard exists to prevent. */
ins.adsbygoogle:not(.ad-slot *) {
    display: block; max-width: 100%; overflow: hidden; margin: 1rem auto;
}

/* Google-injected ads INSIDE a chart or mini container would corrupt the
   ECharts canvas/SVG render (owner request) -- these are hidden outright
   rather than contained. More specific than the catch-net rule above by
   SOURCE ORDER (equal selector specificity), so this wins for anything
   nested in .chart/.mini. */
.chart ins.adsbygoogle,
.mini ins.adsbygoogle {
    display: none;
}

/* ---------- toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120%);
    background: var(--ink); color: #fff; border-radius: 999px;
    padding: 0.6rem 1.2rem; font-size: 0.92rem; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transition: transform 0.25s ease; z-index: 50;
}
.toast--visible { transform: translateX(-50%) translateY(0); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.site-footer > p { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem; }
.site-footer nav { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 1.25rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.site-footer nav a { color: var(--muted); text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
    /* Logo above a single scrollable nav row (no hamburger): stacking gives the
       nav the full width; nowrap + overflow-x keeps the header ~2 rows tall
       instead of ~4 wrapped rows eating a third of the viewport. */
    .site-header { padding: 0.5rem 0.9rem; gap: 0.35rem; flex-direction: column; align-items: stretch; }
    .site-header__nav {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .site-header__nav::-webkit-scrollbar { display: none; }
    .site-header__nav a { white-space: nowrap; flex: none; }
    .site-freshness { display: none; }
    main { padding: 1rem 0.9rem 2.5rem; }
    .chart { height: 320px; }
    .ad-slot--leaderboard { min-height: 60px; }
    th, td { padding: 0.4rem 0.45rem; font-size: 0.9rem; }
}

/* Landing tweaks T1: the first chart on the landing page is half the
   viewport tall on every breakpoint -- placed after the 720px media query
   above (equal specificity to both `.chart` rules; later source order wins)
   so it overrides the mobile 320px height too, not just the 420px desktop
   default. Other `.chart` heights are unchanged. */
.chart--hero { height: 50vh; min-height: 280px; }

@media print {
    .site-header, .site-footer, .feed, .ad-slot, .toast { display: none; }
}
