/* ============================================================
   WEATHER EFFECT — stylesheet for the cycling kit app
   ------------------------------------------------------------
   Design brief: an instrument, not a lifestyle app. Read on a
   phone at 06:40 in December, outdoors, in poor light, often
   with cold hands. Dark-first for that reason; light mode is
   for daylight and print, not the other way round.

   Fonts (add to <head>):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">
   ============================================================ */

/* ---------- 1. Tokens ---------------------------------------- */

:root {
  /* Temperature ramp. This is data, not decoration: every colour
     in the app that isn't chrome comes from this scale. */
  --t-frozen:  #2E6C9E;   /* below -2 */
  --t-cold:    #4A8299;   /*  -2 – 4  */
  --t-cool:    #6E9A93;   /*   4 – 10 */
  --t-mild:    #A3A075;   /*  10 – 15 */
  --t-warm:    #C9A03F;   /*  15 – 20 */
  --t-hot:     #DF8B26;   /*  20 – 25 */
  --t-baking:  #C85A2B;   /*  above 25 */

  --ramp: linear-gradient(90deg,
    var(--t-frozen) 0%, var(--t-cold) 20%, var(--t-cool) 38%,
    var(--t-mild) 54%, var(--t-warm) 70%, var(--t-hot) 86%, var(--t-baking) 100%);

  /* Set per component to tint its edge. Defaults to mild. */
  --temp: var(--t-mild);

  /* Semantic */
  --signal:  #C8452C;   /* gaps, warnings, "your kit runs out here" */
  --plus:    #D9A441;   /* adjustments that add degrees */
  --minus:   #6FA8C7;   /* adjustments that subtract */

  /* Type */
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --data: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  --step--1: 0.78rem;
  --step-0:  0.95rem;
  --step-1:  1.15rem;
  --step-2:  1.6rem;
  --step-3:  2.4rem;
  --step-4:  clamp(3rem, 14vw, 4.6rem);   /* the ride-feel number */

  /* Space — 4px base */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem;
  --sp-4: 1rem;    --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;

  /* The ride screen is a reading column and wants to stay narrow; the gear
     table is a spreadsheet and does not. Set per screen. */
  --shell: 44rem;

  --tap: 44px;              /* minimum touch target */
  --edge: 3px;              /* the temperature edge on surfaces */
  --radius: 2px;            /* nearly square: instrument, not app-store */

  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* Dark is the default. */
:root,
[data-theme="dark"] {
  --bg:        #0E1A24;
  --surface:   #16242F;
  --surface-2: #1E303C;
  --line:      #2A3E4B;
  --text:      #E8EDEB;
  --text-dim:  #8CA3AF;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}

[data-theme="light"] {
  --bg:        #E7EAE8;
  --surface:   #FFFFFF;
  --surface-2: #F2F5F4;
  --line:      #D2D8D9;
  --text:      #14202A;
  --text-dim:  #5E6D78;
  --shadow: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:        #E7EAE8;
    --surface:   #FFFFFF;
    --surface-2: #F2F5F4;
    --line:      #D2D8D9;
    --text:      #14202A;
    --text-dim:  #5E6D78;
    --shadow: none;
  }
}

/* Temperature utility classes — put on any element to set its
   --temp, which tints edges, markers and bars beneath it. */
.t-frozen { --temp: var(--t-frozen); }
.t-cold   { --temp: var(--t-cold); }
.t-cool   { --temp: var(--t-cool); }
.t-mild   { --temp: var(--t-mild); }
.t-warm   { --temp: var(--t-warm); }
.t-hot    { --temp: var(--t-hot); }
.t-baking { --temp: var(--t-baking); }

/* ---------- 2. Base ------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wx-shell {
  max-width: var(--shell);
  transition: max-width .2s var(--ease);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

body[data-screen="gear"] { --shell: 82rem; }

/* ---------- 3. Type roles ------------------------------------ */

.wx-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-3);
  line-height: .98;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: 0 0 var(--sp-3);
}

