/* Rally4Real's pages (tools/site/build-pages.ts copies this to public/stage/site.css; the front page inlines the brand
   tokens and the frame instead, tools/site/front.ts). The brand: docs/BRAND.md; the tokens between the markers are
   written by npm run brand. */
/* brand tokens: start (written by npm run brand from tools/brand/brand.mjs; docs/BRAND.md) */
:root {
  --night: #0b0d10;
  --night-2: #12161a;
  --night-3: #1a1f24;
  --line: #ffffff1a;
  --glass: #0b0d10b8;
  --snow: #f2f1ec;
  --soft: #d3d6d0;
  --muted: #a2aaa4;
  --faint: #868e88;
  --amber: #ffb21c;
  --amber-hi: #ffc54d;
  --amber-ink: #ffd27a;
  --gravel: #b9ae97;
  --spruce: #22392c;
  --ice: #8fc3dc;
  --good: #4cd47a;
  --bad: #ff6b5a;
  --paper: #f4f2ec;
  --paper-2: #e8e5dc;
  --ink: #101215;
  --ink-soft: #3d4340;
  --ink-muted: #5f6662;
  --amber-deep: #8a5300;
  --font-display: "Schibsted Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-move: cubic-bezier(0.45, 0, 0.2, 1);
  --t-quick: 120ms;
  --t-panel: 240ms;
  --t-scene: 600ms;
  --slant: -12deg;
}
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 500 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
/* brand tokens: end */
/* the frame: start (every page's, the front page's too: front.ts inlines this block; the header and the footer are
   page.ts siteHeader and siteFooter).
   One column for every page: the header, the content and the footer share it, so the edges line up from the top of a
   page to its foot. The column is at most --column wide (page.ts COLUMN) and never nearer the screen's edge than
   --gutter. Paragraphs keep their own reading width (their em max-widths); tables, cards, lists and maps may take the
   column. Wider is not better for text: lines much over 75 characters are hard to read. */
