@property --sky-a { syntax: '<color>'; inherits: true; initial-value: #aebbc6; }
@property --sky-b { syntax: '<color>'; inherits: true; initial-value: #e6ecf0; }

:root {
  --page: #f1f5f8;
  --surface: #ffffff;
  --ink: #0b2239;
  --muted: #55687a;
  --line: #d3dde6;
  --link: #0b5cab;

  --c0: #3da35d;
  --c1: #f2c12e;
  --c2: #f28c28;
  --c3: #d7362b;
  --c4: #7b1e3a;
  --cnone: #9aa8b4;

  --track: #e3eaf0; /* the unlit part of a rating bar */
  --wrap: 70rem;
  --gap: clamp(1rem, 3vw, 2rem);
}

* { box-sizing: border-box; }
/* "hidden" must win over any display rule below (flex rows would otherwise stay visible). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, p, ul, dl, dd, table { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; color: inherit; }
a { color: var(--link); }

:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gap); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Sky: the page top takes on the colour of the air ---------- */

.sky {
  --sky-ink: #0b2239;
  background: linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 100%);
  color: var(--sky-ink);
  transition: --sky-a 0.9s ease, --sky-b 0.9s ease, color 0.9s ease;
  padding-bottom: clamp(1.75rem, 4vw, 3rem);
}
.sky[data-cat='0'] { --sky-a: #3f97dd; --sky-b: #cfe8f8; }
.sky[data-cat='1'] { --sky-a: #86b4d6; --sky-b: #e9eee2; }
.sky[data-cat='2'] { --sky-a: #b8b49c; --sky-b: #f0d9a8; --sky-ink: #2a2110; }
.sky[data-cat='3'] { --sky-a: #b86a3c; --sky-b: #f0b068; --sky-ink: #2b1206; }
.sky[data-cat='4'] { --sky-a: #3b1d1a; --sky-b: #b5482a; --sky-ink: #fff3e6; }

.top {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding-block: 1rem;
}

.brand {
  font-size: 1.55rem;
  font-weight: 650;
  font-stretch: 118%;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
  margin-right: auto;
}
/* The logo sits on its own white chip so it reads on any sky colour. */
.brand {
  display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 750; font-stretch: 105%;
  color: #06255a; background: rgb(255 255 255 / 0.92); padding: 0.3rem 0.9rem 0.3rem 0.45rem; border-radius: 999px;
}
.brand .mark { height: 1.45em; width: 1.58em; flex: none; }

.find { position: relative; flex: 0 1 19rem; min-width: 11rem; }
.find input {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid rgb(11 34 57 / 0.25);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.82);
  color: var(--ink);
}
.find input::placeholder { color: #4b5d6e; }

.suggest {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 0.35rem);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 0.9rem;
  box-shadow: 0 12px 30px rgb(11 34 57 / 0.18);
  padding: 0.35rem; max-height: 60vh; overflow: auto;
}
.suggest li {
  padding: 0.5rem 0.7rem; border-radius: 0.6rem; cursor: pointer;
  display: flex; justify-content: space-between; gap: 1rem;
}
.suggest li span { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.suggest li[aria-selected='true'], .suggest li:hover { background: #e7eef4; }
.suggest .empty { color: var(--muted); cursor: default; }
.suggest .empty:hover { background: none; }

.locate {
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-weight: 550;
}
.locate:hover { background: rgb(255 255 255 / 0.25); }
.theme {
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid currentColor; background: transparent; cursor: pointer;
}
.theme:hover { background: rgb(255 255 255 / 0.25); }
.theme svg { width: 1.25rem; height: 1.25rem; }
.theme .sun { display: none; }
:root[data-theme='dark'] .theme .sun { display: block; }
:root[data-theme='dark'] .theme .moon { display: none; }
.locate[disabled] { opacity: 0.6; cursor: progress; }

/* Answer on the left, the national map on the right. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.25rem clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding-top: clamp(0.75rem, 2.5vw, 2rem);
}
/* Both halves of the top row sit on its bottom edge, just above the card and the map. */
.headline { align-self: end; }
.detail { align-self: end; padding-bottom: 0.35rem; }

.place { font-size: clamp(1.5rem, 2.8vw, 2.25rem); font-weight: 650; font-stretch: 105%; letter-spacing: -0.01em; line-height: 1.15; }

/* The rating word gets heavier and tighter as the air thickens. */
.word {
  --wght: 300; --wdth: 110;
  font-size: clamp(3rem, 6.2vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: var(--wght);
  font-stretch: calc(var(--wdth) * 1%);
  font-variation-settings: 'wght' var(--wght), 'wdth' var(--wdth);
  margin: 0.06em 0 0 -0.04em;
  text-wrap: balance;
}
.sky[data-cat='0'] .word { --wght: 200; --wdth: 125; }
.sky[data-cat='1'] .word { --wght: 330; --wdth: 114; }
.sky[data-cat='2'] .word { --wght: 500; --wdth: 100; }
.sky[data-cat='3'] .word { --wght: 700; --wdth: 82; }
.sky[data-cat='4'] .word { --wght: 900; --wdth: 66; }
.sky[data-cat='none'] .word { font-size: clamp(2rem, 4vw, 3rem); --wght: 300; --wdth: 110; }

.advice { font-size: clamp(1.15rem, 1.9vw, 1.4rem); line-height: 1.3; max-width: 30ch; font-weight: 500; }
.sensitive { margin-top: 0.45rem; max-width: 46ch; }
.basis { margin-top: 0.8rem; font-size: 0.92rem; max-width: 52ch; opacity: 0.85; text-wrap: pretty; }

.wind { margin-top: 0.6rem; font-size: 0.92rem; display: flex; align-items: center; gap: 0.45rem; }
.wind svg { width: 1rem; height: 1rem; flex: none; transition: transform 0.4s ease; }
.fires-near { margin-top: 0.6rem; font-size: 0.92rem; max-width: 56ch; text-wrap: pretty; }
/* Legend triangles match the fire markers on the map. */
.tri { width: 0; height: 0; border-left: 0.42rem solid transparent; border-right: 0.42rem solid transparent; border-bottom: 0.72rem solid #5a2a1c; flex: none; }
.tri.burn { position: relative; }
.tri.burn::after { content: ''; position: absolute; left: -0.2rem; top: 0.3rem; border-left: 0.2rem solid transparent; border-right: 0.2rem solid transparent; border-bottom: 0.34rem solid #fff; }

/* Alerts */
.alert { margin-top: 0.9rem; font-size: 0.92rem; }
.alert-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.alert-form label { white-space: nowrap; }
.alert select, .alert-form button {
  padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid rgb(11 34 57 / 0.25);
  background: rgb(255 255 255 / 0.85); color: var(--ink); font: inherit; font-size: 0.9rem;
}
.alert-form button { cursor: pointer; font-weight: 600; }
.alert-form button[disabled] { opacity: 0.6; cursor: progress; }
.alert #alert-status:empty { display: none; }
.alert #alert-status { margin-bottom: 0.4rem; }
button.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* Readings and the outlook share one sheet, so they read the same on any sky. */
.sheet {
  background: var(--surface);
  color: var(--ink);
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgb(11 34 57 / 0.1);
  overflow: hidden;
}
.readings { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); overflow: hidden; }
.readings:empty { display: none; }
.reading { flex: 1 1 7.5rem; padding: 0.8rem 1rem 0.9rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.reading dt { font-size: 0.82rem; color: var(--muted); }
.reading dd { font-size: 2.1rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; margin-top: 0.15rem; }
.reading dd small { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-left: 0.25em; letter-spacing: 0; }
.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-top: 0.55rem; }
.meter i { height: 7px; border-radius: 4px; background: var(--track); }
.meter[data-cat='0'] i:nth-child(1) { background: var(--c0); }
.meter[data-cat='1'] i:nth-child(2) { background: var(--c1); }
.meter[data-cat='2'] i:nth-child(3) { background: var(--c2); }
.meter[data-cat='3'] i:nth-child(4) { background: var(--c3); }
.meter[data-cat='4'] i:nth-child(5) { background: var(--c4); }
.reading .rating { font-size: 0.85rem; font-weight: 600; letter-spacing: 0; color: var(--ink); margin-top: 0.35rem; display: flex; align-items: center; gap: 0.4rem; }
.reading .rating .dot { width: 0.6rem; height: 0.6rem; }

.outlook { padding: 0.9rem 1rem 0.8rem; }
.outlook .heading { margin-bottom: 0.6rem; }
.outlook h2 { font-size: 1rem; font-stretch: 100%; }
.outlook .heading p { font-size: 0.92rem; }
.bars {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px;
  align-items: end; height: 5.25rem; padding-bottom: 1.5rem; position: relative;
}
.bar { position: relative; min-height: 6px; border-radius: 4px 4px 2px 2px; background: var(--cnone); }
.bar[data-cat='0'] { background: var(--c0); }
.bar[data-cat='1'] { background: var(--c1); }
.bar[data-cat='2'] { background: var(--c2); }
.bar[data-cat='3'] { background: var(--c3); }
.bar[data-cat='4'] { background: var(--c4); }
.bar span {
  position: absolute; top: calc(100% + 0.3rem); left: 0;
  font-size: 0.75rem; color: var(--muted); white-space: nowrap;
}
.bars:empty::after { content: 'Forecast not available for this place.'; color: var(--muted); grid-column: 1 / -1; align-self: center; }
.outlook .fine { margin-top: 0.5rem; font-size: 0.8rem; }

/* Past readings */
.past { padding: 0.9rem 1rem 0.8rem; border-top: 1px solid var(--line); }
.past .heading { margin-bottom: 0.6rem; }
.past h2 { font-size: 1rem; font-stretch: 100%; }
.past .heading p { font-size: 0.92rem; }
.past-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.segmented button { padding: 0.3rem 0.75rem; border: 0; background: none; cursor: pointer; font-size: 0.85rem; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.past-tools select {
  margin-left: auto; padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font: inherit; font-size: 0.85rem; color: inherit;
}
.past .bars { height: 6.5rem; }
.past .bars.dense { gap: 1px; }
.past .bars.dense .bar { border-radius: 1px; min-height: 3px; }
.bar.gap { background: none; min-height: 0; }
/* Daily and monthly averages: one colour, because ratings only apply to hourly readings. */
.bar.plain { background: #4a86c5; }
.past .bars.very-dense { gap: 0; }
.past .bars.very-dense .bar { border-radius: 0; }
.past .fine { margin-top: 0.5rem; font-size: 0.8rem; }
.past-table { margin-top: 0.5rem; font-size: 0.85rem; }
.past-table summary { cursor: pointer; color: var(--link); }
.past-table table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; display: block; max-height: 14rem; overflow: auto; }
.past-table th, .past-table td { text-align: left; padding: 0.25rem 0.75rem 0.25rem 0; border-bottom: 1px solid var(--line); }
.past-table thead th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--surface); }

/* Map */
.map-wrap { min-width: 0; }
.map { height: clamp(22rem, 64vh, 38rem); border-radius: 1rem; background: #dfe7ee; overflow: hidden; box-shadow: 0 10px 30px rgb(11 34 57 / 0.1); }
/* The view buttons sit on the map so the map's top edge lines up with the card's. */
.map-frame { position: relative; }
.map-tools { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2; display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.map-tools button {
  padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid rgb(11 34 57 / 0.2);
  background: rgb(255 255 255 / 0.95); color: var(--ink); cursor: pointer; font-size: 0.9rem;
  box-shadow: 0 2px 8px rgb(11 34 57 / 0.15);
}
.map-tools button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.legend .count { margin-left: auto; }
.legend {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.6rem; padding: 0.5rem 0.8rem;
  font-size: 0.85rem; color: var(--muted); background: rgb(255 255 255 / 0.85); border-radius: 0.75rem;
}
.legend li { display: flex; align-items: center; gap: 0.4rem; }
.legend .dot { width: 0.7rem; height: 0.7rem; }
.legend-kind .dot { background: var(--muted); }
.legend .dot.ring { background: var(--surface); box-shadow: inset 0 0 0 3px var(--muted); }
.maplibregl-map { font: inherit; }
/* Credit line: always visible, but small. */
.maplibregl-ctrl-attrib { font-size: 0.68rem; line-height: 1.3; padding: 1px 6px; background: rgb(255 255 255 / 0.7); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin: 0 8px 6px 0; border-radius: 4px; }
.tip .maplibregl-popup-content { padding: 0.35rem 0.6rem; font-size: 0.9rem; border-radius: 0.5rem; box-shadow: 0 4px 14px rgb(11 34 57 / 0.2); color: var(--ink); }
.tip { pointer-events: none; }
/* A ring, so the station dot underneath stays visible. */
.pin { width: 24px; height: 24px; border: 3px solid var(--ink); border-radius: 50%; box-shadow: 0 0 0 2px #fff, inset 0 0 0 2px #fff; pointer-events: none; }

/* ---------- Body ---------- */

main > section { margin-top: clamp(2rem, 5vw, 3.5rem); }

.notice {
  margin-top: 1.25rem; padding: 0.75rem 1rem;
  background: #fff6d6; border-left: 4px solid var(--c1); border-radius: 0.4rem;
}

.heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.25rem; margin-bottom: 1rem; }
.heading p { color: var(--muted); }
h2 { font-size: 1.45rem; font-weight: 650; font-stretch: 108%; letter-spacing: -0.01em; }
.fine { color: var(--muted); font-size: 0.9rem; max-width: 75ch; margin-top: 0.9rem; }

.dot {
  display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%;
  background: var(--cnone); flex: none;
}
[data-cat='0'] > .dot, .dot[data-cat='0'] { background: var(--c0); }
[data-cat='1'] > .dot, .dot[data-cat='1'] { background: var(--c1); }
[data-cat='2'] > .dot, .dot[data-cat='2'] { background: var(--c2); }
[data-cat='3'] > .dot, .dot[data-cat='3'] { background: var(--c3); }
[data-cat='4'] > .dot, .dot[data-cat='4'] { background: var(--c4); }

/* Three lists side by side: nearest, highest, capitals */
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem clamp(1.5rem, 4vw, 3rem); align-items: start; }
.lists h2 { font-size: 1.1rem; font-stretch: 100%; margin-bottom: 0.3rem; }
.stations button {
  width: 100%; display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.25rem; background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; cursor: pointer; border-radius: 0;
}
.stations button:hover { background: #e7eef4; }
.row-name { font-weight: 600; }
.row-sub { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.row-main { flex: 1; min-width: 0; }
.row-value { text-align: right; white-space: nowrap; font-size: 0.95rem; }
.row-value small { display: block; color: var(--muted); font-size: 0.85rem; }
.stations .empty { color: var(--muted); padding: 0.6rem 0.25rem; }

/* Scale */
.scale table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 1rem; overflow: hidden; }
.scale th, .scale td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.scale thead th { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.scale tbody tr:last-child > * { border-bottom: 0; }
.scale tbody th { white-space: nowrap; font-weight: 650; }
.scale tbody th .dot { margin-right: 0.55rem; }
.scale td:nth-child(2) { white-space: nowrap; }

/* Footer */
.foot { margin-top: clamp(3rem, 7vw, 5rem); padding-block: 2rem 3rem; border-top: 1px solid var(--line); }
.foot h2 { font-size: 1.1rem; margin-bottom: 0.6rem; }
.foot li { padding: 0.2rem 0; color: var(--muted); }
.foot li strong { color: var(--ink); font-weight: 600; }

@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; }
  .word { font-size: clamp(3rem, 13vw, 5rem); }
  .map { height: 24rem; }
}
@media (max-width: 34rem) {
  .brand { flex-basis: 100%; }
  .find { flex: 1 1 10rem; }
  .bars { gap: 2px; }
  .legend .count { margin-left: 0; flex-basis: 100%; }
  .scale table, .scale tbody, .scale tr, .scale th, .scale td { display: block; }
  .scale thead { display: none; }
  .scale tbody tr { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
  .scale tbody th, .scale td { padding: 0.1rem 0; border: 0; white-space: normal; }
  .scale td:nth-child(2) { color: var(--muted); font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sky { transition: none; }
}

/* Listing pages (/places, /nsw) */
body.plain .top { padding-block: 1rem; }
.brand img.mark { display: block; }
.listing h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 650; font-stretch: 108%; letter-spacing: -0.02em; margin-top: 1rem; }
.listing .lede { color: var(--muted); margin: 0.4rem 0 1.5rem; max-width: 60ch; }
.listing h2 { margin: 2rem 0 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.letters { display: flex; flex-wrap: wrap; gap: 0.25rem; position: sticky; top: 0; background: var(--page); padding: 0.5rem 0; z-index: 1; }
.letters a { padding: 0.2rem 0.55rem; border-radius: 0.4rem; text-decoration: none; background: var(--surface); border: 1px solid var(--line); }
.place-list { columns: 14rem auto; column-gap: 2rem; }
.place-list li, .state-list li { padding: 0.15rem 0; break-inside: avoid; }
.place-list span, .state-list span { color: var(--muted); font-size: 0.85rem; }
.state-list { font-size: 1.15rem; }
.state-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; max-width: 32rem; }

/* Long-form pages (/about) */
.prose p { max-width: 68ch; margin-bottom: 0.9rem; }
.prose h2 { font-size: 1.25rem; }
.prose table { width: 100%; max-width: 46rem; border-collapse: collapse; background: var(--surface); border-radius: 0.75rem; overflow: hidden; margin-bottom: 1rem; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose thead th { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.prose tbody th { font-weight: 600; }
.prose tbody tr:last-child > * { border-bottom: 0; }

/* Tables on the sources and coverage pages */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; border-radius: 0.75rem; background: var(--surface); }
.table-wrap table { width: 100%; max-width: none; margin: 0; border-collapse: collapse; }
.prose .table-wrap table { background: none; }
.cov table { width: auto; font-size: 0.85rem; }
.cov th, .cov td { padding: 0; border-bottom: 1px solid var(--page); }
.cov th.name { text-align: left; padding: 0.25rem 0.75rem; white-space: nowrap; font-weight: 500; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cov td.span { padding: 0.25rem 0.75rem 0.25rem 0; white-space: nowrap; color: var(--muted); }
.cov thead th { font-weight: 500; color: var(--muted); font-size: 0.75rem; padding: 0.35rem 0; text-align: left; }
.cov thead th.name, .cov thead th:nth-child(2) { padding: 0.35rem 0.75rem; }
.cov th.yr { min-width: 1rem; overflow: visible; white-space: nowrap; }
.cov td { min-width: 1rem; height: 1.3rem; border-left: 1px solid var(--surface); }
/* One colour, four strengths: how much of the year is covered. */
.c1 { background: #c9dcf0; } .c2 { background: #8db5e0; } .c3 { background: #4a86c5; } .c4 { background: #1d4f8a; }
.key { color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin-bottom: 0.5rem; }
.key .sw { width: 1rem; height: 1rem; border-radius: 3px; display: inline-block; margin-left: 0.6rem; }
.listing h2.group { margin-top: 3rem; }

.past-more { margin-top: 0.6rem; font-size: 0.9rem; font-weight: 600; }

.row-value small b { font-weight: 700; color: var(--ink); }

.reading.fault dd { font-size: 1.15rem; font-weight: 600; color: var(--muted); line-height: 1.3; margin-top: 0.35rem; }
.reading.fault .why { display: block; font-size: 0.85rem; font-weight: 400; letter-spacing: 0; margin-top: 0.3rem; }

/* Data explorer (/explore/<station>) */
:root { --series: #2f6fb5; --series-2: #d9612a; }
.explore .crumb { margin-top: 0.75rem; font-size: 0.9rem; }
.explore section { margin-top: 2.25rem; }
.explore h2 { margin: 0 0 0.25rem; padding: 0; border: 0; }
.x-sub { color: var(--muted); max-width: 70ch; margin-bottom: 0.6rem; }
.x-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.9rem 1rem; background: var(--surface); border-radius: 0.9rem; position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 18px rgb(11 34 57 / 0.08); }
.x-controls label, .x-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.x-controls select, .x-inline select { padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.9rem; }
.x-presets { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-left: auto; }
.x-presets button { padding: 0.3rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--ink); cursor: pointer; font: inherit; font-size: 0.85rem; }
.x-presets button:hover { background: var(--page); }
.x-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.x-stats div { background: var(--surface); border-radius: 0.9rem; padding: 0.8rem 1rem; }
.x-stats dt { font-size: 0.85rem; color: var(--muted); }
.x-stats dd { font-size: 1.15rem; font-weight: 650; line-height: 1.25; margin-top: 0.15rem; }
.chart { background: var(--surface); border-radius: 0.9rem; padding: 0.75rem 0.5rem 0.25rem; overflow: hidden; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .ylab, .chart .xlab { fill: var(--muted); font-size: 11px; }
.chart .series-bar { fill: var(--series); }
.chart .series-line { fill: none; stroke: var(--series); stroke-width: 1.5; stroke-linejoin: round; }
.chart .extra-line { fill: none; stroke: var(--series-2); stroke-width: 2; }
.chart .extra-dot { fill: var(--series-2); stroke: var(--surface); stroke-width: 2; }
.chart .ref { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 5 4; opacity: 0.6; }
.chart .reflab { fill: var(--ink); font-size: 11px; opacity: 0.8; }
.chart .marker { stroke: var(--ink); stroke-width: 1; opacity: 0.45; }
.x-empty { color: var(--muted); padding: 2rem 1rem; }
.x-legend { background: none; padding: 0; margin-top: 0.5rem; }
.sw-bar { width: 0.9rem; height: 0.7rem; border-radius: 2px; background: var(--series); display: inline-block; }
.sw-line { width: 1.2rem; height: 0; border-top: 3px solid var(--series-2); display: inline-block; }
.x-inline { margin-bottom: 0.6rem; }
.x-table { max-height: 24rem; overflow: auto; }
.x-table table { font-size: 0.9rem; }
.x-table th, .x-table td { text-align: left; padding: 0.4rem 0.9rem; border-bottom: 1px solid var(--line); }
.x-table thead th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 500; }
.x-tip { position: absolute; z-index: 20; pointer-events: none; background: var(--ink); color: var(--page); padding: 0.3rem 0.6rem; border-radius: 0.4rem; font-size: 0.85rem; white-space: nowrap; }
.cov th.name a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.cov th.name a:hover { text-decoration-color: currentColor; }

/* ---------- Dark theme: set by the header switch, starting from the device setting.
   The rules below are nested, so each applies only inside a dark page. ---------- */
:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0d1620; --surface: #17222e; --ink: #e8eef4; --muted: #9db0c2; --line: #2b3b4b; --link: #7db8f0; --track: #2b3b4b;

  .sky { --sky-ink: #f1f6fa; --sky-a: #1b2836; --sky-b: #131e2a; }
  .sky[data-cat='0'] { --sky-a: #0c3157; --sky-b: #1a5a8f; --sky-ink: #f1f6fa; }
  .sky[data-cat='1'] { --sky-a: #23445c; --sky-b: #4a6475; --sky-ink: #f1f6fa; }
  .sky[data-cat='2'] { --sky-a: #4a4636; --sky-b: #7a6a45; --sky-ink: #fbf5e6; }
  .sky[data-cat='3'] { --sky-a: #5c2f18; --sky-b: #9a5a2a; --sky-ink: #fff3e6; }
  .sky[data-cat='4'] { --sky-a: #2a1210; --sky-b: #7a2a18; --sky-ink: #fff3e6; }

  /* Controls that sit on the sky or the map */
  .find input, .alert select, .alert-form button, .map-tools button, .legend {
    background: rgb(13 22 32 / 0.82); color: #e8eef4; border-color: rgb(255 255 255 / 0.22);
  }
  .find input::placeholder { color: #9db0c2; }
  .map-tools button[aria-pressed='true'], .segmented button[aria-pressed='true'] { background: #e8eef4; border-color: #e8eef4; color: #0d1620; }
  .legend { color: #c5d2de; }
  .legend .dot.ring { background: #0d1620; }

  .suggest li[aria-selected='true'], .suggest li:hover, .stations button:hover { background: #223244; }
  .map { background: #1b2836; }
  .notice { background: #3a3210; }
  .bar.plain { background: #6aa5e0; }
  .tip .maplibregl-popup-content { background: #17222e; color: #e8eef4; }
  .tip .maplibregl-popup-tip { border-top-color: #17222e; border-bottom-color: #17222e; }
  .maplibregl-ctrl-attrib { background: rgb(13 22 32 / 0.7); color: #c5d2de; }
  .maplibregl-ctrl-attrib a { color: #c5d2de; }
  .tri { border-bottom-color: #e0a58f; }
  .tri.burn::after { border-bottom-color: #0d1620; }
  .sheet, .readings dl { box-shadow: 0 10px 30px rgb(0 0 0 / 0.35); }
}
:root[data-theme='dark'] {
  .c1 { background: #24405f; } .c2 { background: #2f6199; } .c3 { background: #4a8fd6; } .c4 { background: #9cc8f5; }
}
:root[data-theme='dark'] {
  --series: #6aa5e0; --series-2: #f0955f;
}
