/* Offroaderz — the website.
 *
 * The game's own design language, carried to the web: Bungee for every word,
 * cream lettering with ink outlines, slab buttons shaped like the ground you
 * are driving on, stage boards hung on chains, and roadbook paper between two
 * rollers. Every colour below comes from godot/scripts/ui/biome_skin.gd; the
 * derived roles (holder, sides, metal…) use the same arithmetic the game does
 * (Godot's darkened/lightened/lerp), so a page wears exactly the palette of
 * the trail it shows.
 */

@font-face {
  font-family: "Bungee";
  src: url("fonts/Bungee-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Bungee", "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  --gutter: max(clamp(16px, 4.2vw, 64px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --trail-h: 66px;
  --ground-h: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gold: 255 209 63;
  --lift: 5px;
  color-scheme: light;
}

/* ---------------------------------------------------------------------------
 * BIOME PALETTES — generated from BiomeSkin.SKINS (rgb triplets, so any role
 * takes an alpha: rgb(var(--ink) / .5)).
 * ------------------------------------------------------------------------- */
[data-biome="hills"] {  /* Rolling Hills — motif dirt */
  --panel: 255 248 231; --ink: 62 42 23; --accent: 217 72 59; --accent2: 247 183 51; --muted: 107 82 51; --flora: 154 111 69; --holder: 33 23 12; --accent-side: 143 47 39; --accent2-side: 163 121 34; --accent-hi: 219 83 71; --accent2-hi: 248 187 63; --paper-lift: 255 252 244; --paper-well: 242 236 219; --metal: 160 150 138; --bolt: 246 204 188; --extrude-near: 164 120 38; --extrude-deep: 26 18 10; --emph: 250 204 109; --roller-shade: 192 182 164; --ground: 150 88 40; --holder-dim: 207 201 187;
}
[data-biome="forest"] {  /* Pine Forest — motif pine */
  --panel: 250 246 226; --ink: 46 59 35; --accent: 194 90 50; --accent2: 143 183 78; --muted: 90 101 66; --flora: 60 138 74; --holder: 25 32 19; --accent-side: 128 59 33; --accent2-side: 94 121 51; --accent-hi: 198 100 62; --accent2-hi: 150 187 89; --paper-lift: 253 251 242; --paper-well: 237 234 215; --metal: 153 157 143; --bolt: 236 207 182; --extrude-near: 99 127 59; --extrude-deep: 19 25 15; --emph: 177 203 125; --roller-shade: 184 185 165; --ground: 136 82 44; --holder-dim: 202 199 183;
}
[data-biome="cliff"] {  /* Lake Cliffs — motif rock */
  --panel: 244 247 245; --ink: 42 50 53; --accent: 22 126 133; --accent2: 141 201 194; --muted: 86 96 99; --flora: 91 95 100; --holder: 23 27 29; --accent-side: 14 83 88; --accent2-side: 93 133 128; --accent-hi: 36 134 140; --accent2-hi: 148 204 198; --paper-lift: 250 251 251; --paper-well: 232 235 233; --metal: 152 153 150; --bolt: 189 217 217; --extrude-near: 96 133 131; --extrude-deep: 18 21 22; --emph: 174 216 210; --roller-shade: 179 183 183; --ground: 66 67 76; --holder-dim: 198 200 198;
}
[data-biome="river"] {  /* River Valley — motif reeds */
  --panel: 242 248 246; --ink: 34 64 74; --accent: 63 146 176; --accent2: 127 208 224; --muted: 74 102 109; --flora: 102 128 58; --holder: 18 35 40; --accent-side: 42 96 116; --accent2-side: 84 137 148; --accent-hi: 75 153 181; --accent2-hi: 135 211 226; --paper-lift: 249 252 251; --paper-well: 230 236 234; --metal: 149 159 158; --bolt: 197 223 229; --extrude-near: 85 143 156; --extrude-deep: 14 27 31; --emph: 164 221 231; --roller-shade: 175 188 189; --ground: 140 90 48; --holder-dim: 196 201 199;
}
[data-biome="canyon"] {  /* Canyon Mesas — motif mesa */
  --panel: 253 241 226; --ink: 90 46 28; --accent: 180 100 60; --accent2: 220 169 124; --muted: 128 83 56; --flora: 180 100 60; --holder: 49 25 15; --accent-side: 119 66 40; --accent2-side: 145 112 82; --accent-hi: 185 109 72; --accent2-hi: 222 174 132; --paper-lift: 254 249 242; --paper-well: 240 229 215; --metal: 170 152 140; --bolt: 235 206 184; --extrude-near: 162 114 81; --extrude-deep: 38 19 12; --emph: 231 192 157; --roller-shade: 198 178 163; --ground: 150 84 46; --holder-dim: 205 195 183;
}
[data-biome="desert"] {  /* Desert Dunes — motif cactus */
  --panel: 253 243 222; --ink: 107 67 38; --accent: 217 138 59; --accent2: 233 211 163; --muted: 139 109 73; --flora: 91 138 91; --holder: 58 36 21; --accent-side: 143 91 39; --accent2-side: 154 139 108; --accent-hi: 219 145 71; --accent2-hi: 234 214 168; --paper-lift: 254 250 240; --paper-well: 240 231 211; --metal: 177 160 144; --bolt: 244 217 181; --extrude-near: 176 146 107; --extrude-deep: 45 28 16; --emph: 239 221 182; --roller-shade: 203 185 163; --ground: 178 118 64; --holder-dim: 205 197 180;
}
[data-biome="jungle"] {  /* Deep Jungle — motif leaf */
  --panel: 241 247 230; --ink: 23 64 42; --accent: 27 122 82; --accent2: 138 197 63; --muted: 62 96 69; --flora: 47 133 68; --holder: 12 35 23; --accent-side: 18 80 54; --accent2-side: 91 130 42; --accent-hi: 41 130 92; --accent2-hi: 145 201 75; --paper-lift: 249 251 244; --paper-well: 229 235 219; --metal: 145 159 146; --bolt: 187 216 193; --extrude-near: 86 137 54; --extrude-deep: 10 27 18; --emph: 171 213 116; --roller-shade: 171 187 169; --ground: 70 66 58; --holder-dim: 195 200 186;
}
[data-biome="snow"] {  /* Snowfield — motif drift */
  --panel: 248 251 255; --ink: 37 50 68; --accent: 62 115 173; --accent2: 199 224 242; --muted: 90 105 122; --flora: 50 95 79; --holder: 20 27 37; --accent-side: 41 76 114; --accent2-side: 131 148 160; --accent-hi: 74 123 178; --accent2-hi: 202 226 243; --paper-lift: 252 253 255; --paper-well: 236 238 242; --metal: 150 153 156; --bolt: 202 217 234; --extrude-near: 126 146 164; --extrude-deep: 16 21 29; --emph: 215 233 246; --roller-shade: 180 185 193; --ground: 200 210 226; --holder-dim: 201 203 207;
}
[data-biome="highway"] {  /* Old Highway — motif roadside */
  --panel: 246 245 242; --ink: 45 47 51; --accent: 33 101 74; --accent2: 242 191 56; --muted: 97 99 103; --flora: 76 79 85; --holder: 24 25 28; --accent-side: 22 67 49; --accent2-side: 160 126 37; --accent-hi: 46 110 85; --accent2-hi: 243 195 68; --paper-lift: 251 251 249; --paper-well: 234 233 230; --metal: 153 152 149; --bolt: 193 209 200; --extrude-near: 153 126 54; --extrude-deep: 19 20 21; --emph: 243 208 116; --roller-shade: 181 181 180; --ground: 60 61 66; --holder-dim: 199 198 196;
}
[data-biome="mountain"] {  /* Mountain Pass — motif rock */
  --panel: 246 246 248; --ink: 45 49 56; --accent: 43 95 139; --accent2: 176 179 185; --muted: 88 94 102; --flora: 60 115 70; --holder: 24 26 30; --accent-side: 28 63 92; --accent2-side: 116 118 122; --accent-hi: 56 105 146; --accent2-hi: 181 184 189; --paper-lift: 251 251 252; --paper-well: 234 233 236; --metal: 153 153 151; --bolt: 195 208 221; --extrude-near: 117 120 127; --extrude-deep: 19 21 24; --emph: 198 200 205; --roller-shade: 181 181 186; --ground: 152 90 44; --holder-dim: 199 199 201;
}
[data-biome="coast"] {  /* Coast Road — motif reeds */
  --panel: 253 246 226; --ink: 102 71 41; --accent: 51 158 173; --accent2: 235 153 112; --muted: 133 105 71; --flora: 71 122 82; --holder: 55 39 22; --accent-side: 34 104 114; --accent2-side: 155 101 74; --accent-hi: 63 164 178; --accent2-hi: 236 159 121; --paper-lift: 254 251 242; --paper-well: 240 234 215; --metal: 175 162 145; --bolt: 202 224 213; --extrude-near: 175 116 80; --extrude-deep: 43 30 17; --emph: 241 183 148; --roller-shade: 201 188 166; --ground: 158 88 48; --holder-dim: 205 199 183;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: rgb(33 23 12);
  /* A jump down the trail drives it: the trails and the car pass on the way. */
  scroll-behavior: smooth;
  /* Keyboard focus stays clear of the trail bar. */
  scroll-padding-bottom: 84px;
  /* Each trail is a stop the page settles on (THE SNAP, under PAGE LAYOUT). */
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: .01em;
  color: rgb(var(--panel));
  background: rgb(var(--holder));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 400; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: rgb(var(--accent2)); color: rgb(var(--ink)); }

:focus-visible {
  outline: 3px solid rgb(var(--accent2));
  outline-offset: 4px;
  border-radius: 10px;
}
.roadbook__paper :focus-visible { outline-color: rgb(var(--ink)); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px; top: 12px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgb(var(--panel));
  color: rgb(var(--ink));
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip-link:focus { transform: none; }

/* Lettering on the world: cream with a dark outline drawn UNDER the fill, the
 * way the game draws every free-floating label (outline 6 for body, 9 for
 * titles, ink at 92%). */
.world {
  color: rgb(var(--panel));
  -webkit-text-stroke: 6px rgb(var(--ink) / .92);
  paint-order: stroke fill;
}

/* ---------------------------------------------------------------------------
 * THE WORLD — fixed scenery behind the page
 * ------------------------------------------------------------------------- */
.scenery {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: rgb(var(--holder));
  pointer-events: none;
}

/* The drive's clips, stacked. The clip on screen plays plain. Another comes in
 * over it: a trail the reader jumps or goes back to through the wipe, a mask
 * that site.js slides from the top of the frame to the bottom; the drive on to
 * the next billboard by a quick fade. The rest wait out of sight. Framed on
 * the car: it keeps the right of a wide frame, the middle of a tall one (site.js
 * FRAME has these numbers too), and then a little lower: site.js works out the
 * clip's box for the screen (THE FRAME, the whole clip, zoomed and shifted)
 * and sets it here. (A clip draws only inside its own box, so the box is the
 * clip's size, not the screen's.) */
.scene {
  position: absolute;
  left: var(--scene-x, 0px);
  top: var(--scene-y, 0px);
  width: var(--scene-w, 100%);
  height: var(--scene-h, 100%);
  display: none;
}
.scene, .scene--fallback img {
  object-fit: cover;
  object-position: 66% 62%;
}
@media (max-aspect-ratio: 1/1), (max-width: 759px) {
  .scene, .scene--fallback img { object-position: 50% 48%; }
}
/* Under the clip on screen, the next one starts up (the stop loop as a drive
 * runs out, the next drive as the reader scrolls on), ready to take over
 * without a blink. */
.scene[data-role="under"] { display: block; z-index: 0; }
.scene[data-role="shown"] { display: block; z-index: 1; }
.scene[data-role="next"], .scene[data-role="fade"] { display: block; z-index: 2; }
.scene[data-role="next"] {
  -webkit-mask-image: var(--wipe);
          mask-image: var(--wipe);
  -webkit-mask-size: 100% var(--wipe-span);
          mask-size: 100% var(--wipe-span);
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 0 var(--wipe-y, 100%);
          mask-position: 0 var(--wipe-y, 100%);
}
/* A drive fades in over the clip it starts in; and under Reduce Motion every
 * trail fades in instead of wiping. */
.scene[data-role="fade"] { opacity: 0; }

/* No scripts: the golden-hour hero's poster simply stays (it sits in <noscript>). */
.scene--fallback { display: block; }
.scene--fallback picture, .scene--fallback img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Darker at the top, under the hanging board, and at the foot, under the
 * trail: the two strips of chrome that sit on the world. */
.scenery__shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(to bottom, rgb(0 0 0 / .26), rgb(0 0 0 / 0) 18%),
    linear-gradient(to top, rgb(0 0 0 / .42), rgb(0 0 0 / 0) 16%);
}

/* The fine print pulls the roadbook holder over the world. */
.scenery__dim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgb(var(--holder));
  opacity: var(--dim, 0);
}

