/* Bir Billing Wind: shared styles for the overview and station pages.
   Light by default (reads best in sun); dark follows the phone setting.
   Colours are by role; the dark block swaps the same roles. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a66;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.12);
  --series-1: #2a78d6;           /* wind average, temperature */
  --series-1-wash: rgba(42, 120, 214, 0.12);
  --series-2: #eb6834;           /* dew point */
  --launch: rgba(12, 163, 12, 0.18); /* shaded launch sector */
  --launch-edge: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
  --bad-text: #a32020;
  --radius: 14px;
  --gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a998f;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.12);
    --series-1: #3987e5;
    --series-1-wash: rgba(57, 135, 229, 0.18);
    --series-2: #d95926;
    --launch: rgba(12, 163, 12, 0.28);
    --good-text: #0ca30c;
    --bad-text: #e66767;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; }

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--page);
  border-bottom: 1px solid var(--grid);
}
.top .wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -0.01em; font-size: 17px; text-decoration: none; }
.brand small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 999px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 10px; border: 0;
  background: transparent; color: var(--ink-2); cursor: pointer; min-height: 34px;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.fly-btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  background: var(--ink); color: var(--page); font-weight: 800; font-size: 14px;
  padding: 8px 14px; border-radius: 999px; min-height: 38px; letter-spacing: 0.02em;
}

/* ---------- cards ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.card h2 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: baseline; gap: 8px;
}
.card h2 .age { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.age { color: var(--muted); font-size: 13px; }
.stale { opacity: 0.45; }
.stale-note { color: var(--bad-text); font-weight: 700; font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; }

/* ---------- readouts ---------- */
.hero-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero { font-size: 76px; font-weight: 800; line-height: 0.95; letter-spacing: -0.03em; }
.hero .unit { font-size: 18px; font-weight: 600; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.subvals { display: grid; gap: 2px; font-size: 18px; }
.subvals b { font-size: 26px; font-weight: 800; }
.subvals span { color: var(--ink-2); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.tile .label { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.tile .value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tile .value small { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tile .note { font-size: 13px; color: var(--muted); }
.delta-up { color: var(--good-text); }
.delta-down { color: var(--bad-text); }

/* wind band: word + symbol, colour is only a supplement */
.band {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 5px 10px; border-radius: 8px;
  border: 2px solid var(--ink);
}
.band.light, .band.moderate { background: transparent; }
.band.strong { background: var(--warn); color: #0b0b0b; border-color: #0b0b0b; }
.band.too-strong { background: var(--critical); color: #fff; border-color: var(--critical); }
.trend { font-weight: 700; font-size: 15px; }

/* ---------- compass ---------- */
.compass { width: 132px; height: 132px; flex: none; }
.compass .rim { fill: none; stroke: var(--axis); stroke-width: 2; }
.compass .tick { stroke: var(--axis); stroke-width: 2; }
.compass .cardinal { fill: var(--ink-2); font-size: 12px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.compass .sector { fill: var(--launch); stroke: var(--launch-edge); stroke-width: 1.5; }
.compass .arrow { fill: var(--ink); }
.compass .nodir { fill: var(--muted); font-size: 12px; text-anchor: middle; }

/* ---------- overview ---------- */
.station-card { display: grid; gap: 10px; text-decoration: none; }
.station-card:hover { border-color: var(--axis); }
.station-card .name { font-size: 19px; font-weight: 800; }
.station-card .meta { color: var(--muted); font-size: 13px; }
.station-card .wind { display: flex; align-items: center; gap: 14px; }
.station-card .big { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.station-card .big small { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.station-card .gust { font-size: 18px; font-weight: 700; }
.station-card .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.station-card .air { font-size: 17px; }
.station-card .air b { font-weight: 800; }
.station-card .thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--grid); }
.spark { width: 100%; height: 44px; display: block; }
.spark .wash { fill: var(--series-1-wash); }
.spark .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.compass.small { width: 64px; height: 64px; }

/* ---------- station page ---------- */
.station-head h1 { margin: 4px 0 2px; font-size: 26px; letter-spacing: -0.01em; }
.station-head .meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.stack { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .stack { grid-template-columns: 1fr 1fr; }
  .stack .wide { grid-column: 1 / -1; }
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button {
  font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; min-height: 34px;
  border-radius: 999px; border: 1px solid var(--axis); background: transparent; color: var(--ink-2); cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; }
.key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.key.band-key { height: 10px; background: var(--series-1-wash); border: 1px solid var(--series-1); }
.chart { width: 100%; min-height: 200px; }
.chart.dir { min-height: 150px; }
.air-charts { display: grid; gap: 14px; margin-top: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .air-charts { grid-template-columns: repeat(3, 1fr); } }
.chart-title { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.cam img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--grid); display: block; }
.cam input[type="range"] { width: 100%; margin-top: 10px; min-height: 32px; }
.cam .when { font-size: 14px; font-weight: 600; margin-top: 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--grid); }
table.data th:first-child, table.data td:first-child { text-align: left; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 13px; margin-top: 8px; }
.status-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.status-list .bad { color: var(--bad-text); font-weight: 700; }

footer.disclaimer {
  margin: 24px auto 0; max-width: 1180px; font-size: 13px; color: var(--muted); text-align: center;
}

/* uPlot chrome follows the theme */
.u-legend { font-size: 13px; color: var(--ink-2); }
.u-legend .u-marker { border-radius: 2px; }
.uplot .u-select { background: var(--series-1-wash); }
