/* ==========================================================================
   RailGuard website: shared components
   Every repeated visual pattern lives here and only here. Pages compose
   these classes and never restyle them. Colours come from tokens.css.
   Contents: base, skip link, header, button, chip, km marker, section head,
   feature + device frame, steps, gear, price card, accordion, footer,
   rail + progress, traffic sign, cab view (hero scene) + restriction card.
   ========================================================================== */

/* ---- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/1.6 var(--font-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: .98; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 600; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
::selection { background: var(--signal); color: var(--on-signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: var(--s-4); top: var(--s-3); z-index: 100;
  padding: .7rem 1rem; border-radius: var(--r-2);
  background: var(--signal); color: var(--on-signal);
  font: 700 1.125rem/1 var(--font-display); text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---- Header ----------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--scrim);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: var(--header-h);
}
.site-header__actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 1.9rem; height: 1.9rem; flex: none; }
.brand__ring { stroke: var(--signal); }
.brand__rail { stroke: var(--text); }
.brand__lamp { fill: var(--signal); }
.brand__name { font: 700 1.625rem/1 var(--font-display); letter-spacing: .005em; }

.site-nav { display: none; }
.site-nav a {
  display: inline-block; padding: .55rem .8rem; border-radius: var(--r-1);
  color: var(--muted); font: 500 1rem/1 var(--font-text); text-decoration: none;
  transition: color var(--t-fast);
}
.site-nav a:hover { color: var(--text); }

.icon-btn {
  display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0;
  color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: var(--r-2);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-base) var(--ease);
}
.icon-btn:hover { border-color: var(--signal); box-shadow: 0 0 20px -6px var(--signal-glow); }
.icon-btn svg { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
/* the theme switch shows the look it will switch to */
.theme-toggle .i-moon { display: none; }
[data-theme="light"] .theme-toggle .i-sun { display: none; }
[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* ---- Button ------------------------------------------------------------------ */
/* Label is bold and 19px: "large text" for contrast, so white on the light-theme amber passes. */
.btn {
  --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3.25rem; padding: 0 1.6rem;
  font: 700 1.1875rem/1 var(--font-display); letter-spacing: .012em; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-2);
  text-decoration: none; cursor: pointer;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-fast), background-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { --btn-bg: var(--signal); --btn-fg: var(--on-signal); --btn-bd: var(--signal); }
.btn--primary:hover { box-shadow: 0 0 0 4px var(--signal-soft), 0 10px 34px -8px var(--signal-glow); }
.btn--quiet:hover { border-color: var(--signal); box-shadow: 0 0 26px -10px var(--signal-glow); }
.btn--sm { min-height: 2.75rem; padding: 0 1.05rem; }

/* ---- Chip ---------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem .75rem; border-radius: var(--r-1);
  font: 500 .9375rem/1.2 var(--font-text); color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
}
.chip--signal { background: var(--signal); border-color: var(--signal); color: var(--on-signal); font-weight: 600; }
/* a lamp: the amber light of the brand, used once above the hero title */
.chip--lamp::before {
  content: ""; flex: none; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 10px var(--signal-glow);
}
@keyframes lamp { 50% { opacity: .35; } }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---- Kilometre marker: the recurring detail ------------------------------------ */
.km {
  display: inline-flex; align-items: stretch;
  font: 500 var(--fs-mono)/1 var(--font-mono); letter-spacing: .02em; color: var(--muted);
}
.km__plate {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .7rem .5rem .6rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--signal);
  border-radius: 2px var(--r-1) var(--r-1) 2px;
}
.km__val { color: var(--signal-text); font-weight: 500; }

/* ---- Section head ----------------------------------------------------------------- */
.section-head { display: grid; justify-items: start; gap: var(--s-4); max-width: 48rem; }
.section-head__title { font-size: var(--fs-h2); letter-spacing: -.002em; }
.section-head__lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--muted); max-width: var(--measure); }

/* ---- Feature block + tick list ---------------------------------------------------- */
.feature { display: grid; gap: var(--s-6); align-items: center; }
.feature__text { display: grid; gap: var(--s-4); align-content: start; max-width: 34rem; }
.feature__title { font-size: var(--fs-h3); }
.feature__lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--muted); }
.ticks { display: grid; gap: var(--s-2); margin-top: var(--s-2); }
.ticks li { position: relative; padding-left: 1.6rem; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .72em; width: .9rem; height: 2px; background: var(--signal);
}
.feature__media { position: relative; display: grid; justify-items: center; }