/* ---------------------------------------------------------------------------
 * PAGE LAYOUT
 * Tall frames (phones, portrait tablets): the scene shows through the top
 * and middle and each roadbook page rises from below. Wide frames: the page
 * runs down a left column and the car in the scene keeps the right.
 * ------------------------------------------------------------------------- */
main {
  position: relative;
  z-index: 1;
}

.stop {
  position: relative;
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 54svh max(22px, env(safe-area-inset-right, 0px)) calc(var(--trail-h) + var(--safe-b) + 40px) max(22px, env(safe-area-inset-left, 0px));
}

.stop > .roadbook { width: min(100%, 540px); }
/* A small phone keeps its page margins tight so the roomier paper keeps a
 * readable line. */
@media (max-width: 420px) {
  .stop {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .roadbook { padding: 24px 14px; }
  .roadbook__paper { padding: 32px 24px 30px; }
}

@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .stop {
    justify-content: center;
    align-items: flex-start;
    padding: 132px var(--gutter) calc(var(--trail-h) + var(--safe-b) + 48px);
  }
  .stop > .roadbook { width: min(100%, 560px); }
  .stop > .roadbook--wide { width: min(100%, 860px); }
}
@media (min-width: 760px) and (min-aspect-ratio: 1/1) and (max-height: 599px) {
  .stop { padding-top: 92px; }
  :root { --trail-h: 50px; }
}

