:root {
  --bg: #dff1ff;
  --bg-strong: #b8dcfb;
  --ink: #123047;
  --muted: #4f6f88;
  --panel: rgba(244, 251, 255, 0.82);
  --panel-strong: rgba(248, 253, 255, 0.96);
  --line: rgba(18, 48, 71, 0.1);
  --shadow: 0 18px 60px rgba(18, 48, 71, 0.12);
  --model-ecmwf_ifs025: #0d5c63;
  --model-gfs_seamless: #e36414;
  --model-gem_seamless: #6b8f71;
  --danger: #cf4d35;
  --warm: #c9a227;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 26%),
    radial-gradient(circle at top right, rgba(86, 160, 211, 0.28), transparent 26%),
    linear-gradient(135deg, #eef9ff 0%, #d7eeff 45%, #b8dcfb 100%);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  min-height: 100vh;
}

.sky,
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.sky {
  background:
    linear-gradient(135deg, rgba(100, 184, 234, 0.18), transparent 34%),
    linear-gradient(135deg, transparent 48%, rgba(174, 223, 255, 0.22) 100%);
}

.grain {
  opacity: 0.08;
  background-image:
    linear-gradient(transparent 96%, rgba(24, 35, 47, 0.16) 97%),
    linear-gradient(90deg, transparent 96%, rgba(24, 35, 47, 0.12) 97%);
  background-size: 11px 11px;
}

.page-header,
.layout {
  position: relative;
  z-index: 1;
}

.page-header {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.35fr 1fr;
  padding: 2rem clamp(1rem, 2.5vw, 2rem) 1rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 0.96;
}

.lede {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.header-meta {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: end;
}

.meta-card,
.hero-card,
.panel-card,
.city-button {
  backdrop-filter: blur(20px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
}

.meta-card {
  border-radius: 1.1rem;
  padding: 1rem;
}

.meta-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 320px minmax(0, 1fr);
  padding: 0 clamp(1rem, 2.5vw, 2rem) 2rem;
}

.city-rail {
  position: sticky;
  top: 1rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rail-header {
  padding: 0.25rem 0.1rem;
}

.rail-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.rail-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.city-list {
  display: grid;
  gap: 0.85rem;
}

.city-button {
  width: 100%;
  border: 0;
  border-radius: 1.25rem;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.city-button:hover,
.city-button:focus-visible {
  transform: translateY(-2px);
}

.city-button.is-active {
  border: 1px solid rgba(13, 92, 99, 0.45);
  box-shadow: 0 20px 40px rgba(13, 92, 99, 0.18);
}

.city-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.city-name-row strong {
  font-size: 1rem;
}

.city-temp {
  font-size: 0.95rem;
  color: var(--muted);
}

.city-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.stat-chip {
  border-radius: 0.9rem;
  padding: 0.65rem 0.7rem;
  background: rgba(255, 255, 255, 0.62);
}

.stat-chip .label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-chip .value {
  display: block;
  margin-top: 0.1rem;
  font-size: 1rem;
  font-weight: 700;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-card,
.panel-card {
  border-radius: 1.5rem;
  padding: 1.25rem;
}

.hero-card {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1.2fr 1fr;
  min-height: 220px;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
}

.hero-copy p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.hero-metric {
  border-radius: 1.25rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 35, 47, 0.08);
}

.hero-metric .metric-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-metric .metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

.hero-metric .metric-note {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tab {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 30px rgba(24, 35, 47, 0.08);
  font-weight: 700;
}

.tab.is-active {
  color: white;
  background: linear-gradient(135deg, #0d5c63, #234d7b);
}

.panel {
  display: grid;
  gap: 1rem;
}

.panel.is-hidden {
  display: none;
}

.cards-3,
.cards-2,
.cards-4 {
  display: grid;
  gap: 1rem;
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.model-card {
  border-top: 5px solid var(--accent, var(--ink));
}

.model-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.model-header h3,
.panel-card h3 {
  margin: 0;
}

.model-source {
  color: var(--muted);
  font-size: 0.9rem;
}

.model-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.mini-metric {
  padding: 0.85rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-metric strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.1rem;
}

.rain-matrix {
  overflow-x: auto;
}

.rain-matrix table,
.hourly-table table {
  width: 100%;
  border-collapse: collapse;
}

.rain-matrix th,
.rain-matrix td,
.hourly-table th,
.hourly-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.rain-matrix th,
.hourly-table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  background: rgba(24, 35, 47, 0.08);
  font-weight: 700;
}

.risk-pill.high {
  background: rgba(207, 77, 53, 0.14);
  color: #8f2716;
}

.risk-pill.medium {
  background: rgba(201, 162, 39, 0.2);
  color: #735500;
}

.sparkline {
  width: 100%;
  height: 64px;
  margin-top: 0.7rem;
}

.sparkline text {
  fill: var(--muted);
  font-size: 11px;
}

.hourly-table {
  overflow-x: auto;
}

.day-card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.day-card {
  min-width: 220px;
}

.day-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.day-title strong {
  font-size: 1rem;
}

.day-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.model-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.model-row:first-of-type {
  border-top: 0;
}

.model-row small {
  color: var(--muted);
}

.month-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.15fr 0.85fr;
}

.history-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
}

.outlook-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(13, 92, 99, 0.12);
  color: #0d5c63;
  font-weight: 700;
}

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.6s infinite;
}

.skeleton-line {
  height: 16px;
  border-radius: 999px;
  background: rgba(24, 35, 47, 0.08);
  margin-bottom: 0.7rem;
}

.skeleton-line.wide {
  width: 85%;
}

.skeleton-line.short {
  width: 45%;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 1180px) {
  .page-header,
  .layout,
  .hero-card,
  .month-layout,
  .cards-3,
  .cards-4,
  .cards-2 {
    grid-template-columns: 1fr;
  }

  .city-rail {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-header {
    padding-top: 1.2rem;
  }

  .header-meta,
  .city-stats,
  .hero-grid,
  .model-metrics {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }
}
