/* loqation — tokens from DESIGN.md. Do not add a value that is not a token there. */
:root {
  --paper: #f5f7f6; --paper-2: #eaeeec; --rule: #d5dbd8;
  --ink: #151c1f; --ink-2: #33403f; --ink-3: #5c6a69; --ink-4: #87938f;
  --dot: #9aa7a2; --accent: #1f57a3; --accent-2: #174582; --accent-bg: #e3ebf6;
  --warm: #b45a1b; --wet: #1f57a3;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r-ctl: 10px; --r-chip: 999px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1417; --paper-2: #172024; --rule: #26323a;
    --ink: #eef3f1; --ink-2: #c9d3d0; --ink-3: #9aa8a4; --ink-4: #6f7d79;
    --dot: #667873; --accent: #7fb0f5; --accent-2: #a8c9f8; --accent-bg: #1a2a40;
    --warm: #f0a060; --wet: #7fb0f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1417; --paper-2: #172024; --rule: #26323a;
  --ink: #eef3f1; --ink-2: #c9d3d0; --ink-3: #9aa8a4; --ink-4: #6f7d79;
  --dot: #667873; --accent: #7fb0f5; --accent-2: #a8c9f8; --accent-bg: #1a2a40;
  --warm: #f0a060; --wet: #7fb0f5;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink-2);
  font: 400 1rem/1.55 Archivo, "Helvetica Neue", Arial, sans-serif; font-variation-settings: "wdth" 100;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink); margin: 0; }
p { margin: 0 0 var(--s3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font: inherit; font-weight: 600; }

/* ── header */
.top {
  display: flex; align-items: center; gap: var(--s4);
  padding: max(var(--s3), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) var(--s3) max(var(--gutter), env(safe-area-inset-left));
  border-bottom: 1px solid var(--rule);
}
.mark { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink); text-decoration: none; min-height: 44px; flex: none; }
.mark svg { width: 18px; height: 18px; fill: var(--accent); stroke: var(--accent); stroke-width: 1.4; }
.mark span { font-weight: 760; font-variation-settings: "wdth" 120; font-size: 1.0625rem; letter-spacing: -0.01em; }
.is-home .top .find { display: none; }

/* ── search */
.find { position: relative; flex: 1; min-width: 0; }
.top .find { max-width: 28rem; margin-left: auto; }
.find input {
  width: 100%; min-height: 44px; padding: 0 var(--s3);
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper-2); border: 1px solid transparent; border-radius: var(--r-ctl);
  -webkit-appearance: none; appearance: none;
}
.find input::placeholder { color: var(--ink-4); }
.find input:focus { outline: none; border-color: var(--accent); background: var(--paper); }
.find.big input { min-height: 52px; font-size: 1.125rem; padding: 0 var(--s4); }
.hits {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: var(--s1) 0; list-style: none;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-ctl);
  max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain;
}
.hits li a { display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: var(--s2) var(--s3); text-decoration: none; color: var(--ink); }
.hits li a small { color: var(--ink-3); font-size: 0.8125rem; }
.hits li[aria-selected="true"] a, .hits li a:hover { background: var(--accent-bg); }
.hits .none { padding: var(--s3); color: var(--ink-3); font-size: 0.9375rem; }

/* ── layout */
main { padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); max-width: 1180px; margin: 0 auto; }
.foot { max-width: 1180px; margin: var(--s8) auto 0; padding: var(--s5) var(--gutter) max(var(--s6), env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); color: var(--ink-4); font-size: 0.8125rem; }
.foot p { max-width: 68ch; margin: 0; }

