/* ------------------------------------------------------------------
   "The page is the sky right now."
   CSS variables are written by JS on each tick based on solar position.
   Defaults below are a safe night palette so the page never flashes
   white before the first applyTheme().
------------------------------------------------------------------ */
:root {
  --sky-top:    #050614;
  --sky-mid:    #0a0e27;
  --sky-bot:    #1a1f3d;
  --fg:         #e6e1d2;
  --fg-muted:   #8a8b9c;
  --card-bg:    rgba(255, 255, 255, 0.04);
  --card-border:rgba(255, 255, 255, 0.10);
  --accent:     #f0d49a;
  --star-op:    1;
  --sun-fill:   #f0e6d8;
  --sun-glow:   #f0e6d8;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%,
                    var(--sky-bot) 0%, transparent 70%),
    linear-gradient(to bottom,
                    var(--sky-top) 0%,
                    var(--sky-mid) 55%,
                    var(--sky-bot) 100%);
  background-attachment: fixed;
  color: var(--fg);
  font-feature-settings: 'tnum' 1, 'kern' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: color 600ms ease;
  overflow-x: hidden;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* Staggered cascade fade on load */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
main > section, main > footer { animation: rise 700ms cubic-bezier(.2,.7,.2,1) both; }
main > section:nth-child(1) { animation-delay: 0ms; }
main > section:nth-child(2) { animation-delay: 60ms; }
main > section:nth-child(3) { animation-delay: 160ms; }
main > section:nth-child(4) { animation-delay: 260ms; }
main > section:nth-child(5) { animation-delay: 360ms; }
main > section:nth-child(6) { animation-delay: 460ms; }
main > section:nth-child(7) { animation-delay: 560ms; }
main > footer              { animation-delay: 660ms; }

/* ---- Sky + hero stack ----
   The hero (large temp + condition) sits on top of the sky band. The
   #sky SVG fills the wrapper and renders behind the hero text — the
   sun/moon arc visibly passes around the hero. Chrome (horizon line,
   sunrise/sunset labels, station/clock, landscape silhouette) sits at
   the bottom of the SVG, below the hero. */

/* Sizing/overflow/margins live in the consolidated .sky-hero-stack rule
   in the relayout section below — single source of truth. */
.sky-hero-stack {
  position: relative;
}

#sky {
  position: absolute;
  inset: 0;
  margin: 0 -.5rem;
  z-index: 0;
  pointer-events: none;
}
#sun-arc {
  width: 100%;
  height: 100%;
  display: block;
  color: var(--sun-fill);
}
#sun-arc .horizon {
  stroke: var(--fg-muted);
  stroke-opacity: 0.18;
  stroke-width: 1;
}
#sun-arc .arc {
  stroke: var(--fg-muted);
  stroke-opacity: 0.40;
  stroke-width: 1;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
  transition: d 800ms ease;
}
#sun-arc .arc-moon {
  /* Paler than the sun arc; visible only at night per the
     moon-group display rules below. */
  stroke-opacity: 0.22;
  stroke-dasharray: 1 6;
}
#sun-arc .moon-group .moon-shade {
  transition: d 600ms ease;
}
#sun-arc .landscape {
  fill: var(--fg-muted);
  fill-opacity: 0.12;
}
#sun-arc .sun-group {
  transition: transform 800ms ease, opacity 800ms ease;
}
#sun-arc .sun {
  fill: var(--sun-fill);
  transition: fill 800ms ease;
}
#sun-arc .sun-glow {
  color: var(--sun-glow);
  transition: opacity 800ms ease;
}
#sun-arc .sun-rays line {
  stroke: var(--sun-fill);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.85;
  transition: stroke 800ms ease;
}
[data-phase=night] #sun-arc .sun-rays,
[data-phase=dusk]  #sun-arc .sun-rays,
[data-phase=dawn]  #sun-arc .sun-rays { display: none; }

#sun-arc .moon-group { display: none; }
#sun-arc .arc-moon   { display: none; }
[data-phase=night] #sun-arc .moon-group,
[data-phase=dusk]  #sun-arc .moon-group,
[data-phase=dawn]  #sun-arc .moon-group { display: block; }
[data-phase=night] #sun-arc .arc-moon,
[data-phase=dusk]  #sun-arc .arc-moon,
[data-phase=dawn]  #sun-arc .arc-moon  { display: block; }
#sun-arc .moon-disk  { fill: #f5edd8; }
#sun-arc .moon-shade { fill: var(--sky-top); }