.wx-heading {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-1);
  letter-spacing: .03em;
  text-transform: uppercase;
  margin: 0 0 var(--sp-2);
}

/* Eyebrow: always says what kind of thing follows, never decorative. */
.wx-eyebrow {
  font-family: var(--data);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 var(--sp-2);
}

.wx-dim { color: var(--text-dim); }

.wx-num {
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 4. Signature: the ride-feel readout --------------- */
/* The one number the whole app exists to produce. Oversized,
   monospaced so it doesn't jump as it counts, sitting directly
   on the temperature ramp that produced it. */

.wx-readout {
  position: relative;
  padding: var(--sp-4) 0 var(--sp-5);
}

.wx-readout__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
}

.wx-readout__value {
  font-family: var(--data);
  font-weight: 600;
  font-size: var(--step-4);
  line-height: .84;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--temp);
  transition: color .3s var(--ease);
}

.wx-readout__unit {
  font-family: var(--display);
  font-size: var(--step-1);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}

.wx-readout__air {
  font-family: var(--data);
  font-size: var(--step--1);
  color: var(--text-dim);
  text-align: right;
  line-height: 1.6;
}

/* The ramp rule. Also usable on its own as a divider. */
.wx-strip {
  height: 6px;
  background: var(--ramp);
  margin-top: var(--sp-4);
  position: relative;
}

.wx-strip__mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--text);
  transform: translateX(-50%);
  transition: left .3s var(--ease);
}

.wx-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--data);
  font-size: .62rem;
  color: var(--text-dim);
  margin-top: var(--sp-1);
}

/* ---------- 5. Surfaces -------------------------------------- */
/* Every card carries a temperature edge on its left. The chrome
   itself encodes the reading. */

.wx-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: var(--edge) solid var(--temp);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow);
}

.wx-card--flat { background: none; border-color: var(--line); }

.wx-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

/* ---------- 6. Kit list -------------------------------------- */
/* Head to feet, in that order, because that is how you get dressed. */

.wx-kit { margin: 0; }

.wx-kit__row {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--line);
}
.wx-kit__row:first-child { border-top: 0; }

.wx-kit__zone {
  flex: 0 0 4.6rem;
  font-family: var(--data);
  font-size: var(--step--1);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: .15em;
}

.wx-kit__items { flex: 1; margin: 0; }

.wx-kit__items em {
  font-style: normal;
  color: var(--text-dim);
}

/* ---------- 7. Adjustment chips ------------------------------ */
/* Air temperature → ride-feel. Sign is carried by colour so the
   arithmetic scans without reading. */

.wx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.wx-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--step--1);
  color: var(--text-dim);
  white-space: nowrap;
}

.wx-chip b {
  font-family: var(--data);
  font-weight: 600;
  color: var(--minus);
}

.wx-chip--plus b { color: var(--plus); }

.wx-chip[aria-pressed="true"] {
  border-color: var(--text);
  color: var(--text);
}

/* ---------- 8. Garment bars ---------------------------------- */
/* A band chart: bars overlap because the wardrobe overlaps.
   Position encodes the range; colour encodes the midpoint. */

.wx-lane {
  position: relative;
  height: 28px;
  background: var(--surface-2);
  margin-bottom: 3px;
  border-radius: var(--radius);
  overflow: hidden;
}

.wx-bar {
  position: absolute;
  inset-block: 0;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2);
  background: var(--temp);
  color: #0E1A24;
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
  transition: opacity .2s var(--ease);
}