/* THE BOARDS — with scripts, a trail's page is the billboard in the drive behind
 * it, so its stop is one clear screen and the words on paper step aside: still
 * here for screen readers and search, out of sight. Without scripts the paper
 * stays, as a page of its own. */
.js .stop--board { padding: 0; }
.js .stop--board > .roadbook {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* THE SNAP — with scripts, site.js THE PAGER moves the page a stop per scroll;
 * this settles everything else (the scroll bar, links, Home / End, and pages
 * without scripts) on a stop. With a mouse or trackpad on a wide frame the snap
 * is mandatory, and a stop taller than the screen (the fine print) scrolls
 * freely inside. A touch screen only pulls towards each stop (proximity): iOS
 * drops its momentum inside a mandatory stop taller than the screen (WebKit bug
 * 253195), and the fine print is many screens long. */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) and (hover: hover) and (pointer: fine) {
  html {
    scroll-snap-type: y mandatory;
    /* A stop is exactly one snapport tall, so it snaps without slack. */
    scroll-padding-bottom: 0;
  }
}

/* ---------------------------------------------------------------------------
 * STAGE BOARD PARTS — the title board (site.js) is drawn in these, in the
 * order stage_board.gd paints them.
 * ------------------------------------------------------------------------- */
.board-title {
  font-family: var(--font);
  fill: rgb(var(--panel));
  stroke: rgb(var(--ink) / .92);
  stroke-linejoin: round;
  paint-order: stroke fill;
}
.b-chain ellipse, .b-chain line { fill: none; stroke-linecap: round; }
.b-chain-o { stroke: rgb(var(--ink) / .85); stroke-width: 3.4; }
.b-chain-m { stroke: rgb(var(--metal)); stroke-width: 1.7; }
.b-bar-o { stroke: rgb(var(--ink) / .85); stroke-width: 3.6; }
.b-bar-m { stroke: rgb(var(--metal)); stroke-width: 1.8; }
.b-shadow { fill: rgb(var(--ink) / .3); }
.b-side { fill: rgb(var(--accent-side)); }
.b-face { fill: rgb(var(--accent)); stroke: rgb(var(--ink)); stroke-width: 3; }
.b-inner { fill: none; stroke: rgb(var(--panel) / .85); stroke-width: 2; }
.b-bolt-o { fill: rgb(var(--ink) / .9); }
.b-bolt-i { fill: rgb(var(--bolt)); }
.b-eye-m { fill: rgb(var(--metal)); }
.b-eye-c { fill: rgb(var(--accent-side)); }