#sun-arc .stars circle {
  fill: #fff;
  opacity: calc(var(--star-op, 0) * 0.7);
  transition: opacity 1500ms ease;
}

/* =========================================================
 * Atmospheric overlay — drifting clouds, falling rain/snow,
 * lightning flashes, fog haze; gated by [data-condition].
 * ========================================================= */

#sun-arc .atmospheric-clouds,
#sun-arc .atmospheric-precip {
  display: none;
  opacity: 0;
  transition: opacity 700ms ease;
}

/* Clouds — show for any cloud-bearing category. */
[data-condition=partly_cloudy] #sun-arc .atmospheric-clouds,
[data-condition=cloudy]        #sun-arc .atmospheric-clouds,
[data-condition=overcast]      #sun-arc .atmospheric-clouds,
[data-condition=rain]          #sun-arc .atmospheric-clouds,
[data-condition=snow]          #sun-arc .atmospheric-clouds,
[data-condition=thunderstorm]  #sun-arc .atmospheric-clouds,
[data-condition=fog]           #sun-arc .atmospheric-clouds { display: block; opacity: 1; }

/* Precipitation container — shown only for rain/snow/thunderstorm. */
[data-condition=rain]         #sun-arc .atmospheric-precip,
[data-condition=snow]         #sun-arc .atmospheric-precip,
[data-condition=thunderstorm] #sun-arc .atmospheric-precip { display: block; opacity: 1; }

/* Within the container, show only the applicable precipitation type. */
[data-condition=rain]         #sun-arc #snow-flakes,
[data-condition=thunderstorm] #sun-arc #snow-flakes { display: none; }
[data-condition=snow]         #sun-arc #rain-streaks { display: none; }

/* Cloud base style — NO inline fill/stroke on the referenced <path>;
   styling delivered entirely via CSS so day/night palette swaps work. */
#sun-arc .cloud {
  fill: #f0e6d8;
  opacity: 0.70;
}
[data-condition=partly_cloudy] #sun-arc .cloud { opacity: 0.55; }
[data-condition=cloudy]        #sun-arc .cloud { opacity: 0.70; }
[data-condition=overcast]      #sun-arc .cloud { opacity: 0.85; }
[data-condition=rain]          #sun-arc .cloud { opacity: 0.80; }
[data-condition=snow]          #sun-arc .cloud { opacity: 0.78; }
[data-condition=thunderstorm]  #sun-arc .cloud { fill: #555a72; opacity: 0.88; }
[data-condition=fog]           #sun-arc .cloud { opacity: 0.50; }

/* Night palette for clouds — phase-driven palette swap. */
[data-phase=night] #sun-arc .cloud { fill: #2a304a; }
[data-phase=dusk]  #sun-arc .cloud { fill: #6a5775; }
[data-phase=dawn]  #sun-arc .cloud { fill: #b8927e; }

/* When overcast, dim the sun a touch — sky reads as covered. */
[data-condition=overcast] #sun-arc .sun-group { opacity: 0.4; }

/* Cloud drift — GPU-composited transform on the wrapping <g>. */
@keyframes cloud-drift {
  from { transform: translateX(-1100px); }
  to   { transform: translateX(0); }
}
#sun-arc .cloud-drift {
  animation: cloud-drift 90s linear infinite;
}

/* Fog haze — sits in the clouds layer; only visible when condition=fog. */
#sun-arc .fog-haze {
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 700ms ease;
}
[data-condition=fog] #sun-arc .fog-haze { opacity: 1; }

/* Rain — three parallax layers (far/mid/near). Each layer scales the
   wrapping <g> so streak length + line weight reads as depth without
   needing separate SVG content. --x is included in the keyframe so the
   column survives the Y transform; per-instance duration/delay set in JS. */
