/* Kurzeme 300. One font (Saira, variable width), one accent (lime), kept for the live parts: handle, ridden fill, km readout, buttons, the fee, the 300 in the logo, focus. */
:root {
  --bg: #10140f;
  --panel: #171c15;
  --line: #2b3228;
  --field: #6f7866;
  --ink: #eef0e6;
  --muted: #a9ad9e;
  --lime: #d4ff3a;
  --earth: #8a6d3b;
  --s-forest: #5f7350;
  --s-farm: #a59c7c;
  --s-sand: #8a6d3b;
  --s-beach: #e3d7b1;
  --s-asphalt: #565c52;
  --pad: clamp(16px, 4vw, 56px);
  --max: 1440px;
  --gutter: max(var(--pad), calc((100vw - var(--max)) / 2 + var(--pad)));
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 Saira, system-ui, sans-serif; font-stretch: 100%;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; font-stretch: 70%; text-transform: uppercase; line-height: 1.1; letter-spacing: 0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.num, .ro-km output, .ro-stats dd, .totals b, .rb-km, .rb-up b, .cutoffs td, .tables td, .fee, .dates time { font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--lime); color: var(--bg); padding: 10px 14px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* header */
.top {
  position: absolute; top: 0; left: 0; right: 0; margin-inline: auto; max-width: var(--max); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 24px;
  padding: 18px var(--pad);
}
.mark { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; text-transform: uppercase; font-stretch: 70%; font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: 0.02em; }
.mark b { color: var(--lime); font-style: italic; font-weight: 800; }
.top ul { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; padding: 0; list-style: none; align-items: center; }
.top nav a { text-decoration: none; font-stretch: 75%; font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 0; text-shadow: 0 1px 8px rgba(16, 20, 15, 0.9); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.top .nav-signup { text-decoration: underline; text-decoration-color: var(--earth); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px;
  padding: 0 30px 0 24px; border: 0; cursor: pointer;
  background: var(--lime); color: var(--bg); text-decoration: none; white-space: nowrap;
  font: 700 19px/1 Saira, sans-serif; font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.05em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: translateY(1px); }
/* keep the slanted shape on focus: a dark inset ring inside the lime instead of an outline the clip-path would cut */
.btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 5px var(--lime); text-decoration: underline; text-underline-offset: 4px; }

/* hero */
.hero {
  display: grid; position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-template-areas: "title" "lede" "inst" "totals";
  min-height: 100dvh;
  padding: 0 var(--gutter) 24px;
}
.stage { grid-area: 1 / 1 / 3 / 2; position: relative; margin: 0 calc(var(--gutter) * -1); overflow: hidden; background: #1b2118; --p: 0; }
.stage img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0;
  transform: translate3d(calc(var(--p) * -2.5%), 0, 0) scale(1.07);
  transition: opacity 700ms var(--ease);
}
.stage img[data-photo="finish"] { object-position: 50% 40%; }
.stage img.on { opacity: 1; }
/* film grain over the photo only: these are dusty, early-morning race shots */
.stage::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: url(../img/grain.png) repeat; background-size: 180px; opacity: 0.04; }
.stage::after { z-index: 1; }
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(16, 20, 15, 0.88) 0%, rgba(16, 20, 15, 0.55) 34%, rgba(16, 20, 15, 0) 62%),
    linear-gradient(180deg, rgba(16, 20, 15, 0.9) 0%, rgba(16, 20, 15, 0.72) 9%, rgba(16, 20, 15, 0) 24%, rgba(16, 20, 15, 0) 62%, var(--bg) 100%);
}
.hero-title { grid-area: title; position: relative; z-index: 2; align-self: end; padding-top: 76px; max-width: 1040px; }
h1 { font-size: clamp(52px, 7.4vw, 120px); font-style: italic; line-height: 1; }
.hero-lede { grid-area: lede; position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 40px; padding: 16px 0 24px; }
.hero-lede p { max-width: 620px; font-size: 19px; line-height: 1.45; text-wrap: pretty; }
.hero-lede strong { font-weight: 700; }

