:root {
  --accent: #1d9e75;
  --accent2: #d85a30;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface2: #f3f6f9;
  --text: #1a2129;
  --text-muted: #5f6b76;
  --text-faint: #9aa6b1;
  --border: rgba(0,0,0,0.08);
  --shadow: 0 1px 3px rgba(0,0,0,0.07);
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #0e1318;
  --surface: #171f27;
  --surface2: #1e2832;
  --text: #e6edf3;
  --text-muted: #9aa7b3;
  --text-faint: #5e6b77;
  --border: rgba(255,255,255,0.09);
  --shadow: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 22px 18px 40px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.topbar .loc { font-size: 21px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar .sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.theme-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; width: 42px; height: 42px; cursor: pointer; font-size: 19px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.hero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.hero .eyebrow { font-size: 14px; color: var(--hero-fg-muted, var(--text-muted)); }
.hero .temp { font-size: 58px; font-weight: 600; line-height: 1; margin-top: 4px; color: var(--hero-fg, var(--text)); }
.hero .feels { font-size: 14px; color: var(--hero-fg-muted, var(--text-muted)); margin-top: 8px; }

/* ---- sky states ---------------------------------------------------------
   A weather-driven backdrop on the hero only. The state is classified on the
   Pi (data.json "sky") and applied as a class here; with no class the hero
   falls back to the plain surface exactly as before.

   Layer order matters: sky 0, horizon 1, scrim 2, content 3. The hero keeps
   its own opaque background underneath as the no-sky fallback, which is why
   none of these can use a negative z-index. */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero.has-sky::before {
  content: ""; position: absolute; inset: 0; z-index: 0; background: var(--sky);
}
/* downland horizon with the cathedral spire, recoloured per state */
.hero.has-sky::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%; z-index: 1;
  background: var(--sky-horizon, rgba(18,26,34,.82)); opacity: var(--sky-horizon-op, .9);
  -webkit-mask-image: var(--sky-sil); mask-image: var(--sky-sil);
  -webkit-mask-size: cover; mask-size: cover;
  -webkit-mask-position: bottom; mask-position: bottom;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  --sky-sil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 260' preserveAspectRatio='none'%3E%3Cpath d='M0,260 V204 C80,192 180,198 276,196 C350,194 414,198 462,198 L462,156 L470,153 L478,98 L486,153 L494,156 L494,198 C556,198 612,190 692,184 C822,174 952,186 1082,180 C1132,178 1172,182 1200,184 V260 Z' fill='%23000'/%3E%3C/svg%3E");
}
.hero > * { position: relative; z-index: 3; }
.hero-scrim {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg,
    rgba(0,0,0,var(--scrim,.44)) 0%,
    rgba(0,0,0,calc(var(--scrim,.44) * .72)) 42%,
    rgba(0,0,0,calc(var(--scrim,.44) * .18)) 78%,
    rgba(0,0,0,0) 100%);
}
/* Text colour follows the BACKGROUND's luminance, not the light/dark theme:
   a dark-mode visitor still needs dark type over fog. */
