:root {
  --night: #18222d;      /* page */
  --panel: #1f2c39;      /* sidebar, bars */
  --raised: #283849;     /* inputs, hover */
  --line: #34485c;
  --text: #eaf0f5;
  --muted: #93a6b8;
  --chosen-bg: #eaf0f5;  /* the selected option inverts */
  --chosen-text: #18222d;
  /* NWS hazard colours, softened a little for a dark page */
  --warning: #ef5350;
  --watch: #f5a524;
  --advisory: #e3c94f;
  --statement: #6ca6e0;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* ---- top bar ---- */
.top {
  height: 56px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--gutter);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.search { position: relative; display: flex; gap: 6px; flex: 0 1 380px; }
.search input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 18px;
}
.search input::placeholder { color: var(--muted); }
.icon-button {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  background: var(--raised); border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.icon-button:hover { border-color: var(--muted); }
.icon-button[aria-pressed="true"] { background: var(--chosen-bg); color: var(--chosen-text); border-color: var(--chosen-bg); }
.results {
  position: absolute; z-index: 2000; top: 42px; left: 0; right: 84px;
  margin: 0; padding: 4px; list-style: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .45);
}
.results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: var(--chosen-bg); color: var(--chosen-text); }
.results .empty { color: var(--muted); cursor: default; }
.results .empty:hover { background: none; color: var(--muted); }

.views { display: flex; gap: 2px; margin-left: auto; background: var(--raised); border-radius: 18px; padding: 3px; }
.views button {
  border: 0; background: none; padding: 6px 14px; border-radius: 15px; cursor: pointer; color: var(--muted);
}
.views button[aria-selected="true"] { background: var(--chosen-bg); color: var(--chosen-text); font-weight: 600; }

/* ---- main layout: the picture, then the written report ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  height: calc(100dvh - 56px);
}
.stage { position: relative; min-height: 0; background: #0e151c; }
.view { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #0e151c; }

/* ---- map overlays ---- */
.map-controls {
  position: absolute; z-index: 1000; top: 12px; left: 56px; right: 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  pointer-events: none;
}
.map-controls > * { pointer-events: auto; }
.switch, .segmented {
  display: flex; align-items: center;
  margin: 0; padding: 3px; border: 0;
  background: rgb(31 44 57 / .92); border-radius: 18px;
  box-shadow: 0 2px 10px rgb(0 0 0 / .35);
}
.switch { gap: 8px; padding: 3px 12px 3px 10px; height: 36px; cursor: pointer; }
.switch input { width: 16px; height: 16px; margin: 0; accent-color: #02c501; cursor: pointer; }
.segmented legend { float: left; padding: 0 8px 0 10px; color: var(--muted); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 11px; border-radius: 15px; color: var(--muted); }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--chosen-bg); color: var(--chosen-text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 1px; }
.hint {
  max-width: 560px; margin: 0; padding: 6px 12px; border-radius: 10px;
  background: rgb(31 44 57 / .92); box-shadow: 0 2px 10px rgb(0 0 0 / .35);
  color: var(--text); font-size: 13px;
}
.map-controls .hint { flex-basis: auto; }
.map-controls::after { content: ""; flex-basis: 100%; order: 1; }  /* the hint always starts a new row */
.hint { order: 2; }
.hint:empty { display: none; }
.hint { transition: opacity .8s, visibility .8s; }
.hint.faded { opacity: 0; visibility: hidden; }

