:root {
  --bg: #FBFAF7;
  --bg-2: #F2F0EB;      /* bands, table heads, hover */
  --line: #DCD8CF;
  --text-primary: #161616;
  --text-secondary: #45433E;
  --text-muted: #6B675F;
  --accent: #11457E;    /* blue of the flag: current section, sliders */
  --hover: #D7141A;     /* red of the flag: links under the pointer */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --wrapw: 960px;      /* page container */
  --gutter: 32px;
  --colw: 688px;        /* article column: charts */
  --textw: 576px;       /* article text */
  --sidew: 184px;       /* side navigation of an article */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-primary); }
a:hover { color: var(--hover); }

.wrap { max-width: var(--wrapw); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner {
  min-height: 64px;
  padding-top: 12px; padding-bottom: 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px;
}
.site-title { display: block; flex: none; line-height: 0; }
.site-title img { display: block; height: 26px; width: auto; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; font-size: 15px; font-weight: 500; }
.site-nav a { text-decoration: none; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer-inner { padding-top: 22.5px; padding-bottom: 29px; font-size: 11px; color: var(--text-muted); }

/* ---------- home page ---------- */
/* B: two columns, two rows. Row 1: the text, sitting on the bottom edge of the map | map and legend.
   Row 2: empty | caption and switches (the figure spans both rows through a subgrid) */
.hero-inner {
  padding-top: 48px; padding-bottom: 44px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto;
  column-gap: 48px; row-gap: 16px;
}
.hero-text { grid-column: 1; grid-row: 1; align-self: end; min-width: 0; margin-bottom: -5px; } /* -5 px: the descenders of the lede */
.hero h1 { margin: 0; font-size: 44px; line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; }
.hero-lede { margin: 16px 0 0; max-width: 30em; font-size: 15.5px; line-height: 1.55; color: var(--text-secondary); }

#orp-map { grid-column: 2; grid-row: 1 / span 2; margin: 0; display: grid; grid-template-rows: subgrid; min-width: 0; }
/* map with its legend on the right (vertical, highest on top) */
.orp-body { align-self: end; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.orp-svg { display: block; flex: 0 1 300px; min-width: 0; height: auto; aspect-ratio: 227 / 138.24; overflow: visible; }
.orp-legend { flex: none; display: flex; gap: 8px; }
/* the flag view has no legend: home.js fades it out, its place is kept, so nothing moves */
.orp-legend svg { display: block; }
.orp-legend-labels {
  height: 119px; display: flex; flex-direction: column; justify-content: space-between;
  width: 3.6em; /* fixed: the swatches stay put whatever the length of the labels ("−15 %", "80+", "0") */
  font-size: 11.5px; line-height: 1; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* caption: a fixed two-line window, so the caption sliding in and out does not move anything */
.orp-caption { position: relative; overflow: hidden; height: 42px; }
.orp-cap { will-change: transform, opacity; }
.orp-title, .orp-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orp-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.orp-sub { font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.orp-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.orp-states { display: flex; align-items: center; }
.orp-states button { width: 28px; height: 32px; padding: 0; background: none; border: 0; cursor: pointer; display: flex; align-items: center; }
/* switches: tracks that fill while their view is on (home.js) */
.orp-track { display: block; width: 22px; height: 2px; background: #C9C5BC; overflow: hidden; }
.orp-fill { display: block; height: 100%; background: var(--text-primary); transform: scaleX(0); transform-origin: left; }
.orp-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.orp-link svg { display: block; flex: none; }
.orp-link svg[hidden] { display: none; }

.band { border-top: 1px solid var(--line); }
.band > .wrap { padding-top: 32px; padding-bottom: 70.5px; }
.section-title { margin: 0 0 22.5px; font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; scroll-margin-top: 19px; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(166.5px, 1fr)); gap: 38.5px 29px; }
.topic { border-top: 1px solid var(--line); padding-top: 14.5px; min-width: 0; }
.topic-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6.5px; color: var(--accent); }
.topic-icon { display: block; flex: none; }
.topic h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.topic ul { list-style: none; margin: 0; padding: 0; }
.topic li { border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.4; }
.topic li a { display: block; padding: 9px 0; text-decoration: none; }
.topic-soon { border-top-color: var(--line); }
.topic-soon .topic-head, .topic-soon h3, .topic-soon li { color: var(--text-muted); }
.topic-soon li { padding: 9px 0; }

.about { background: var(--bg-2); }
.about > .wrap { padding-top: 57.5px; padding-bottom: 70.5px; }
.about-inner { display: flex; flex-wrap: wrap; gap: 19px 57.5px; }
.about .section-title { flex: 1 1 192px; margin: 0; }
.about-text { flex: 3 1 448px; min-width: 0; max-width: 608px; }
.about-text p { margin: 0; font-size: 15px; line-height: 1.6; }
.about-text .about-second { margin: 16px 0 32px; color: var(--text-secondary); }
.about-facts { margin: 0; }
.about-facts > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 13px; padding: 11px 0; border-top: 1px solid var(--line); }
.about-facts dt { font-size: 11px; color: var(--text-muted); }
.about-facts dd { margin: 0; font-size: 13px; }
.about-facts a { text-underline-offset: 3px; }

/* ---------- article ---------- */
.article-page {
  max-width: 992px;
  padding-top: 38.5px; padding-bottom: 83px;
  display: flex; align-items: flex-start; gap: 32px 51px;
}
.article-page main { flex: 999 1 448px; min-width: 0; max-width: var(--colw); }
/* text is narrower than the charts */
.article-page main > :not(figure) { max-width: var(--textw); }
.article-page main h1 { margin: 0; font-size: clamp(29px, 3.68vw, 41.5px); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.article-page main h2 { margin: 45px 0 13px; font-size: 22.5px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; scroll-margin-top: 19px; }
.article-page main h3 { margin: 25.5px 0 6.5px; font-size: 16px; line-height: 1.3; font-weight: 600; scroll-margin-top: 19px; }
.article-page main > :is(p, ul, ol, blockquote) { font-size: 14.5px; line-height: 1.65; margin-top: 0; margin-bottom: 16px; }
.article-page main strong { font-weight: 600; }
.breadcrumb { margin: 0 0 14.5px; font-size: 11px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.article-page main > .lede { margin: 17.5px 0 0; max-width: 36em; font-size: 17px; line-height: 1.5; color: var(--text-secondary); }
.article-page main > .article-meta {
  margin: 19px 0 0; padding: 9.5px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 11px; line-height: 1.55; color: var(--text-muted);
}

.article-page main > .next-article {
  max-width: none;
  margin-top: 51px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 13px 25.5px;
}
.next-link { text-decoration: none; }
.next-label { display: block; font-size: 10.5px; color: var(--text-muted); }
.next-title { display: block; margin-top: 3px; font-size: 14.5px; font-weight: 600; }
.next-all { align-self: flex-end; margin-left: auto; font-size: 11px; font-weight: 500; text-decoration: none; }

/* ---------- side navigation of an article ---------- */
.sidenav {
  flex: 0 1 var(--sidew); min-width: 160px;
  position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto;
  padding-top: 5px; padding-bottom: 19px;
}
.sidenav-back { display: inline-block; margin-bottom: 16px; font-size: 11px; font-weight: 500; text-decoration: none; }
.sidenav-sections { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.sidenav-sections a {
  display: block; padding: 5px 0 5px 11px; margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 11px; line-height: 1.4; color: var(--text-muted); text-decoration: none;
}
.sidenav-sections .sub a { padding-left: 21px; }
.sidenav-sections a:hover { color: var(--text-primary); }
.sidenav-sections a.reading { border-left-color: var(--accent); color: var(--text-primary); font-weight: 500; }

/* narrow: one column, the map under the text, centred */
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 32px; }
  .hero-text { grid-row: auto; margin-bottom: 0; }
  #orp-map { grid-column: 1; grid-row: auto; display: block; justify-self: center; width: 100%; max-width: 380px; }
  .orp-foot { margin-top: 16px; }
}

@media (max-width: 1000px) {
  .article-page { display: block; }
  .sidenav { position: static; max-height: none; padding: 0; }
  .sidenav-sections { display: none; }
}

/* ---------- chart card ---------- */
.chart-card { margin: 38.5px 0 45px; padding-top: 14.5px; border-top: 1px solid var(--line); position: relative; }
.chart-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 9.5px 25.5px; margin-bottom: 8px; }
.chart-head > div:first-child { flex: 1 1 304px; min-width: 0; }
.chart-title { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.chart-subtitle { margin: 3px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }

/* switches (Graf / Tabulka, tabs, Rozdělit): underlined words, no boxes */
.chart-controls { display: flex; flex: none; flex-wrap: wrap; gap: 0 14.5px; align-items: flex-start; }
.chart-tabs, .chart-switch { display: flex; flex-wrap: wrap; gap: 0 14.5px; }
.chart-tabs[hidden], .chart-switch[hidden] { display: none; }
.chart-switch { margin: 3px 0 8px; }
.chart-tab {
  min-height: 29px; padding: 0 2px;
  font: inherit; font-size: 11px; font-weight: 400;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer;
}
.chart-tab:hover { color: var(--text-primary); }
.chart-tab[aria-pressed="true"] { border-bottom-color: var(--text-primary); color: var(--text-primary); font-weight: 600; }
/* facet toggle (options$facet): one small chart per series */
.chart-facet-toggle { display: inline-flex; align-items: center; gap: 5px; }
.chart-facet-toggle svg { fill: currentColor; }
.chart-facets { display: grid; row-gap: 14.5px; }
/* the panel under the pointer on top, so its tooltip is not covered by the next panel */
.chart-facets > svg { position: relative; }
.chart-facets > svg:hover { z-index: 1; }

.chart-body { min-height: 96px; }
.chart-body figure { margin: 0; }
.chart-body svg { max-width: 100%; }
.chart-body [aria-label="tip"] { font-size: 10.5px; }
.chart-body [aria-label="tip"] > path:first-child, .chart-body [aria-label="tip"] path { fill: var(--bg); stroke: var(--line); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 5px 14.5px; margin: 11px 0 8px; font-size: 10.5px; color: var(--text-secondary); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 5px; }

.chart-table-wrap { max-height: 336px; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chart-table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 5px 9.5px; text-align: left; border-bottom: 1px solid var(--line); }
.chart-table th { position: sticky; top: 0; background: var(--bg-2); font-weight: 600; }
.chart-table .num { text-align: right; }
.chart-table tbody tr:last-child td { border-bottom: 0; }

/* year slider: two range inputs on one track, only their handles take the pointer */
.chart-timeline { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 10.5px; }
.timeline-year { flex: none; min-width: 2.6em; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.timeline-track { position: relative; flex: 1; min-width: 0; height: 22.5px; }
.timeline-track::before, .timeline-fill { content: ""; position: absolute; top: 10.5px; height: 2px; }
.timeline-track::before { left: 6.5px; right: 6.5px; background: var(--line); }
.timeline-fill {
  left: calc(6.5px + (100% - 13px) * var(--from, 0));
  width: calc((100% - 13px) * (var(--to, 1) - var(--from, 0)));
  background: var(--accent);
}
.timeline-track input {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 22.5px; margin: 0; padding: 0;
  background: none; pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.timeline-track input::-webkit-slider-runnable-track { height: 22.5px; background: none; }
.timeline-track input::-moz-range-track { background: none; }
.timeline-track input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; margin-top: 5.5px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  pointer-events: auto; cursor: grab;
}
.timeline-track input::-moz-range-thumb {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  pointer-events: auto; cursor: grab;
}
.timeline-track input:focus-visible { outline: none; }
.timeline-track input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline-track input:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

/* data note: a popover above the footer, shown on hover, focus or tap */
.chart-source { position: relative; }
.chart-note-button { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: help; text-decoration: underline dotted; text-underline-offset: 2.5px; }
.chart-note-button:hover, .chart-note-button:focus-visible { color: var(--text-primary); }
.chart-note-tip, .chart-term-tip {
  display: none;
  position: absolute; left: 0; bottom: calc(100% + 6.5px); z-index: 5;
  width: max-content; max-width: min(352px, 100%);
  padding: 8px 9.5px;
  background: var(--bg); color: var(--text-secondary);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
  font-size: 10.5px; line-height: 1.5;
}
.chart-note:hover .chart-note-tip, .chart-note:focus-within .chart-note-tip { display: block; }

/* inline tooltip in a title, subtitle or article text, written as [word::tooltip] */
.chart-term { position: relative; text-decoration: underline dotted; text-decoration-thickness: 1px; text-decoration-color: var(--text-muted); text-underline-offset: 3px; cursor: help; }
.chart-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-term-tip { top: calc(100% + 5px); bottom: auto; max-width: min(256px, 64vw); font-weight: 400; font-style: normal; text-align: left; hyphens: manual; text-decoration: none; }
.chart-term:hover .chart-term-tip, .chart-term:focus .chart-term-tip { display: block; }

.chart-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6.5px 19px;
  margin-top: 9.5px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--text-muted);
}
.chart-actions { display: flex; gap: 16px; }
.chart-action { font: inherit; background: none; border: 0; padding: 0; color: var(--text-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2.5px; }
.chart-action:hover { color: var(--hover); }
.chart-error { padding: 13px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-secondary); font-size: 11px; }

@media (max-width: 560px) {
  :root { --gutter: 13px; }
  .hero-inner { padding-top: 28px; padding-bottom: 32px; }
  .hero h1 { font-size: 36px; }
  .band > .wrap, .about > .wrap { padding-top: 38.5px; padding-bottom: 51px; }
  .about-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .chart-title { font-size: 14.5px; }
  .article-page main h2 { font-size: 19px; }
  .article-page main > p { font-size: 13.5px; }
}