:root { --column: 960px; --gutter: clamp(20px, 3.4vw, 40px); color-scheme: dark; }
* { box-sizing: border-box; }
html { background: var(--night); color: var(--snow); font-family: var(--font-text); line-height: 1.55;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { margin: 0; }
a { color: var(--snow); text-decoration-color: #ffb21c99; text-underline-offset: 3px; transition: color var(--t-quick); }
a:hover { color: var(--amber); }
a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.top, main, footer { width: min(100% - 2 * var(--gutter), var(--column)); margin-inline: auto; }
/* a paragraph keeps a reading width in the column unless its own rule gives it another (a lede's 44em, a card's) */
main p { max-width: 46em; }
/* the header: the wordmark home at the left, the sections and the other language at the right (on a phone under it) */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; min-height: 64px; padding: 12px 0; }
.mark { display: block; line-height: 0; }
.mark img { display: block; width: 164px; height: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 15px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { color: var(--snow); }
/* the footer: the page's own credits, then the same menu line on every page */
footer { margin-top: 26px; padding: 26px 0 44px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
footer h2 { font-family: var(--font-text); font-size: 14px; font-weight: 600; line-height: 1.55; letter-spacing: 0; color: var(--muted); margin: 0 0 6px; }
footer ul { padding-left: 1.1em; margin: 6px 0 18px; }
footer p { margin: 6px 0; max-width: 60em; color: var(--faint); }
footer a { color: var(--muted); }
@media (max-width: 560px) {
  .mark img { width: 138px; }
  .top nav { gap: 4px 16px; font-size: 14px; }
}
/* the frame: end */
:root {
  --bg: var(--night);
  --panel: var(--night-2);
  --accent: var(--amber);
}
h1, h2, h3, .drive, dl.figs dd, .card h2 { font-family: var(--font-display); }

.crumbs { font-size: 13px; color: var(--faint); margin: 10px 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.hero { padding: 22px 0 30px; }
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 13px; color: var(--muted); margin: 0 0 10px; }
h1 { font-size: clamp(34px, 6.4vw, 58px); line-height: 1.04; margin: 0 0 18px; font-weight: 800; letter-spacing: -0.015em; text-wrap: balance; }
.character { font-size: 20px; color: var(--amber-ink); margin: -6px 0 14px; }
/* the page's signature: the stage's own road, start ring to finish dot (src/ui/roadline.ts) */
.road-strip { margin: 0 0 22px; max-width: 100%; height: auto; }
.rl .rl-road { stroke: var(--amber); }
.rl .rl-start { fill: var(--bg); stroke: var(--snow); }
.rl .rl-finish { fill: var(--snow); }
.lede { font-size: 19px; color: var(--soft); max-width: 44em; margin: 0 0 26px; }
.beat { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--amber); background: #ffb21c14; font-weight: 700; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0; }
.drive { display: inline-block; background: var(--amber); color: var(--ink); font-weight: 800; font-size: 18px; padding: 12px 28px;
  border-radius: 10px; text-decoration: none; letter-spacing: 0.02em; transition: background var(--t-quick); }
.drive::after { content: " \2192"; }
.drive:hover { background: var(--amber-hi); color: var(--ink); }
.cta small { color: var(--muted); font-size: 14px; max-width: 30em; }

section { position: relative; padding: 28px 0; border-top: 1px solid var(--line); }
/* section breaks: the next kilometre of the stage's own road sits on the rule, with its distance */
.km-rule { position: absolute; top: -12px; left: 0; display: flex; align-items: center; gap: 8px; padding-right: 10px; background: var(--bg); }
.km-rule .rl-road { stroke-opacity: 0.85; }
.km-rule span { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
h2 { font-size: 23px; line-height: 1.25; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.005em; }
h3 { font-size: 17px; margin: 26px 0 8px; }
.hard p { font-size: 18px; max-width: 46em; margin: 0; color: var(--soft); }
.along p { font-size: 18px; max-width: 46em; margin: 0 0 10px; color: var(--soft); }
.along p.small { font-size: 13px; color: var(--faint); margin: 0; }

dl.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 26px; margin: 0; }
dl.figs div { border-top: 1px solid var(--line); padding: 10px 0 8px; }
dl.figs dt { font-size: 13px; color: var(--muted); }
dl.figs dd { margin: 2px 0 0; font-size: 17px; font-weight: 650; }

figure { margin: 0; }
figcaption { font-size: 13px; color: var(--faint); margin-top: 10px; max-width: 52em; }

/* elevation profile: the plot stretches to its box, the labels are HTML */
.profile-box { position: relative; height: 210px; margin: 26px 0 30px 44px; }
.profile-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.profile .grid { fill: none; stroke: #ffffff17; stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile .area { fill: #ffb21c17; }
.profile .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ylab { position: absolute; right: 100%; transform: translate(-8px, -50%); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.xlab { position: absolute; top: 100%; transform: translate(-50%, 6px); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pdot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--snow); box-shadow: 0 0 0 2px var(--bg); transform: translate(-50%, -50%); }
.plab { position: absolute; transform: translate(-50%, calc(-100% - 9px)); font-size: 12px; font-weight: 650; white-space: nowrap;
  background: #0b0d10d9; padding: 0 5px; border-radius: 4px; }
.plab.below { transform: translate(-50%, 9px); }

/* map */
.map-box { position: relative; width: 100%; margin: 0 auto; background: #0e1215; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.map-box svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map .c { fill: none; stroke: #ffffff10; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map .ci { fill: none; stroke: #ffffff24; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map .w { fill: #16324a; } /* lakes: a deep ice; never a navy ground under amber (docs/BRAND.md) */
.map .sr { fill: none; stroke: #a3aba566; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .rc { fill: none; stroke: #0b0d10; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .r { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .km { fill: none; stroke: var(--snow); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map .lead { fill: none; stroke: var(--snow); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.kml { position: absolute; transform: translate(-50%, -50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin { position: absolute; width: 15px; height: 15px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--bg); }
.pin.start { background: var(--bg); border: 3px solid var(--snow); }
.pin.finish { background: var(--snow); }
.pinlab { position: absolute; transform: translate(13px, -50%); font-size: 13px; font-weight: 700; background: #0b0d10d9; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.pinlab.left { transform: translate(calc(-100% - 13px), -50%); }
.lbl { position: absolute; font-size: 12px; line-height: 1.3; white-space: nowrap; color: var(--soft); text-shadow: 0 0 3px #0b0d10, 0 0 6px #0b0d10; pointer-events: none; }
.lbl.place::before { content: ""; position: absolute; left: -9px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--soft); }
.lbl.hill::before { content: "\25B2"; position: absolute; left: -11px; top: 50%; transform: translateY(-50%); font-size: 8px; color: var(--muted); }
.lbl.water { color: var(--ice); }
.lbl.r { transform: translate(9px, -50%); }
.lbl.l { transform: translate(calc(-100% - 9px), -50%); }
.lbl.c { transform: translate(-50%, -50%); }
.lbl.l.place::before, .lbl.l.hill::before { left: auto; right: -9px; }
.lbl.c.place::before, .lbl.c.hill::before { display: none; }
.corner { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: var(--snow); color: var(--bg);
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.scale { position: absolute; left: 16px; bottom: 14px; height: 7px; border: 1.5px solid var(--muted); border-top: 0; }
.scale span { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.north { position: absolute; right: 16px; top: 12px; font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.1; }
.north::before { content: "\2191"; display: block; font-size: 15px; }
ol.hardest { padding-left: 1.5em; margin: 0; }
ol.hardest li { margin: 8px 0; padding-left: 4px; }
ol.hardest li::marker { font-weight: 800; color: var(--snow); }
.at, .geo { color: var(--muted); font-variant-numeric: tabular-nums; }
.call { color: var(--muted); }

/* corners by grade: one series, bars from a shared baseline, the count at the tip */
.grades { list-style: none; padding: 0; margin: 0 0 14px; max-width: 560px; }
.grades li { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 12px; margin: 5px 0; }
.grades .g { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.grades .bar { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.grades .bar i { display: block; height: 16px; background: var(--accent); border-radius: 0 4px 4px 0; }
.grades .bar b { font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.grades .zero b { color: var(--faint); }
.small { font-size: 14px; color: var(--muted); max-width: 46em; }

.made p { margin: 0; color: var(--soft); max-width: 46em; }
.road-note { border-left: 3px solid #ffffff2e; padding: 2px 0 2px 16px; color: var(--muted); font-size: 15px; max-width: 46em; }
.road-note p { margin: 0; }

/* the stage lists */
.intro { font-size: 19px; color: var(--soft); max-width: 44em; margin: 0 0 8px; }
.cards { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 20px; background: var(--panel); display: grid; grid-template-columns: 1fr 96px; align-content: start; gap: 6px 18px; }
.card h2 { font-size: 19px; margin: 0 0 2px; grid-column: 1; }
.card h2 a { text-decoration: none; }
.card h2 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card p { margin: 0; font-size: 14px; color: var(--muted); grid-column: 1; }
.card .thumb { grid-column: 2; grid-row: 1 / span 4; width: 96px; height: 96px; }
.thumb path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.thumb .s, .thumb .f { stroke: var(--snow); stroke-width: 6; }
.thumb .s { stroke-width: 7; }

/* the rally pages (tools/site/rally.ts): the roads side by side, the time card, the cars, Sweden */
.rally-roads { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 28px; margin: 0 0 22px; }
.rally-roads > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; }
.rally-roads .road-strip { margin: 0; }
.rally-roads span { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; color: var(--faint); }
p.body { font-size: 18px; max-width: 46em; margin: 0 0 14px; color: var(--soft); }
.table-wrap { overflow-x: auto; margin: 6px 0 12px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; border-bottom-color: #ffffff33; }
th.n, td.n { text-align: right; padding: 9px 0 9px 14px; white-space: nowrap; }
.timecard .t { color: var(--muted); width: 4.4em; }
.timecard .ss b { color: var(--amber-ink); margin-right: 3px; }
.timecard .ss a { font-weight: 650; }
.timecard .svc td, .timecard .fin td, .timecard .night td { color: var(--muted); }
.timecard .day th { padding-top: 20px; font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--snow); text-transform: none; letter-spacing: 0; }
.timecard tfoot th, .timecard tfoot td { font-weight: 700; border-bottom: 0; }
.cars th[scope="row"] { font-weight: 400; }
.cars th b { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.cars th small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 34em; }
.cars td.none { color: var(--faint); white-space: normal; }
.medal { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.medal.gold { background: linear-gradient(135deg, #ffe58a, #d99a12); }
.medal.silver { background: linear-gradient(135deg, #f1f4f5, #9aa4aa); }
.medal.bronze { background: linear-gradient(135deg, #e4a06a, #9a5a2c); }
.where { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 44px; align-items: start; }
.sweden { display: block; height: auto; max-width: 100%; }
.sw-land { fill: #ffffff14; stroke: #ffffff4d; stroke-linejoin: round; }
.sw-dot { fill: #ffffff59; }
.sw-dot.driven { fill: var(--amber); }
.sw-here { fill: none; stroke: var(--snow); }
.cta.end { margin: 26px 0 0; }
.card h3 { font-size: 19px; margin: 0 0 2px; grid-column: 1; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p.runs { color: var(--amber-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.rally-card { grid-template-columns: minmax(0, 1fr); }
.card-roads { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.card-roads .thumb { width: 72px; height: 72px; }
.in-rally p { margin: 0 0 8px; color: var(--soft); max-width: 46em; font-size: 17px; }
.rally-list { margin-top: 34px; }
.rally-list .cards { margin-top: 14px; }
.arrow::after { content: " \2192"; }

/* plain pages: privacy, confirmation (tools/site/plain.ts) */
.doc { padding: 8px 0 34px; }
.doc h1 { font-size: clamp(30px, 5.4vw, 44px); margin: 18px 0 18px; }
.doc h2 { font-size: 20px; margin: 30px 0 8px; }
.doc p, .doc li { color: var(--soft); max-width: 44em; font-size: 17px; }
.doc .note { font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .lede, .intro { font-size: 17px; }
  .hard p, .along p { font-size: 16.5px; }
  .profile-box { height: 170px; margin-left: 38px; }
  .kml, .lbl { display: none; }
  dl.figs { grid-template-columns: 1fr 1fr; gap: 2px 18px; }
  dl.figs dd { font-size: 16px; }
  p.body { font-size: 16.5px; }
  table { font-size: 14px; }
  thead th { font-size: 11px; letter-spacing: 0.04em; }
  th, td { padding-right: 10px; }
  th.n, td.n { padding-left: 10px; }
  .timecard .t { width: auto; }
  /* the kilometre columns' headings wrap, so the time card fits a phone */
  thead th.n { white-space: normal; }
  .timecard th.n, .timecard td.n { padding-left: 6px; }
  .where { grid-template-columns: minmax(0, 1fr); }
  .where-map { justify-self: center; }
}
@media (forced-colors: active) {
  .map .r, .profile .line, .thumb path, .rl .rl-road { stroke: CanvasText; }
  .drive { border: 2px solid ButtonText; }
}
