@font-face {
  font-family: "Mallory";
  src: url("../fonts/Mallory-Book.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory";
  src: url("../fonts/Mallory-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory";
  src: url("../fonts/Mallory-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory";
  src: url("../fonts/Mallory-BookItalic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Mallory MP";
  src: url("../fonts/MalloryMP-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f9f5;
  --panel: #ffffff;
  --text: #2b2d31;
  --muted: #065d45;
  --accent: #065d45;
  --accent-2: #062a70;
  --line: #acdbce;
  --danger: #f02f23;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Mallory", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, #dcefe7 0%, transparent 28%),
    radial-gradient(circle at 88% 100%, #d8e3f7 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

.app {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-family: "Mallory MP", "Mallory", sans-serif;
  color: var(--accent);
  font-weight: 700;
}

.subhead {
  max-width: 68ch;
  color: var(--muted);
}

.station-mode {
  margin-top: 1.25rem;
}

.controls {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.segmented {
  display: inline-flex;
  background: #eef6f3;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.segment-btn {
  border: 0;
  border-radius: 999px;
  min-height: 2rem;
  padding: 0 1rem;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.segment-btn.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 6px rgba(43, 45, 49, 0.12);
}

.mode-panel {
  margin-top: 0.8rem;
}

.field span {
  font-size: 0.83rem;
  font-family: "Mallory MP", "Mallory", sans-serif;
  color: var(--muted);
}

select,
input,
button {
  font: inherit;
}

select,
input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-height: 2.6rem;
  padding: 0 0.75rem;
  color: var(--text);
}

.btn {
  border: 0;
  border-radius: 10px;
  min-height: 2.6rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.hint {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.card,
.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(43, 45, 49, 0.06);
}

.card h2,
.chart-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.extremes {
  display: grid;
  gap: 0.5rem;
}

.extreme {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-size: 0.96rem;
}

.extreme strong {
  font-weight: 700;
}

.meta {
  margin: 0;
  color: var(--muted);
}

.chart-card {
  margin-top: 1rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.chart-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.chart-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
}

.day-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 2.4rem;
  padding: 0 0.8rem;
  background: #f3faf7;
  color: var(--accent-2);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.day-nav-icon {
  font-size: 1.05em;
  line-height: 1;
}

.chart-wrap {
  position: relative;
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fcfa 0%, #edf4ff 100%);
  padding: 0.75rem;
  overflow: hidden;
}

.datum-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: "Mallory MP", "Mallory", sans-serif;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.station-map {
  margin-top: 0.75rem;
  height: 210px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.map-selected-station {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.station-popup {
  font-size: 0.9rem;
  line-height: 1.35;
}

.chart-svg {
  width: 100%;
  height: auto;
  min-width: 0;
  display: block;
}

.axis,
.grid {
  stroke: #9ccfbc;
  stroke-width: 1;
}

.grid {
  stroke-dasharray: 4 6;
}

.path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
}

.point-high {
  fill: var(--accent-2);
}

.point-low {
  fill: var(--danger);
}

.label {
  font-family: "Mallory MP", "Mallory", sans-serif;
  font-size: clamp(6px, 1.15vw, 12px);
  fill: #1f2937;
  font-weight: 600;
}

.axis-label {
  font-family: "Mallory MP", "Mallory", sans-serif;
  font-size: clamp(6px, 1.05vw, 12px);
  fill: #374151;
}

.status {
  margin-top: 0.8rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 900px) {
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-nav {
    gap: 0.55rem;
  }

  .summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .day-nav-label {
    display: none;
  }

  .day-nav-btn {
    width: 2.4rem;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 540px) {
  .app {
    width: min(1120px, calc(100vw - 1rem));
    padding-top: 1.25rem;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .station-map {
    height: 170px;
  }
}