.place, .country { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s7); }
.head { padding: var(--s6) 0 var(--s4); }
.where { margin: 0 0 var(--s2); color: var(--ink-3); font-size: 0.9375rem; }
.where a { color: inherit; }
.head h1 {
  font-weight: 780; font-variation-settings: "wdth" 118;
  font-size: clamp(2.4rem, 9vw, 4.25rem); line-height: 0.95; letter-spacing: -0.01em;
  overflow-wrap: anywhere; hyphens: auto;
}
.coord { margin: var(--s3) 0 0; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
.side { min-width: 0; }
.body { min-width: 0; max-width: 68ch; }

/* Phone: the answer to "what is it like there right now" comes before the fact list.
   The side column and body dissolve into the page grid and are reordered; on desktop
   the side column is a sticky rail again. */
@media (max-width: 879.98px) {
  .place > .side, .place > .body { display: contents; }
  .place .head { order: -3; }
  .place .loc { order: -2; }
  .place .summary, .place #weather { order: -1; }
  .place .facts { order: 0; margin-top: var(--s7); }
  .place .side > .src { order: 0; margin-bottom: 0; }
  .place .body > .mod:not(#weather) { order: 1; }
}

@media (min-width: 880px) {
  .place, .country { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "head head" "body side"; }
  .head { grid-area: head; padding-top: var(--s7); }
  .side { grid-area: side; position: sticky; top: var(--s5); align-self: start; }
  .body { grid-area: body; }
}

/* ── maps */
.loc { margin: 0 0 var(--s4); }
.loc svg { display: block; width: 100%; height: auto; background: var(--paper-2); }
.loc figcaption { margin-top: var(--s2); color: var(--ink-4); font-size: 0.8125rem; }
.dots circle { fill: var(--dot); }
.countrymap .dots circle { fill: var(--accent); fill-opacity: 0.55; }
.grat line { stroke: var(--accent); stroke-width: 0.6; stroke-opacity: 0.35; }
.here .pin { fill: var(--accent); }
.here .ring { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.here { transform-box: fill-box; transform-origin: center; animation: grow 240ms ease-out both; }
@keyframes grow { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
.scale line { stroke: var(--ink-3); stroke-width: 1.2; }
.scale text { fill: var(--ink-3); font: 500 10px Archivo, sans-serif; paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px; stroke-linejoin: round; }
.scale line { paint-order: stroke; }
@media (prefers-reduced-motion: reduce) { .here { animation: none; } }

/* ── facts */
.facts { margin: 0 0 var(--s2); display: grid; }
.facts > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--rule); }
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-3); font-size: 0.9375rem; }
.facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts.wide > div { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
@media (min-width: 560px) { .facts.wide > div { grid-template-columns: 12rem minmax(0, 1fr); gap: var(--s4); } }

.src { color: var(--ink-4); font-size: 0.8125rem; line-height: 1.45; margin: var(--s3) 0 0; }
.src a { color: var(--ink-3); }
.empty, .loading { color: var(--ink-3); }

/* ── sections */
.summary { padding-top: var(--s5); }
.summary p { font-size: 1.0625rem; }
.summary .src { font-size: 0.8125rem; }
.lead-img { margin: 0 0 var(--s4); }
.lead-img img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: cover; background: var(--paper-2); }
.lead-img figcaption { font-size: 0.8125rem; margin-top: var(--s1); }
.lead-img figcaption a { color: var(--ink-4); }

.mod { padding-top: var(--s7); }
/* reserve roughly the loaded height so sections do not shove the page while scrolling */
#weather .mod-body { min-height: 440px; }
#climate .mod-body { min-height: 300px; }
#air .mod-body { min-height: 150px; }
.mod h2 { font-weight: 700; font-variation-settings: "wdth" 112; font-size: 1.125rem; margin-bottom: var(--s3); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-top: 1px solid var(--rule); }
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
.rows a { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding: var(--s2) 0; text-decoration: none; color: var(--ink); }
.rows a:hover .nm { text-decoration: underline; text-underline-offset: 0.18em; }
.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist { flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
@media (min-width: 560px) {
  .rows.cols { columns: 2; column-gap: var(--s6); }
  .rows.cols > li { break-inside: avoid; }
  .rows.cols > li:last-child { border-bottom: 0; }
}
.deeper li { padding: var(--s1) 0 var(--s3); }
.deeper li a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }
.deeper li span { display: block; color: var(--ink-3); font-size: 0.9375rem; margin-top: var(--s1); }

details.region { border-top: 1px solid var(--rule); }
details.region:last-of-type { border-bottom: 1px solid var(--rule); }
details.region > summary { display: flex; justify-content: space-between; align-items: center; min-height: 48px; cursor: pointer; list-style: none; color: var(--ink); font-weight: 600; }
details.region > summary::-webkit-details-marker { display: none; }
details.region > summary::before { content: ""; width: 7px; height: 7px; margin-right: var(--s3); border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform 160ms ease-out; flex: none; }
details.region[open] > summary::before { transform: rotate(45deg); }
details.region > summary span:first-of-type { flex: 1; }
details.region .rows { margin-bottom: var(--s3); }
details.region .rows > li:first-child { border-top: 0; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); border: 1px solid var(--rule); border-radius: var(--r-chip); text-decoration: none; color: var(--ink); }
.chips a:hover { background: var(--accent-bg); border-color: var(--accent-bg); }

