/* Shared styles for every page. Order on a page: crisis band, hero, resources, where the data comes from, filters, list sorted by who has room.
   A page sets its own --accent and hero colours in a small inline block generated from its topic file. */
:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --ink: #14212b;
  --muted: #53636e;
  --line: #d3dce2;
  --accent: #1d5bb8;
  --accent-ink: #ffffff;
  --ok: #17713f;
  --ok-bg: #e2f3e9;
  --warn: #8a5a00;
  --warn-bg: #fbefd2;
  --bad: #a8261f;
  --bad-bg: #fbe5e3;
  --unk: #53636e;
  --unk-bg: #e7ecef;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f161b;
    --surface: #18222a;
    --ink: #e7eef2;
    --muted: #9dadb7;
    --line: #2c3a45;
    --accent: #86b4ff;
    --accent-ink: #0b1622;
    --ok: #6bd699;
    --ok-bg: #143324;
    --warn: #f2bd55;
    --warn-bg: #3a2c0c;
    --bad: #ff948a;
    --bad-bg: #3d1a17;
    --unk: #9dadb7;
    --unk-bg: #24313b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f161b;
  --surface: #18222a;
  --ink: #e7eef2;
  --muted: #9dadb7;
  --line: #2c3a45;
  --accent: #86b4ff;
  --accent-ink: #0b1622;
  --ok: #6bd699;
  --ok-bg: #143324;
  --warn: #f2bd55;
  --warn-bg: #3a2c0c;
  --bad: #ff948a;
  --bad-bg: #3d1a17;
  --unk: #9dadb7;
  --unk-bg: #24313b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
}
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
.lede { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 8px;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, label.filebtn:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.crisis { border-left: 5px solid var(--bad); }
.guide-link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--accent); }
.guide-link strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--accent); }
.guide-link:hover strong { text-decoration: underline; }
.crisis ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.crisis strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.source p { margin: 0 0 10px; }
.tag-sample {
  display: inline-block;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}
.tag-real {
  display: inline-block;
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}
.source-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
label.filebtn, button.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
label.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.small { font-size: 0.9rem; color: var(--muted); }
.msg { margin: 10px 0 0; font-size: 0.95rem; }
.msg.err { color: var(--bad); }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.filters .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field select, .field input[type="search"] {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.95rem; }
.check input { margin-top: 4px; }
.summary {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.summary .total { font-family: var(--font-display); font-size: 1.25rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); } .dot.unk { background: var(--unk); }
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-wrap: anywhere;
}
.card.ok { border-left-color: var(--ok); }
.card.warn { border-left-color: var(--warn); }
.card.bad { border-left-color: var(--bad); }
.card.unk { border-left-color: var(--unk); }
.card h3 { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.2; margin: 0; }
.statusrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.pill { font-weight: 600; font-size: 0.9rem; padding: 2px 9px; border-radius: 999px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.unk { background: var(--unk-bg); color: var(--unk); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 0.85rem; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.chip.aud { border-color: var(--accent); color: var(--accent); }
.contacts { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.prov { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.prov button {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px;
}
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
footer { color: var(--muted); font-size: 0.9rem; }
footer p { margin: 0 0 6px; }
@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  .filters { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { transition: border-color 0.15s; }
}

/* ---------- Crisis band: always the first thing on the page ---------- */
.crisis.top { border: 0; border-bottom: 3px solid var(--bad); border-radius: 0; padding: 10px 16px; }
.crisis.top .in { max-width: 960px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; }
.crisis.top h2 { margin: 0; font-size: 1rem; }
.crisis.top ul { flex-direction: row; flex-wrap: wrap; gap: 2px 18px; font-size: 0.95rem; }
.crisis.top .small { margin: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%); }
.hero-art { position: absolute; inset: 0; pointer-events: none; }
.hero-art svg { position: absolute; right: -40px; bottom: 0; height: 100%; width: auto; max-width: none; opacity: 0.55; }
.hero-art.photo { background-size: cover; background-position: center; opacity: 0.35; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, var(--hero-a) 0%, var(--hero-a) 38%, transparent 78%); opacity: 0.92; pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 44px 16px 40px; min-height: min(78vh, 640px); display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.brand { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; display: flex; align-items: center; gap: 8px; }
.brand a { color: inherit; text-decoration: none; }
.brand .mark { width: 14px; height: 14px; border-radius: 4px; background: var(--hero-light); display: inline-block; }
.brand .crumb { font-family: var(--font-body); font-weight: 600; opacity: 0.85; }
.hero h1 { font-size: clamp(2.3rem, 7.5vw, 4.4rem); line-height: 0.98; font-weight: 700; max-width: 14ch; letter-spacing: -0.01em; }
.hero h1 em { font-style: normal; color: var(--hero-light); }
.hero-lede { margin: 0; font-size: clamp(1.05rem, 2.4vw, 1.3rem); max-width: 46ch; opacity: 0.95; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
a.cta { display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; text-decoration: none; padding: 13px 22px; border-radius: 999px; background: var(--hero-light); color: #14212b; }
a.cta.line { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.75); }
a.cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.hero-stats { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 26px; font-variant-numeric: tabular-nums; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.5rem; display: block; line-height: 1.1; }
.hero-stats span { font-size: 0.92rem; opacity: 0.9; }
.hero-note { margin: 4px 0 0; font-size: 0.9rem; opacity: 0.85; max-width: 70ch; }
@media (max-width: 620px) {
  .hero-art svg { opacity: 0.3; right: -120px; }
  .hero::after { background: linear-gradient(180deg, var(--hero-a) 0%, transparent 130%); opacity: 0.7; }
}

/* ---------- Resources around the index ---------- */
.wrap { max-width: 960px; }
.sectitle { font-family: var(--font-display); font-size: 1.35rem; margin: 6px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
a.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--tone, var(--accent)); border-radius: 10px; padding: 14px; }
a.tile strong { font-family: var(--font-display); font-size: 1.12rem; color: var(--tone, var(--accent)); }
a.tile span { font-size: 0.95rem; color: var(--muted); }
a.tile:hover strong { text-decoration: underline; }
#hledat, [id] { scroll-margin-top: 12px; }

/* ---------- Motion: glide to anchors, fade between pages. Off for people who ask the system for less motion. ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; animation-timing-function: ease-out; }
}
.field select:disabled { opacity: 0.55; }
.chip.more { border-style: dashed; color: var(--muted); }