/* ---- Device frame (CSS only; the screenshot is an <img> inside) ------------------- */
.device {
  --w: 15rem;
  position: relative; width: var(--w); max-width: 100%;
  padding: calc(var(--w) * .03);
  background: var(--device-body);
  border-radius: calc(var(--w) * .125);
  box-shadow: inset 0 0 0 1px var(--device-edge), var(--shadow-device);
  isolation: isolate;
}
.device::before {                       /* ambient glow, so the frame reads as lit */
  content: ""; position: absolute; inset: -14% -22%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--signal-soft), transparent);
}
.device img {
  width: 100%; height: auto;
  border-radius: calc(var(--w) * .097);
  background: var(--surface);
}
.device--phone::after {                 /* camera */
  content: ""; position: absolute; left: 50%; top: calc(var(--w) * .062);
  width: calc(var(--w) * .035); aspect-ratio: 1; border-radius: 50%;
  transform: translateX(-50%); background: var(--device-body); box-shadow: 0 0 0 1px var(--device-edge);
}
.device--tablet { --w: 34rem; padding: calc(var(--w) * .02); border-radius: calc(var(--w) * .04); }
.device--tablet img { border-radius: calc(var(--w) * .022); }

/* Two devices overlapping: the tablet leads, the phone sits over its lower corner.
   Both share one grid cell, so the box is as tall as the taller device and nothing leaks into the text.
   Sizes follow the width of the media box (container units), never the viewport. */
.feature__media { container-type: inline-size; }
.feature__media--duo { width: 100%; max-width: 38rem; justify-items: stretch; }
.feature__media--duo .device { grid-area: 1 / 1; }
.feature__media--duo .device--tablet { --w: min(32rem, calc(100cqw - 4.25rem)); justify-self: start; align-self: start; }
.feature__media--duo .device--phone { --w: 8.5rem; justify-self: end; align-self: end; }
.feature__media--solo .device--phone { --w: min(16rem, 100cqw); }
@media (min-width: 56rem) {
  .feature__media--duo .device--tablet { --w: min(32rem, calc(100cqw - 5rem)); }
  .feature__media--duo .device--phone { --w: 9.75rem; }
  .feature__media--solo .device--phone { --w: min(17rem, 100cqw); }
}

/* ---- Steps: a sequence, so numbered ------------------------------------------------ */
.steps { display: grid; gap: var(--s-6); position: relative; }
.step { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s-4); align-items: start; align-content: start; }
.step__no {
  position: relative; z-index: 1;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  font: 500 1.125rem/1 var(--font-mono); color: var(--signal-text);
  background: var(--ground); border: 2px solid var(--signal); border-radius: 50%;
}
.step__title { font-size: 1.875rem; padding-top: .2rem; }
.step__text { grid-column: 2; margin-top: var(--s-2); color: var(--muted); max-width: 26rem; }
.step__action { grid-column: 2; margin-top: var(--s-4); }

/* ---- Notice: one sentence the reader must not miss ------------------------------------------ */
.notice {
  max-width: 44rem; padding: var(--s-1) 0 var(--s-1) var(--s-4);
  border-left: 3px solid var(--signal);
  font-size: var(--fs-lead); line-height: 1.5; color: var(--text);
}

/* ---- Gear (equipment): a ruled parts list, not a card grid ------------------------- */
.gear { display: grid; border-top: 1px solid var(--line); }
.gear__item {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-4);
  padding: var(--s-5) 0; border-bottom: 1px solid var(--line);
}
.gear__icon { grid-row: span 2; width: 2.5rem; height: 2.5rem; color: var(--signal-text); }
.gear__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gear__title { font: 700 1.625rem/1.1 var(--font-display); }
.gear__text { color: var(--muted); max-width: 28rem; }

