:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5f6368;
  --line: #e3e5e8;
  --tile: #f3f6f9;
  --accent: #0b6e4f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --fg: #e8eaed;
    --muted: #9aa0a6;
    --line: #2d3238;
    --tile: #1f242a;
    --accent: #5fd3a6;
  }
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; color: var(--fg); background: var(--bg); }
body { margin: 0; }
a { color: var(--accent); }
main, .site-header, .site-footer { max-width: 60rem; margin: 0 auto; padding: 0 1rem; }
.site-header { display: flex; justify-content: space-between; align-items: baseline; padding-top: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.site-header nav a { margin-left: 1rem; }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); font-size: 1.1rem; white-space: nowrap; }
.brand img { vertical-align: -0.3em; margin-right: 0.45rem; }   /* the mark; the name stays on the baseline of the menu */
@media (max-width: 48rem) {   /* the menu no longer fits beside the name: below it, from the left */
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .site-header nav { display: flex; flex-wrap: wrap; gap: 0.15rem 1rem; }
  .site-header nav a { margin-left: 0; }
}
.site-footer { margin-top: 3rem; padding-top: 1rem; padding-bottom: 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }
.lede { font-size: 1.1rem; }
.crumbs { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; }
.muted, .source { color: var(--muted); font-size: 0.9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.tile { background: var(--tile); border-radius: 0.5rem; padding: 0.9rem 1rem; }
.tile strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.tile span { color: var(--muted); font-size: 0.85rem; }
table.data { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.95rem; }
table.data th, table.data td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.num, table.data td.num { text-align: right; }
.place-list { list-style: none; padding: 0; margin: 0.5rem 0 1rem; columns: 3; column-gap: 2rem; }
.place-list li { display: flex; justify-content: space-between; gap: 0.5rem; break-inside: avoid; padding: 0.15rem 0; border-bottom: 1px solid var(--line); }
.place-list .num { color: var(--muted); }
.countries { display: grid; gap: 1.5rem; margin: 1.5rem 0; }
.country-card { border: 1px solid var(--line); border-radius: 0.75rem; padding: 1rem 1.25rem; }
.country-card h2 { margin-top: 0; }
.country-card .tiles { margin-bottom: 0.75rem; }
@media (max-width: 40rem) {
  .place-list { columns: 1; }
  h1 { font-size: 1.5rem; }
  table.data { font-size: 0.85rem; }
}
figure.badge { margin: 0.75rem 0 0.5rem; }
pre.embed { background: var(--tile); border-radius: 0.5rem; padding: 0.75rem 1rem; font-size: 0.8rem; white-space: pre-wrap; word-break: break-all; }
figure.chart { margin: 0.75rem 0 1.25rem; }
figure.map { margin: 0.75rem 0 1.25rem; max-width: 480px; }
figure.map svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 0.5rem; background: #fff; }
figure.map figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
figure.chart img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 0.5rem; background: #fff; }

/* Cluster map (Pages/Shared/_ClusterMap.cshtml, wwwroot/map.js) */
main.wide { max-width: 90rem; }
.cpmap { position: relative; height: 26rem; margin: 1rem 0 0.4rem; border: 1px solid var(--line); border-radius: 0.5rem; overflow: hidden; background: var(--tile); }
.cpmap.full { height: calc(100vh - 16rem); min-height: 26rem; }
.cpmap-fallback { padding: 1rem; margin: 0; }
.cpmap-legend { margin: 0 0 1.5rem; }
.cpmap-legend a { margin-left: 0.5rem; }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; vertical-align: -0.05rem; margin-left: 0.3rem; }
.dot.ac { background: #0b6e4f; }
.dot.dc { background: #d9620b; }
.cpmap-panel { font: 0.9rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1a1a1a; }
.cpmap-panel strong { display: block; margin-bottom: 0.15rem; }
.cpmap-panel .muted { color: #5f6368; font-size: 0.85rem; }
.cpmap-panel a { display: inline-block; margin-top: 0.35rem; color: #0b6e4f; }
@media (prefers-color-scheme: dark) {
  .dot.ac { background: #5fd3a6; }
  .dot.dc { background: #ffa24d; }
}
@media (max-width: 40rem) {
  .cpmap { height: 20rem; }
  .cpmap.full { height: 70vh; }
}

/* Embeds (Pages/Embed, in an iframe on another site): the whole frame, the map fills what is left. */
body.embed { margin: 0; padding: 0.6rem 0.75rem; min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; background: var(--bg); }
.embed-head h1 { font-size: 1.05rem; margin: 0 0 0.5rem; line-height: 1.3; }
.embed-head h1 a { color: var(--fg); text-decoration: none; }
.embed-head h1 a:hover, .embed-head h1 a:focus { text-decoration: underline; }
.embed-head .tiles { grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 0.4rem; margin: 0 0 0.5rem; }
.embed-head .tile { padding: 0.45rem 0.6rem; }
.embed-head .tile strong { font-size: 1.15rem; }
.embed-head .tile span { font-size: 0.75rem; }
.cpmap.embedded { flex: 1; height: auto; min-height: 12rem; margin: 0 0 0.3rem; }
.cpmap-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cpmap-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0.55rem 1rem; border: 0; border-radius: 0.4rem;
  background: var(--accent); color: var(--bg); font: 600 0.9rem system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.cpmap-start:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.cpmap-start:disabled { cursor: progress; opacity: 0.85; }
body.embed .cpmap-legend { margin: 0 0 0.2rem; font-size: 0.75rem; }
.embed-source { color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.embed-brand { font-weight: 700; }
details.embed-code { margin: 1.5rem 0; }
details.embed-code summary { cursor: pointer; font-weight: 600; }
details.year-table { margin: 0.5rem 0 1.5rem; }
details.year-table summary { cursor: pointer; font-weight: 600; }
