:root {
  color-scheme: light;
  --page:            #f9f9f7;
  --surface-1:       #fcfcfb;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --muted:           #898781;
  --gridline:        #e1e0d9;
  --baseline:        #c3c2b7;
  --border:          rgba(11,11,11,0.10);
  --series-1:        #2a78d6;
  --series-1-wash:   rgba(42,120,214,0.10);
  --good:            #0ca30c;
  --warning:         #fab219;
  --serious:         #ec835a;
  --critical:        #d03b3b;
  --critical-wash:   #fbeceb;
  --warning-wash:    #fff6e2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:            #0d0d0d;
    --surface-1:       #1a1a19;
    --text-primary:    #ffffff;
    --text-secondary:  #c3c2b7;
    --muted:           #898781;
    --gridline:        #2c2c2a;
    --baseline:        #383835;
    --border:          rgba(255,255,255,0.10);
    --series-1:        #3987e5;
    --series-1-wash:   rgba(57,135,229,0.14);
    --good:            #0ca30c;
    --warning:         #fab219;
    --serious:         #ec835a;
    --critical:        #e66767;
    --critical-wash:   #2a1817;
    --warning-wash:    #2a2313;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:            #0d0d0d;
  --surface-1:       #1a1a19;
  --text-primary:    #ffffff;
  --text-secondary:  #c3c2b7;
  --muted:           #898781;
  --gridline:        #2c2c2a;
  --baseline:        #383835;
  --border:          rgba(255,255,255,0.10);
  --series-1:        #3987e5;
  --series-1-wash:   rgba(57,135,229,0.14);
  --good:            #0ca30c;
  --warning:         #fab219;
  --serious:         #ec835a;
  --critical:        #e66767;
  --critical-wash:   #2a1817;
  --warning-wash:    #2a2313;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 36px; line-height: 1; }
.brand h1 { font-size: 22px; margin: 0; font-weight: 700; }
.tagline { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

.location-control select {
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  min-width: 200px;
}

.alert-banner {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alert-banner.sev-critical { background: var(--critical-wash); }
.alert-banner.sev-warning  { background: var(--warning-wash); }

.alert-item { display: flex; gap: 10px; align-items: flex-start; }
.alert-icon { flex: none; font-size: 18px; line-height: 1.3; }
.alert-body strong { display: block; font-size: 14px; }
.alert-body span { display: block; font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

main { display: flex; flex-direction: column; gap: 18px; }

.current-card, .chart-card, .forecast-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.current-main {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}
.current-icon { font-size: 56px; line-height: 1; }
.current-temp { font-size: 48px; font-weight: 700; line-height: 1; }
.current-desc { margin-top: 4px; font-size: 15px; color: var(--text-secondary); }

.current-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--gridline);
}
.stat dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}
.stat dd {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.updated {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.chart-card h2, .forecast-card h2 {
  font-size: 15px;
  margin: 0 0 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap svg .chart-axis-label {
  font-size: 10px;
  fill: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.08s ease;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-time { color: var(--muted); font-size: 11px; }
.chart-tooltip .tt-temp { font-weight: 700; }

.forecast-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.day-card {
  text-align: center;
  padding: 12px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  min-width: 0;
}
.day-card .day-name { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.day-card .day-icon { font-size: 26px; margin: 8px 0 4px; }
.day-card .day-hi { font-size: 14px; font-weight: 700; }
.day-card .day-lo { font-size: 13px; color: var(--muted); }
.day-card .day-precip { font-size: 11px; color: var(--series-1); margin-top: 4px; }

.site-footer {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.site-footer a { color: var(--text-secondary); }

@media (max-width: 640px) {
  .current-stats { grid-template-columns: repeat(2, 1fr); }
  .forecast-row {
    grid-template-columns: none;
    grid-auto-columns: minmax(84px, 1fr);
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

/* ---------- Site-wide shell (nav / footer) ---------- */

.sitehead {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.sitehead-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.sitehead .brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
}
.sitehead nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13.5px;
}
.sitehead nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 8px;
}
.sitehead nav a:hover { background: var(--page); color: var(--text-primary); }
.sitehead nav a.active { color: var(--text-primary); background: var(--page); font-weight: 600; }

.sitefoot {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.sitefoot-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 32px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.sitefoot nav {
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.sitefoot nav a { color: var(--text-secondary); text-decoration: none; }
.sitefoot nav a:hover { text-decoration: underline; }
.sitefoot p { margin: 4px 0; }

/* ---------- Long-form content pages ---------- */

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 8px;
}
.content .eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--series-1);
  margin: 0 0 8px;
}
.content h1 { font-size: 30px; line-height: 1.2; margin: 0 0 10px; }
.content h2 { font-size: 20px; margin: 32px 0 12px; }
.content h3 { font-size: 16px; margin: 20px 0 8px; }
.content .lede { font-size: 16px; color: var(--text-secondary); margin: 0 0 20px; }
.content p { line-height: 1.65; color: var(--text-primary); margin: 0 0 14px; }
.content ul, .content ol { line-height: 1.65; margin: 0 0 16px; padding-left: 22px; }
.content li { margin-bottom: 6px; }
.content a { color: var(--series-1); }

.info-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 20px 0;
}
.info-card h3 { margin-top: 0; }

.disclaimer {
  font-size: 12.5px;
  color: var(--muted);
  border-left: 3px solid var(--baseline);
  padding-left: 12px;
  margin: 20px 0;
}

.breadcrumb {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 0 0 20px; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table th, table.data-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}
table.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; }

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0 24px;
}
.region-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.region-card h3 { margin: 0 0 8px; font-size: 15px; }
.region-card ul { margin: 0; padding-left: 18px; font-size: 13.5px; }

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn-primary { background: var(--series-1); color: #fff; }
.btn-secondary { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 8px 0 0;
}
.hub-tile {
  display: block;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: var(--text-primary);
}
.hub-tile:hover { border-color: var(--series-1); }
.hub-tile .hub-icon { font-size: 26px; }
.hub-tile h3 { margin: 10px 0 4px; font-size: 15.5px; }
.hub-tile p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }

.hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px 8px;
  text-align: center;
}
.hero h1 { font-size: 32px; margin: 12px 0 8px; }
.hero p { font-size: 16px; color: var(--text-secondary); max-width: 560px; margin: 0 auto; }

/* ---------- Ad slots ---------- */
.ad-slot {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 20px;
}
.ad-slot .ad-slot-inner {
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- Clock (time page) ---------- */
.clock-display {
  text-align: center;
  padding: 28px 20px;
}
.clock-time {
  font-size: 56px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.clock-date { font-size: 15px; color: var(--text-secondary); margin-top: 6px; }
.clock-tz { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