/* ---------------------------------------------------------------------------
 * SLAB BUTTONS — the game's BiomeButton. site.js lays the authored silhouette
 * for the biome underneath (shadow, dark side, lit face lifted 5 px, ink rim,
 * surface marks); these rules are the label and the no-script fallback.
 * ------------------------------------------------------------------------- */
.slab {
  --fill: var(--accent);
  --fill-hi: var(--accent-hi);
  --side: var(--accent-side);
  --text: var(--panel);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 16px 36px 18px;
  border: 0;
  background: none;
  color: rgb(var(--text));
  font-family: var(--font);
  font-size: 19px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.slab[data-variant="secondary"] {
  --fill: var(--accent2);
  --fill-hi: var(--accent2-hi);
  --side: var(--accent2-side);
  --text: var(--ink);
}
.slab:focus-visible { outline-offset: 2px; }

.slab__label,
.slab__sub {
  position: relative;
  display: block;
  transform: translateY(calc(-1 * var(--lift)));
  transition: transform .07s ease-out;
  -webkit-text-stroke: 2px rgb(var(--ink) / .55);
  paint-order: stroke fill;
}
.slab:not([data-variant="secondary"]) .slab__label,
.slab:not([data-variant="secondary"]) .slab__sub {
  -webkit-text-stroke: 3px rgb(var(--ink) / .78);
}
.slab__sub {
  margin-top: 4px;
  font-size: .7em;
  opacity: .9;
}
.slab:active { --lift: 0px; }

.slab__art {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.slab__art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.slab__shadow { fill: rgb(var(--ink) / .3); transform: translateY(calc(7px + var(--lift) * .4)); }
.slab__shadow--soft { transform: translateY(calc(3.85px + var(--lift) * .4)) scale(.98); }
.slab__base { fill: rgb(var(--side)); }
.slab__face, .slab__marks, .slab__shadow {
  transform-box: view-box;
  transform-origin: 50% 50%;
  transition: transform .07s ease-out;
}
.slab__face { transform: translateY(calc(-1 * var(--lift))) scale(.965); }
.slab__marks { transform: translateY(calc(-1 * var(--lift))); }
.slab__fill { fill: rgb(var(--fill)); transition: fill .15s; }
.slab__rim { fill: none; stroke: rgb(var(--ink)); stroke-width: 3px; stroke-linejoin: round; }
.slab__marks line { stroke: rgb(var(--ink) / .22); stroke-linecap: butt; }
.slab__marks line.light { stroke: rgb(255 255 255 / .3); }
.slab__marks line.paint { stroke: rgb(var(--text) / .3); }
.slab:hover .slab__fill { fill: rgb(var(--fill-hi)); }
.slab__art .slab__shadow, .slab__art .slab__base, .slab__art .slab__fill { transition: fill .6s; }

/* Before (or without) site.js: a rounded slab of the right colours. */
.slab:not(.is-drawn) {
  background: rgb(var(--fill));
  border: 3px solid rgb(var(--ink));
  border-radius: 14px;
  box-shadow: 0 5px 0 rgb(var(--side)), 0 10px 0 rgb(var(--ink) / .28);
}

/* The top corner: Privacy and Get the game, out of the way on the hero and the
 * finale (site.js UPDATE). */
.topbar {
  position: fixed;
  z-index: 21;
  top: calc(var(--safe-t) + 12px);
  right: var(--gutter);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: opacity .3s, transform .3s;
}
.topbar.is-hidden, .policy-open .topbar { opacity: 0; visibility: hidden; transform: translateY(-12px); pointer-events: none; transition: opacity .3s, transform .3s, visibility 0s .3s; }
.topcta {
  min-height: 64px;
  padding: 16px 34px 18px;
  font-size: 16px;
}
.topcta[data-variant="secondary"] { padding-inline: 28px; }
@media (max-width: 759px), (max-aspect-ratio: 1/1) {
  .topbar { display: none; }
}

/* ---------------------------------------------------------------------------
 * ROADBOOK PAGE — cream paper fed between two rollers in a dark holder. The
 * paper carries ink only; colour stays on boards, buttons and art.
 * ------------------------------------------------------------------------- */
.roadbook {
  position: relative;
  padding: 26px 18px;
  border-radius: 22px;
  background: rgb(var(--holder) / .95);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .07),
    0 26px 50px -16px rgb(0 0 0 / .6);
}

/* A page coming on screen rises into place (site.js; never without it). */
.roadbook, .finale {
  transition: opacity .6s ease-out, transform .7s cubic-bezier(.2, .8, .2, 1);
}
.roadbook.is-pending, .finale.is-pending {
  opacity: 0;
  transform: translateY(36px);
}

.roadbook__paper {
  position: relative;
  padding: 36px 28px 34px;
  background: rgb(var(--panel));
  color: rgb(var(--ink));
  box-shadow: 0 2px 6px rgb(0 0 0 / .28);
}
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .roadbook { padding: 30px 22px; }
  .roadbook__paper { padding: 46px 42px 42px; }
}