#sun-arc .rain-streak {
  animation: rain-fall 1.8s linear infinite;
}
#sun-arc .rain-streak line {
  stroke: rgba(180, 210, 230, 0.65);
  stroke-width: 1.1;
  stroke-linecap: round;
}
/* Layer tweaks: scale + opacity + line weight. */
#sun-arc .rain-far  { opacity: 0.35; }
#sun-arc .rain-far  line { stroke-width: 0.7; stroke: rgba(180, 210, 230, 0.45); }
#sun-arc .rain-mid  { opacity: 0.7; }
#sun-arc .rain-mid  line { stroke-width: 1.0; }
#sun-arc .rain-near { opacity: 1; }
#sun-arc .rain-near line { stroke-width: 1.4; stroke: rgba(195, 220, 235, 0.85); }
@keyframes rain-fall {
  from { transform: translate(var(--x, 0), -25px); }
  to   { transform: translate(var(--x, 0), 360px); }
}

/* Snow — three parallax layers. Near flakes drift wider via --drift. */
#sun-arc .snow-flake {
  animation: snow-fall 12s linear infinite;
}
#sun-arc .snow-flake circle {
  fill: rgba(255, 255, 255, 0.85);
}
#sun-arc .snow-far  { opacity: 0.5; }
#sun-arc .snow-far  circle { fill: rgba(255, 255, 255, 0.6); }
#sun-arc .snow-mid  { opacity: 0.8; }
#sun-arc .snow-near { opacity: 1; }
#sun-arc .snow-near circle { filter: drop-shadow(0 0 1.5px rgba(255,255,255,0.6)); }
@keyframes snow-fall {
  from { transform: translate(var(--x, 0), -20px); }
  50%  { transform: translate(calc(var(--x, 0) + var(--drift, 8px)), 170px); }
  to   { transform: translate(var(--x, 0), 360px); }
}

/* Lightning flash — fixed 12s cycle. */
#sun-arc .lightning {
  opacity: 0;
  pointer-events: none;
}
@keyframes lightning-flash {
  0%       { opacity: 0; }
  0.4%     { opacity: 0.65; }
  1.2%     { opacity: 0.10; }
  2.0%     { opacity: 0.50; }
  3.0%     { opacity: 0; }
  100%     { opacity: 0; }
}
[data-condition=thunderstorm] #sun-arc .lightning {
  animation: lightning-flash 12s infinite;
}
/* No night-specific lightning override needed: the flash inherits the
   daytime animation and already reads bright against the night sky. */

/* Reduced-motion: respect OS preference and freeze the overlay. */
@media (prefers-reduced-motion: reduce) {
  #sun-arc .cloud-drift,
  #sun-arc .rain-streak,
  #sun-arc .snow-flake,
  #sun-arc .lightning {
    animation: none !important;
  }
}

#sun-arc text {
  fill: var(--fg-muted);
  font-family: 'Geist', sans-serif;
  font-weight: 400;
}
#sun-arc .t-rise, #sun-arc .t-set {
  font-size: 13px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
#sun-arc .t-clock {
  fill: var(--fg);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

/* ---- Hero ---- */

