/* Rad-Check Wien — design tokens ------------------------------------------ */

:root {
  --bg:        #f4f6f8;
  --surface:   #ffffff;
  --surface-2: #eef1f5;
  --ink:       #16202b;
  --ink-soft:  #55636f;
  --ink-faint: #8a97a3;
  --line:      #dde3ea;
  --accent:    #0f6fb5;
  --accent-in: #ffffff;
  --good:      #1f8a55;
  --warn:      #b57500;
  --bad:       #c0392f;
  --river:     #2f7fbf;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(16, 32, 48, .06), 0 6px 20px rgba(16, 32, 48, .06);
  --wrap:      1080px;
  --font:      ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1419;
    --surface:   #151d24;
    --surface-2: #1c262f;
    --ink:       #e6edf3;
    --ink-soft:  #a3b1bd;
    --ink-faint: #6f7f8c;
    --line:      #263340;
    --accent:    #4aa8e8;
    --accent-in: #08131c;
    --good:      #46c283;
    --warn:      #e0a63c;
    --bad:       #e8695c;
    --river:     #4aa8e8;
    --shadow:    0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }

a { color: var(--accent); }

/* Header ------------------------------------------------------------------ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 22px 0 18px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 34px; line-height: 1; }
.site-header h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.tagline { margin: 2px 0 0; color: var(--ink-soft); font-size: .92rem; }

.now-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.now-item {
  flex: 1 1 120px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

.now-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.now-value { display: block; font-size: 1.16rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.now-value .unit { font-size: .78rem; font-weight: 500; color: var(--ink-soft); margin-left: 2px; }

/* Sections ---------------------------------------------------------------- */

main { padding-block: 30px 44px; display: grid; gap: 38px; }

/* Grid and flex children default to min-width:auto, which lets wide content
 * (the hour timeline, the code blocks) push the page sideways instead of
 * scrolling inside its own container. Opt every section back to zero. */
main > section { min-width: 0; }

.section-label {
  margin: 0 0 14px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-faint);
}

/* Verdict ----------------------------------------------------------------- */

.verdict {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 26px;
  align-items: start;
}

.verdict .section-label { grid-column: 1 / -1; margin-bottom: 0; }

.verdict-headline {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 3.4vw, 1.95rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.verdict-sub { margin: 10px 0 0; color: var(--ink-soft); font-size: 1rem; }

.flags { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.flags li {
  font-size: .84rem;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 500;
}

.flag-good { color: var(--good); }
.flag-warn { color: var(--warn); }
.flag-bad  { color: var(--bad); }
.flag-info { color: var(--river); }

.verdict-compass { justify-self: center; text-align: center; }
/* height:auto — the dial is taller than it is wide now that the wind readout
 * sits under it instead of on top of the spokes. */
.verdict-compass svg { width: 240px; height: auto; max-width: 100%; }
.compass-caption { margin: 6px 0 0; font-size: .78rem; line-height: 1.5; color: var(--ink-faint); }

.key {
  display: inline-block; width: 16px; height: 5px; border-radius: 3px;
  margin: 0 4px 0 10px; vertical-align: middle; background: var(--river);
}
.compass-caption .key:first-child { margin-left: 0; }
/* Dotted, to match the way the return spokes are drawn on the dial. */
.key-back {
  height: 4px; opacity: .55; background: none;
  background-image: repeating-linear-gradient(90deg, var(--river) 0 2px, transparent 2px 6px);
}
.key-wind { background: var(--accent); }

/* Controls ---------------------------------------------------------------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.control { flex: 1 1 220px; min-width: 0; }

.control-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.control-label output {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  font-size: .84rem;
}

.control input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

/* Route profile ----------------------------------------------------------- */

.profile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
}

.prof-leg + .prof-leg { margin-top: 4px; }

.prof-leg-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin-bottom: 8px; }
.prof-leg-head h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.prof-leg-time { font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* Blocks are sized by flex-grow set from data-w, so distance is visible at a
 * glance without an inline style attribute. */
.prof-track { display: flex; gap: 5px; align-items: stretch; overflow-x: auto; min-width: 0; padding-bottom: 4px; }

.prof-block {
  flex: 1 1 0;
  /* A 3 km stretch beside a 16 km one would otherwise shrink until its name is
   * three letters and an ellipsis. Distance still drives the width, but never
   * below something readable — the track scrolls instead. */
  min-width: 124px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 9px 8px 10px;
  text-align: center;
  overflow: hidden;
}

.prof-bad     { border-color: color-mix(in srgb, var(--bad) 55%, var(--line));  background: color-mix(in srgb, var(--bad) 11%, var(--surface)); }
.prof-good    { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); background: color-mix(in srgb, var(--good) 11%, var(--surface)); }
.prof-neutral { border-color: var(--line); }

