/* GrayCloud — Dark Sky-style web app */

:root {
  --bg: #ffffff;
  --bg-muted: #f6f6f6;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #8a8a8a;
  --rule: #e6e6e6;
  --bar-bg: #1a1a1a;
  --bar-ink: #d6d6d6;
  --bar-ink-strong: #ffffff;
  --link: #1a73e8;
  --accent: #2f7bff;

  /* Hourly grayscale (cloud cover ramp) */
  --cloud-0: #f4f4f4;
  --cloud-1: #d8d8d8;
  --cloud-2: #b6b6b6;
  --cloud-3: #828282;
  --cloud-4: #4a4a4a;

  /* UV badges */
  --uv-low: #4caf50;
  --uv-mod: #ffc107;
  --uv-high: #ff9800;
  --uv-veryhigh: #f44336;
  --uv-extreme: #9c27b0;

  /* Day range bar gradient endpoints */
  --range-cold: #2b6cb0;
  --range-mid: #6b7280;
  --range-warm: #c0392b;

  --maxw: 1080px;
  --pad-x: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "tnum" 1, "ss01" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
select, input { font: inherit; color: inherit; }

/* ---------- Top nav ---------- */
.topnav {
  background: var(--bar-bg);
  color: var(--bar-ink);
  position: sticky; top: 0; z-index: 100;
}
.topnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--bar-ink-strong);
  font-weight: 300;
  font-size: 17px;
  letter-spacing: 0.2px;
  text-decoration: none;
}
.brand-mark { width: 32px; height: 32px; border-radius: 22%; display: block; object-fit: cover; }
.brand-word { font-weight: 300; }
.topnav-links {
  display: flex; align-items: center; gap: clamp(20px, 4vw, 56px);
  margin-left: auto;
  font-size: 15px;
  font-weight: 300;
}
.topnav-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--bar-ink);
  text-decoration: none;
}
.topnav-links a:hover { color: var(--bar-ink-strong); text-decoration: none; }
.nav-icon { width: 14px; height: 18px; }

/* ---------- Search row ---------- */
.search-row {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--rule);
}
.search-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--pad-x);
  display: flex; align-items: center; gap: 10px;
}
.geolocate {
  width: 36px; height: 36px;
  background: transparent; border: none;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.geolocate:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.geolocate svg { width: 18px; height: 18px; transform: rotate(-45deg); }

.search-form {
  flex: 1;
  display: flex; align-items: center;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  height: 36px;
  padding: 0 10px;
  min-width: 0;
}
.search-input {
  flex: 1;
  border: none; outline: none;
  background: transparent;
  font-size: 15px;
  text-align: center;
  min-width: 0;
}
.search-submit {
  background: transparent; border: none;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px;
}
.search-submit svg { width: 18px; height: 18px; }

.select-wrap {
  position: relative;
  display: inline-flex;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  height: 36px;
}
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  border: none; background: transparent;
  font-size: 14px;
  padding: 0 30px 0 12px;
  height: 100%;
  outline: none;
}
.select-wrap::after {
  content: "";
  position: absolute; right: 12px; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---------- Stats bar ---------- */
.stats {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--pad-x);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--rule);
}
.stat {
  display: flex; align-items: baseline; gap: 6px;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.stat-label { color: var(--ink-3); font-weight: 600; }
.stat-value { color: var(--ink); }
.uv-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 18px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--uv-low);
  color: #fff;
  font-size: 12px; font-weight: 700;
}
.uv-badge[data-level="moderate"] { background: var(--uv-mod); color: #1a1a1a; }
.uv-badge[data-level="high"]     { background: var(--uv-high); }
.uv-badge[data-level="very-high"]{ background: var(--uv-veryhigh); }
.uv-badge[data-level="extreme"]  { background: var(--uv-extreme); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--pad-x) 16px;
  text-align: center;
}
.hero-icon { display: inline-block; }
.hero-icon svg { width: 80px; height: 80px; vertical-align: middle; margin-right: 8px; }
.hero-headline {
  display: inline-block;
  margin: 0;
  font-size: clamp(34px, 5.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.5px;
  vertical-align: middle;
}
.hero-temp { font-weight: 600; }
.hero-deg { font-weight: 300; margin-right: 4px; }
.hero-cond { font-weight: 600; }

.hero-meta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  display: flex; gap: 24px; justify-content: center; flex-wrap: wrap;
}
.hero-meta strong { color: var(--ink-2); font-weight: 600; }