#hero {
  text-align: center;
  /* top: positions text inside the arc bowl, below the arc apex
     (apex clamped to viewBox y=30..95, screen ~32..102px).
     bottom: keeps space for sky chrome (horizon line, sunrise/sunset
     labels, station/clock) at viewBox y=350..388. */
  padding: 9rem 0 4rem;
  position: relative;
  z-index: 2;                  /* sits on top of #sky */
}
.hero-temp {
  font-family: 'Geist', sans-serif;
  font-weight: 200;
  font-size: clamp(6rem, 16vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.hero-temp .hero-deg {
  font-size: 0.55em;
  vertical-align: 0.32em;
  opacity: 0.55;
  font-weight: 200;
  letter-spacing: 0;
}
.hero-condition {
  font-family: 'Geist', sans-serif;
  font-weight: 400;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  letter-spacing: 0.01em;
  color: var(--fg);
  opacity: 0.85;
  margin-top: 0.5rem;
}
.hero-feels {
  font-family: 'Geist', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--fg);
  opacity: 0.65;
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.hero-meta {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ---- Now strip ---- */

.now-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 2.25rem 0 2rem;
}
@media (max-width: 720px) {
  .now-strip { grid-template-columns: repeat(2, 1fr); }
}
.tile {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem 1.15rem 0.9rem;
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--fg) 18%, transparent);
}
.tile-label {
  font-size: 0.78rem; /* 0.68rem was below comfortable legibility on phones */
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.tile-value {
  font-family: 'Geist', sans-serif;
  font-weight: 300;
  font-size: 2rem;
  line-height: 1.05;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tile-unit {
  font-family: 'Geist', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-left: 0.3em;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.tile-extra {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ---- Forecast band ---- */

.forecast-band {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin: 2rem 0;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}
.fc-day {
  padding: 1rem 0.5rem;
  text-align: center;
  border-right: 1px solid var(--card-border);
  transition: background 220ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fc-day:last-child { border-right: none; }
.fc-day:hover { background: var(--card-bg); }
.fc-day .fc-name {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}
.fc-day .fc-icon {
  width: 44px;
  height: 44px;
  margin: 0.4rem 0;
  opacity: 0.95;
}
.fc-day .fc-icon img { width: 100%; height: 100%; display: block; }
.fc-day .fc-temp {
  font-family: 'Geist', sans-serif;
  font-weight: 300;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.fc-day .fc-hi { color: var(--fg); margin-right: 0.4em; }
.fc-day .fc-lo { color: var(--fg-muted); opacity: 0.65; font-weight: 300; }
.fc-day .fc-short {
  font-size: 0.7rem;
  color: var(--fg-muted);
  line-height: 1.35;
  min-height: 2.5em;
  margin-top: 0.25rem;
  font-weight: 400;
}

@media (max-width: 720px) {
  .forecast-band { grid-template-columns: repeat(4, 1fr); }
  .fc-day:nth-child(n+5) { display: none; }
}

/* Hourly forecast line charts — same card style as history-chart. */
#hourly-charts { margin: 0; }
#hourly-temp, #hourly-precip { height: 160px; max-height: 160px; }
@media (max-width: 720px) {
  #hourly-temp, #hourly-precip { height: 130px; max-height: 130px; }
}

/* ---- Section headings ---- */

h2 {
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 1rem;
}

/* ---- Radar ---- */

#radar-wrap { margin-top: 2.5rem; }
.radar-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  aspect-ratio: 16 / 9;
  max-height: 540px;
}
#radar-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ---- History ---- */

#history { margin-top: 2.5rem; }
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
}
.tabs button {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: color 200ms ease;
  position: relative;
}
.tabs button:hover { color: var(--fg); }
.tabs button.active { color: var(--fg); }
.tabs button.active::after {
  content: '';
  position: absolute;
  left: 1rem; right: 1rem; bottom: -1px; height: 1px;
  background: var(--fg);
}

.history-chart {
  display: block;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  margin: 0.6rem 0;
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
/* Lock the rendered height per chart so width-driven viewport changes
   don't distort the drawing. drawChart() sizes the canvas buffer from
   clientWidth × clientHeight to match exactly. */
#history-temp { height: 200px; max-height: 200px; }
#history-wind, #history-rain { height: 160px; max-height: 160px; }
@media (max-width: 720px) {
  #history-temp { height: 160px; max-height: 160px; }
  #history-wind, #history-rain { height: 130px; max-height: 130px; }
}

/* ---- Records (band 6) ---- */

#records { margin-top: 2.5rem; }
.records-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  font-family: 'Geist', sans-serif;
  font-size: 0.95rem;
}
.records-table thead th {
  text-align: left;
  padding: 0.5rem 0.9rem;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--card-border);
}
.records-table tbody td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--card-border);
}
.records-table tbody tr:last-child td { border-bottom: 0; }
.records-table td:first-child { color: var(--fg-muted); }
.records-table .records-empty {
  text-align: center;
  color: var(--fg-muted);
  padding: 1.2rem;
}
.records-table .records-rain-total { text-align: center; }
.records-table .records-rain-note {
  margin-left: 0.4rem;
  color: var(--fg-muted);
  font-size: 0.85em;
}

/* ---- Alerts ---- */

#alerts { margin-bottom: 0.5rem; }
:root {
  /* NWS alert banner — themed via variables like everything else so a
     future palette change doesn't strand hardcoded colors here. */
  --alert-bg:     rgba(120, 30, 30, 0.45);
  --alert-border: rgba(220, 90, 90, 0.6);
  --alert-fg:     #ffe2d8;
}
.alert {
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  color: var(--alert-fg);
  padding: 0.85rem 1.1rem;
  margin: 0.4rem 0;
  border-radius: 12px;
  font-size: 0.92rem;
  backdrop-filter: blur(10px);
}

/* ---- Footer ---- */

/* Until updateSky() fills the moon summary, hide the separator dot so
   the footer doesn't open with an orphaned "·". */
#moon-summary:empty + .dot { visibility: hidden; }

footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
  opacity: 0.6;
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--fg); }
footer .dot { margin: 0 0.6em; opacity: 0.5; }