/* The rollers: a cream cylinder across the paper's edge, a brass knob at
 * each end (accent2, as the game's roller ends). */
.roadbook__paper::before,
.roadbook__paper::after {
  content: "";
  position: absolute;
  left: -14px;
  right: -14px;
  height: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgb(var(--accent2-hi)) 0 2.5px, rgb(var(--accent2)) 3px 6px, rgb(var(--accent2-side)) 6.5px 7.4px, rgb(var(--ink)) 7.6px 8.6px, transparent 9px) left center / 18px 18px no-repeat,
    radial-gradient(circle at 50% 42%, rgb(var(--accent2-hi)) 0 2.5px, rgb(var(--accent2)) 3px 6px, rgb(var(--accent2-side)) 6.5px 7.4px, rgb(var(--ink)) 7.6px 8.6px, transparent 9px) right center / 18px 18px no-repeat,
    linear-gradient(to bottom,
      rgb(var(--ink) / .5) 0 1px,
      rgb(var(--paper-lift)) 1px,
      rgb(var(--panel)) 40%,
      rgb(var(--paper-well)) 66%,
      rgb(var(--roller-shade)) calc(100% - 1px),
      rgb(var(--ink) / .5) calc(100% - 1px)) center / calc(100% - 16px) 13px no-repeat;
  filter: drop-shadow(0 2px 1.5px rgb(0 0 0 / .4));
}
.roadbook__paper::before { top: -11px; }
.roadbook__paper::after { bottom: -11px; }

/* Paper typography: every role in ink, dim copy at 72 %. */
.kicker {
  font-size: 12px;
  letter-spacing: .06em;
  color: rgb(var(--ink) / .72);
}

.roadbook h2 {
  margin: 6px 0 12px;
  font-size: clamp(24px, 6.4vw, 29px);
  line-height: 1.08;
}

.roadbook p,
.roadbook li,
.roadbook dd,
.roadbook dt {
  /* Bungee Light, the way the game draws body copy: the face's one weight,
   * pared back by an edge in the paper's own colour. */
  -webkit-text-stroke: .55px rgb(var(--panel));
}

.roadbook p { font-size: 15px; line-height: 1.6; }
.roadbook p + p { margin-top: .8em; }

.roadbook a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.roadbook a:hover { text-decoration-thickness: 3px; }

/* ---------------------------------------------------------------------------
 * HERO
 * ------------------------------------------------------------------------- */