.wx-bar--dark-text { color: #0E1A24; }
.wx-bar--light-text { color: #F5F7F6; }

.wx-bar[data-active="false"] { opacity: .25; }

.wx-bar__range {
  font-family: var(--data);
  font-size: .62rem;
  opacity: .7;
  margin-left: var(--sp-2);
}

/* ---------- 9. Controls -------------------------------------- */

.wx-btn {
  font-family: var(--display);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.wx-btn:hover { background: var(--text); color: var(--bg); }

.wx-btn--primary {
  background: var(--temp);
  border-color: var(--temp);
  color: #0E1A24;
}
.wx-btn--primary:hover { filter: brightness(1.12); background: var(--temp); color: #0E1A24; }

.wx-btn--quiet {
  border-color: var(--line);
  color: var(--text-dim);
  padding: 0 var(--sp-4);
}

/* Slider — the ramp is the track, so dragging feels like moving
   along the temperature itself rather than an abstract control. */
.wx-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--tap);
  background: none;
  margin: 0;
  display: block;
  cursor: ew-resize;
}
.wx-slider::-webkit-slider-runnable-track {
  height: 6px; background: var(--ramp); border-radius: var(--radius);
}
.wx-slider::-moz-range-track {
  height: 6px; background: var(--ramp); border-radius: var(--radius);
}
.wx-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 6px; height: 30px; margin-top: -12px;
  background: var(--text); border: 0; border-radius: 1px;
}
.wx-slider::-moz-range-thumb {
  width: 6px; height: 30px;
  background: var(--text); border: 0; border-radius: 1px;
}

/* ---------- 10. Data table ----------------------------------- */

.wx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}

.wx-table th {
  font-family: var(--data);
  font-weight: 500;
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding-bottom: var(--sp-2);
}

.wx-table td {
  border-top: 1px solid var(--line);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) 0;
  vertical-align: top;
}

.wx-table td:last-child { padding-right: 0; color: var(--text-dim); }

.wx-table .wx-feel {
  font-family: var(--data);
  font-weight: 600;
  color: var(--temp);
}

/* ---------- 11. Alert ---------------------------------------- */
/* For the honest bits: where the wardrobe runs out. Never used
   for anything the user can simply dismiss. */

.wx-alert {
  border-left: var(--edge) solid var(--signal);
  padding: var(--sp-1) 0 var(--sp-1) var(--sp-4);
  margin: var(--sp-4) 0;
  font-size: var(--step--1);
}

.wx-alert b { color: var(--signal); }

/* ---------- 12. Glove mode ----------------------------------- */
/* Not an accessibility afterthought — the intended winter state.
   Bigger targets, bigger type, more contrast, fewer taps. */

[data-touch="gloves"] {
  --step--1: 0.9rem;
  --step-0:  1.1rem;
  --step-1:  1.35rem;
  --tap: 60px;
}
[data-touch="gloves"] .wx-lane { height: 38px; }
[data-touch="gloves"] .wx-kit__row { padding: var(--sp-3) 0; }
[data-touch="gloves"] .wx-chip { padding: var(--sp-2) var(--sp-4); }
[data-touch="gloves"] .wx-slider::-webkit-slider-thumb { height: 44px; width: 10px; margin-top: -19px; }
[data-touch="gloves"] .wx-slider::-moz-range-thumb { height: 44px; width: 10px; }

/* ---------- 13. Responsive ----------------------------------- */

@media (max-width: 30rem) {
  .wx-kit__zone { flex-basis: 3.6rem; }
  .wx-bar__range { display: none; }
  .wx-readout__row { align-items: flex-start; }
}

/* ---------- 14. Motion and print ----------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --text-dim: #444; --line: #bbb; }
  body { background: #fff; }
  .wx-slider, .wx-btn { display: none; }
  .wx-bar[data-active="false"] { opacity: 1; }
  .wx-card { break-inside: avoid; }
}

/* ---------- 15. App chrome ----------------------------------- */
/* Everything the design system doesn't cover, built from its own
   tokens: the form that describes a ride, the gear screen, and
   the lookup comparison. Nothing here introduces a new colour. */

.wx-tabs {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.wx-tab {
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  background: none;
  border: 0;
  border-bottom: var(--edge) solid transparent;
  margin-bottom: -1px;
  color: var(--text-dim);
  cursor: pointer;
}
.wx-tab[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--temp); }

/* --- Fields --- */

.wx-field { display: block; margin-bottom: var(--sp-4); }

.wx-label {
  display: block;
  font-family: var(--data);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
}