/* ---- Stale state ---- */

body.stale .hero-temp { opacity: 0.55; }


/* ==========================================================
   Emphasis additions (visual flourish on top of base sky).
   ---------------------------------------------------------
   These layers stack INSIDE .sky-hero-stack alongside the
   existing data-driven #sky SVG. They are CSS-only animation;
   the sun/moon arc + terminator remain JS-driven via app.js.
   ========================================================== */

.sky-hero-stack {
  overflow: hidden;
  isolation: isolate;
  margin: -1rem 0 1.2rem;
  min-height: 560px;
  height: 64vh;
  max-height: 760px;
}
@media (max-width: 720px) {
  .sky-hero-stack { min-height: 420px; height: 56vh; }
}

/* ---- Parallax cloud + atmosphere layer ---- */
.hero-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.atmos-cloud-row {
  position: absolute;
  left: -25%;
  right: -25%;
  display: flex;
  gap: clamp(80px, 12vw, 200px);
  will-change: transform;
  animation: hero-cloud-drift var(--dur, 120s) linear infinite;
}
.atmos-cloud-row.back  { top: 10%; --dur: 240s; opacity: 0.45; filter: blur(2px); transform: scale(0.7); }
.atmos-cloud-row.mid   { top: 24%; --dur: 160s; opacity: 0.75; }
.atmos-cloud-row svg {
  flex-shrink: 0;
  width: clamp(160px, 22vw, 360px);
  height: auto;
}
.atmos-cloud-row svg path { fill: #f3ecd8; }
[data-phase=night] .atmos-cloud-row svg path { fill: #2a304a; }
[data-phase=dusk]  .atmos-cloud-row svg path { fill: #c89878; }
[data-phase=dawn]  .atmos-cloud-row svg path { fill: #e2b89a; }
[data-phase=midday] .atmos-cloud-row svg path,
[data-phase=morning] .atmos-cloud-row svg path,
[data-phase=afternoon] .atmos-cloud-row svg path { fill: #ffffff; }
[data-condition=overcast] .atmos-cloud-row svg path,
[data-condition=rain]     .atmos-cloud-row svg path,
[data-condition=thunderstorm] .atmos-cloud-row svg path {
  fill: color-mix(in srgb, var(--fg-muted) 60%, #2a3040);
}
[data-condition=clear] .atmos-cloud-row,
[data-condition=fog]   .atmos-cloud-row { opacity: 0.25; }
@keyframes hero-cloud-drift {
  from { transform: translate3d(-12%, 0, 0); }
  to   { transform: translate3d(12%, 0, 0); }
}

/* Wind streamers — thin horizontal lines blowing across. */
.wind-streamers { position: absolute; inset: 0; }
.wind-streamers > span {
  position: absolute;
  width: 140px;
  height: 1.5px;
  background: linear-gradient(to right, transparent, var(--fg) 50%, transparent);
  opacity: 0.18;
  animation: hero-streamer var(--dur, 6s) linear infinite;
  animation-delay: var(--delay, 0s);
  border-radius: 2px;
  filter: blur(0.3px);
}
@keyframes hero-streamer {
  from { transform: translate3d(-160px, 0, 0); opacity: 0; }
  10%  { opacity: 0.18; }
  90%  { opacity: 0.18; }
  to   { transform: translate3d(110vw, 0, 0); opacity: 0; }
}

/* Dust motes — fine particles rising. */
.dust-motes { position: absolute; inset: 0; opacity: 0.45; }
[data-phase=night] .dust-motes { opacity: 0.18; }
.dust-motes > span {
  position: absolute;
  bottom: -5%;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sun-glow) 80%, white);
  filter: blur(0.5px);
  animation: hero-mote-rise var(--dur, 18s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}
@keyframes hero-mote-rise {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { transform: translate3d(40px, -100vh, 0); opacity: 0; }
}

/* ---- Foreground landscape ---- */
.hero-landscape {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 32%;
  z-index: 2;
  pointer-events: none;
}
.hero-landscape .hill {
  position: absolute;
  left: -5%; right: -5%;
  width: 110%;
  height: auto;
}
.hero-landscape .hill.far  { bottom: 38%; opacity: 0.35; filter: blur(1px); }
.hero-landscape .hill.mid  { bottom: 18%; opacity: 0.55; }
.hero-landscape .hill.near { bottom:  0;  opacity: 0.85; }
.hero-landscape .hill path { fill: var(--sky-top); }
[data-phase=midday]    .hero-landscape .hill path,
[data-phase=morning]   .hero-landscape .hill path,
[data-phase=afternoon] .hero-landscape .hill path {
  fill: color-mix(in srgb, var(--sky-top) 70%, black);
}

.tree-row {
  position: absolute;
  left: 0; right: 0;
  bottom: 8%;
  display: flex;
  justify-content: space-around;
}
.tree-row .tree {
  width: clamp(20px, 3vw, 38px);
  height: clamp(40px, 6vw, 80px);
  transform-origin: bottom center;
  animation: hero-tree-sway var(--dur, 6s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
  fill: color-mix(in srgb, var(--sky-top) 80%, black);
  opacity: 0.9;
}
@keyframes hero-tree-sway {
  from { transform: rotate(-1.5deg); }
  to   { transform: rotate(2deg); }
}
[data-condition=thunderstorm] .tree-row .tree { animation-duration: 1.6s; }
[data-condition=rain]         .tree-row .tree { animation-duration: 3s; }

/* ---- Sun emphasis: bigger glow + slow rotating ray crown ---- */
/* The existing #sun-arc renders the sun-group correctly; we boost it. */
#sun-arc .sun-glow {
  r: 56;                     /* SVG2: Chrome/Safari override; Firefox uses attr r="34" */
  transform-box: fill-box;
  transform-origin: center;
  animation: sun-halo 8s ease-in-out infinite;
}
@keyframes sun-halo {
  /* scale(52/56)=0.929 min, scale(60/56)=1.071 max — matches original r intent.
     transform: scale() is GPU-composited on both Chrome and Firefox;
     animating `r` directly forces layout recalc and is unsupported in Firefox. */
  0%, 100% { opacity: 0.85; transform: scale(0.929); }
  50%      { opacity: 1;    transform: scale(1.071); }
}
#sun-arc .sun-rays {
  transform-box: fill-box;
  transform-origin: center;
  animation: sun-rays-spin 220s linear infinite;
}
@keyframes sun-rays-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
#sun-arc .sun {
  filter: drop-shadow(0 0 6px var(--sun-glow));
}

/* ---- Moon emphasis: warmer gradient + drop-shadow glow ---- */
#sun-arc .moon-disk {
  filter: drop-shadow(0 0 8px rgba(245,237,216,0.55));
}

/* ---- Celestial position pills (top-center of hero) ---- */
.celestial-row {
  position: absolute;
  top: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  gap: 0.6rem;
  pointer-events: none;
}
@media (max-width: 720px) {
  .celestial-row { top: 3rem; flex-direction: column; gap: 0.35rem; align-items: center; }
}
.body-label {
  font-family: 'Geist', sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
  background: color-mix(in srgb, var(--sky-top) 65%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 600ms ease;
}
.body-label.dim { opacity: 0.4; }
.body-label .swatch {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.sun-label  .swatch { background: var(--sun-glow); box-shadow: 0 0 10px var(--sun-glow); }
.moon-label .swatch { background: #f5edd8;        box-shadow: 0 0 8px #f5edd8; }

/* ---- Hero text: bigger, breathing temp + grid layout ---- */
#hero {
  padding: 9rem 1.5rem 4rem;
}
.hero-temp {
  font-size: clamp(7rem, 18vw, 13rem);
  animation: hero-breath 7s ease-in-out infinite;
}
@keyframes hero-breath {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50%      { opacity: 0.96; transform: translateY(-1px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .atmos-cloud-row,
  .wind-streamers > span,
  .dust-motes > span,
  .tree-row .tree,
  #sun-arc .sun-glow,
  #sun-arc .sun-rays,
  .hero-temp { animation: none !important; }
}