.stop--hero {
  justify-content: space-between;
  padding-top: calc(var(--safe-t) + 16px);
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 560px;
  text-align: center;
  flex: 1;
}
/* THE TITLE BOARD — the launch splash's OFFROADERZ stage board. site.js hangs
 * it from the top of the page on its chains and drops it in as the site opens
 * (stage_board.gd's fall, settle and letter wave). Without scripts the heading
 * is a plain board in the same colours. */
.title-board {
  position: relative;
  width: 100%;
  margin: 0;
  line-height: 1;
}
.title-board__text {
  display: inline-block;
  padding: 18px 30px 20px;
  border: 3px solid rgb(var(--ink));
  border-radius: 12px;
  background: rgb(var(--accent));
  box-shadow:
    inset 0 0 0 5px rgb(var(--accent)),
    inset 0 0 0 7px rgb(var(--panel) / .85),
    0 5px 0 rgb(var(--accent-side)),
    0 9px 0 rgb(var(--ink) / .3);
  color: rgb(var(--panel));
  font-size: clamp(32px, 10vw, 64px);
  -webkit-text-stroke: 6px rgb(var(--ink) / .92);
  paint-order: stroke fill;
}
.title-board.is-drawn .title-board__text {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.title-board__art {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
}
/* LIFE ON THE TRAIL springs in under the board, letter by letter
 * (tests/ad_title_capture.gd SpringText): cream over a 6 px ink outline, with
 * that outline's shadow 3 px below. */
.hero__sub {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.15;
  color: rgb(var(--panel));
  -webkit-text-stroke: 6px rgb(var(--ink) / .92);
  paint-order: stroke fill;
  filter: drop-shadow(0 3px 0 rgb(var(--ink) / .35));
}
.hero__sub .ch {
  display: inline-block;
  white-space: pre;
  transform-origin: 50% 62%;
}
/* While the script takes the title over, the plain heading stays out of
 * sight, but never for long if the script doesn't arrive. */
.js .title-board:not(.is-drawn) .title-board__text,
.js .hero__sub:not(.is-split) {
  opacity: 0;
  animation: show-late 0s linear 3s forwards;
}
@keyframes show-late { to { opacity: 1; } }
/* On a phone the store badges wait at the foot of the screen, so the middle of
 * the frame stays clear for the car. */
.hero .cta { margin-top: auto; }

@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .stop--hero {
    justify-content: flex-start;
    padding-top: calc(var(--safe-t) + 16px);
  }
  .hero {
    width: min(46vw, 600px);
    max-width: none;
    flex: 0 0 auto;
    gap: 16px;
  }
  .hero .cta { margin-top: clamp(14px, 4vh, 40px); }
}

/* Calls to action: the official store badges once there is a store page,
 * an ink stamp until then. */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
}
.cta__note {
  font-size: 13px;
  color: rgb(var(--panel));
  -webkit-text-stroke: 5px rgb(var(--ink) / .92);
  paint-order: stroke fill;
}
.badge { display: block; border-radius: 10px; }
.badge img { height: 52px; width: auto; }
.badge--play img { height: 52px; }

/* STATUS STAMP — ink plate, a cream rule inset, set a touch off square. */
.stamp {
  display: inline-block;
  padding: 11px 22px 12px;
  border-radius: 9px;
  background: rgb(var(--ink));
  color: rgb(var(--panel));
  font-size: 19px;
  line-height: 1;
  box-shadow:
    inset 0 0 0 3px rgb(var(--ink)),
    inset 0 0 0 5px rgb(var(--panel) / .92),
    0 0 0 2px rgb(var(--panel) / .92),
    0 0 0 4px rgb(var(--ink)),
    0 8px 18px rgb(0 0 0 / .35);
  transform: rotate(-2deg);
}

/* ---------------------------------------------------------------------------
 * FINALE
 * ------------------------------------------------------------------------- */
.stop--finale {
  justify-content: center;
  align-items: center;
  padding-top: 26svh;
}
.finale {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}
.finale__title {
  max-width: 12em;
  font-size: clamp(32px, 8.6vw, 54px);
  line-height: 1.05;
  color: rgb(var(--panel));
  -webkit-text-stroke: 9px rgb(var(--ink) / .92);
  paint-order: stroke fill;
}
.facts {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 34em;
}
.facts li {
  padding: 8px 14px 9px;
  border-radius: 9px;
  background: rgb(var(--panel));
  color: rgb(var(--ink));
  font-size: 12.5px;
  line-height: 1;
  box-shadow: 0 0 0 2px rgb(var(--ink)), 0 5px 0 rgb(var(--ink) / .35);
}
.facts li:nth-child(odd) { transform: rotate(-1.4deg); }
.facts li:nth-child(even) { transform: rotate(1.2deg); }

@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .stop--finale { align-items: flex-start; padding-top: 132px; }
  .finale { justify-items: start; text-align: left; }
  .finale .cta, .facts { justify-content: flex-start; }
}