.wx-input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  font-family: var(--data);
  font-size: var(--step-0);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.wx-input:focus { outline: 2px solid var(--temp); outline-offset: -1px; border-color: var(--temp); }
select.wx-input { font-family: var(--body); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--temp); width: auto; min-height: 0; }

.wx-grid { display: grid; gap: var(--sp-3); }
.wx-grid--2 { grid-template-columns: repeat(2, 1fr); }
.wx-grid--3 { grid-template-columns: repeat(3, 1fr); }
.wx-grid--4 { grid-template-columns: repeat(4, 1fr); }
.wx-grid--5 { grid-template-columns: repeat(5, 1fr); }
.wx-row { display: flex; gap: var(--sp-2); align-items: flex-end; }
.wx-row > .wx-grow { flex: 1; }

@media (max-width: 46rem) { .wx-grid--5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 34rem) {
  .wx-grid--3, .wx-grid--4, .wx-grid--5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 22rem) {
  .wx-grid--2, .wx-grid--3, .wx-grid--4, .wx-grid--5 { grid-template-columns: 1fr; }
}

/* Choice chips reuse the adjustment chip, pressed state and all. */
.wx-choice { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.wx-choice .wx-chip {
  min-height: var(--tap);
  align-items: center;
  cursor: pointer;
  background: none;
  font-family: var(--body);
}
.wx-choice .wx-chip[aria-pressed="true"] {
  background: var(--temp);
  border-color: var(--temp);
  color: var(--bg);
}

/* --- Location suggestions --- */

.wx-suggest {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.wx-suggest button {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font-family: var(--body);
  font-size: var(--step-0);
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.wx-suggest button:first-child { border-top: 0; }
.wx-suggest button:hover:not(:disabled) { background: var(--surface-2); }
.wx-suggest button:disabled { color: var(--text-dim); cursor: default; }

/* --- Status --- */

.wx-status {
  border-left: var(--edge) solid var(--temp);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-4);
  margin-top: var(--sp-4);
  font-size: var(--step--1);
  color: var(--text-dim);
}
.wx-status--err { border-left-color: var(--signal); color: var(--signal); }

/* --- Disclosure --- */

.wx-more { margin-top: var(--sp-4); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.wx-more > summary {
  cursor: pointer;
  font-family: var(--data);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.wx-more > summary:hover { color: var(--text); }
.wx-more[open] > summary { color: var(--text); margin-bottom: var(--sp-3); }

/* --- Tables that must scroll rather than squash the page --- */

.wx-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wx-table td.wx-right, .wx-table th.wx-right { text-align: right; }
.wx-table tr.is-here td { background: var(--surface-2); }
.wx-table tr.is-here td:first-child { box-shadow: inset var(--edge) 0 0 var(--temp); }
.wx-table .wx-total td { border-top: 2px solid var(--line); font-weight: 600; color: var(--text); }

/* --- Gear list --- */

.wx-gear { min-width: 46rem; }
.wx-gear tbody tr { cursor: pointer; }
.wx-gear tbody tr:hover td { background: var(--surface-2); }
.wx-gear tr.is-off td { opacity: .38; }
.wx-gear tr.is-off td:first-child { opacity: 1; }
.wx-gear tr.is-off .wx-item { text-decoration: line-through; }
.wx-gear tr.is-sel td { background: var(--surface-2); }
.wx-gear tr.is-sel td:first-child { box-shadow: inset var(--edge) 0 0 var(--temp); }
.wx-gear td:first-child { text-align: center; width: 4.4rem; }

/* In or out of the advice. A labelled two-state button rather than a tick box:
   the state is readable without decoding it, and it is a real tap target. */
.wx-toggle {
  min-width: 3.2rem;
  min-height: 32px;
  padding: 0 var(--sp-2);
  font-family: var(--display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
/* One consistent "on", not the row's temperature tint. Colour is data
   everywhere else in this app; a control that borrowed the ramp would turn the
   column into a chart and make the state harder to read, not easier. */
.wx-toggle[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.wx-toggle:hover { border-color: var(--text); }
[data-touch="gloves"] .wx-toggle { min-height: var(--tap); min-width: 4rem; }
.wx-gear .wx-item { font-weight: 500; color: var(--text); }
.wx-gear .wx-flagcell { font-family: var(--data); font-size: .62rem; color: var(--text-dim); white-space: nowrap; }

/* The range column drawn rather than written: same band chart as the
   torso lanes, so a gap in the wardrobe is visible as a gap. */
.wx-gear .wx-lane { height: 18px; min-width: 8rem; margin: 0; }
.wx-gear .wx-bar { font-size: .62rem; padding: 0 var(--sp-1); }

.wx-bar--empty { background: none; border: 1px dashed var(--line); color: var(--text-dim); }

/* --- Toolbar --- */

.wx-bar-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-4); }
.wx-bar-row .wx-spacer { flex: 1; }
.wx-file {
  display: inline-flex; align-items: center;
  font-family: var(--display); font-size: var(--step-0); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  min-height: var(--tap); padding: 0 var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text-dim); cursor: pointer;
}
.wx-file:hover { border-color: var(--text); color: var(--text); }
/* A toggle needs to show its state, not just respond to hover. */
.wx-btn[aria-pressed="true"] {
  background: var(--text); color: var(--bg); border-color: var(--text);
}
.wx-btn:disabled { opacity: .35; cursor: default; }
.wx-btn:disabled:hover { background: none; color: var(--text); }

/* --- Add / edit form --- */

.wx-form {
  border: 1px solid var(--line);
  border-left: var(--edge) solid var(--temp);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
}

.wx-flags { display: flex; flex-direction: column; gap: var(--sp-1); }
.wx-check {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--step--1); color: var(--text); cursor: pointer;
}

/* --- Lookup result --- */

.wx-found {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--sp-3);
  margin-top: var(--sp-3);
}
.wx-found__head { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-3); }

.wx-badge {
  font-family: var(--data);
  font-size: .62rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 2px var(--sp-2);
  border: 1px solid currentColor;
  border-radius: var(--radius);
}
.wx-badge--high { color: var(--t-cool); }
.wx-badge--medium { color: var(--plus); }
.wx-badge--low { color: var(--signal); }

.wx-cmp td.wx-new { color: var(--temp); font-weight: 600; }
.wx-cmp td:last-child, .wx-cmp th:last-child { text-align: center; width: 3rem; }

.wx-note { font-size: var(--step--1); color: var(--text-dim); margin: var(--sp-3) 0 0; }

/* Why a lookup returned what it did — a reading trail, so it wants to be
   compact and quiet rather than spaced like the kit list. */
.wx-why { margin: 0; padding: 0; list-style: none; font-size: var(--step--1); }
.wx-why li {
  padding: var(--sp-1) 0 var(--sp-1) var(--sp-3);
  border-left: 1px solid var(--line);
  color: var(--text-dim);
}
.wx-why li:first-child { color: var(--text); }

/* --- Footer --- */

.wx-foot {
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--text-dim);
}
.wx-foot a { color: inherit; }

