/* Clima Local — single stylesheet, no build step.
   Light palette lives on :root; dark only redefines tokens. */

:root {
  --paper:      #EDF1F4;
  --surface:    #FBFCFD;
  --surface-2:  #F3F6F9;
  --ink:        #111A21;
  --steel:      #556774;
  --faint:      #8496A3;
  --line:       #D5DEE5;
  --line-2:     #BCCAD4;
  --accent:     #0F6E8C;
  --accent-ink: #0B5670;
  --accent-soft: rgba(15,110,140,.10);
  --cold:       #4B7FC0;
  --mild:       #4F9E7A;
  --warm:       #D08A2E;
  --hot:        #C4512F;
  --rain:       #3D7FB8;
  --danger:     #B5462B;
  --shadow:     0 1px 1px rgba(16,32,44,.05), 0 10px 26px -16px rgba(16,32,44,.35);
  --tile-filter: none;

  /* CJK families are appended rather than substituted: font fallback is
     per-glyph, so Latin text and digits still come from the earlier faces. */
  --sans: system-ui, "Segoe UI Variable Display", "Segoe UI", -apple-system, "Helvetica Neue", Arial,
          "PingFang SC", "Hiragino Sans", "Yu Gothic UI", "Microsoft YaHei",
          "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans CJK SC", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono",
          "PingFang SC", "Hiragino Sans", "Yu Gothic UI", "Microsoft YaHei",
          "Malgun Gothic", "Apple SD Gothic Neo", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0B1116;
    --surface:    #131C22;
    --surface-2:  #182229;
    --ink:        #DEE8EE;
    --steel:      #93A5B2;
    --faint:      #6B7D8A;
    --line:       #233038;
    --line-2:     #31434E;
    --accent:     #48B0CE;
    --accent-ink: #7FCDE3;
    --accent-soft: rgba(72,176,206,.14);
    --cold:       #6D9FDA;
    --mild:       #63B892;
    --warm:       #E0A44C;
    --hot:        #E06B47;
    --rain:       #5A9DD6;
    --danger:     #E08163;
    --shadow:     0 1px 1px rgba(0,0,0,.4), 0 12px 28px -18px rgba(0,0,0,.9);
    --tile-filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.92) saturate(.75);
  }
}

:root[data-theme="dark"] {
  --paper:      #0B1116;
  --surface:    #131C22;
  --surface-2:  #182229;
  --ink:        #DEE8EE;
  --steel:      #93A5B2;
  --faint:      #6B7D8A;
  --line:       #233038;
  --line-2:     #31434E;
  --accent:     #48B0CE;
  --accent-ink: #7FCDE3;
  --accent-soft: rgba(72,176,206,.14);
  --cold:       #6D9FDA;
  --mild:       #63B892;
  --warm:       #E0A44C;
  --hot:        #E06B47;
  --rain:       #5A9DD6;
  --danger:     #E08163;
  --shadow:     0 1px 1px rgba(0,0,0,.4), 0 12px 28px -18px rgba(0,0,0,.9);
  --tile-filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.92) saturate(.75);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

main { display: flex; flex-direction: column; gap: 26px; }

/* ---------- atoms ---------- */
.lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.sec-head h2 {
  margin: 0; font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2));
  background-size: 300% 100%;
  animation: shimmer 1.5s linear infinite;
  border-radius: 3px; color: transparent;
}
@keyframes shimmer { to { background-position: -300% 0; } }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand b {
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
}
.brand-sub { color: var(--faint); font-size: 11px; font-family: var(--mono); }