.hero-summary {
  margin: 28px auto 0;
  max-width: 720px;
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 400;
  color: var(--ink);
}

/* ---------- Hourly bar ---------- */
.hourly {
  max-width: var(--maxw);
  margin: 14px auto 0;
  padding: 0 var(--pad-x);
}
.hourly-bar {
  display: flex; flex-wrap: nowrap;
  height: 38px;
  border-radius: 2px;
  overflow: hidden;
  user-select: none;
}
.hourly-seg {
  display: flex; align-items: center; justify-content: center;
  min-width: 0; overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  padding: 0 8px;
  border-right: 1px solid rgba(255,255,255,0.6);
}
.hourly-seg:last-child { border-right: none; }
.hourly-seg[data-shade="0"] { background: var(--cloud-0); color: var(--ink); }
.hourly-seg[data-shade="1"] { background: var(--cloud-1); color: var(--ink); }
.hourly-seg[data-shade="2"] { background: var(--cloud-2); color: #fff; }
.hourly-seg[data-shade="3"] { background: var(--cloud-3); color: #fff; }
.hourly-seg[data-shade="4"] { background: var(--cloud-4); color: #fff; }
.hourly-seg.is-narrow { color: transparent; }
.hourly-seg.is-rain {
  background-image: repeating-linear-gradient(135deg, rgba(58,160,255,0.15) 0 4px, transparent 4px 10px);
}

.hourly-ticks {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  margin-top: 4px;
  font-size: 12px;
}
.hourly-tick {
  display: flex; flex-direction: column; align-items: flex-start;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  line-height: 1.3;
}
.hourly-tick .t-time { font-weight: 600; }
.hourly-tick .t-temp { color: var(--ink-2); }
.hourly-tick.is-night .t-time,
.hourly-tick.is-night .t-temp { color: var(--ink-3); }

/* ---------- Radar ---------- */
.radar-section {
  margin: 22px 0 40px;
}
.radar-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 7 / 2;
  background: #0c1017;
  overflow: hidden;
}
@media (max-width: 720px) { .radar-wrap { aspect-ratio: 2 / 1; } }

.radar-frame {
  width: 100%; height: 100%;
  border: 0; display: block;
}
.radar-overlay {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 12px;
  pointer-events: none;
  gap: 10px;
}
.radar-overlay > * { pointer-events: auto; }

.radar-overlay-left,
.radar-overlay-center,
.radar-overlay-right {
  display: flex; align-items: center; gap: 8px;
}
.radar-overlay-center {
  background: rgba(255,255,255,0.92);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 13px;
}
.radar-overlay-left .select-wrap,
.radar-overlay-right .select-wrap,
.radar-overlay .select-wrap {
  background: rgba(255,255,255,0.92);
}
.scrub-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.scrubber { width: clamp(120px, 22vw, 240px); }
.scrub-now {
  background: #fff; border: 1px solid #d6d6d6; border-radius: 3px;
  font-size: 12px; padding: 3px 10px;
}
.radar-brand {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.92);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--ink);
  font-size: 12px; font-weight: 600; line-height: 1.1;
  text-decoration: none;
}
.radar-brand-mark { width: 26px; height: 26px; border-radius: 22%; display: block; object-fit: cover; }

@media (max-width: 720px) {
  .radar-overlay { flex-wrap: wrap; }
  .radar-overlay-center { order: 3; flex-basis: 100%; justify-content: center; }
}

