:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-hi: #1f262f;
  --border: #2c333d;
  --fg: #e6edf3;
  --fg-mute: #8b949e;
  --accent: #58a6ff;
  --green: #2ea043;
  --yellow: #d29922;
  --red: #cf222e;
  --radius: 6px;
  --pad: 1rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad) 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand a { color: var(--fg); font-weight: 600; font-size: 1.2rem; }
.brand .tagline { color: var(--fg-mute); margin-left: 0.75rem; font-size: 0.9rem; }
.site-nav a { margin-left: 1.25rem; color: var(--fg-mute); }
.site-nav a:hover { color: var(--fg); }

.site-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  gap: 2rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem 2rem;
  font-size: 0.85rem;
  color: var(--fg-mute);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.kpi-value { font-size: 2.5rem; font-weight: 700; }
.kpi-label { color: var(--fg-mute); margin-top: 0.25rem; }
.kpi-label small { font-size: 0.75rem; }

.status-band h2,
.map-placeholder h2,
.top-events h2 { margin: 0 0 1rem 0; font-size: 1.1rem; color: var(--fg-mute); font-weight: 600; }

.pills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pill {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.pill::before {
  content: "";
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
}
.pill-green::before { background: var(--green); }
.pill-yellow::before { background: var(--yellow); }
.pill-red::before { background: var(--red); }
.pill-source { font-weight: 600; }
.pill-meta { color: var(--fg-mute); }

.placeholder-box {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--fg-mute);
}

.event-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.event {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.event-meta {
  display: flex; gap: 0.6rem; align-items: center;
  font-size: 0.8rem; color: var(--fg-mute);
  margin-bottom: 0.4rem;
}
.event-title { display: block; font-weight: 600; font-size: 1.05rem; }
.event-summary { color: var(--fg-mute); margin: 0.4rem 0 0 0; }
.empty { color: var(--fg-mute); font-style: italic; }

.badge {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  font-family: ui-monospace, "JetBrains Mono", monospace;
}

.severity { padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.75rem; text-transform: uppercase; }
.severity-info  { background: #1e3a5f; color: #79c0ff; }
.severity-watch { background: #4d3c00; color: #f0c674; }
.severity-alert { background: #4d1014; color: #ff7b72; }

.feed-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}
@media (max-width: 720px) { .feed-layout { grid-template-columns: 1fr; } }

.feed-filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.feed-filters h2 { margin: 0 0 0.75rem 0; font-size: 1rem; color: var(--fg-mute); }
.feed-filters form { display: grid; gap: 0.6rem; }
.feed-filters label { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--fg-mute); }
.feed-filters input,
.feed-filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  padding: 0.4rem 0.5rem;
  font: inherit;
}
.feed-filters button {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.feed-filters .reset {
  text-align: center;
  color: var(--fg-mute);
  font-size: 0.85rem;
}

.feed-header { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 1rem; }
.feed-header h2 { margin: 0; font-size: 1.1rem; color: var(--fg-mute); }
.feed-count { color: var(--fg-mute); font-size: 0.85rem; }

.country, .lang {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.pagination .disabled { color: var(--fg-mute); opacity: 0.4; }
.pagination .page-indicator { color: var(--fg-mute); }

.prose h2, .prose h3 { color: var(--fg); }
.prose ul { padding-left: 1.5rem; }

.timeseries h2, .province-table h2 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--fg-mute);
}

.chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0;
}
.chart svg { display: block; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--fg-mute);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  vertical-align: middle;
}

.province-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.province-table th,
.province-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.province-table th { color: var(--fg-mute); font-weight: 600; font-size: 0.85rem; background: var(--surface-hi); }
.province-table tr:last-child td { border-bottom: 0; }
.province-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* World map — global signals heatmap on the overview page. */
.world-map h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--fg-mute);
  font-weight: 600;
}
.world-map .map-meta {
  margin: 0 0 1rem 0;
  color: var(--fg-mute);
  font-size: 0.85rem;
}
.world-map .map-svg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow: hidden;
}
.world-map .map-svg svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
}
/* Country fills are injected per-request as inline style="fill:..."
   on each <path> with at least one event. Multi-polygon countries
   (US, AR, CA, AU, RU, ...) carry the fill on a wrapping <g>; the
   child <path>s inherit it via SVG cascade. Default fill for all
   un-styled paths comes from a fill="#3c434f" attribute on the SVG
   root (set in worldmap.go) — NOT from this CSS rule, because a
   path-level CSS rule beats <g>-inherited fill and the multi-polygon
   countries would lose their heatmap colour. */