.legend {
  position: absolute; z-index: 1000; left: 12px; bottom: 84px; width: 236px;
  padding: 8px 10px 6px; border-radius: 10px;
  background: rgb(31 44 57 / .92); box-shadow: 0 2px 10px rgb(0 0 0 / .35);
  font-size: 12px; color: var(--muted);
}
/* NWS reflectivity colours, 5 to 75 dBZ in 5 dBZ steps */
.ramp {
  height: 8px; border-radius: 4px;
  background: linear-gradient(to right,
    #04e9e7 0 7.1%, #019ff4 0 14.3%, #0300f4 0 21.4%, #02fd02 0 28.6%, #01c501 0 35.7%,
    #008e00 0 42.9%, #fdf802 0 50%, #e5bc00 0 57.1%, #fd9500 0 64.3%, #fd0000 0 71.4%,
    #d40000 0 78.6%, #bc0000 0 85.7%, #f800fd 0 92.9%, #9854c6 0);
}
/* RainViewer's only free scheme, "Universal Blue", 5 to 65 dBZ */
.rainviewer .ramp {
  background: linear-gradient(to right,
    #928871 0 7.7%, #cec087 0 15.4%, #88ddee 0 23.1%, #00a3e0 0 30.8%, #0077aa 0 38.5%, #005588 0 46.2%,
    #ffee00 0 53.8%, #ffaa00 0 61.5%, #ff4400 0 69.2%, #c10000 0 76.9%, #ffaaff 0 84.6%, #ff77ff 0 92.3%, #ffffff 0);
}
.ramp-labels { display: flex; justify-content: space-between; margin-top: 3px; }

.timeline {
  position: absolute; z-index: 1000; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 8px 8px; border-radius: 14px;
  background: rgb(31 44 57 / .94); box-shadow: 0 2px 14px rgb(0 0 0 / .4);
}
.play {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--chosen-bg); color: var(--chosen-text); cursor: pointer;
}
.play svg { width: 20px; height: 20px; fill: currentColor; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.scrub { flex: 1; min-width: 0; }
.scrub input[type="range"] { width: 100%; margin: 0; accent-color: var(--chosen-bg); cursor: pointer; }
.when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 2px; }
.when strong { font-size: 17px; font-weight: 650; }
.when span { color: var(--muted); font-size: 13px; }
.loop-length select, .closeup-bar select {
  height: 34px; padding: 0 8px; background: var(--raised);
  border: 1px solid var(--line); border-radius: 8px;
}

.leaflet-container { font: inherit; }
.relief { opacity: .16 !important; }
.leaflet-labels-pane { filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 2px rgb(0 0 0 / .8)); }
.leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--raised); color: var(--text); }
.leaflet-control-attribution {
  background: rgb(24 34 45 / .8) !important; color: var(--muted);
  font-size: 11px; max-width: 60%;
}
.leaflet-control-attribution a { color: var(--text); }
.leaflet-bottom { bottom: 76px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content strong { display: block; margin-bottom: 2px; }
/* hurricanes and tropical storms */
.storm-point { display: flex; align-items: center; }
.storm-dot {
  flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  color: #18222d; font-size: 11px; font-weight: 750; line-height: 1;
  border: 2px solid #18222d; box-shadow: 0 0 0 1px rgb(234 240 245 / .7);
}
.storm-dot.now { width: 26px; height: 26px; font-size: 13px; box-shadow: 0 0 0 2px #eaf0f5, 0 0 12px rgb(0 0 0 / .6); }
.storm-label {
  margin-left: 6px; padding: 1px 6px; border-radius: 6px; white-space: nowrap;
  background: rgb(24 34 45 / .85); color: var(--text); font-size: 13px; font-weight: 650;
}
.here {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--night); box-shadow: 0 0 0 2px var(--text);
}

/* ---- satellite close-up ---- */
#view-closeup { display: flex; flex-direction: column; }
.closeup-bar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted);
}
.closeup-bar label { display: flex; align-items: center; gap: 8px; }
.closeup-bar select { color: var(--text); }
.closeup-figure { position: relative; flex: 1; min-height: 0; margin: 0 0 84px; }
.closeup-figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.closeup-figure img:not([src]) { visibility: hidden; }
.closeup-figure figcaption {
  position: absolute; top: 12px; left: 12px; color: var(--muted); font-size: 13px;
  text-shadow: 0 1px 3px rgb(0 0 0 / .9);
}