/* ---- Price card ------------------------------------------------------------------------ */
.price {
  position: relative; display: grid; gap: var(--s-3); align-content: start;
  padding: var(--s-5) var(--s-5) var(--s-6);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.price:hover { border-color: color-mix(in srgb, var(--signal) 60%, var(--line)); box-shadow: 0 18px 50px -28px var(--signal-glow); }
.price--best { border-color: var(--signal); background: linear-gradient(180deg, var(--signal-soft), transparent 55%), var(--surface); }
.price__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 2rem; }
.price__period { font: 600 1.375rem/1.1 var(--font-text); }
.price__figure {
  display: flex; align-items: baseline; gap: var(--s-3);
  font: 700 var(--fs-figure)/.82 var(--font-display); letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.price__figure [data-count] { display: inline-block; min-width: 2ch; }
.price__cur { font: 500 1.25rem/1 var(--font-mono); color: var(--muted); letter-spacing: 0; }
.price__per { font: 500 var(--fs-small)/1.3 var(--font-mono); color: var(--muted); }

/* ---- Form: fieldset, field, input, choice card, tick, stepper (the buying page) ---------------- */
.form { display: grid; gap: var(--s-7); min-width: 0; }
.fieldset { display: grid; gap: var(--s-4); min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset__legend { padding: 0; margin-bottom: var(--s-3); font: 700 var(--fs-h3)/1 var(--font-display); }
.field { display: grid; gap: var(--s-2); min-width: 0; }
.field__label { font: 600 1.0625rem/1.3 var(--font-text); }
.field__opt { color: var(--muted); font-weight: 400; }
.field__hint { color: var(--muted); font-size: var(--fs-small); }
.field__error { color: var(--critical); font: 600 var(--fs-small)/1.4 var(--font-text); }
.input {
  width: 100%; min-height: 3.25rem; padding: .7rem .9rem;
  font: 400 1.0625rem/1.3 var(--font-text); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2);
  transition: border-color var(--t-fast), box-shadow var(--t-base) var(--ease);
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: color-mix(in srgb, var(--signal) 45%, var(--line)); }
.input:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-color: var(--signal); border-radius: var(--r-2); }
.input[aria-invalid="true"] { border-color: var(--critical); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* a card that is a real radio button: the input covers the card, so the whole card is the target */
.choices { display: grid; gap: var(--s-3); }
.choice { position: relative; display: block; cursor: pointer; }
.choice__input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice__body {
  position: relative; display: grid; gap: var(--s-1); align-content: start; height: 100%;
  padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3);
  transition: border-color var(--t-fast), box-shadow var(--t-base) var(--ease), background-color var(--t-fast);
}
.choice__body::after {
  content: ""; position: absolute; top: var(--s-4); right: var(--s-4); width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--muted); border-radius: 50%;
}
.choice__input:hover + .choice__body { border-color: color-mix(in srgb, var(--signal) 60%, var(--line)); }
.choice__input:checked + .choice__body {
  border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal);
  background: linear-gradient(180deg, var(--signal-soft), transparent 70%), var(--surface);
}
.choice__input:checked + .choice__body::after { border-color: var(--signal); background: radial-gradient(circle, var(--signal) 0 40%, transparent 45%); }
.choice__input:focus-visible + .choice__body { outline: 2px solid var(--signal); outline-offset: 3px; }
.choice__body .chip { justify-self: start; }
.choice__title { padding-right: 2rem; font: 700 1.5rem/1.1 var(--font-display); }
.choice__text { color: var(--muted); font-size: var(--fs-small); }
.choice__figure { font: 700 2.25rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.choice__price { font: 500 var(--fs-small)/1.3 var(--font-mono); color: var(--muted); }

.tick { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); align-items: start; cursor: pointer; }
.tick__input {
  appearance: none; -webkit-appearance: none; flex: none; width: 1.5rem; height: 1.5rem; margin: .1rem 0 0;
  background: var(--surface); border: 2px solid var(--muted); border-radius: var(--r-1); cursor: pointer;
}
.tick__input:checked { background: var(--signal); border-color: var(--signal); }
.tick__input:checked::after {
  content: ""; display: block; width: .4rem; height: .8rem; margin: .06rem auto 0;
  border: solid var(--on-signal); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.tick__input[aria-invalid="true"] { border-color: var(--critical); }
.tick a { color: var(--text); }

.stepper { display: inline-grid; grid-template-columns: 3.25rem 6rem 3.25rem; width: max-content; max-width: 100%; }
.stepper__btn {
  min-height: 3.25rem; padding: 0; font: 700 1.5rem/1 var(--font-display); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.stepper__btn:hover { border-color: var(--signal); }
.stepper__btn:first-child { border-radius: var(--r-2) 0 0 var(--r-2); }
.stepper__btn:last-child { border-radius: 0 var(--r-2) var(--r-2) 0; }
.stepper .input { border-radius: 0; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper .input::-webkit-outer-spin-button, .stepper .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- Summary: what is being bought and what it costs ------------------------------------------- */
.summary { display: grid; gap: var(--s-4); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.summary__title { font: 700 1.5rem/1 var(--font-display); }
.summary__rows { display: grid; gap: var(--s-2); margin: 0; }
.summary__row { display: flex; justify-content: space-between; gap: var(--s-4); color: var(--muted); }
.summary__row dd { margin: 0; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.summary__total {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4);
  padding-top: var(--s-4); border-top: 1px solid var(--line);
  font: 700 2.5rem/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.summary__total span { font: 600 1.0625rem/1 var(--font-text); color: var(--muted); }
.summary__note { color: var(--muted); font-size: var(--fs-small); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ---- Alert: a message about what just happened (error by default, "info" for a neutral one) ---- */
.alert {
  padding: var(--s-4) var(--s-5); border: 1px solid var(--critical); border-left-width: 4px; border-radius: var(--r-2);
  background: color-mix(in srgb, var(--critical) 9%, var(--surface)); color: var(--text);
}
.alert--info { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 9%, var(--surface)); }
.alert p + p { margin-top: var(--s-2); }

/* ---- Licence code: shown large, easy to copy ---------------------------------------------------- */
.code { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.code__value {
  display: block; padding: var(--s-4) var(--s-5); min-width: 0; max-width: 100%;
  font: 500 clamp(1.5rem, 1rem + 3vw, 2.75rem)/1.1 var(--font-mono); letter-spacing: .04em; color: var(--signal-text);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--signal);
  border-radius: 2px var(--r-2) var(--r-2) 2px; overflow-wrap: anywhere; user-select: all;
}

/* ---- Waiting lamp: the brand light, pulsing while something is on its way ------------------------ */
.wait { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--muted); }
.wait__lamp { flex: none; width: .9rem; height: .9rem; border-radius: 50%; background: var(--signal); box-shadow: 0 0 14px var(--signal-glow); }
@media (prefers-reduced-motion: no-preference) { .wait__lamp { animation: lamp 1.3s ease-in-out infinite; } }

/* ---- Facts: a short ruled list of what was bought ------------------------------------------------ */
.facts { display: grid; border-top: 1px solid var(--line); }
.facts > li { padding: var(--s-3) 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.facts strong { color: var(--text); }

/* ---- Panel + rows: the account page (a titled card, and a ruled list of things inside it) -------- */
.panel { display: grid; gap: var(--s-4); min-width: 0; padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.panel__title { font: 700 1.75rem/1.1 var(--font-display); }
.panel__text { color: var(--muted); }
.rows { display: grid; border-top: 1px solid var(--line); }
.row { display: grid; gap: var(--s-3); min-width: 0; padding: var(--s-4) 0; border-bottom: 1px solid var(--line); }
.row__main { display: grid; gap: var(--s-2); min-width: 0; }
.row__title { font: 600 1.125rem/1.3 var(--font-text); overflow-wrap: anywhere; }
.row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); color: var(--muted); font-size: var(--fs-small); }
.row__code { font: 500 var(--fs-mono)/1.2 var(--font-mono); letter-spacing: .03em; color: var(--signal-text); overflow-wrap: anywhere; }
.row__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.row__extra { grid-column: 1 / -1; display: grid; gap: var(--s-2); padding: var(--s-3) var(--s-4); background: var(--ground); border: 1px solid var(--line); border-radius: var(--r-2); }
.chip--good { color: var(--good); border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.chip--bad { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 55%, var(--line)); }
.btn--danger { --btn-fg: var(--critical); --btn-bd: color-mix(in srgb, var(--critical) 55%, var(--line)); }
.btn--danger:hover { border-color: var(--critical); box-shadow: 0 0 22px -10px var(--critical); }

/* ---- Legal text: long-form reading with numbered clauses ---------------------------------------- */
.legal { display: grid; gap: var(--s-4); max-width: var(--measure); color: var(--text); line-height: 1.65; }
.legal h2 { margin-top: var(--s-5); font: 700 1.75rem/1.1 var(--font-display); }
.legal ol, .legal ul { display: grid; gap: var(--s-2); padding-left: 1.25rem; }
.legal ol { list-style: decimal; }
.legal ul { list-style: disc; }
.legal li::marker { color: var(--signal-text); }
.legal a { color: var(--text); }
.legal__meta { color: var(--muted); font-size: var(--fs-small); }

/* ---- Accordion (native <details>) -------------------------------------------------------- */
.faq { border-top: 1px solid var(--line); }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__item summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-4) 0; cursor: pointer; list-style: none;
  font: 600 1.25rem/1.3 var(--font-text); min-height: 3.5rem;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: ""; flex: none; width: 1.125rem; height: 1.125rem; color: var(--signal-text);
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  transition: transform var(--t-base) var(--ease);
}
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item summary:hover { color: var(--signal-text); }
.faq__body { padding: 0 0 var(--s-5); max-width: var(--measure); }
@media (prefers-reduced-motion: no-preference) { .faq__body { animation: faq-in var(--t-base) var(--ease); } }
.faq__body p + p { margin-top: var(--s-3); }
@keyframes faq-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---- Contact + footer -------------------------------------------------------------------- */
.contact-mail {
  display: inline-block; font: 500 clamp(1.375rem, 1rem + 2vw, 2.25rem)/1.2 var(--font-mono);
  color: var(--signal-text); text-decoration-thickness: 2px;
}
.site-footer { border-top: 1px solid var(--line); padding-block: var(--s-7) var(--s-6); color: var(--muted); font-size: var(--fs-small); }
.site-footer__grid { display: grid; gap: var(--s-6); }
.site-footer__title { font: 700 1.25rem/1 var(--font-display); color: var(--text); margin-bottom: var(--s-3); }
.site-footer a { color: var(--text); display: inline-block; padding-block: .2rem; }
.site-footer address { font-style: normal; display: grid; gap: var(--s-2); }
.site-footer__brand { display: flex; align-items: center; gap: .6rem; margin-bottom: var(--s-3); color: var(--text); }
.site-footer__note { max-width: 30rem; }

/* ---- Rail + progress: the line you travel along --------------------------------------------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: var(--z-progress);
  background: var(--signal); transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
  pointer-events: none;
}
.rail { display: none; }
.rail__scale {
  position: absolute; left: 4.9rem; top: 0; bottom: 0; width: 1.1rem;
  border-right: 1px solid var(--wash-strong);
  background-image:
    linear-gradient(to bottom, var(--wash-strong) 0 1px, transparent 1px),
    linear-gradient(to bottom, var(--wash-strong) 0 2px, transparent 2px);
  background-size: .55rem 1.5rem, 1.1rem 15rem;
  background-repeat: repeat-y;
  background-position: right var(--rail-y, 0px), right var(--rail-y, 0px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, var(--ground) 18%, var(--ground) 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, var(--ground) 18%, var(--ground) 82%, transparent);
}
.rail__mark { position: absolute; left: 0; top: 46%; display: flex; align-items: center; transform: translateY(-50%); }
.rail__km {
  padding: .35rem .5rem; border-radius: 2px var(--r-1) var(--r-1) 2px;
  font: 500 var(--fs-mono)/1 var(--font-mono); color: var(--on-signal); background: var(--signal);
  min-width: 4.4rem; text-align: center; font-variant-numeric: tabular-nums;
}
.rail__mark::after { content: ""; width: 1.7rem; height: 2px; background: var(--signal); }

/* ---- Traffic sign (speed limit ring), real colours in both themes ------------------------- */
.sign {
  --sign-size: 4.5rem;
  display: inline-grid; place-items: center; flex: none;
  width: var(--sign-size); aspect-ratio: 1; border-radius: 50%;
  background: var(--sign-face); color: var(--sign-ink);
  border: calc(var(--sign-size) * .13) solid var(--sign-red);
  font: 700 calc(var(--sign-size) * .46)/1 var(--font-display); letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.sign--green { border-color: var(--sign-green); }

/* ---- Restriction card: the app's "next restriction" card, shown in the hero ---------------- */
@counter-style pad3 { system: extends decimal; pad: 3 "0"; }
.restriction {
  display: grid; gap: var(--s-3);
  width: min(var(--card-w, 21rem), calc(100cqw - 2 * var(--gutter))); padding: var(--s-3) var(--s-4) var(--s-3) var(--s-3);
  background: color-mix(in srgb, var(--surface-raised) 90%, transparent);
  border: 1px solid var(--line); border-radius: var(--r-3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--shadow-raise);
}
.restriction__pos {
  display: none; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  padding: 0 var(--s-1) var(--s-3); border-bottom: 1px solid var(--line);
}
.restriction__row { display: flex; align-items: center; gap: var(--s-4); }
.restriction__ring { --sign-size: 4rem; }
.restriction__body { display: grid; gap: .15rem; min-width: 0; }
.restriction__label { font: 500 .875rem/1.2 var(--font-text); color: var(--muted); }
.restriction__dist {
  font: 500 2.125rem/1 var(--font-mono); color: var(--signal-text); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.restriction__km { font: 500 .8125rem/1.3 var(--font-mono); color: var(--muted); }
.restriction__pos-km { font: 500 1.5rem/1 var(--font-mono); color: var(--signal-text); letter-spacing: -.01em; }

/* ---- Cab view: the hero scene (decorative, aria-hidden) -------------------------------------
   True perspective, driven by compositor animations (transform only, no per-frame style work):
   an object at depth z shows at VP + (1/z) * (end - VP), with depth running from R (far) to 1 (near).
   Position and scale are interpolated between those two states with an easing curve that is exactly
   the perspective curve, so one easing (--ease-persp) serves every object. Phases (--o) spread the
   ties and posts along the track. Only the odometer in the card counts with --p.
   Geometry is in container units (cqw, cqh) of the scene box and is set per layout in site.css.
   When nothing moves (reduced motion), the same layout is computed once for the frame --still.
   ------------------------------------------------------------------------------------------- */
@property --p { syntax: "<number>"; inherits: true; initial-value: .88; }

.cab {
  --vp-x: 50cqw;  --vp-y: 20cqh;        /* vanishing point */
  --tr-l: 26cqw;  --tr-r: 74cqw;        /* the rails where they leave the bottom edge */
  --axis-x: calc((var(--tr-l) + var(--tr-r)) / 2);
  --dock-x: 20cqw; --dock-y: 88cqh;     /* where the sign lands: the ring in the card */
  --post-l: -12cqw; --post-r: 112cqw;   /* post feet at the near end */
  --g: calc(100cqh - var(--vp-y));      /* height of the ground below the horizon */
  --card-w: 21rem; --ring-off: calc(var(--s-3) + 1px + 2rem);   /* card width; ring centre from card edge */
  --R: 9;                               /* far depth over near depth */
  --still: .88;                         /* the loop position shown when nothing moves */
  --ease-persp: linear(0.0000 0%, 0.0122 10%, 0.0270 20%, 0.0455 30%, 0.0690 40%, 0.1000 50%, 0.1429 60%, 0.2059 70%, 0.2500 75%, 0.3077 80%, 0.3684 84%, 0.4490 88%, 0.5000 90%, 0.5610 92%, 0.6351 94%, 0.6786 95%, 0.7273 96%, 0.7823 97%, 0.8448 98%, 0.9167 99%, 1.0000 100%);
  position: relative; overflow: hidden; pointer-events: none;
  container-type: size;
}

/* movers: 0x0 anchors at the vanishing point, placed and scaled by 1/z (--lam) */
.cab__tie, .cab__post, .cab__sign {
  --k: mod(calc(var(--still) + var(--o, 0)), 1);
  --lam: calc(1 / (var(--R) * (1 - var(--k)) + var(--k)));
  position: absolute; left: var(--vp-x); top: var(--vp-y); width: 0; height: 0;
  transform-origin: 0 0;
  translate: calc(var(--lam) * var(--dx)) calc(var(--lam) * var(--dy));
  scale: var(--lam);
}

/* phases: ties are spread evenly in depth, posts come in pairs */
.cab__ties, .cab__posts { display: contents; }
.cab__tie:nth-child(1) { --o: 0.0; }
.cab__tie:nth-child(2) { --o: 0.05; }
.cab__tie:nth-child(3) { --o: 0.1; }
.cab__tie:nth-child(4) { --o: 0.15; }
.cab__tie:nth-child(5) { --o: 0.2; }
.cab__tie:nth-child(6) { --o: 0.25; }
.cab__tie:nth-child(7) { --o: 0.3; }
.cab__tie:nth-child(8) { --o: 0.35; }
.cab__tie:nth-child(9) { --o: 0.4; }
.cab__tie:nth-child(10) { --o: 0.45; }
.cab__tie:nth-child(11) { --o: 0.5; }
.cab__tie:nth-child(12) { --o: 0.55; }
.cab__tie:nth-child(13) { --o: 0.6; }
.cab__tie:nth-child(14) { --o: 0.65; }
.cab__tie:nth-child(15) { --o: 0.7; }
.cab__tie:nth-child(16) { --o: 0.75; }
.cab__tie:nth-child(17) { --o: 0.8; }
.cab__tie:nth-child(18) { --o: 0.85; }
.cab__tie:nth-child(19) { --o: 0.9; }
.cab__tie:nth-child(20) { --o: 0.95; }
.cab__post:nth-child(4n+1) { --o: 0; }
.cab__post:nth-child(4n+2) { --o: .25; }
.cab__post:nth-child(4n+3) { --o: .5; }
.cab__post:nth-child(4n+4) { --o: .75; }

.cab__sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 46cqw 30cqh at var(--vp-x) var(--vp-y), var(--haze), transparent 72%),
    radial-gradient(ellipse 90cqw 60cqh at var(--vp-x) var(--vp-y), color-mix(in srgb, var(--signal) 5%, transparent), transparent 70%);
}
.cab__hills {
  position: absolute; left: 0; width: 100%; height: 5.5cqh; top: calc(var(--vp-y) - 5.5cqh);
  fill: var(--ridge);
}
.cab__ground {
  position: absolute; left: 0; right: 0; top: var(--vp-y); bottom: 0;
  background:
    radial-gradient(ellipse 34cqw 62% at var(--axis-x) 100%, var(--wash), transparent 72%),
    radial-gradient(ellipse 40cqw 14% at var(--vp-x) 0%, color-mix(in srgb, var(--signal) 9%, transparent), transparent 100%),
    linear-gradient(to bottom, var(--ridge), var(--ground) 42%);
}
.cab__rail {
  --hw: .85cqw;
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent var(--vp-y), var(--wash-strong) calc(var(--vp-y) + var(--g) * .12), var(--text) 100%);
  opacity: .62;
}
.cab__rail--l, .cab__lit--l { clip-path: polygon(var(--vp-x) var(--vp-y), calc(var(--tr-l) - var(--hw, .85cqw)) 100%, calc(var(--tr-l) + var(--hw, .85cqw)) 100%); }
.cab__rail--r, .cab__lit--r { clip-path: polygon(var(--vp-x) var(--vp-y), calc(var(--tr-r) - var(--hw, .85cqw)) 100%, calc(var(--tr-r) + var(--hw, .85cqw)) 100%); }

/* a tie: a bar whose length scales with 1/z and whose thickness with 1/z squared */
.cab__tie { --dx: calc(var(--axis-x) - var(--vp-x)); --dy: var(--g); }
.cab__tie::before {
  --len: calc((var(--tr-r) - var(--tr-l)) * 1.36);
  content: ""; position: absolute; top: 0; left: calc(var(--len) / -2);
  width: var(--len); height: calc(var(--g) * .032);
  background: var(--wash-strong); border-radius: 2px;
  transform-origin: 50% 0;
  scale: 1 var(--lam);
}

/* a lineside post with an amber plate, anchored at its foot */
.cab__post {
  --pole-w: .5cqw; --pole-h: calc(var(--g) * .62); --plate-w: 1.5cqw; --plate-h: 1.1cqw;
  --dy: var(--g);
}
.cab__post--l { --dx: calc(var(--post-l) - var(--vp-x)); }
.cab__post--r { --dx: calc(var(--post-r) - var(--vp-x)); }
.cab__post::before, .cab__post::after { content: ""; position: absolute; }
.cab__post::before { left: calc(var(--pole-w) / -2); bottom: 0; width: var(--pole-w); height: var(--pole-h); background: var(--wash-strong); }
.cab__post::after {
  left: calc(var(--plate-w) / -2); bottom: calc(var(--pole-h) - var(--plate-h) / 2); width: var(--plate-w); height: var(--plate-h);
  background: var(--signal); border-radius: 1px; opacity: .75; box-shadow: 0 0 calc(var(--plate-w) * 1.2) var(--signal-glow);
}

/* distance haze: things emerge from it, so nothing pops in at the far end of the loop */
.cab__fog {
  position: absolute; left: 0; right: 0; top: var(--vp-y); height: calc(var(--g) * .45);
  background: linear-gradient(to bottom, var(--ridge), color-mix(in srgb, var(--ridge) 75%, transparent) 22%, color-mix(in srgb, var(--ridge) 25%, transparent) 60%, transparent);
}

/* the light that runs ahead along the rails, once per loop; the sign follows it */
.cab__pulse, .cab__lit {
  --u: min(1, calc(var(--still) / .24));
  --lam: calc((1 - var(--u)) * (1 - var(--u)));      /* 1 at the bottom edge, 0 at the vanishing point */
  --fade: calc(min(1, calc(var(--u) * 10)) * (1 - min(1, calc(max(0, calc(var(--u) - .78)) * 4.5))));
}
.cab__lit { position: absolute; inset: 0; }
.cab__lit::before {
  content: ""; position: absolute; left: 0; right: 0;
  top: calc(var(--vp-y) - var(--g) * .225); height: calc(var(--g) * .45);
  background: linear-gradient(to bottom, transparent, var(--signal) 50%, transparent);
  transform-origin: 50% 50%;
  translate: 0 calc(var(--lam) * var(--g));
  scale: 1 calc(.111 + .889 * var(--lam));
  opacity: calc(var(--fade) * .95);
}
.cab__pulse {
  --dx: calc(var(--axis-x) - var(--vp-x)); --dy: var(--g);
  position: absolute; left: var(--vp-x); top: var(--vp-y); width: 0; height: 0;
  transform-origin: 0 0;
  translate: calc(var(--lam) * var(--dx)) calc(var(--lam) * var(--dy));
  scale: calc(.06 + .94 * var(--lam));
  opacity: calc(var(--fade) * .9);
}
.cab__pulse::before {
  content: ""; position: absolute; left: -30cqw; top: -4cqw; width: 60cqw; height: 8cqw;
  background: radial-gradient(closest-side, var(--signal) 0 7%, var(--signal-glow) 24%, transparent 100%);
}

/* the scene melts into the page at the bottom edge (the card sits above it) */
.cab__fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: min(18cqh, 9rem);
  background: linear-gradient(to bottom, transparent, var(--ground));
}