/* instrument: readout + profile + band + axis */
.instrument { grid-area: inst; position: relative; z-index: 2; }
.readout { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 0 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ro-km { display: flex; align-items: baseline; gap: 8px; line-height: 0.8; }
.ro-label { font-weight: 600; font-size: 20px; color: var(--muted); }
.ro-km output { display: inline-block; min-width: 3ch; font-stretch: 70%; font-weight: 700; font-style: italic; font-size: clamp(60px, 6.4vw, 92px); color: var(--lime); }
.ro-place { font-stretch: 75%; font-weight: 700; font-size: 24px; line-height: 1.15; text-transform: uppercase; letter-spacing: 0.02em; }
.ro-surface { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 16px; margin-top: 2px; }
.sw { display: inline-block; width: 14px; height: 14px; flex: none; background: var(--s-forest); }
.ro-stats { display: flex; gap: 28px; margin: 0; }
.ro-stats dt { color: var(--muted); font-size: 14px; }
.ro-stats dd { margin: 0; font-weight: 600; font-size: 19px; white-space: nowrap; }

.chart { position: relative; height: clamp(90px, 12vh, 160px); margin-top: 18px; cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart:focus-visible { outline-offset: 6px; }
.profile { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.profile .grid line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile .area { fill: rgba(238, 240, 230, 0.1); }
.profile .area-ridden { fill: rgba(212, 255, 58, 0.26); }
.profile .line { fill: none; stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.y { position: absolute; right: 0; transform: translateY(-120%); font-size: 12px; color: var(--muted); pointer-events: none; }
.y20 { top: 74%; } .y40 { top: 53%; } .y60 { top: 32%; }
.cp-lines i { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(238, 240, 230, 0.28); }
/* the handle box is exactly the chart's height, so the dot's top % matches the SVG's y */
.handle { position: absolute; top: 0; bottom: 0; left: 0; width: 0; pointer-events: none; }
.handle::before { content: ""; position: absolute; top: -8px; bottom: -32px; left: -1px; width: 2px; background: var(--lime); }
.dot { position: absolute; left: -9px; top: 90%; margin-top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--lime); transition: transform 120ms var(--ease); }
.chart.dragging .dot { transform: scale(1.3); }

.band { display: flex; height: 12px; margin-top: 14px; }
.band i, .rb-band i { display: block; height: 100%; }
.s-forest { background: var(--s-forest); } .s-farm { background: var(--s-farm); } .s-sand { background: var(--s-sand); }
.s-beach { background: var(--s-beach); } .s-asphalt { background: var(--s-asphalt); }

.axis { position: relative; height: 40px; margin-top: 4px; }
.stop {
  position: absolute; transform: translateX(-50%); padding: 6px 4px; border: 0; background: none; cursor: pointer;
  color: var(--ink); font: 600 15px/1 Saira, sans-serif; font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.stop:first-child { transform: none; padding-left: 0; }
.stop:last-child { transform: translateX(-100%); padding-right: 0; }
.stop.r1, .stop.r2 { top: 0; }

.totals { grid-area: totals; position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px 36px; list-style: none; margin: 8px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.totals li { display: flex; align-items: center; gap: 10px; }
.totals b { color: var(--ink); font-stretch: 70%; font-weight: 700; font-size: 36px; line-height: 1; }
.totals .climb { margin-left: auto; }

/* pace: pick a speed, the readout's pass time and the plan line follow */
.pace { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; margin-top: 4px; }
.pace fieldset { display: flex; align-items: center; gap: 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pace legend { float: left; padding: 0; font-size: 14px; color: var(--muted); }
.pace-opts { display: flex; align-items: center; }
.pace-opts label { position: relative; cursor: pointer; }
.pace-opts input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.pace-opts label span { display: block; min-width: 46px; padding: 8px 10px; text-align: center; border: 1px solid var(--field); margin-left: -1px; font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.pace-opts input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); position: relative; }
.pace-opts input:focus-visible + span { outline: 3px solid var(--lime); outline-offset: 2px; position: relative; z-index: 1; }
.pace-unit { margin-left: 10px; font-size: 14px; color: var(--muted); }
.pace-sum { flex: 1 1 360px; font-size: 15px; color: var(--muted); }
.pace-sum b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* sections shared */
main > section:not(.hero) { max-width: var(--max); margin: 0 auto; padding: clamp(72px, 10vw, 140px) var(--pad) 0; }
main > section.sections { padding-top: clamp(64px, 7vw, 104px); }
main > section.results { padding-top: clamp(88px, 12vw, 176px); }
h2 { font-size: clamp(48px, 6.4vw, 96px); line-height: 1; }

/* route */
.route { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.route h2 { margin-bottom: 32px; }
.route .big { font-size: clamp(21px, 2vw, 26px); line-height: 1.4; margin-bottom: 20px; }
.route-text > p:not(.big) { color: var(--muted); max-width: 60ch; }
.facts { margin: 40px 0 0; }
.facts div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; color: var(--ink); }
.facts dd { margin: 0; color: var(--muted); }
.route-photo { margin: 0; position: sticky; top: 24px; }
.route-photo picture { display: block; overflow: hidden; }
.route-photo img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.route-photo figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); max-width: 40ch; }

/* sections: road book */
.sections h2 { margin-bottom: 40px; }
.roadbook { list-style: none; margin: 0; padding: 0; }
.roadbook > li {
  display: grid; grid-template-columns: 170px minmax(0, 1fr) 230px 110px; gap: 10px 32px; align-items: start;
  padding: 26px 0 44px; position: relative;
}
.rb-km { display: flex; align-items: baseline; gap: 10px; font-stretch: 70%; font-weight: 700; font-style: italic; font-size: 44px; line-height: 0.9; }
.rb-km span + span::before { content: "to "; font-style: normal; font-weight: 600; font-size: 18px; color: var(--muted); margin-right: 6px; }
.rb-body h3 { font-size: 32px; margin-bottom: 8px; }
.rb-body p { color: var(--muted); max-width: 62ch; }
.rb-mix { display: flex; flex-direction: column; font-size: 15px; padding-top: 6px; }
.rb-up { text-align: right; color: var(--muted); font-size: 15px; padding-top: 2px; }
.rb-up b { display: block; color: var(--ink); font-stretch: 70%; font-weight: 700; font-size: 36px; line-height: 1; }
.rb-prof { grid-column: 1 / -1; margin-top: 4px; }
.rb-prof svg { display: block; width: 100%; height: clamp(36px, 3.5vw, 52px); overflow: visible; }
.rb-area { fill: rgba(238, 240, 230, 0.12); }
.rb-line { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rb-band { display: flex; height: 6px; }

/* dated route note from the race director */
.note { margin-top: 36px; max-width: 640px; padding-left: 18px; border-left: 3px solid var(--earth); }
.note p { color: var(--muted); }
.note time { color: var(--ink); font-weight: 600; }
.note .sig { display: block; margin-top: 6px; color: var(--ink); font-style: italic; }
.quote { margin: 40px 0 0; max-width: 620px; }
.quote p { font-size: clamp(21px, 2vw, 26px); line-height: 1.35; font-style: italic; }
.quote footer { margin-top: 8px; font-size: 15px; color: var(--muted); }

/* forest strip between the road book and the rules, feathered into the page */
.strip { margin-top: clamp(72px, 9vw, 128px); }
.strip img { width: 100%; height: clamp(260px, 32vw, 520px); object-fit: cover; object-position: 50% 55%;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.25) 6%, rgba(0,0,0,0.6) 13%, #000 22%, #000 78%, rgba(0,0,0,0.6) 87%, rgba(0,0,0,0.25) 94%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.25) 6%, rgba(0,0,0,0.6) 13%, #000 22%, #000 78%, rgba(0,0,0,0.6) 87%, rgba(0,0,0,0.25) 94%, transparent 100%); }
main > section.rules { padding-top: clamp(40px, 5vw, 72px); }

/* rules */
.rules { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.rules-head { position: sticky; top: 24px; }
.cutoffs h3 { font-size: 26px; margin-bottom: 10px; }
.rules-body { display: block; }
.rules-lead { font-size: clamp(21px, 2vw, 26px); line-height: 1.4; max-width: 34ch; }
.rules-lead strong { display: block; font-stretch: 70%; font-weight: 700; text-transform: uppercase; font-size: 1.25em; line-height: 1.1; margin-bottom: 8px; }
.rulelist { margin: 32px 0 0; }
.rulelist div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rulelist dt { font-weight: 600; }
.rulelist dd { margin: 0; color: var(--muted); max-width: 60ch; }
.cutoffs { margin-top: 40px; }
.cutoffs p { color: var(--muted); }
.cutoffs table { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 17px; }
.cutoffs th, .cutoffs td { text-align: left; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); }
.cutoffs thead th { font-size: 14px; color: var(--muted); font-weight: 400; }
.cutoffs tbody th { font-weight: 600; }
.cutoffs td:last-child { font-weight: 700; }

/* results */
.results { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 32px clamp(32px, 6vw, 96px); align-items: end; }
.results .tables, .results .results-note, .results .quote { grid-column: 1 / -1; }
.results-head { max-width: 760px; }
.label-h { font-size: 15px; font-stretch: 75%; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); line-height: 1.2; }
.results-head .results-big { margin-top: 0; font-stretch: 70%; font-weight: 700; text-transform: uppercase; font-size: clamp(48px, 6.4vw, 96px); line-height: 1; color: var(--ink); text-wrap: balance; }
.clock { margin: 0; }
.clock figcaption { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.clock ol { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; align-items: end; height: 190px; margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--ink); }
.clock li { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.clock li i { display: block; width: 100%; height: calc(var(--n) * 140px); background: var(--s-farm); }
.clock li:nth-child(6) i { background: var(--ink); }
.clock li b { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.clock li span { position: absolute; top: 100%; margin-top: 6px; font-size: 13px; color: var(--muted); }
.clock + .tables { margin-top: 40px; }
.results-head p { margin-top: 20px; color: var(--muted); max-width: 60ch; font-size: 19px; }
.results-head strong { color: var(--ink); font-weight: 600; }
.tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; margin-top: 40px; }
.tables table { width: 100%; border-collapse: collapse; }
.tables caption { text-align: left; font-stretch: 70%; font-weight: 700; text-transform: uppercase; font-size: 30px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tables th, .tables td { text-align: left; padding: 11px 10px 11px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.tables thead th { font-size: 14px; color: var(--muted); }
.tables tbody th { font-weight: 600; }
.tables td:first-child { width: 2.5em; color: var(--muted); }
.tables td:nth-child(3) { color: var(--muted); width: 3.5em; }
.tables td:last-child { text-align: right; padding-right: 0; }
.tables thead th:last-child { text-align: right; padding-right: 0; }
.tables tbody tr:first-child td:first-child, .tables tbody tr:first-child td:last-child { color: var(--ink); font-weight: 700; }
.results-note { margin-top: 22px; font-size: 15px; color: var(--muted); }
.results-note a, .form-note a { color: var(--ink); text-decoration-color: var(--earth); text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* sign up */
main > section.signup { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: start; padding-bottom: clamp(72px, 10vw, 140px); }
.price { position: sticky; top: 24px; }
.fee { font-stretch: 70%; font-weight: 700; font-style: italic; font-size: clamp(130px, 17vw, 240px); line-height: 0.82; color: var(--lime); }
.fee .cur { font-size: 0.42em; vertical-align: 0.95em; margin-right: 4px; font-style: normal; }
.fee-what { margin-top: 22px; max-width: 46ch; font-size: 19px; }
.dates { list-style: none; margin: 40px 0 0; padding: 0; }
.dates li { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dates time { font-weight: 700; }
.dates span { color: var(--muted); }
.mailform { background: var(--panel); padding: clamp(24px, 3vw, 40px); display: flex; flex-direction: column; }
.mailform h3 { font-size: 30px; }
.form-note { margin: 12px 0 8px; font-size: 15px; color: var(--muted); }
.mailform label { margin-top: 18px; margin-bottom: 6px; font-size: 15px; font-weight: 600; color: var(--muted); }
.opt { color: var(--muted); font-weight: 400; }
.mailform input, .mailform select, .mailform textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--field); border-radius: 0;
  background: var(--bg); color: var(--ink); font: 400 17px/1.4 Saira, sans-serif;
}
.mailform textarea { resize: vertical; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.pair > div { display: flex; flex-direction: column; min-width: 0; }
.mailform input:focus-visible, .mailform select:focus-visible, .mailform textarea:focus-visible { outline: 3px solid var(--lime); outline-offset: 0; border-color: var(--lime); }
.mailform .btn { margin-top: 26px; align-self: flex-start; }
.form-status { margin-top: 14px; font-size: 15px; color: var(--ink); min-height: 1.4em; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 0 var(--pad) 32px; }
.ruler { position: relative; height: 34px; margin: 0 calc(var(--pad) * -1);
  background: repeating-linear-gradient(90deg, rgba(238, 240, 230, 0.3) 0 1px, transparent 1px calc(100% / 30)) top / 100% 8px no-repeat; }
.ruler i { position: absolute; top: 0; width: 2px; height: 16px; margin-left: -1px; }
.ruler i::before { content: ""; position: absolute; inset: 0; background: var(--earth); }
.ruler i:first-child { margin-left: 0; } .ruler i:last-child { margin-left: -2px; }
.ruler span { font-style: normal; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ruler i:first-child span { left: 0; transform: none; margin-left: 6px; } .ruler i:last-child span { left: auto; right: 0; transform: none; margin-right: 6px; }
.foot-line, .foot-cols, .foot-small { max-width: calc(var(--max) - 2 * var(--pad)); }
.foot-line { margin: 56px auto 0; font-stretch: 70%; font-weight: 700; font-style: italic; text-transform: uppercase; font-size: clamp(40px, 6vw, 84px); line-height: 1; }
.foot-cols { margin: 48px auto 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-cols h2 { font-size: 15px; font-stretch: 100%; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); margin-bottom: 8px; line-height: 1.3; }
.foot-cols p { color: var(--muted); font-size: 16px; }
.foot-cols a { color: var(--ink); text-decoration-color: var(--earth); text-underline-offset: 3px; }
.foot-small { margin: 48px auto 0; font-size: 13px; color: var(--muted); }

/* hover only where a pointer can hover */
@media (hover: hover) {
  .top nav a:hover { text-decoration: underline; text-decoration-color: var(--ink); }
  .btn:hover { background: var(--ink); }
  .chart:hover .handle::before { width: 4px; left: -2px; }
  .pace-opts label:hover span { border-color: var(--ink); }
  .roadbook > li:hover .rb-area { fill: rgba(238, 240, 230, 0.2); }
  .stop:hover { text-decoration: underline; text-decoration-color: var(--earth); }
  .mailform input:hover, .mailform select:hover, .mailform textarea:hover { border-color: var(--muted); }
  .results-note a:hover, .form-note a:hover, .foot-cols a:hover { text-decoration-color: var(--ink); }
}

/* tablet */
@media (max-width: 1100px) {
  .readout { grid-template-columns: auto minmax(0, 1fr); }
  .ro-stats { grid-column: 1 / -1; margin-top: 12px; }
  .roadbook > li { grid-template-columns: 130px minmax(0, 1fr) 100px; }
  .rb-mix { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; gap: 0 16px; padding-top: 0; }
  .rb-up { grid-column: 3; grid-row: 1; }
  .totals .climb { margin-left: 0; }
}
@media (max-width: 860px) {
  .route, .rules, main > section.signup { grid-template-columns: minmax(0, 1fr); }
  .route-photo, .rules-head, .price { position: static; }
  .route-photo img { aspect-ratio: 4 / 3; object-position: 50% 35%; }
  .tables, .results { grid-template-columns: minmax(0, 1fr); }
  .foot-cols { grid-template-columns: minmax(0, 1fr); }
}

/* phone: photo + title, then the price line, then the instrument and totals (same order as the DOM) */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .top { flex-wrap: wrap; padding-top: 12px; padding-bottom: 0; }
  .top nav { width: 100%; }
  .top ul { gap: 2px 18px; }
  .top nav a { font-size: 14px; letter-spacing: 0.04em; padding: 6px 0; display: inline-block; }
  .mark { font-size: 23px; }
  .hero { min-height: 0; padding-bottom: 8px; }
  .stage { grid-area: 1 / 1 / 2 / 2; }
  .stage::after { background: linear-gradient(180deg, rgba(16, 20, 15, 0.92) 0%, rgba(16, 20, 15, 0.78) 24%, rgba(16, 20, 15, 0) 44%, rgba(16, 20, 15, 0.35) 62%, var(--bg) 100%); }
  .hero-title { padding-top: 168px; padding-bottom: 4px; }
  h1 { font-size: clamp(44px, 13.4vw, 60px); }
  .hero-lede { padding: 14px 0 22px; gap: 16px; }
  .hero-lede p { font-size: 17px; }
  .hero-lede .btn { align-self: stretch; width: 100%; }
  .readout { grid-template-columns: auto minmax(0, 1fr); gap: 0 16px; padding-bottom: 10px; }
  .ro-km output { font-size: 60px; }
  .ro-label { font-size: 17px; }
  .ro-place { font-size: 19px; }
  .ro-surface { font-size: 15px; }
  .ro-stats { gap: 10px 18px; margin-top: 10px; flex-wrap: wrap; }
  .ro-stats dd { font-size: 16px; }
  .ro-next { flex-basis: 100%; }
  .ro-next dd { white-space: normal; }
  .chart { height: 96px; margin-top: 14px; }
  .y { font-size: 11px; }
  .band { margin-top: 10px; height: 10px; }
  .axis { height: 50px; }
  .stop { font-size: 13px; font-stretch: 62%; padding: 4px 2px; }
  .stop.r2 { top: 24px; }
  .totals { gap: 10px 22px; padding-top: 14px; font-size: 14px; }
  .totals b { font-size: 28px; }
  .pace { gap: 10px; }
  .pace fieldset { flex-wrap: wrap; gap: 8px; }
  .pace legend { float: none; width: 100%; }
  .pace-opts label span { min-width: 0; padding: 8px 9px; }
  .clock ol { height: 160px; }
  .clock li i { height: calc(var(--n) * 116px); }
  .clock li b, .clock li span { font-size: 12px; }
  .facts div, .dates li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .roadbook > li { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .rb-km { grid-column: 1; grid-row: 1; font-size: 36px; }
  .rb-up { grid-column: 2; grid-row: 1; }
  .rb-body { grid-column: 1 / -1; grid-row: 2; }
  .rb-mix { grid-column: 1 / -1; grid-row: 3; }
  .rb-body h3 { font-size: 28px; }
  .rulelist div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .tables th, .tables td { font-size: 15px; }
  .mailform .btn { align-self: stretch; }
}

/* scroll-driven, transform only: nothing is ever hidden, so the page reads the same with or without them */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .roadbook > li, .rules-lead, .rulelist > div, .cutoffs, .facts > div, .tables table, .dates li, .clock {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 70%;
    }
    .route-photo img { animation: settle linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  }
}
@keyframes rise { from { transform: translateY(22px); } to { transform: none; } }
@keyframes settle { from { transform: scale(1.06) translateY(-1.5%); } to { transform: scale(1) translateY(1%); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage img { transition: none; transform: none; }
  .btn, .dot { transition: none; }
}