.world-map .map-svg path {
  /* Default stroke (#5a6370 / 0.4) lives on the SVG root attribute so
     per-<g> inline strokes inherit correctly. See worldmap.go. */
  transition: fill 0.15s ease, stroke 0.15s ease;
  cursor: default;
}
.world-map .map-svg path:hover {
  stroke: var(--fg);
  stroke-width: 0.8;
}
.world-map .map-legend {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--fg-mute);
}
.world-map .map-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.world-map .map-legend .swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--border);
}
.world-map .map-legend .swatch-stroke {
  background: transparent;
  border-style: solid;
  /* per-bucket border-color and border-width come from inline style */
}
.world-map .map-legend .legend-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.world-map .map-legend .legend-title {
  color: var(--fg);
  font-weight: 600;
  margin-right: 0.25rem;
}

/* KPI delta indicator: small line beneath the big value showing the
   change against the previous comparison window. */
.kpi-delta {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}
.kpi-delta-arrow { font-size: 0.95rem; line-height: 1; }
.kpi-delta-abs { font-weight: 600; }
.kpi-delta-pct { color: var(--fg-mute); }
.kpi-delta.delta-up    { color: var(--red); }
.kpi-delta.delta-up    .kpi-delta-pct { color: var(--red); opacity: 0.75; }
.kpi-delta.delta-down  { color: var(--green); }
.kpi-delta.delta-down  .kpi-delta-pct { color: var(--green); opacity: 0.75; }
.kpi-delta.delta-flat  { color: var(--fg-mute); }

/* Map pan/zoom: cursor affordance + reset button. */
.world-map .map-svg svg {
  cursor: grab;
  user-select: none;
}
.world-map .map-reset { margin-left: auto; }
.world-map .map-reset button {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--fg-mute);
  border-radius: 4px;
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.world-map .map-reset button:hover {
  color: var(--fg);
  border-color: var(--fg-mute);
}

/* Legal pages: imprint + privacy. Static long-form text — narrower
 * column, generous line-height, table styling for the recipients
 * matrix, blockquote for the Amazon-mandated German disclosure. */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  line-height: 1.55;
}
.legal h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
.legal h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.legal h3 { font-size: 1rem; margin: 1.25rem 0 0.4rem; color: var(--fg); }
.legal p, .legal ul, .legal ol { margin: 0.5rem 0; }
.legal ul { padding-left: 1.4rem; }
.legal address { font-style: normal; color: var(--fg); }
.legal a { color: var(--fg); text-decoration: underline; }
.legal a:hover { color: var(--fg-mute); }
.legal-lede { color: var(--fg-mute); margin-bottom: 1.5rem; }
.legal blockquote {
  margin: 0.75rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--surface-hi);
  color: var(--fg);
}
.legal-translation { display: block; color: var(--fg-mute); font-size: 0.9rem; margin-top: 0.25rem; }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}
.legal-table th, .legal-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.legal-table th { color: var(--fg-mute); font-weight: 600; }

/* Footer links to /imprint and /privacy. */
.site-footer-links { display: flex; gap: 1rem; margin-left: auto; }
.site-footer-links a { color: var(--fg-mute); text-decoration: none; }
.site-footer-links a:hover { color: var(--fg); }

/* Above-fold hero block on /. Adds the SEO-relevant <h1> + a 60-100-word
 * lede paragraph that explains methodology + cadence. Sized restrained
 * because the dashboard's value is the visualisations below, not the copy. */
.hero { padding: 1.25rem 1.5rem 0.5rem; max-width: 880px; }
.hero h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.hero-lede {
  margin: 0;
  color: var(--fg-mute);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 65ch;
}

/* About-this-data / methodology block. Editorial prose, narrower
 * reading column than the data sections above. Sits between the
 * world map and Latest events. Needed for AdSense "publisher
 * content" classifier — Auto Ads otherwise flags the dashboard as
 * "low-quality content" because the rest of the page is mostly
 * UI chrome (pills, KPI tiles, map). */
.methodology {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  line-height: 1.55;
}
.methodology h2 {
  font-size: 1.2rem;
  margin: 0 0 0.75rem;
  color: var(--fg);
}
.methodology h3 {
  font-size: 1rem;
  margin: 1.4rem 0 0.4rem;
  color: var(--fg);
}
.methodology p {
  margin: 0 0 0.75rem;
  color: var(--fg-mute);
  font-size: 0.95rem;
}
.methodology code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: var(--surface-hi);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  color: var(--fg);
}
.methodology em { color: var(--fg); font-style: italic; }
.methodology a { color: var(--fg); text-decoration: underline; }
.methodology a:hover { color: var(--fg-mute); }
