/* Verdict colours: chosen so every pair stays apart for colour-blind readers (protan, deutan,
   tritan; CIEDE2000 >= 28 after simulation, Machado 2009): teal-green fine, light amber slight,
   deep crimson strong, separated by lightness as well as hue (checked with a colour-vision simulation, 2026-11-20). */
/* MEDUSA site: one stylesheet for every page. Light by default, dark when the system asks. */
/* Verdict colours: fine teal-green, slight amber, strong red, no reading grey. Checked for
   colour-blind separation (deutan/protan/tritan) against both surfaces; every verdict also
   carries a word, and on the map a size and ring, so colour never stands alone. */
:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --ink: #12202b;
  --muted: #5b6b78;
  --line: #dde3e8;
  --accent: #0b6e99;
  --fine: #0e7c86;
  --slight: #f2b705;
  --strong: #a3122a;
  --none: #8f9ba5;
  --slight-ink: #8a5a00;
  --strong-ink: #a3122a;
  --slight-wash: rgba(242, 183, 5, 0.14);
  --strong-wash: rgba(163, 18, 42, 0.08);
  --band: rgba(11, 110, 153, 0.13);
  --qr: #aa3377;
  --shadow: 0 1px 2px rgba(16, 32, 43, 0.06), 0 4px 16px rgba(16, 32, 43, 0.06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151b; --panel: #16212a; --ink: #e6edf2; --muted: #9aabb8; --line: #26343f;
    --accent: #5cc3ea; --fine: #3aa8b2; --slight: #f2b705; --strong: #c8344a; --none: #6b7883;
    --slight-ink: #f0b54a; --strong-ink: #ff8a80;
    --slight-wash: rgba(242, 183, 5, 0.14); --strong-wash: rgba(200, 52, 74, 0.16);
    --band: rgba(92, 195, 234, 0.16); --qr: #e07ab8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151b; --panel: #16212a; --ink: #e6edf2; --muted: #9aabb8; --line: #26343f;
  --accent: #5cc3ea; --fine: #3aa8b2; --slight: #f2b705; --strong: #c8344a; --none: #6b7883;
  --slight-ink: #f0b54a; --strong-ink: #ff8a80;
  --slight-wash: rgba(242, 183, 5, 0.14); --strong-wash: rgba(200, 52, 74, 0.16);
  --band: rgba(92, 195, 234, 0.16); --qr: #e07ab8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
/* most readers sit at a desktop screen: charts and tables use a wider column there, while
   running text keeps a readable line length */
@media (min-width: 1500px) { .wrap { max-width: 1440px; } }
@media (min-width: 2200px) { .wrap { max-width: 1760px; } }
main p, main li { max-width: 95ch; }

/* top bar */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.04em; color: var(--ink); }
.brand img { width: 26px; height: 26px; }
.brand:hover { text-decoration: none; }
.crumbs { color: var(--muted); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.crumbs a { color: var(--muted); }
.spacer { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.badge { min-width: 0; flex: 0 1 auto; }   /* a long status (late, or in Finnish) shortens on a phone */
.badge .txt { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--none); flex: none; }
.dot.ok, .dot.fine { background: var(--fine); }
.dot.late { background: #e0a100; }
.dot.slight { background: var(--slight); box-shadow: inset 0 0 0 1px var(--slight-ink); }   /* a light amber needs a rim on white */
.dot.strong { background: var(--strong); }

/* cards and text */
main { padding: 24px 0 48px; }
h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* verdict banner */
.verdict { display: flex; gap: 14px; align-items: flex-start; }
.verdict .dot { width: 14px; height: 14px; margin-top: 6px; }
.verdict b { font-size: 18px; }
.verdict p { margin: 2px 0 0; color: var(--muted); }

/* chips and buttons */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.chip:focus-visible, .chart:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* stat tiles */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* on the narrowest phones a tile's label can take two lines: keep them before the data arrive */
@media (max-width: 380px) { .stat .k { min-height: 42px; } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat { padding: 12px; }
.readout { min-height: 22px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 6px; }
.readout b { color: var(--ink); font-weight: 600; }
main h1 { margin-top: 6px; }
.stat .k { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.links { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.links a { font-size: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px;
  display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.links a:hover { border-color: var(--accent); text-decoration: none; }

/* search */
.search { width: 100%; font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); }

/* chart */
.chart { width: 100%; min-height: 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
details summary { cursor: pointer; font-weight: 600; }
details p, details li { color: var(--muted); }
footer { color: var(--muted); font-size: 13px; padding: 24px 0 40px; border-top: 1px solid var(--line); }
footer a { color: var(--muted); text-decoration: underline; }
.skeleton { color: var(--muted); }
.error { color: var(--strong); }

@media (max-width: 640px) {
  .top .wrap { gap: 10px; }
  .crumbs { display: none; }
  .card { padding: 14px; }
  .chart { min-height: 300px; }
}

/* ---- Prototype 2026-11-20 (GUI plan) ---- */
.icon-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px;
  width: 34px; height: 34px; cursor: pointer; flex: none; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--accent); }
.dot.none-hollow { background: transparent; border: 2px solid var(--none); }
.verdict.slight { border-left: 4px solid var(--slight); background: linear-gradient(var(--slight-wash), var(--slight-wash)), var(--panel); }
.verdict.strong { border-left: 4px solid var(--strong); background: linear-gradient(var(--strong-wash), var(--strong-wash)), var(--panel); }
.verdict.fine { border-left: 4px solid var(--fine); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; flex: 1 1 auto; }

/* follow star */
.star { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
  padding: 4px 6px; border-radius: 8px; flex: none; }
.star[aria-pressed="true"] { color: var(--slight); }
.star:hover { background: var(--bg); }
.star:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 .star { font-size: 26px; vertical-align: 3px; }

/* rows: a table on a wide screen, stacked on a phone */
.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
.rows th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rows td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rows tr:last-child td { border-bottom: 0; }
.rows td.n, .rows th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .gauge a { font-weight: 600; }
.rows .gauge .sub2 { display: block; color: var(--muted); font-size: 13px; }
.rows tr.is-strong td:first-child { box-shadow: inset 3px 0 0 var(--strong); }
.rows tr.is-slight td:first-child { box-shadow: inset 3px 0 0 var(--slight); }
.vword { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.tag.new { border-color: var(--strong); color: var(--strong-ink); }
.tag.allday { border-color: var(--slight); color: var(--slight-ink); }
.tag.old { border-style: dashed; }
.rows tr.is-old td { opacity: 0.8; }
.meter { display: inline-block; width: 48px; height: 6px; border-radius: 3px; background: var(--line);
  vertical-align: middle; margin-left: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--slight); border-radius: 3px; }
.meter i.strong { background: var(--strong); }
.empty { color: var(--muted); padding: 10px 0; }
.count { color: var(--muted); font-weight: 400; font-size: 15px; }
.chips.small .chip { padding: 4px 10px; font-size: 13px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.tablewrap { overflow-x: auto; }
@media (max-width: 640px) {
  .rows thead { display: none; }
  .rows, .rows tbody { display: block; width: 100%; }
  .rows tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 0 10px 10px;
    border-bottom: 1px solid var(--line); }
  .rows tr:last-child { border-bottom: 0; }
  .rows td { display: block; border: 0; padding: 0; }
  .rows td:first-child { order: 0; }
  .rows td.gauge { order: 1; flex: 1 1 60%; min-width: 0; }
  .rows td.act { order: 2; margin-left: auto; }
  .rows td:not(.gauge):not(.act):not(:first-child) { order: 3; font-size: 13px; color: var(--muted); }
  .rows td.n { text-align: left; }
  .rows td[data-k]::before { content: attr(data-k) " "; }
  .rows td:empty { display: none; }
  .rows tr.is-strong td:first-child, .rows tr.is-slight td:first-child { box-shadow: none; }
  .rows tr.is-strong { box-shadow: inset 3px 0 0 var(--strong); }
  .rows tr.is-slight { box-shadow: inset 3px 0 0 var(--slight); }
  .rows .gauge .sub2 { font-size: 12px; }
}

/* the verdict of every step, as a strip under the hydrograph */
.ribbon { display: block; width: 100%; height: 14px; border-radius: 3px; margin-top: 4px; }
.subchart-title { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 2px; }
.subchart-title h3 { font-size: 15px; margin: 0; }
.nb { display: inline-flex; align-items: center; gap: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chart.small-chart { min-height: 180px; }
[hidden] { display: none !important; }

/* "New results are in": a page left open says so, at the bottom, without redrawing */
.newbar { position: fixed; left: 0; right: 0; bottom: 16px; margin: 0 auto; width: max-content; z-index: 1000;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: 8px 10px 8px 16px; display: flex; gap: 10px;
  align-items: center; font-size: 14px; max-width: calc(100vw - 32px); }

/* result lists on a phone: the name gets its own line, the details wrap under it */
@media (max-width: 560px) {
  .list li { flex-wrap: wrap; row-gap: 2px; }
  .list .name { flex: 1 1 calc(100% - 60px); white-space: normal; }
  .list .meta { flex: 1 1 100%; order: 3; white-space: normal; padding-left: 18px; }
}

a.stat { color: var(--ink); text-decoration: none; display: block; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }

.chip:disabled { opacity: .45; cursor: not-allowed; }

.shared-note { background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px;
  margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.tag.changed { border-color: var(--accent); color: var(--accent); }

/* space kept before the data arrive, so nothing below jumps (CLS) */
main > .sub.reserve { min-height: 48px; }
.every-bar.pending { visibility: hidden; }
#trend { min-height: 200px; }
/* Find your gauge on the landing page: on a desktop the results open over the page as a list
   under the field, so the countries below stay put */
.searchbox { position: relative; max-width: 560px; }
#results { margin-top: 6px; }
@media (min-width: 640px) {
  #results { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; max-height: 60vh; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 2px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
  #results:empty { display: none; }
  #results li:hover { background: var(--bg); }
}
/* station page: the verdict box fills to three or four lines of facts once the data arrive;
   landing page: the country card fills from a one-line placeholder */
#verdict { min-height: 207px; }
#countries > .skeleton { min-height: 194px; }
@media (max-width: 639px) {
  #verdict { min-height: 400px; }
  #countries > .skeleton { min-height: 300px; }
  main > h1:has(#follow) { min-height: 35px; }
  #sub:not(.reserve) { min-height: 48px; }
}
@media (max-width: 400px) {
  #sub:not(.reserve) { min-height: 72px; }
  #verdict { min-height: 448px; }
}
@media (max-width: 639px) {
  #trend { min-height: 160px; }
  /* the note and the readout wrap to two or three lines on a phone once filled */
  #trend-card .card-head { min-height: 98px; align-content: flex-start; }
  #trend-readout { min-height: 46px; }
  /* the select gets its own line, so the bar is as tall before and after the options arrive */
  .every-bar select { flex: 1 1 100%; }
  /* the subtitle fills to up to four lines once the data arrive, in every language */
  main > .sub.reserve { min-height: 96px; }
}
.every-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.every-bar select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); }

/* language flags in the header (build_site.py): the current language full, the others dimmed;
   a row on a wide screen, one flag that opens the three on a phone */
.langs { display: flex; align-items: center; gap: 4px; flex: none; }
.flag { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; }
.flag svg { width: 24px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.flag:not([aria-current]) svg { opacity: 0.55; filter: saturate(0.6); }
.flag:hover svg, .flag:focus-visible svg { opacity: 1; filter: none; }
.flag[aria-current] { background: var(--bg); }
.flag:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.langs-menu { display: none; position: relative; flex: none; }
.langs-menu summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.langs-menu summary::-webkit-details-marker { display: none; }
.langs-menu summary svg { width: 20px; height: 12.5px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.langs-menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.langs-menu nav { position: absolute; right: 0; top: 40px; z-index: 20; display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
@media (max-width: 640px) {
  .langs { display: none; }
  .langs-menu { display: block; }
}

/* links inside running text are underlined, not told apart by colour alone (WCAG 1.4.1) */
.note a { text-decoration: underline; text-underline-offset: 2px; }

/* column heads of Needs a look sort the list (desktop readers) */
.th-sort { all: unset; cursor: pointer; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.th-sort:hover { color: var(--ink); text-decoration: underline; }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