.wx-hidden { display: none !important; }

@media print { .wx-tabs, .wx-bar-row, .wx-form, .wx-suggest { display: none; } }

/* ---------- 16. Sky, wind and the hours ahead ---------------- */

/* The hourly strip. Ride hours are lit; the hours after are dimmed but
   present, because a shower that lands twenty minutes after you'd be home
   is worth seeing before you decide how long to go out for. */

.wx-hours { display: flex; gap: 1px; min-width: min-content; }

.wx-hour {
  flex: 0 0 3.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-1);
  background: var(--surface-2);
  border-top: var(--edge) solid transparent;
  opacity: .45;
}
.wx-hour.is-riding { opacity: 1; border-top-color: var(--temp); }

.wx-hour__time {
  font-family: var(--data);
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.wx-hour__temp {
  font-family: var(--data);
  font-weight: 600;
  font-size: var(--step-0);
  color: var(--temp);
}
.wx-hour__wind {
  display: flex; align-items: center; gap: 2px;
  font-size: .66rem; color: var(--text-dim);
}
.wx-hour__rain { font-family: var(--data); font-size: .64rem; color: var(--text-dim); }
.wx-hour__rain.is-wet { color: var(--minus); font-weight: 600; }

.wx-ico { display: block; }
.wx-windarrow { color: var(--text-dim); flex: 0 0 auto; }

/* --- Wind and route --- */

.wx-windgrid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-5);
  align-items: center;
}
@media (max-width: 30rem) {
  .wx-windgrid { grid-template-columns: 1fr; gap: var(--sp-3); justify-items: center; }
  .wx-windgrid > div:last-child { justify-self: stretch; }
}
.wx-rosewrap { line-height: 0; }
.wx-rose { display: block; }

