:root {
  color-scheme: light;
  --paper: #f5f5f7;
  --card: #fff;
  --control: #fff;
  --ink: #161617;
  --muted: #646467;
  --line: #dedee1;
  --blue: #006fce;
  --temp: #cc641f;
  --pressure: #0074c9;
  --warning-ink: #945012;
  --space: clamp(14px, 3vw, 28px);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #000;
  --card: #111;
  --control: #171717;
  --ink: #f5f5f7;
  --muted: #aaaab0;
  --line: #2c2c2e;
  --blue: #80c5ff;
  --temp: #ffb36b;
  --pressure: #80c5ff;
  --warning-ink: #ffb56d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-underline-offset: 4px; }
button, select, input { font: inherit; color: var(--ink); }
button, select, input[type="date"] { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--control); padding: 10px 12px; }
button, select, summary { cursor: pointer; }
button:hover { background: var(--paper); }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.skip { position: absolute; top: -100px; left: 12px; z-index: 10; padding: 12px; background: var(--card); }
.skip:focus { top: 12px; }
header { border-bottom: 1px solid var(--line); }
.top { max-width: 1120px; margin: auto; padding: 18px var(--space); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; }
.brand { color: var(--ink); text-decoration: none; flex: 0 0 auto; }
.brand strong { font-size: 25px; line-height: 1; letter-spacing: -1px; }
.brand strong span { font-weight: 400; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px clamp(12px, 2vw, 28px); }
nav a { display: inline-flex; align-items: center; min-height: 40px; color: var(--muted); text-decoration: none; font-size: 15px; }
nav a:hover, nav .active { color: var(--ink); }
main { max-width: 1120px; margin: auto; padding: 32px var(--space) 48px; }
h1, h2, p, figure, dl, dd { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 28px); line-height: 1.25; font-weight: 500; letter-spacing: -.7px; overflow-wrap: break-word; }
h2 { font-size: 23px; line-height: 1.3; font-weight: 600; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px 28px; }
.page-heading > div:first-child { flex: 1 1 300px; min-width: 0; }
.heading-tools { display: flex; flex: 1 1 300px; flex-wrap: wrap; gap: 10px; max-width: 400px; min-width: 0; }
.heading-tools select { width: 0; min-width: 0; max-width: 100%; font-size: 15px; }
#units { flex: 2 1 180px; }
#theme { flex: 1 1 110px; }
.notice { margin-top: 20px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-wrap: anywhere; }
.notice.warning { color: var(--warning-ink); }
.observations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 20px; margin: 32px 0 36px; }
.observations article { min-width: 0; padding: 28px 16px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 24px; container-type: inline-size; }
.measurement-label h2 { color: var(--muted); font-size: 20px; font-weight: 400; }
.reading { display: flex; align-items: baseline; justify-content: center; gap: .08em; margin-top: 12px; font-size: clamp(36px, 16cqi, 72px); line-height: 1.15; font-weight: 300; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reading .unit { flex: 0 0 auto; font-size: .36em; letter-spacing: 0; color: var(--muted); }
.alternate-reading { margin-top: 10px; color: var(--muted); font-size: 18px; font-weight: 400; font-variant-numeric: tabular-nums; }
.reading[data-missing="true"] { color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.section-heading > div { min-width: 0; }
.section-heading p { margin-top: 8px; color: var(--muted); }
#range { min-width: 0; max-width: 100%; flex: 0 1 180px; }
.date-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; margin-bottom: 20px; }
.date-controls label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.date-controls input { min-width: 0; width: 100%; }
.range-status { margin-bottom: 18px; color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.charts figure { min-width: 0; padding: 22px 18px 18px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); }
.charts figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 20px; font-size: 20px; }
.charts figcaption strong { min-width: 0; font-weight: 500; }
.charts figcaption span { flex: 0 0 auto; color: var(--muted); font-size: 16px; }
.chart { position: relative; min-width: 0; height: clamp(220px, 24vw, 280px); }
.chart canvas { display: block; width: 100% !important; height: 100% !important; }
.chart-inspection { margin-top: 12px; }
.chart-inspection p { margin-bottom: 10px; min-height: 58px; overflow-wrap: anywhere; }
.chart-inspection strong { display: block; font-size: 22px; font-weight: 500; }
.chart-inspection time { display: block; color: var(--muted); font-size: 15px; }
.chart-inspection input { display: block; width: 100%; min-width: 0; height: 28px; margin: 0; padding: 0; accent-color: var(--pressure); cursor: ew-resize; }
#temp-scrub { accent-color: var(--temp); }
.summary-section { min-width: 0; margin-top: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); }
.table-wrap { max-width: 100%; overflow-x: auto; border-radius: 8px; overscroll-behavior-x: contain; }
table { width: 100%; min-width: 650px; border-collapse: collapse; text-align: right; font-size: 16px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 400; }
tbody th { font-weight: 400; }
tbody tr:last-child > * { border-bottom: 0; }
.lower { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; margin-top: 20px; }
.lower > section { min-width: 0; padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); overflow-wrap: anywhere; }
.lower p { margin-top: 18px; line-height: 1.65; }
.station-photo { margin: 20px 0; }
.station-photo img { display: block; width: 100%; height: auto; max-height: 240px; aspect-ratio: 2/1; object-fit: cover; border-radius: 16px; }
.lower dl { margin-top: 20px; }
.lower dl > div { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lower dt { color: var(--muted); }
details { margin-top: 20px; }
summary { color: var(--blue); min-height: 36px; }
.instrument { display: block; width: 100%; max-width: 280px; height: auto; border-radius: 14px; margin-top: 12px; }
.export-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.export-buttons button { min-width: 0; padding: 12px 22px; font-size: 17px; }
.export-buttons button:first-child { color: var(--paper); background: var(--ink); border-color: var(--ink); }
#export-status { color: var(--muted); }
.api-details { margin-top: 24px; }
@media (max-width: 820px) {
  .charts, .lower { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 270px; }
}
@media (max-width: 680px) {
  .observations { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 24px; }
  .observations article { padding: 24px 12px; }
  .summary-section, .lower > section { padding: 22px 16px; }
  .chart { height: 240px; }
}
@media (max-width: 400px) {
  .top { align-items: flex-start; flex-direction: column; gap: 8px; }
  nav { width: 100%; justify-content: space-between; gap: 4px 10px; }
  nav a { font-size: 14px; }
  main { padding-top: 24px; }
  h2 { font-size: 21px; }
  .charts figure { padding: 20px 12px 14px; }
  .charts figcaption { font-size: 18px; }
  .chart { height: 220px; }
  #range { flex-basis: 155px; font-size: 15px; }
  .lower dl > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