/* ---------------------------------------------------------------------------
 * THE FINE PRINT
 * ------------------------------------------------------------------------- */
.stop--fineprint {
  padding-top: 120px;
  justify-content: flex-start;
}
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .stop--fineprint { justify-content: flex-start; padding-top: 140px; }
}
.policy h2 { font-size: clamp(26px, 6.6vw, 34px); }
.policy h3 {
  margin: 28px 0 10px;
  font-size: 17px;
  line-height: 1.25;
}
.policy p, .policy li { font-size: 14px; line-height: 1.65; }
.policy ul {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: grid;
  gap: 8px;
}
.policy li {
  position: relative;
  padding-left: 20px;
}
.policy li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--ink));
}
.policy strong { font-weight: 400; color: rgb(var(--ink)); -webkit-text-stroke: 0; }
.policy__short {
  margin: 18px -6px 6px;
  padding: 4px 18px 16px;
  border-radius: 12px;
  background: rgb(var(--paper-well));
}
.policy__short h3 { margin-top: 14px; }
.policy__short li { -webkit-text-stroke-color: rgb(var(--paper-well)); }

/* The policy opened over the page (site.js THE PRIVACY POLICY): its roadbook
 * page in a dialog over the dimmed world, scrolling inside, with a Close slab
 * where the Privacy one was. */
.policy-dialog {
  box-sizing: border-box;
  width: min(100% - 2 * var(--gutter), 860px);
  max-width: none;
  height: calc(100% - var(--safe-t) - var(--safe-b) - 24px);
  max-height: none;
  margin: calc(var(--safe-t) + 12px) auto 0;
  padding: 0;
  border: 0;
  background: none;
  color: rgb(var(--ink));
  overflow: visible;
}
.policy-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: policy-in .4s cubic-bezier(.2, .8, .2, 1);
}
.policy-dialog::backdrop {
  background: rgb(14 10 6 / .62);
  animation: policy-fade .3s ease-out;
}
@keyframes policy-in { from { opacity: 0; transform: translateY(28px); } }
@keyframes policy-fade { from { opacity: 0; } }
.policy-dialog__bar {
  flex: none;
  display: flex;
  justify-content: flex-end;
  padding-bottom: 8px;
}
.policy-dialog__close {
  min-height: 56px;
  padding: 14px 28px 16px;
  font-size: 15px;
}
.policy-dialog__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--holder-dim) / .5) transparent;
}
.policy-dialog__scroll:focus { outline: none; }
.policy-dialog__scroll:focus-visible { outline: 3px solid rgb(var(--accent2)); outline-offset: -3px; }
@media (max-width: 420px) {
  .policy-dialog { width: calc(100% - 20px); }
}

/* ---------------------------------------------------------------------------
 * FOOTER
 * ------------------------------------------------------------------------- */
.footer {
  position: relative;
  z-index: 1;
  /* The foot of the page is a stop too, or snapping would never reach it. */
  scroll-snap-align: end;
  padding: 12px var(--gutter) calc(var(--trail-h) + var(--safe-b) + 30px);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: rgb(var(--holder-dim));
}
.footer a { color: rgb(var(--panel)); }
.footer__small {
  max-width: 62em;
  margin: 10px auto 0;
  font-size: 10px;
  opacity: .75;
}

/* ---------------------------------------------------------------------------
 * THE TRAIL — the scroll bar: the Trailblazer drives a strip of solid ground
 * toward a finish line, reaching it at the foot of the page. site.js builds it.
 * ------------------------------------------------------------------------- */
.trail {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--trail-h) + var(--safe-b));
  padding: 0 max(clamp(14px, 3vw, 40px), env(safe-area-inset-right, 0px)) var(--safe-b) max(clamp(14px, 3vw, 40px), env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.trail[hidden] { display: none; }
/* A soft shade above the ground, so pages scrolling under the car don't
 * fight it. */
.trail::before {
  content: "";
  position: absolute;
  inset: -16px 0 0;
  z-index: -2;
  background: linear-gradient(to top, rgb(var(--holder) / .5), rgb(var(--holder) / 0));
}
/* The ground, edge to edge, in the colour of the trail on screen: a lit top
 * edge over an ink line, darkening toward the bottom. */
.trail__ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  height: calc(var(--ground-h) + var(--safe-b));
  background-color: rgb(var(--ground));
  background-image:
    linear-gradient(rgb(255 255 255 / .2), rgb(255 255 255 / 0) 3px),
    linear-gradient(to top, rgb(0 0 0 / .26), rgb(0 0 0 / 0) 85%);
  box-shadow: 0 -2px 0 rgb(var(--ink) / .65);
  transition: background-color .6s, box-shadow .6s;
}
.trail__track {
  position: relative;
  height: 100%;
}

/* The finish: a chequered line painted across the ground, its flag planted
 * just past it. The flag waves as the car arrives. */