.search { position: relative; flex: 1 1 260px; max-width: 400px; }
.search input {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 9px 12px; padding-inline-start: 34px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.search .glass {
  position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
.results {
  position: absolute; z-index: 900; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 3px;
  box-shadow: var(--shadow); overflow: hidden; display: none;
}
.results.open { display: block; }
.results button {
  display: flex; width: 100%; align-items: baseline; gap: 8px;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 9px 12px; text-align: start; font: inherit; color: var(--ink); cursor: pointer;
}
.results button:last-child { border-bottom: 0; }
.results button:hover, .results button:focus-visible { background: var(--accent-soft); outline: none; }
.results em { font-style: normal; color: var(--faint); font-size: 11px; font-family: var(--mono); margin-inline-start: auto; }
.results .none { color: var(--faint); cursor: default; }

.geo {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  padding: 10px 13px; cursor: pointer;
}
.geo:hover { background: var(--accent-ink); }
.geo:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.geo[aria-busy="true"] { opacity: .6; pointer-events: none; }
.geo svg { width: 13px; height: 13px; }

.prefs { display: flex; gap: 12px; flex-wrap: wrap; }
.pref { display: flex; flex-direction: column; gap: 3px; }
.pref select {
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 3px; padding: 5px 6px; min-width: 78px;
}
.pref select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.banner {
  border: 1px solid var(--line-2); border-inline-start: 3px solid var(--danger);
  background: var(--surface); border-radius: 3px; padding: 10px 13px;
  font-size: 13.5px; color: var(--ink);
}

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0,1.06fr) minmax(0,1fr); gap: 20px; }