.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); font: inherit; font-weight: 600; color: var(--accent); background: transparent; border: 1px solid var(--accent); border-radius: var(--r-ctl); cursor: pointer; touch-action: manipulation; }
.btn:hover { background: var(--accent-bg); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ── weather */
.now { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s4); align-items: baseline; margin-bottom: var(--s4); }
.now .t { font-weight: 720; font-variation-settings: "wdth" 110; font-size: 3rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; grid-row: span 2; }
.now .what { color: var(--ink); font-weight: 600; }
.now .more { color: var(--ink-3); font-size: 0.9375rem; }
.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 2.6rem 5.2rem 2.6rem; align-items: center; gap: var(--s2); min-height: 40px; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.days li:last-child { border-bottom: 1px solid var(--rule); }
.days .d { color: var(--ink); font-weight: 600; }
.days .w { color: var(--ink-3); font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days .lo { color: var(--ink-3); text-align: right; }
.days .hi { color: var(--ink); text-align: left; }
.days .bar { position: relative; height: 4px; background: var(--paper-2); border-radius: 2px; }
.days .bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--warm); }
.days .rain { grid-column: 2; }
.sun { margin: var(--s3) 0 0; color: var(--ink-3); font-size: 0.9375rem; }

/* ── climate chart */
.clim svg { display: block; width: 100%; height: auto; }
.clim .rng { stroke: var(--warm); stroke-width: 7; stroke-linecap: round; }
.clim .pr { fill: var(--wet); fill-opacity: 0.35; }
.clim text { fill: var(--ink-3); font: 500 10px Archivo, sans-serif; }
.clim .lbl { fill: var(--ink); font-weight: 600; }
.clim .axis { stroke: var(--rule); }
.clim-key { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s2) 0 0; color: var(--ink-3); font-size: 0.8125rem; }
.clim-key i { display: inline-block; width: 12px; height: 7px; margin-right: 6px; vertical-align: middle; border-radius: 4px; }

/* ── air */
.aq { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.aq .sw { width: 14px; height: 14px; border-radius: 0; flex: none; box-shadow: inset 0 0 0 1px var(--rule); }
.aq .band { color: var(--ink); font-weight: 700; font-size: 1.25rem; font-variation-settings: "wdth" 110; }
.aq .idx { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pollutants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s5); margin: 0; }
.pollutants > div { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.pollutants dt { color: var(--ink-3); }
.pollutants dd { margin: 0; color: var(--ink); }

/* ── events / wiki */
.ev a, .wk a { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
.ev .nm, .wk .nm { white-space: normal; }
.ev small, .wk small { color: var(--ink-3); font-size: 0.875rem; }
.wk a { flex-direction: row; align-items: center; gap: var(--s3); }
.wk .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wk img { width: 48px; height: 48px; object-fit: cover; flex: none; background: var(--paper-2); }

/* ── home */
.hero { padding: var(--s7) 0 var(--s5); max-width: 40rem; }
.hero h1 { font-weight: 780; font-variation-settings: "wdth" 118; font-size: clamp(2.25rem, 8.4vw, 4rem); line-height: 0.98; letter-spacing: -0.01em; }
.lede { margin: var(--s4) 0 var(--s5); font-size: 1.125rem; color: var(--ink-2); max-width: 36rem; }
.near-me { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: var(--s4) 0 0; }
.near-status { color: var(--ink-3); font-size: 0.9375rem; }
.world { margin: var(--s4) calc(-1 * var(--gutter)) 0; }
.world-map { position: relative; cursor: crosshair; touch-action: manipulation; }
.world-map img { display: block; width: 100%; height: auto; }
.world figcaption { margin: var(--s2) var(--gutter) 0; color: var(--ink-4); font-size: 0.8125rem; }
.world-pick { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent); pointer-events: none; box-shadow: 0 0 0 4px var(--accent-bg); }
@media (min-width: 880px) { .world { margin-left: 0; margin-right: 0; } .world figcaption { margin-left: 0; } }

.prose { max-width: 68ch; padding-top: var(--s7); }
.prose h1 { font-weight: 780; font-variation-settings: "wdth" 118; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; margin-bottom: var(--s4); }
.prose h2 { font-weight: 700; font-variation-settings: "wdth" 112; font-size: 1.125rem; margin: var(--s6) 0 var(--s3); }
.nowrap { white-space: nowrap; }
details.more > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { color: var(--ink-3); }