.prof-to {
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.25;
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prof-arrow { line-height: 0; margin: 3px 0 1px; color: var(--ink-soft); }
.prof-wind { font-size: .76rem; font-weight: 600; }
.prof-bad .prof-wind  { color: var(--bad); }
.prof-good .prof-wind { color: var(--good); }
.prof-meta { font-size: .68rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.prof-climb { opacity: .85; }

.prof-turn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
}
.prof-turn::before, .prof-turn::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.w-good { color: var(--good); }
.w-bad { color: var(--bad); }
.w-neutral { color: var(--ink-soft); }

/* Rides ------------------------------------------------------------------- */

.ride-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.ride {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ride.is-pick { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.ride.is-far { opacity: .58; }

.ride-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ride-name { margin: 0; font-size: 1.05rem; font-weight: 650; }
.ride-score { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.ride-score .out-of { font-size: .7rem; font-weight: 500; color: var(--ink-faint); }

.ride-meta { margin: 0; font-size: .86rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ride-note { margin: 0; font-size: .86rem; color: var(--ink-soft); }

.ride-stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .84rem; }
.ride-stats dt { color: var(--ink-faint); }
.ride-stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Departure slots --------------------------------------------------------- */

.departures-scroll { overflow-x: auto; min-width: 0; padding-bottom: 6px; }
.departures { display: flex; gap: 6px; min-width: min-content; align-items: flex-end; }

.slot {
  flex: 0 0 52px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  box-shadow: var(--shadow);
}

.slot.is-best { border-color: var(--good); box-shadow: 0 0 0 1px var(--good), var(--shadow); }

/* Light state of the finish: amber = home after sunset, grey = after last light. */
.slot.is-dusk { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.slot.is-dusk .meter-v > span { background: var(--warn); }
.slot.is-dark { opacity: .5; }
.slot.is-dark .meter-v > span { background: var(--ink-faint); }
.slot-time { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.slot-score { font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }

.meter-v {
  height: 70px;
  width: 10px;
  margin: 6px auto 0;
  display: flex;
  align-items: flex-end;
  border-radius: 999px;
}
.meter-v > span { width: 100%; align-self: flex-end; }

.pick-badge {
  align-self: flex-start;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-in);
  border-radius: 999px;
  padding: 3px 9px;
}

.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* Timeline ---------------------------------------------------------------- */

.timeline-scroll { overflow-x: auto; min-width: 0; padding-bottom: 6px; overscroll-behavior-x: contain; }
.timeline { display: flex; gap: 8px; min-width: min-content; }

.hour {
  flex: 0 0 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

/* Which half of the ride each hour belongs to. */
.hour.is-out { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.hour.is-back { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }

.hour-time { font-size: .78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hour-arrow { display: block; margin: 4px auto 2px; }
.hour-speed { font-size: .96rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.hour-gust { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.hour-rain { font-size: .72rem; color: var(--accent); font-variant-numeric: tabular-nums; min-height: 1.1em; }

.hint { margin: 10px 0 0; font-size: .86rem; color: var(--ink-soft); }

/* Method ------------------------------------------------------------------ */

.method {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.method summary { cursor: pointer; font-weight: 600; }
.method-body { font-size: .92rem; color: var(--ink-soft); }
.method-body p { margin: 12px 0; }
.method-body h3 { margin: 20px 0 6px; font-size: .95rem; color: var(--ink); }
.method code { font-family: var(--mono); font-size: .86em; }
.method pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  overflow-x: auto;
  font-size: .84rem;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 34px;
  color: var(--ink-faint);
  font-size: .85rem;
}
.site-footer p { margin: 4px 0; }

.refresh {
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 13px;
  cursor: pointer;
}
.refresh:hover { border-color: var(--accent); color: var(--accent); }

/* Error state ------------------------------------------------------------- */

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

/* Responsive -------------------------------------------------------------- */

@media (max-width: 720px) {
  .verdict { grid-template-columns: minmax(0, 1fr); }
  .verdict-compass { justify-self: start; }
  .now-item { flex-basis: 88px; }

  /* Squeezing five stretches into 390px makes each unreadable. Let the track
   * scroll sideways inside its own card instead. */
  .profile { padding-inline: 12px; }
  .prof-block { flex: 0 0 124px; }
}

/* Belt and braces: nothing should ever scroll the page sideways. */
html, body { max-width: 100%; overflow-x: hidden; }