/* the sign: flies from the far end to the dock */
.cab__sign { --dx: calc(var(--dock-x) - var(--vp-x)); --dy: calc(var(--dock-y) - var(--vp-y)); }
.cab__sign .sign {
  --sign-size: 4rem;
  position: absolute; left: calc(var(--sign-size) / -2); top: calc(var(--sign-size) / -2);
  box-shadow: 0 0 calc(var(--sign-size) * .5) -2px var(--signal-glow);
}

/* the card sits where the sign lands; its odometer is the only thing counted on the main thread */
.cab .restriction { position: absolute; left: calc(var(--dock-x) - var(--ring-off)); bottom: calc(100cqh - var(--dock-y) - var(--ring-off)); }
.restriction { --step: round(down, calc(var(--p) * 70), 1); }
.restriction__dist { counter-reset: dist calc(700 - var(--step) * 10); }
.restriction__dist::before { content: counter(dist) " m"; }
.restriction__pos-km { counter-reset: pos calc(300 + var(--step) * 10); }
.restriction__pos-km::before { content: "509." counter(pos, pad3) " km"; }

/* ---- Motion (off under reduced motion; the still frame above is then the picture) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal].is-in .km__plate { animation: km-pass 1.1s var(--ease) 1; }
  .cab__tie, .cab__post {
    animation: cab-fly var(--cab-loop) var(--ease-persp) infinite;
    animation-delay: calc(var(--o, 0) * var(--cab-loop) * -1);
  }
  .cab__tie::before {
    animation: cab-squash var(--cab-loop) var(--ease-persp) infinite;
    animation-delay: calc(var(--o, 0) * var(--cab-loop) * -1);
  }
  .cab__sign {
    animation: cab-fly var(--cab-loop) var(--ease-persp) infinite, cab-sign-fade var(--cab-loop) linear infinite;
  }
  .cab__pulse {
    animation: cab-pulse-move var(--cab-loop) linear infinite, cab-pulse-fade var(--cab-loop) linear infinite;
  }
  .cab__lit::before {
    animation: cab-lit-move var(--cab-loop) linear infinite, cab-lit-fade var(--cab-loop) linear infinite;
  }
  .cab .restriction { animation: cab-drive var(--cab-loop) linear infinite; }
  .cab .restriction__ring { animation: ring-flash var(--cab-loop) linear infinite; }
  .chip--lamp::before { animation: lamp 3.2s ease-in-out infinite; }
}

@keyframes km-pass {
  0% { box-shadow: 0 0 0 0 transparent; }
  30% { box-shadow: -10px 0 26px -6px var(--signal-glow); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes cab-fly {
  from { translate: calc(var(--dx) / var(--R)) calc(var(--dy) / var(--R)); scale: calc(1 / var(--R)); }
  to   { translate: var(--dx) var(--dy); scale: 1; }
}
@keyframes cab-squash { from { scale: 1 calc(1 / var(--R)); } to { scale: 1 1; } }
@keyframes cab-sign-fade { 0% { opacity: 0; } 8% { opacity: 1; } 95.5% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cab-pulse-move {
  0% { translate: var(--dx) var(--dy); scale: 1; animation-timing-function: cubic-bezier(.25, .46, .45, .94); }
  24%, 100% { translate: 0 0; scale: .06; }
}
@keyframes cab-pulse-fade { 0% { opacity: 0; } 2.4% { opacity: .9; } 18.7% { opacity: .9; } 24%, 100% { opacity: 0; } }
@keyframes cab-lit-move {
  0% { translate: 0 var(--g); scale: 1 1; animation-timing-function: cubic-bezier(.25, .46, .45, .94); }
  24%, 100% { translate: 0 0; scale: 1 .111; }
}
@keyframes cab-lit-fade { 0% { opacity: 0; } 2.4% { opacity: .95; } 18.7% { opacity: .95; } 24%, 100% { opacity: 0; } }
@keyframes cab-drive { from { --p: 0; } to { --p: 1; } }
@keyframes ring-flash {
  0%, 94% { box-shadow: 0 0 0 0 transparent; }
  97% { box-shadow: 0 0 0 0 var(--signal-glow), 0 0 34px 4px var(--signal-glow); }
  100% { box-shadow: 0 0 0 14px transparent, 0 0 0 0 transparent; }
}

/* browsers without container units simply get the page without the scene */
@supports not (width: 1cqw) { .cab { display: none; } }

.cab[data-paused] *, .cab[data-paused] *::before, .cab[data-paused] *::after { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