.now { padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.now-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.place h1 { margin: 2px 0 0; font-size: 25px; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
.place .coords { margin-top: 4px; }
.fix {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft); padding: 4px 8px; border-radius: 2px;
}
.fix i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

.read { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; }
.temp-big {
  font-size: 76px; line-height: .86; font-weight: 500; letter-spacing: -.05em;
}
.temp-big sup { font-size: 26px; vertical-align: top; letter-spacing: 0; margin-inline-start: 2px; }
.cond { display: flex; flex-direction: column; gap: 5px; padding-bottom: 5px; }
.cond .icon { color: var(--accent); min-height: 30px; }
.cond .desc { font-size: 15px; }
.cond .feels { color: var(--steel); font-size: 12.5px; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border-top: 1px solid var(--line); margin-top: auto; }
.metrics > div {
  padding: 12px 14px 11px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.metrics > div:nth-child(3n) { border-inline-end: 0; }
.metrics > div:nth-last-child(-n+3) { border-bottom: 0; }
.metrics .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 18px; letter-spacing: -.02em; }
.metrics .v u { text-decoration: none; font-size: 11px; color: var(--steel); margin-inline-start: 2px; }
.metrics .sub { font-size: 11px; color: var(--steel); font-family: var(--mono); display: flex; align-items: center; gap: 5px; }
.arrow { width: 12px; height: 12px; color: var(--accent); flex: none; }

/* ---------- map ---------- */
.map { position: relative; overflow: hidden; min-height: 300px; display: flex; flex-direction: column; }
.map-stage { position: relative; flex: 1; min-height: 260px; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.leaflet-tile-pane { filter: var(--tile-filter); }
.leaflet-container { background: var(--surface-2); font-family: var(--sans); }
.leaflet-control-attribution { display: none; }
.leaflet-bar a {
  background: var(--surface); color: var(--ink); border-bottom-color: var(--line-2);
}
.leaflet-bar a:hover { background: var(--surface-2); color: var(--ink); }
.map .badge {
  position: absolute; z-index: 500; bottom: 12px; inset-inline-start: 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow);
  max-width: 60%;
}
.map .badge b { font-size: 12.5px; font-weight: 600; }
.pin { position: relative; }
.pin span {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--accent); border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---------- 5-day outlook ---------- */
/* auto-fit, so the row follows FORECAST_DAYS instead of assuming five */
.days { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.day {
  padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 11px;
  cursor: pointer; text-align: start; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: var(--shadow); transition: border-color .15s ease, transform .15s ease;
}
.day:hover { border-color: var(--line-2); transform: translateY(-1px); }
.day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.day[aria-pressed="true"] { border-color: var(--accent); box-shadow: var(--shadow), inset 0 0 0 1px var(--accent); }
.day .dow { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.day .dow b { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.day .dow span { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.day .glyph { color: var(--accent); height: 34px; display: flex; align-items: center; }
.day .range { display: flex; align-items: center; gap: 8px; }
.day .range .lo, .day .range .hi { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; min-width: 30px; }
.day .range .lo { color: var(--steel); text-align: end; }
.day .bar { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.day .bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.day .foot { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--steel); }
.day .foot span { display: inline-flex; align-items: center; gap: 4px; }
.day .foot svg { width: 11px; height: 11px; flex: none; }
.day .foot .wet { color: var(--rain); }

/* ---------- hourly ---------- */
.hourly-card { padding: 16px 18px 12px; display: flex; flex-direction: column; gap: 6px; }
.hourly-card canvas { display: block; width: 100%; height: 190px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------- nearby ---------- */
.near { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.spot { padding: 13px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.spot .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.spot .head b { font-size: 14.5px; font-weight: 600; }
.spot .head .dist { font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .04em; }
.spot .head .t { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 21px; letter-spacing: -.03em; }
.spot .mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; border-top: 1px solid var(--line); padding-top: 9px; }
.spot .mini > div { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.spot .mini .d { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }
.spot .mini .g { color: var(--accent); height: 18px; }
.spot .mini .n { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; }
.spot .mini .n small { color: var(--faint); font-size: 10px; }
.spot .go {
  align-self: flex-start; background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.spot .go:hover { text-decoration: underline; }
.spot .go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

footer {
  border-top: 1px solid var(--line); padding-top: 14px;
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
}

/* ---------- RTL ----------
   `dir` is set on <html> by app.js. Flex, grid and the logical properties
   above mirror on their own; what follows is the set of things that must NOT
   mirror, plus a few runs that bidi would otherwise scramble.

   Quantitative axes stay left-to-right. The temperature bar, the hourly chart
   and the map are measurement surfaces, not prose — flipping the chart while
   leaving the canvas (drawn manually, always LTR) unflipped would put the two
   in direct contradiction on the same screen. */
[dir="rtl"] .day .range { direction: ltr; }
[dir="rtl"] #map { direction: ltr; }

/* Number-only runs. Left in RTL, a string like "54.6872 · 25.2797 · 111 m"
   reorders around the neutral separators and reads wrong. Blocks additionally
   need the physical alignment restored, since direction:ltr moves `start`. */
[dir="rtl"] .coords { direction: ltr; text-align: right; }
[dir="rtl"] .metrics .v { direction: ltr; text-align: right; }
[dir="rtl"] .temp-big,
[dir="rtl"] .day .foot span,
[dir="rtl"] .spot .head .dist,
[dir="rtl"] .spot .head .t,
[dir="rtl"] .spot .mini .n { direction: ltr; }

/* The wind arrow encodes a compass bearing, so it must never be mirrored —
   it is only ever rotated, but pin this down so nobody adds scaleX later. */
[dir="rtl"] .arrow { transform-origin: center; }

/* ---------- CJK ----------
   The micro-label style — 10px, uppercase, wide tracking — is designed for
   Latin capitals. Chinese, Japanese and Korean have no case, and 10px glyphs
   with .13em tracking are hard to read, so those rules are relaxed. `lang` is
   set on <html> by app.js, and :lang(zh) also matches "zh-CN"/"zh-Hant". */
html:lang(zh) .lbl, html:lang(ja) .lbl, html:lang(ko) .lbl,
html:lang(zh) .day .dow b, html:lang(ja) .day .dow b, html:lang(ko) .day .dow b,
html:lang(zh) .spot .mini .d, html:lang(ja) .spot .mini .d, html:lang(ko) .spot .mini .d {
  font-size: 11.5px;
  letter-spacing: .02em;
  text-transform: none;
}
html:lang(zh) .sec-head h2, html:lang(ja) .sec-head h2, html:lang(ko) .sec-head h2,
html:lang(zh) .geo, html:lang(ja) .geo, html:lang(ko) .geo,
html:lang(zh) .spot .go, html:lang(ja) .spot .go, html:lang(ko) .spot .go,
html:lang(zh) .fix, html:lang(ja) .fix, html:lang(ko) .fix {
  letter-spacing: .04em;
  text-transform: none;
}
html:lang(zh) .sec-head h2, html:lang(ja) .sec-head h2, html:lang(ko) .sec-head h2 { font-size: 14px; }
html:lang(zh) .geo, html:lang(ja) .geo, html:lang(ko) .geo,
html:lang(zh) .pref select, html:lang(ja) .pref select, html:lang(ko) .pref select { font-size: 12.5px; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .near { grid-template-columns: repeat(2, 1fr); }
  .temp-big { font-size: 64px; }
  .search { max-width: none; order: 5; flex-basis: 100%; }
}
@media (max-width: 620px) {
  .near { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics > div:nth-child(3n) { border-inline-end: 1px solid var(--line); }
  .metrics > div:nth-child(2n) { border-inline-end: 0; }
  .prefs { width: 100%; }
  .pref { flex: 1 1 30%; }
  .pref select { width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- map weather layers ----------
   Positioned over the map on wide screens, but on a phone the control would
   cover a large share of an already small map, so below ~620px it becomes a
   row underneath it instead. */
.wx-layers {
  position: absolute; z-index: 600; top: 10px; inset-inline-end: 10px;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden;
  box-shadow: var(--shadow); background: var(--line-2);
}
.wx-layers button {
  background: var(--surface); color: var(--steel); border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; padding: 6px 10px; text-align: start; white-space: nowrap;
}
.wx-layers button:hover { background: var(--surface-2); color: var(--ink); }
.wx-layers button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wx-layers button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.wx-timeline {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.wx-timeline[hidden] { display: none; }
.wx-play {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 10px; line-height: 1; display: grid; place-items: center;
}
.wx-play:hover { background: var(--surface-2); }
.wx-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wx-timeline input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.wx-timeline .num { font-size: 11px; color: var(--steel); min-width: 68px; text-align: end; }
.wx-timeline.is-loading { opacity: .55; pointer-events: none; }

/* Overlay tokens. The temperature field needs a lighter touch in dark mode:
   the basemap is already inverted and low-contrast, so a heavy wash buries it.
   The canvas sits above the tiles, so it also covers roads and labels — which
   is why the dark alpha is well under half. Screen blending was tried and
   rejected: it lifts a dark basemap into a pale panel that fights the page. */
:root {
  --wx-particle: rgba(30,45,60,.80);
  --wx-field-alpha: 0.46;
  --wx-isobar: rgba(18,30,42,.72);
  --wx-isobar-halo: rgba(255,255,255,.60);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wx-particle: rgba(255,255,255,.85);
    --wx-field-alpha: 0.30;
    --wx-isobar: rgba(228,240,248,.72);
    --wx-isobar-halo: rgba(6,12,18,.55);
  }
}
:root[data-theme="dark"] {
  --wx-particle: rgba(255,255,255,.85);
  --wx-field-alpha: 0.30;
  --wx-isobar: rgba(228,240,248,.72);
  --wx-isobar-halo: rgba(6,12,18,.55);
}

/* Overlay canvases must never eat map gestures. */
.wx-overlay { pointer-events: none; }


@media (max-width: 620px) {
  .wx-layers {
    position: static; flex-direction: row; gap: 0;
    border: 0; border-top: 1px solid var(--line); border-radius: 0;
    box-shadow: none; background: var(--surface); overflow-x: auto;
  }
  .wx-layers button {
    flex: 1 0 auto; text-align: center; padding: 9px 8px;
    border-inline-end: 1px solid var(--line);
  }
  .wx-layers button:last-child { border-inline-end: 0; }
  .wx-timeline { border-top: 1px solid var(--line); }
}

/* The timeline is a time axis: keep it left-to-right even in RTL. */
[dir="rtl"] .wx-timeline { direction: ltr; }

/* ---------- map legend + expand ----------
   A colour field with no key is decoration, not information: the bar always
   describes the frame currently drawn, not a fixed scale. */
.wx-legend {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.wx-legend[hidden] { display: none; }
.wx-legend-bar {
  flex: 1; height: 8px; border-radius: 4px; min-width: 0;
  border: 1px solid var(--line);
}
.wx-legend-scale {
  display: flex; gap: 10px; font-size: 10.5px; color: var(--steel); white-space: nowrap;
}

.wx-expand {
  position: absolute; z-index: 600; bottom: 12px; inset-inline-end: 12px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 3px;
  box-shadow: var(--shadow); cursor: pointer;
}
.wx-expand:hover { background: var(--surface-2); }
.wx-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wx-expand svg { width: 15px; height: 15px; }

/* Expanded: the card leaves the grid and covers the viewport. */
.map.is-expanded {
  position: fixed; inset: 0; z-index: 1000; border-radius: 0;
  max-width: none; margin: 0;
}
body.wx-expanded { overflow: hidden; }

/* The legend is a value axis — keep it left-to-right even in RTL. */
[dir="rtl"] .wx-legend { direction: ltr; }

/* ---------- nearby towns pinned on the map ----------
   A dot marks the true position; the label hangs beside it so a cluster of
   towns stays readable instead of the labels sitting on top of each other. */
.town-pin { pointer-events: auto; }
.town-pin-dot {
  position: absolute; left: -3px; top: -3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--ink); border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-2);
}
.town-pin-body {
  position: absolute; left: 7px; top: -9px;
  display: flex; align-items: baseline; gap: 4px; white-space: nowrap;
  padding: 2px 6px; border-radius: 3px; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-family: var(--mono); font-size: 10.5px; color: var(--steel);
}
.town-pin-body b { font-size: 12px; font-variant-numeric: tabular-nums; }
.town-pin:hover .town-pin-body { background: var(--surface); color: var(--ink); }

/* ---------- subscribe ---------- */
.subscribe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px 40px;
  align-items: start;
  padding: 20px 22px;
}
.sub-copy h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.sub-blurb { margin: 0; color: var(--steel); font-size: 14px; line-height: 1.55; }
.sub-form { display: flex; flex-direction: column; gap: 8px; }
.sub-form > label { margin: 0; }
.sub-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-row input {
  flex: 1 1 13rem; min-width: 0;
  font: inherit; font-size: 14px;
  padding: 9px 11px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 6px;
}
.sub-row input::placeholder { color: var(--faint); }
.sub-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sub-row button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  padding: 9px 18px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer;
}
.sub-row button:hover { background: var(--accent-ink); }
.sub-row button[disabled] { opacity: .55; cursor: default; }
.sub-note { margin: 0; color: var(--faint); text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.sub-status { margin: 0; font-size: 13px; line-height: 1.5; min-height: 0; }
.sub-status.ok { color: var(--mild); }
.sub-status.bad { color: var(--danger); }
.sub-status:empty { display: none; }
.sub-switch {
  align-self: start; margin: 0; padding: 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  color: var(--steel); text-decoration: underline; text-underline-offset: 2px;
}
.sub-switch:hover { color: var(--accent); }

@media (max-width: 720px) {
  .subscribe { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- explore nav ----------
   Server-rendered links to other places. Present in the HTML before any script
   runs, which is the whole point: it is what gives a crawler a graph to walk. */
.explore {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 18px 32px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.explore-group h2 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--faint);
}
.explore-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.explore-group a {
  color: var(--steel);
  font-size: 13.5px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.explore-group a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.explore-group a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