.hero.on-dark { --hero-fg: #ffffff; --hero-fg-muted: rgba(255,255,255,.84); }
.hero.on-dark .temp { text-shadow: 0 1px 12px rgba(0,0,0,.34); }
.hero.on-pale { --hero-fg: #12181f; --hero-fg-muted: rgba(18,24,31,.74); }
.hero.on-pale .temp { text-shadow: 0 1px 10px rgba(255,255,255,.5); }
.hero-glyph { font-size: 64px; line-height: 1; color: var(--hero-fg, var(--accent2)); }
.hero.has-sky .hero-glyph { filter: drop-shadow(0 2px 10px rgba(0,0,0,.35)); }

.sky-day    { --sky: linear-gradient(178deg,#4b93d8 0%,#79b4e4 46%,#b9d9ef 78%,#dcebf6 100%); --scrim: .42; }
.sky-golden { --sky: linear-gradient(176deg,#2f3f6b 0%,#7a5a86 30%,#d1795e 62%,#f0a959 84%,#f7c877 100%); --scrim: .40; }
.sky-night  {
  --sky: radial-gradient(1.4px 1.4px at 12% 22%,#fff,transparent),
         radial-gradient(1.6px 1.6px at 31% 12%,#fff,transparent),
         radial-gradient(1.2px 1.2px at 48% 30%,#e8eeff,transparent),
         radial-gradient(1.5px 1.5px at 66% 16%,#fff,transparent),
         radial-gradient(1.1px 1.1px at 79% 34%,#dce6ff,transparent),
         radial-gradient(1.7px 1.7px at 89% 20%,#fff,transparent),
         radial-gradient(1.2px 1.2px at 22% 40%,#cfdcff,transparent),
         linear-gradient(179deg,#070d1c 0%,#101a35 44%,#1e2c4e 76%,#33436a 100%);
  --scrim: .30; --sky-horizon: rgba(4,8,12,.92);
}
.sky-rain   {
  --sky: repeating-linear-gradient(74deg,rgba(255,255,255,.20) 0 1px,transparent 1px 7px),
         linear-gradient(177deg,#3c4650 0%,#525d69 40%,#6c7883 72%,#87929c 100%);
  --scrim: .44;
}
.sky-fog    {
  --sky: radial-gradient(120% 65% at 50% 88%,rgba(255,255,255,.94) 0%,rgba(255,255,255,.55) 45%,transparent 72%),
         linear-gradient(178deg,#9fa9ad 0%,#bcc4c6 48%,#d8dcdb 100%);
  --scrim: .10; --sky-horizon-op: .30;
}
.sky-frost  {
  --sky: radial-gradient(115% 70% at 62% 8%,rgba(255,241,214,.62) 0%,transparent 52%),
         linear-gradient(177deg,#8fb2cf 0%,#b6cfe0 42%,#dfeaf0 76%,#eef4f6 100%);
  --scrim: .12;
}
@media (prefers-reduced-motion: no-preference) {
  .sky-rain::before { animation: skyRain 0.62s linear infinite; }
  @keyframes skyRain { to { background-position: 0 24px, 0 0; } }
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 17px;
}
.card .label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 25px; font-weight: 600; margin-top: 6px; }
.card .meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.card.await { opacity: 0.5; }

/* High and low given equal visual weight -- previously the high was the card's
   value and the low was demoted to a meta line, which read as one statistic
   with a footnote rather than a pair. */
.hilo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 7px; }
.hilo-k { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.hilo-hi { color: var(--accent2); }
.hilo-lo { color: #378ADD; }              /* the dew-point blue already used in the charts */
.hilo-v { font-size: 21px; font-weight: 600; margin-top: 3px; }
.hilo-t { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.wind-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.wind-dial { width: 72px; height: 72px; flex: none; }
.wind-ring { fill: none; stroke: rgba(128,128,128,0.35); stroke-width: 2; }
.wind-pt { font-size: 11px; fill: var(--text-faint); text-anchor: middle; }
.wind-needle { transform-box: fill-box; transform-origin: center; transition: transform 0.6s ease; }
.wind-arrow { fill: var(--accent2); }
.wind-arrow-tail { fill: var(--text-faint); opacity: 0.5; }
.wind-readout .value { font-size: 21px; }

/* Barometer dial. Deliberately mirrors the wind compass above so the two
   instrument cards read as a pair. Scale runs 960-1060 hPa over 270 degrees
   (station range is 994-1053), which puts 1010 straight up.

   No numbers on the face: at 72px they'd be illegible, and unlike wind
   direction the exact value is already spelled out in the readout beside it.
   The dial's job is position-within-range and rate of change. */
.baro-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.baro-dial { width: 72px; height: 72px; flex: none; }
.baro-ring { fill: none; stroke: rgba(128,128,128,0.35); stroke-width: 2; }
.baro-tick { stroke: var(--text-faint); stroke-width: 1.4; opacity: 0.55; }
.baro-tick-maj { stroke-width: 2; opacity: 0.9; }
.baro-hub { fill: var(--text-faint); }
/* view-box (not fill-box): these hands are asymmetric about the hub, so their
   own bounding-box centre is NOT the dial centre -- they must pivot on 40,40. */
.baro-hand { transform-box: view-box; transform-origin: 40px 40px; transition: transform 0.6s ease; }
.baro-arrow { fill: var(--accent2); }
/* the set hand is a memory of 3h ago, so it recedes */
.baro-set-arrow { fill: var(--text-faint); opacity: 0.6; }   /* readable at 72px, still clearly secondary */
.baro-readout .value { font-size: 21px; }
/* the sweep from set hand to live hand: green rising (fair), amber falling
   (unsettled) -- the direction is also carried by the arrowhead, so the colour
   is reinforcement rather than the only signal */
.baro-trend { fill: none; stroke-width: 3; stroke-linecap: round; transition: stroke 0.3s ease; }
.baro-trend-rising  { stroke: var(--accent); }
.baro-trend-falling { stroke: var(--accent2); }
.baro-trend-tip.baro-trend-rising  { fill: var(--accent); stroke: none; }
.baro-trend-tip.baro-trend-falling { fill: var(--accent2); stroke: none; }

/* Moon phase, drawn to the real illuminated fraction rather than picked from a
   set of eight icons: the lit region is the disc's limb on one side and an
   ellipse terminator on the other, which is what the phase actually looks like. */
.moon-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.moon-dial { width: 72px; height: 72px; flex: none; }
/* Fixed colours, not theme tokens: the unlit limb is dark and the lit limb is
   bright in BOTH themes, because that's what a moon looks like. Using
   --surface2 for the shadow made it #f3f6f9 in light mode -- indistinguishable
   from the lit side, so the phase vanished. */
.moon-dark { fill: #2b3542; }
.moon-lit { fill: #eef1f7; }
.moon-edge { fill: none; stroke: rgba(128,128,128,0.45); stroke-width: 1.5; }
.moon-readout .value { font-size: 16px; }
/* full card width, below the dial: it's a sentence, and squeezing it into the
   ~140px beside a 72px dial would wrap it to three lines */
.moon-next { margin-top: 9px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.panel h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.ph {
  background: var(--surface2); border-radius: 10px; aspect-ratio: 16 / 9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-faint); font-size: 13px;
}
.radar-map { position: relative; height: 340px; border-radius: 10px; overflow: hidden; }
.radar-max-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1001;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.radar-max-btn:hover { color: var(--accent); border-color: var(--accent); }
.radar-bar {
  position: absolute; bottom: 10px; left: 10px; z-index: 1001;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px 10px 3px 4px;
}
.radar-play {
  width: 26px; height: 26px; padding: 0; cursor: pointer; background: transparent; border: none;
  color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.radar-play:hover { color: var(--accent); }
.radar-time-ov { font-size: 12px; color: var(--text-muted); min-width: 84px; }
.webcam-wrap { position: relative; }
.webcam-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }
.webcam-max {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.webcam-max:hover { color: var(--accent); border-color: var(--accent); }
.webcam-lightbox {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center; padding: 2vmin;
}
.webcam-lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 6px; }
.webcam-loading { color: #fff; font-size: 14px; opacity: 0.85; }
.webcam-time {
  position: absolute; bottom: 8px; left: 10px; z-index: 2;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px;
}
.webcam-time-lb {
  position: absolute; bottom: 16px; left: 16px;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 13px; padding: 4px 10px; border-radius: 6px;
}
.webcam-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; cursor: pointer;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.3); color: #fff;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.radar-toggle {
  margin-left: auto; background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; width: 28px; height: 28px; padding: 0;
  cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.radar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.radar-time { font-size: 12px; font-weight: 400; color: var(--text-muted); min-width: 56px; text-align: right; }
.leaflet-container { background: var(--surface2); font: inherit; }
/* Leaflet needs content-box; the global border-box above breaks tile sizing (blank map) */
.leaflet-container, .leaflet-container * { box-sizing: content-box; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin-top: 16px; }
.chart-card { margin-top: 16px; }
.panel-wide { grid-column: 1 / -1; }   /* full-width row: day bars read better wide than boxed in a column */
.chart-box { position: relative; width: 100%; height: 240px; }
/* ---- article pages (about, records) ------------------------------------- */
.prose { margin-top: 16px; line-height: 1.65; }
.prose + .prose { margin-top: 14px; }
.prose h1 { font-size: 25px; margin: 0 0 14px; letter-spacing: -.015em; }
.prose h2 { font-size: 18px; margin: 26px 0 10px; letter-spacing: -.01em; }
.prose h2:first-of-type { margin-top: 4px; }
.prose h3 { font-size: 15px; margin: 20px 0 8px; color: var(--text-muted); }
.prose p { margin: 0 0 13px; max-width: 68ch; color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: var(--surface2); padding: .12em .4em; border-radius: 5px;
}
.facts { border-collapse: collapse; width: 100%; max-width: 520px; font-size: 14px; }
.facts th, .facts td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--border); }
.facts th { font-weight: 600; width: 42%; color: var(--text-muted); }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts .muted { color: var(--text-faint); }
.report-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.report-list a {
  display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface2);
}
.report-list a:hover { border-color: var(--accent); }
.nav-links { margin-bottom: 10px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.nav-links a { font-weight: 600; }

.foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.foot-note { margin: 8px 0 12px; }

/* ---- contact ------------------------------------------------------------ */
.contact-btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 4px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.contact-btn:hover { border-color: var(--accent); color: var(--accent); }
.contact-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.contact-dlg {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text);
  width: min(460px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.contact-dlg::backdrop { background: rgba(8,12,18,.55); }
.contact-dlg form { padding: 20px 22px 18px; text-align: left; }
.contact-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-head h2 { font-size: 17px; margin: 0; }
.contact-x {
  background: none; border: 0; cursor: pointer; color: var(--text-faint);
  font-size: 18px; line-height: 1; padding: 2px;
}
.contact-x:hover { color: var(--text); }
.contact-intro { font-size: 13.5px; color: var(--text-muted); margin: 8px 0 16px; line-height: 1.5; }
.contact-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.contact-opt { font-weight: 400; color: var(--text-faint); }
.contact-dlg textarea, .contact-dlg input[type="email"] {
  font: inherit; font-size: 14px; width: 100%; margin-bottom: 14px;
  padding: 9px 11px; border-radius: 9px; resize: vertical;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
}
.contact-dlg textarea:focus, .contact-dlg input[type="email"]:focus {
  outline: none; border-color: var(--accent);
}
/* off-screen rather than display:none -- some bots skip hidden fields */
.contact-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-status { font-size: 13px; min-height: 19px; margin-bottom: 10px; }
.contact-status.err { color: var(--accent2); }
.contact-status.ok { color: var(--accent); font-weight: 600; }
.contact-actions { display: flex; justify-content: flex-end; gap: 9px; }
.contact-actions button {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  padding: 9px 17px; border-radius: 9px; border: 1px solid var(--border);
}
.contact-cancel { background: var(--surface2); color: var(--text-muted); }
.contact-send { background: var(--accent); border-color: var(--accent); color: #fff; }
.contact-send[disabled] { opacity: .55; cursor: default; }
.contact-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.accent { color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
@media (max-width: 520px) {
  .hero .temp { font-size: 46px; }
  .wrap { padding: 16px 12px 32px; }
  /* Two metric cards per row. auto-fit's 220px floor needs ~454px to hold two
     columns, so on a phone it collapses to one and wastes half the width.
     minmax(0,...) not minmax(auto,...): the wind dial and the sun/moon string
     would otherwise force a column wider than its share and overflow the page. */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 13px 14px; }
  .card .value { font-size: 21px; }
  /* dial + readout share a half-width card, so both have to give a little */
  .wind-row, .baro-row, .moon-row { gap: 10px; }
  .wind-dial, .baro-dial, .moon-dial { width: 54px; height: 54px; }
  /* .charts/.panels floors (360px/300px) can't shrink below themselves, so on a
     narrow phone the track overflows its container and the page scrolls
     sideways (360px-wide Androids and the 320px SE). They already render as a
     single column at this width, so dropping the floor changes nothing visually. */
  .charts, .panels { grid-template-columns: minmax(0, 1fr); }
  /* a canvas reports its pixel width as min-content, which a bare 1fr track
     (really minmax(auto,1fr)) refuses to shrink past -- hence minmax(0,...)
     above and the belt-and-braces cap here. */
  .chart-box, .chart-box canvas { max-width: 100%; }
}