/* ---------- Daily ---------- */
.daily {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x) 64px;
}
.daily-summary {
  /* Bottom 26 px + the first row's 14 px padding-top equals the 40 px the
     radar-section reserves below itself, so the summary sits centred between
     the radar and the forecast list. */
  margin: 0 0 26px;
  font-size: clamp(18px, 2vw, 20px);
  text-align: center;
  color: var(--ink);
}
.daily-list {
  list-style: none;
  margin: 0; padding: 0;
}
.daily-row {
  display: grid;
  grid-template-columns: 56px 36px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms ease;
}
.daily-row:hover { background: var(--rule-soft, rgba(127,127,127,0.06)); }
.daily-daycol { display: flex; flex-direction: column; gap: 2px; }
.daily-day {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.daily-precip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: #1f7ae0;
}
.daily-precip[data-zero="true"] { color: var(--ink-3); }
.daily-precip .daily-drop { width: 11px; height: 11px; }
.daily-icon { width: 32px; height: 32px; color: var(--ink-2); display: block; }
.daily-icon svg { width: 100%; height: 100%; }
.daily-range {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}
.daily-range-inner {
  position: relative;
  flex: 1;
  margin: 0 50px;
  height: 20px;
}
.daily-range-pill {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--start, 0%);
  right: calc(100% - var(--end, 100%));
  background: var(--rule);
  border-radius: 999px;
  min-width: 28px;
}
.daily-low, .daily-high {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.daily-low {
  right: calc(100% - var(--start, 0%));
  padding-right: 6px;
  text-align: right;
}
.daily-high {
  left: var(--end, 100%);
  padding-left: 6px;
}

.daily-hourly {
  display: none;
  grid-template-columns: 20px 1fr;
  gap: 26px;
  padding: 14px 0 20px;
  list-style: none;
}
.daily-hourly.is-open { display: grid; }
.hourly-spine {
  border-radius: 999px;
  align-self: stretch;
}
.hourly-list { list-style: none; margin: 0; padding: 0; }
.hourly-row {
  display: grid;
  grid-template-columns: 52px auto 1fr;
  align-items: center;
  column-gap: 14px;
  height: 44px;
}
.hourly-time {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
}
.hourly-condition {
  font-size: 13px;
  font-style: italic;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hourly-condition:empty { display: none; }
.hourly-condition:empty + .hourly-track { grid-column: 2 / span 2; }
.hourly-track {
  position: relative;
  height: 100%;
  margin-right: 50px;
}
.hourly-rule {
  position: absolute;
  top: 50%;
  left: 0;
  right: calc(100% - var(--pill-pos, 100%));
  height: 1px;
  background: var(--rule);
}
.hourly-pill {
  position: absolute;
  top: 50%;
  left: var(--pill-pos, 100%);
  transform: translate(-2px, -50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: #ededee;
  border: 1px solid #d6d6d8;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .daily-row {
    grid-template-columns: 48px 28px 1fr;
    gap: 8px;
  }
  .daily-day { font-size: 12px; }
  .daily-precip { font-size: 11px; }
  .daily-icon { width: 26px; height: 26px; }
  .daily-range { height: 24px; }
  .daily-range-inner { margin: 0 40px; height: 16px; }
  .daily-low, .daily-high { font-size: 16px; }
  .daily-hourly { grid-template-columns: 16px 1fr; gap: 18px; padding: 10px 0 14px; }
  .hourly-row { grid-template-columns: 44px auto 1fr; column-gap: 10px; height: 38px; }
  .hourly-time { font-size: 14px; }
  .hourly-condition { font-size: 12px; }
  .hourly-track { margin-right: 40px; }
  .hourly-pill { font-size: 13px; padding: 4px 11px; }
}

/* ---------- Time machine CTA ---------- */
.time-machine-cta {
  text-align: center;
  padding: 28px var(--pad-x) 40px;
  border-top: 1px solid var(--rule);
  margin-top: 24px;
}
.time-machine-cta p {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink-2);
}
.time-machine {
  display: inline-block;
  background: #2f7bff;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.6px;
  font-size: 13px;
  padding: 10px 28px;
  border-radius: 4px;
  text-decoration: none;
  text-transform: uppercase;
}
.time-machine:hover { background: #2667d9; text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bar-bg);
  color: var(--bar-ink);
  padding: 56px var(--pad-x) 32px;
  font-size: 14px;
  font-weight: 300;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 40px;
}
.brand--footer {
  font-size: 28px;
  color: var(--bar-ink-strong);
}
.brand--footer .brand-mark { width: 48px; height: 48px; }
.footer-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  text-align: right;
  color: var(--bar-ink);
}
.footer-links a { color: var(--bar-ink); text-decoration: none; }
.footer-links a:hover { color: var(--bar-ink-strong); text-decoration: none; }
.footer-copy {
  max-width: var(--maxw);
  margin: 36px auto 0;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topnav-inner { gap: 12px; }
  .topnav-links { gap: 18px; font-size: 14px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { flex-direction: column; gap: 24px; }
  .footer-links { text-align: left; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); font-size: 13px; }
  .hero-icon svg { width: 56px; height: 56px; }
  .hourly-ticks { grid-template-columns: repeat(6, 1fr); }
  .hourly-ticks .hourly-tick:nth-child(2n) { display: none; }
  .topnav-links a:not([href="/help"]):not([href="/maps"]) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .radar-section, .topnav, .site-footer, .search-row, .time-machine-cta { display: none; }
}

/* Fallback content for noscript / SSR-only */
.noscript-fallback ul { list-style: none; padding: 0; margin: 0; }
.noscript-fallback li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