/* ---- the written report ---- */
.report {
  overflow-y: auto; padding: 20px var(--gutter) 24px;
  background: var(--panel); border-left: 1px solid var(--line);
}
.place { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.place h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.text-button {
  padding: 0; border: 0; background: none; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.text-button:hover { color: var(--text); }
.home-tag { margin: 0; color: var(--muted); }

.now { margin-top: 10px; }
.reading { display: flex; align-items: flex-start; gap: 16px; }
.temp {
  font-size: 88px; line-height: .9; font-weight: 200; letter-spacing: -.04em;
}
.temp sup { font-size: .42em; font-weight: 300; vertical-align: .95em; margin-left: 2px; letter-spacing: 0; }
.sky { padding-top: 8px; }
.sky p { margin: 0; }
.sky .desc { font-size: 19px; font-weight: 550; }
.sky .feels { color: var(--muted); }
.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px;
  margin: 16px 0 0; padding: 12px 0; border-block: 1px solid var(--line);
}
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; font-size: 15px; font-weight: 550; white-space: nowrap; }
.rain-today { margin-top: 14px; }
.rain-today p { margin: 0; }
.rain-total { display: flex; align-items: baseline; gap: 10px; }
.rain-total span { color: var(--muted); }
.rain-total b { font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--statement); }
.rain-note { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.source { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.problem { color: var(--muted); }

.alerts:empty { display: none; }
.alerts { margin-top: 18px; display: grid; gap: 8px; }
.alert {
  border-radius: 10px; background: var(--raised);
  border-left: 5px solid var(--statement);
}
.alert.warning { border-left-color: var(--warning); }
.alert.watch { border-left-color: var(--watch); }
.alert.advisory { border-left-color: var(--advisory); }
.alert summary { padding: 10px 12px; cursor: pointer; list-style: none; }
.alert summary::-webkit-details-marker { display: none; }
.alert summary strong { display: block; font-size: 16px; }
.alert summary span { color: var(--muted); font-size: 13px; }
.alert .body { padding: 0 12px 12px; font-size: 13.5px; white-space: pre-line; }
.alert .body p { margin: 0 0 8px; }

.report h2 { margin: 24px 0 8px; font-size: 15px; font-weight: 650; }
.storm-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.storm-list > li { border-radius: 10px; background: var(--raised); }
.storm-list > li.source { background: none; margin: 0; }
.storm {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px 4px;
  border: 0; background: none; text-align: left; cursor: pointer;
}
.storm .storm-dot { width: 26px; height: 26px; font-size: 13px; margin-top: 1px; }
.storm-text { display: grid; min-width: 0; }
.storm-text strong { font-size: 16px; }
.storm-text span { color: var(--muted); font-size: 13px; }
.storm:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.storm-links { display: flex; gap: 14px; margin: 0; padding: 2px 12px 10px 48px; font-size: 13px; }
.storm-links a { color: var(--muted); }
.storm-links a:hover { color: var(--text); }
.hour-strip {
  display: flex; gap: 2px; margin: 0; padding: 0 0 8px; list-style: none;
  overflow-x: auto; scrollbar-width: thin;
}
.hour-strip li {
  position: relative;  /* keeps the screen-reader text inside the scrolling strip */
  flex: none; width: 54px; padding: 8px 0 6px; border-radius: 8px; text-align: center;
  background: var(--night);
}
.hour-strip .t { color: var(--muted); font-size: 12.5px; }
.hour-strip .icon { display: block; font-size: 20px; line-height: 28px; }
.hour-strip .deg { font-weight: 600; }
.hour-strip .wet { display: block; height: 18px; font-size: 12px; color: #4fc3f7; }

.day-list { margin: 0; padding: 0; list-style: none; }
.day-list li { border-top: 1px solid var(--line); }
.day-list details > summary {
  display: grid; grid-template-columns: 44px 28px minmax(0, 1fr) 36px 72px; align-items: center; gap: 8px;
  padding: 9px 0; cursor: pointer; list-style: none;
}
.day-list summary::-webkit-details-marker { display: none; }
.day-list .dname { font-weight: 600; }
.day-list .icon { font-size: 20px; text-align: center; }
.day-list .short { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-list .wet { color: #4fc3f7; font-size: 13px; text-align: right; }
.day-list .hilo { text-align: right; }
.day-list .hilo .lo { color: var(--muted); margin-left: 6px; }
.day-list .detail { margin: 0 0 12px; font-size: 13.5px; color: var(--text); }
.day-list .detail p { margin: 0 0 6px; }
.day-list .detail b { font-weight: 600; }

.credits { margin-top: 28px; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---- narrow screens: picture on top, report below ---- */
@media (max-width: 900px) {
  .top { height: auto; flex-wrap: wrap; padding: 10px var(--gutter); gap: 10px; }
  .search { flex: 1 1 100%; }
  .views { margin-left: 0; flex: 1 1 100%; }
  .views button { flex: 1; }
  .layout { display: block; height: auto; }
  .stage { height: 68vh; min-height: 420px; }
  .report { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .map-controls { left: 52px; right: 8px; top: 8px; }
  .segmented legend { display: none; }
  .segmented span { padding: 6px 7px; font-size: 13.5px; white-space: nowrap; }
  .hint { font-size: 12.5px; }
  .legend { bottom: 92px; left: 8px; width: 200px; }
  .timeline { left: 8px; right: 8px; bottom: 8px; }
  .leaflet-bottom { bottom: 100px; }
  .leaflet-control-attribution { max-width: 100%; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .hint { transition: none; }
}