/* Beaufort, because that is the unit the forecast gets discussed in here,
   and the number carries more than a speed does. */
.wx-bft { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.wx-bft__n {
  font-family: var(--data);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: .9;
  color: var(--minus);
}
.wx-bft__u {
  font-family: var(--display);
  font-size: var(--step-0);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.wx-bft__name {
  font-family: var(--display);
  font-size: var(--step-1);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.wx-startdir {
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-3);
  border-left: var(--edge) solid var(--temp);
  font-size: var(--step-0);
}
.wx-startdir b { color: var(--temp); }

[data-touch="gloves"] .wx-hour { flex-basis: 4.8rem; }

@media print { .wx-hour { opacity: 1; } }

/* ---------- 17. Gear table header controls ------------------- */

.wx-th { display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
/* On a right-aligned column the buttons are rendered before the label, so they
   sit inside the cell rather than hard against the next column's heading. */
.wx-right .wx-th { justify-content: flex-end; }
/* Header cells are ruled apart, which is what lets a column's buttons sit at
   its edge without reading as the next column's. */
#geartable thead th { padding-left: var(--sp-3); padding-right: var(--sp-3); vertical-align: bottom; }
#geartable thead th + th { border-left: 1px solid var(--line); }
#geartable thead th:first-child { padding-left: var(--sp-2); }
#geartable tbody td:first-child { padding-left: var(--sp-2); }
#geartable tbody td { padding-left: var(--sp-3); }

.wx-th__label { cursor: help; border-bottom: 1px dotted var(--line); }
.wx-th__label:hover, .wx-th__label:focus-visible { color: var(--text); border-bottom-color: var(--text-dim); }

.wx-th__btns { display: flex; gap: 1px; flex: 0 0 auto; }

/* --- Scale under the range heading --- */
.wx-axis {
  position: relative;
  height: 1.1rem;
  margin-top: var(--sp-1);
  border-top: 1px solid var(--line);
}
.wx-axis__t {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  font-family: var(--data);
  font-size: .56rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-dim);
}
/* The end labels would otherwise hang outside the column. */
.wx-axis__t:first-child { transform: none; }
.wx-axis__t:last-child { transform: translateX(-100%); }

/* Gridlines on every lane at the same 5°C spacing, so each bar can be read
   against the scale rather than only against its neighbours. */
.wx-gear .wx-lane {
  background-image: repeating-linear-gradient(90deg,
    var(--line) 0 1px, transparent 1px calc(100% / 7));
}

.wx-hbtn {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.wx-hbtn:hover { color: var(--text); border-color: var(--line); }
.wx-hbtn svg { display: block; }
.wx-hbtn.is-on { color: var(--bg); background: var(--text); border-color: var(--text); }
[data-touch="gloves"] .wx-hbtn { width: 30px; height: 30px; font-size: 13px; }

.wx-empty { text-align: center; color: var(--text-dim); padding: var(--sp-5) var(--sp-3); }
.wx-link {
  background: none; border: 0; padding: 0;
  color: var(--text); text-decoration: underline; cursor: pointer; font: inherit;
}

/* --- Tooltip and filter popover --- */

.wx-tip, .wx-pop {
  position: fixed;
  z-index: 50;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.wx-tip {
  max-width: 22rem;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--text);
  pointer-events: none;
}
.wx-pop {
  width: min(20rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--sp-3);
  border-left: var(--edge) solid var(--temp);
}
.wx-poplist { max-height: 14rem; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-1); }
.wx-poprow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.wx-pop .wx-check { padding: var(--sp-1) 0; }
.wx-pop .wx-input { min-height: 36px; }

@media print { .wx-th__btns, .wx-tip, .wx-pop { display: none; } }

/* ---------- 18. Along the route ------------------------------ */
/* One column per leg, ordered by distance. Same shape as the hourly strip,
   because it answers the same question along a different axis. */

.wx-legs { display: flex; gap: 1px; min-width: min-content; }

.wx-leg {
  flex: 0 0 4.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-1);
  background: var(--surface-2);
  border-top: var(--edge) solid var(--temp);
}

.wx-leg__km {
  font-family: var(--data);
  font-size: .62rem;
  letter-spacing: .04em;
  color: var(--text);
}
.wx-leg__feel {
  font-family: var(--data);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.1;
  color: var(--temp);
}
.wx-leg__air, .wx-leg__ele, .wx-leg__time {
  font-family: var(--data);
  font-size: .58rem;
  color: var(--text-dim);
}
.wx-leg__wind {
  display: flex; align-items: center; gap: 2px;
  font-size: .6rem; color: var(--text-dim);
}
/* Riding into it is the case worth seeing without reading the number. */
.wx-leg__wind .wx-num { color: var(--minus); font-weight: 600; }

[data-touch="gloves"] .wx-leg { flex-basis: 5.4rem; }
@media print { .wx-leg { break-inside: avoid; } }

/* ---------- 19. The mark ------------------------------------- */
/* The temperature ramp wrapped into a wheel and cut into its seven bands,
   with a needle reading off it. A gauge rather than a bicycle: the app is an
   instrument, and the one number it exists to produce is a needle position. */

.wx-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.wx-brand > div { min-width: 0; }
.wx-brand .wx-eyebrow { margin-bottom: 2px; }
.wx-brand .wx-title { margin: 0; }

.wx-logo {
  width: 3.1rem;
  height: 3.1rem;
  flex: 0 0 auto;
  display: block;
}

@media (max-width: 26rem) {
  .wx-logo { width: 2.5rem; height: 2.5rem; }
}
@media print { .wx-logo { width: 2.2rem; height: 2.2rem; } }

/* ---------- 20. Map ------------------------------------------ */
/* Tiles underneath, everything meaningful drawn on top — so a blocked or
   offline tile server costs the basemap and nothing else. */

.wx-map {
  position: relative;
  margin: 0 0 var(--sp-3);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.wx-map__tiles { position: absolute; inset: 0; }
.wx-map__tiles img {
  position: absolute;
  width: 256px; height: 256px;
  /* OSM's raster tiles are drawn for light backgrounds; damp them down so the
     route and arrows stay the brightest things on a dark screen. */
  filter: grayscale(.55) brightness(.72) contrast(1.05);
}
:root[data-theme="light"] .wx-map__tiles img,
:root:not([data-theme="dark"]) .wx-map__tiles img { filter: grayscale(.35) contrast(1.02); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wx-map__tiles img { filter: grayscale(.55) brightness(.72) contrast(1.05); }
}

.wx-map__ink { position: relative; display: block; }
.wx-map__credit {
  position: absolute; right: 0; bottom: 0;
  margin: 0; padding: 1px 5px;
  font-size: .58rem;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.wx-map__credit a { color: inherit; }

.wx-maplegend {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  font-size: var(--step--1); color: var(--text-dim);
  margin: 0 0 var(--sp-3);
}
.wx-maplegend span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.wx-maplegend i { width: 20px; height: 0; border-top-width: 3px; border-top-style: solid; }
.wx-maplegend .k-wind { border-top-color: var(--minus); }
.wx-maplegend .k-go { border-top-color: var(--temp); border-top-style: dashed; }
.wx-maplegend .k-route { border-top-color: var(--temp); }
