:root {
  font-family: system-ui, sans-serif;
  color: #ecf4f7;
  background: #0d161e;
  color-scheme: dark;
  --muted: #a9bac8;
  --line: #2a3d49;
  --accent: #8fe0cf;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 16% 0%, #193741 0%, transparent 43rem);
}
main { width: min(100% - 3rem, 76rem); margin-inline: auto; padding: 3.5rem 0 2rem; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.055em; line-height: 1.05; }
h1 span { color: var(--accent); }
h2 { font-size: 1.35rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; font-weight: 650; }
.masthead, .history-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.masthead { border-bottom: 1px solid var(--line); padding-bottom: 1.65rem; margin-bottom: 1.8rem; }
#observed { margin-top: .7rem; color: var(--muted); }
.status {
  border: 1px solid var(--line); border-radius: 2rem; padding: .5rem .8rem;
  font-size: .875rem; white-space: nowrap; color: var(--muted);
}
.status[data-state="live"] { color: var(--accent); border-color: #3d655f; }
.status[data-state="stale"], .status[data-state="error"] { color: #ffd295; border-color: #997044; }
.conditions { display: grid; grid-template-columns: repeat(2, 1.2fr) minmax(0, 1fr); gap: .8rem; margin-top: 1rem; }
.wind-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: .8rem; }
.panel { background: #15232e; border: 1px solid var(--line); border-radius: .85rem; padding: 1.15rem; min-width: 0; }
.temperature-panel { background: linear-gradient(145deg, #20434a, #172a35 85%); border-color: #3b6268; }
.temperature { font-size: clamp(2.25rem, 4vw, 3.9rem); font-weight: 650; letter-spacing: -.07em; line-height: 1.2; margin: .45rem 0; }
.compass-panel { text-align: center; }
.compass {
  position: relative; width: min(12rem, 100%); aspect-ratio: 1; margin: .6rem auto .35rem;
  border: 1px solid #56717d; border-radius: 50%; background: #101e28; color: var(--muted);
  font-size: 1.75rem; font-weight: 650;
}
.compass span { position: absolute; }
.north, .south { left: 50%; transform: translateX(-50%); }
.north { top: .32rem; }
.south { bottom: .32rem; }
.east, .west { top: 50%; transform: translateY(-50%); }
.east { right: .7rem; }
.west { left: .7rem; }
#wind-needle {
  top: 50%; left: calc(50% - .8rem); width: 1.6rem; height: 3.2rem;
  margin-top: -3.2rem; transform-origin: center bottom; background: var(--accent);
  clip-path: polygon(50% 0, 100% 56%, 66% 49%, 66% 100%, 34% 100%, 34% 49%, 0 56%);
}
dl { margin-top: .6rem; }
dl div { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .42rem 0; }
dl div + div { border-top: 1px solid var(--line); }
dt, .chart-note, #history-status, footer { color: var(--muted); font-size: .875rem; }
dd { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.atmosphere { grid-column: 1 / -1; display: flex; align-items: center; gap: 1.5rem; padding-block: .7rem; }
.atmosphere dl { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin: 0; }
.atmosphere dl div + div { border: 0; }
.history { margin-top: 2.1rem; }
.ranges { display: flex; border: 1px solid var(--line); padding: .2rem; border-radius: .65rem; gap: .15rem; }
button {
  border: 0; border-radius: .45rem; padding: .55rem .75rem; min-height: 2.75rem;
  font: inherit; font-size: .875rem; background: transparent; color: var(--muted); cursor: pointer;
}
button:hover, button[aria-pressed="true"] { background: #26444d; color: #e5faf6; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#history-status { margin: .65rem 0; min-height: 1.25rem; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.chart-note { margin: .3rem 0 .7rem; }
.wind-key, .gust-key { display: inline-block; width: .8rem; height: 2px; vertical-align: middle; background: #8fe0cf; }
.gust-key { background: #eeb9f3; }
canvas { display: block; width: 100%; height: 12.5rem; }
.chart-empty { display: grid; min-height: 12.5rem; place-items: center; color: var(--muted); }
footer { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1rem; }

@media (max-width: 65rem) {
  .conditions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 42rem) {
  main { width: calc(100% - 2rem); padding-top: 1.5rem; }
  .masthead, .history-header { flex-wrap: wrap; }
  .charts, .wind-sections { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 28rem) {
  .conditions { grid-template-columns: minmax(0, 1fr); }
  .atmosphere { display: block; }
  .atmosphere dl { display: block; }
  .atmosphere dl div + div { border-top: 1px solid var(--line); }
}