.trail__finish {
  position: absolute;
  bottom: 0;
  left: var(--finish-x, 100%);
  width: 12px;
  height: var(--ground-h);
  margin-left: -6px;
  background: conic-gradient(rgb(var(--ink)) 25%, rgb(var(--panel)) 0 50%, rgb(var(--ink)) 0 75%, rgb(var(--panel)) 0) 0 0 / 6px 6px;
}
.trail__flag {
  position: absolute;
  bottom: 100%;
  left: 10px;
  width: 3px;
  height: 34px;
  border-radius: 2px;
  background: rgb(var(--ink));
}
.trail__flag::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 3px;
  width: 22px;
  height: 15px;
  border-radius: 1px 3px 3px 1px;
  background: conic-gradient(rgb(var(--ink)) 25%, rgb(var(--panel)) 0 50%, rgb(var(--ink)) 0 75%, rgb(var(--panel)) 0) 0 0 / 7.4px 7.5px;
  box-shadow: 0 0 0 1.5px rgb(var(--ink));
  transform-origin: 0 50%;
}
.trail.is-finished .trail__flag::after { animation: flag-wave .9s ease-in-out 2; }
@keyframes flag-wave {
  0%, 100% { transform: skewY(0) scaleX(1); }
  30% { transform: skewY(-9deg) scaleX(.9); }
  65% { transform: skewY(7deg) scaleX(.96); }
}
@media (max-width: 520px) {
  :root { --ground-h: 14px; }
  .trail__flag { height: 28px; }
  .trail__flag::after { width: 18px; height: 12px; background-size: 6px 6px; }
}

/* The car. Its body and wheels are separate renders (website/tools/
 * render_cars.py), so the wheels roll with the distance driven. */
.trail__car {
  position: absolute;
  left: 0;
  bottom: var(--ground-h);
  width: var(--car-w, 110px);
  height: var(--car-h, 46px);
  transform: translate3d(var(--car-x, 0px), 0, 0);
  will-change: transform;
}
.trail__body {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  transform: translateY(var(--bob, 0px)) rotate(var(--pitch, 0deg));
}
.trail__body img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 1.2px rgb(var(--ink))) drop-shadow(0 1px 0 rgb(var(--ink) / .7));
}
.trail__wheel {
  position: absolute;
  width: var(--wheel, 18px);
  height: var(--wheel, 18px);
  margin: calc(var(--wheel, 18px) / -2) 0 0 calc(var(--wheel, 18px) / -2);
  transform: rotate(var(--spin, 0deg));
  filter: drop-shadow(0 0 1px rgb(var(--ink)));
}

/* Headlights after dark: a beam ahead of the bumper, a glow at the tail. */
.trail__beam {
  position: absolute;
  left: var(--lamp-x, 96%);
  top: var(--lamp-y, 55%);
  width: calc(var(--car-w, 110px) * 1.3);
  height: calc(var(--car-w, 110px) * .42);
  margin-top: calc(var(--car-w, 110px) * -.21);
  border-radius: 0 50% 50% 0;
  background: radial-gradient(ellipse at left center, rgb(255 236 170 / .55), rgb(255 230 150 / .18) 45%, transparent 72%);
  opacity: 0;
  transition: opacity .8s;
  pointer-events: none;
}
.trail__tail {
  position: absolute;
  left: var(--tail-x, 2%);
  top: var(--tail-y, 50%);
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 80 60 / .85), rgb(255 60 40 / 0));
  opacity: 0;
  transition: opacity .8s;
}
.trail.is-night .trail__beam, .trail.is-night .trail__tail { opacity: 1; }

.trail__dust {
  position: absolute;
  bottom: calc(var(--ground-h) - 2px);
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: rgb(var(--panel) / .55);
  pointer-events: none;
  animation: dust .7s ease-out forwards;
}
@keyframes dust {
  from { opacity: .8; transform: translate(0, 0) scale(.6); }
  to { opacity: 0; transform: translate(var(--dx, -18px), -10px) scale(1.8); }
}

/* ---------------------------------------------------------------------------
 * MOTION — the title drops, buttons press and the car drives; all of it stops
 * for Reduce Motion.
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print the policy, not the world. */
@media print {
  .scenery, .topbar, .trail, .stop:not(.stop--fineprint), .skip-link { display: none !important; }
  /* The policy as a dialog prints alone, open or not. */
  .has-policy main, .has-policy .footer, .policy-dialog__bar { display: none !important; }
  .policy-dialog { display: block !important; position: static; width: auto; height: auto; margin: 0; animation: none; }
  .policy-dialog__scroll { overflow: visible; border-radius: 0; }
  body, html { background: #fff; color: #000; }
  .stop--fineprint { min-height: 0; padding: 0; display: block; }
  .roadbook { background: none; box-shadow: none; padding: 0; }
  .roadbook__paper { box-shadow: none; background: #fff; color: #000; }
  .roadbook__paper::before, .roadbook__paper::after { display: none; }
  .roadbook p, .roadbook li { -webkit-text-stroke: 0; }
}
