/* DRIFTLANDS landing page.
   The page is a rally co-driver's roadbook: each section is an entry with its distance, a tulip
   diagram and the pace note, and the racing line runs down the rail beside them. The colours are
   the game's: spruce, gravel, birch bark, and the orange of the wordmark's tyre line. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/Archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/Archivo-Italic-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: italic;
  font-display: swap;
}

:root {
  --spruce-950: #0c1811;
  --spruce-900: #10201a;
  --spruce-800: #14281c;
  --spruce-700: #1e3a29;
  --spruce-500: #3d6248;
  --gravel-200: #f0d6ad;
  --gravel-300: #e4bd85;
  --gravel-400: #d6a565;
  --gravel-700: #6e4920;
  --gravel-900: #2e1d0b;
  --birch: #f3e9d5;
  --birch-200: #e9dcc2;
  --ink: #121110;
  --ink-800: #1b1a18;
  --flag: #ed6b29;
  --flag-600: #d4561a;
  --flag-200: #f7b48f;

  --text: var(--birch);
  --text-2: #c7c8b2;

  --rail: clamp(9.5rem, 15vw, 13rem);
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 88rem;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--spruce-900);
  color: var(--text);
  font-family: "Archivo", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: .08em; }
button { font: inherit; color: inherit; }
::selection { background: var(--flag); color: var(--ink); }
:focus-visible { outline: 3px solid var(--flag); outline-offset: 3px; border-radius: 2px; }
html { scrollbar-color: var(--spruce-500) var(--spruce-950); }

.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 {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--flag); color: var(--ink); padding: .6rem 1rem; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- buttons ---------- */
.btn {
  --b: var(--birch); --f: var(--ink);
  display: inline-flex; align-items: center; gap: .6em;
  min-height: 3.25rem; padding: 0 1.5rem;
  border: 2px solid var(--b); border-radius: 999px;
  background: var(--b); color: var(--f);
  font-weight: 750; font-stretch: 88%; font-size: 1.05rem; letter-spacing: .01em;
  text-decoration: none; cursor: pointer;
  transition: background-color .25s var(--ease-out), color .25s var(--ease-out), border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn__icon { width: 1.05em; height: 1.05em; fill: currentColor; }
.btn__icon--down { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn--flag { --b: var(--flag); --f: var(--ink); }
.btn--flag:hover { --b: #ff7d3b; }
.btn--ghost { background: transparent; color: var(--birch); border-color: rgba(243, 233, 213, .55); }
.btn--ghost:hover { border-color: var(--birch); background: rgba(243, 233, 213, .08); }
.btn--ink { --b: var(--ink); --f: var(--birch); }
.btn--ink:hover { --b: #000; }
.btn--small { min-height: 2.5rem; padding: 0 1.1rem; font-size: .95rem; --b: var(--flag); --f: var(--ink); }

/* ---------- the bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.5rem);
  height: 4.25rem; padding: 0 var(--gutter);
  color: var(--birch);
  transition: background-color .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.bar.is-solid { background: rgba(12, 24, 17, .92); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); backdrop-filter: saturate(1.2) blur(10px); }
.bar__mark img { width: 9.5rem; height: auto; }
/* the small mark only once the hero's big one has gone by (the client: the name was on screen four times) */
.bar__mark { opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .4s var(--ease-out), transform .4s var(--ease-out), visibility 0s linear .4s; }
.bar.is-solid .bar__mark { opacity: 1; visibility: visible; transform: none; transition: opacity .4s var(--ease-out), transform .4s var(--ease-out), visibility 0s; }
.trip {
  display: flex; align-items: baseline; gap: .45rem;
  padding: .35rem .8rem; border: 1.5px solid rgba(243, 233, 213, .35); border-radius: 6px;
  font-stretch: 70%; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem;
  font-variant-numeric: tabular-nums; opacity: 0; transform: translateY(-4px);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.bar.is-solid .trip { opacity: 1; transform: none; }
.trip__label { color: var(--text-2); }
.trip__km { font-size: 1.15rem; letter-spacing: 0; color: var(--birch); }
.trip__unit { color: var(--text-2); }
.trip__next { color: var(--flag); margin-left: .4rem; white-space: nowrap; }
.bar__nav { display: flex; gap: clamp(.8rem, 1.8vw, 1.6rem); margin-left: auto; }
.bar__nav a { text-decoration: none; font-weight: 600; font-stretch: 85%; font-size: .98rem; color: var(--text-2); transition: color .2s; }
.bar__nav a:hover, .bar__nav a[aria-current="location"] { color: var(--birch); }
.bar__nav a[aria-current="location"] { text-decoration: underline; text-decoration-color: var(--flag); text-decoration-thickness: 2px; text-underline-offset: .45em; }

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: grid; align-items: stretch;
  padding: 5.25rem var(--gutter) clamp(2rem, 6vh, 4.5rem);
  overflow: hidden; isolation: isolate; background: var(--spruce-950);
}
/* THE HERO'S PICTURES (the client: "the hero frame should change smoothly, with a beautiful animation"): each one
   drifts in slowly while it is on, and the next comes in sideways, wiped across from the left behind a soft
   slanted edge (main.js runs the wipe; without a mask it cross-fades) */
.hero__slides { position: absolute; inset: 0; z-index: -2; overflow: hidden; background: var(--spruce-950); }
.hero__slide {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%;
  opacity: 0; transform: scale(1.07); will-change: transform;
}
.hero__slide.is-on { opacity: 1; animation: hero-drift 4.5s linear forwards; }
.hero__slide.is-top { z-index: 1; }
.hero__slide:nth-child(even).is-on { animation-name: hero-drift-back; }
@keyframes hero-drift { from { transform: scale(1.08) translate3d(1.2%, .6%, 0); } to { transform: scale(1.01) translate3d(0, 0, 0); } }
@keyframes hero-drift-back { from { transform: scale(1.08) translate3d(-1.2%, .4%, 0); } to { transform: scale(1.01) translate3d(0, 0, 0); } }
.hero__progress {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 1rem; z-index: 2;
  display: flex; gap: .5rem;
}
.hero__progress button {
  flex: 1; height: 1.25rem; padding: 0; border: 0; background: none; cursor: pointer; display: grid; align-items: center;
}
.hero__progress button span {
  display: block; height: 3px; border-radius: 2px; background: rgba(243, 233, 213, .28); overflow: hidden; position: relative;
}
.hero__progress button span::after {
  content: ""; position: absolute; inset: 0; background: var(--flag); transform-origin: left; transform: scaleX(var(--p, 0));
}
.hero__progress button:hover span { background: rgba(243, 233, 213, .45); }
.hero__progress button:focus-visible { outline-offset: 2px; }
.hero__shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 18, 13, .55) 0%, rgba(10, 18, 13, 0) 22%),
    linear-gradient(0deg, rgba(10, 18, 13, .92) 0%, rgba(10, 18, 13, .55) 32%, rgba(10, 18, 13, 0) 62%),
    linear-gradient(90deg, rgba(10, 18, 13, .45) 0%, rgba(10, 18, 13, 0) 55%);
}
.hero__body { max-width: min(62rem, 100%); display: flex; flex-direction: column; }
/* the big mark at the top left, where the bar's small one is hidden, on the same left edge as the text and the buttons */
.hero__title { margin: 0 0 auto; padding-bottom: 2rem; }
.hero__title img { width: min(100%, 46rem); transform: translateX(-0.8%); filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .35)); }
.hero__hook {
  margin: 0 0 2rem; max-width: 38ch;
  font-size: clamp(1.15rem, .95rem + .8vw, 1.6rem); line-height: 1.38; font-weight: 450; font-stretch: 92%;
  text-wrap: pretty;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.stamp {
  position: absolute; right: var(--gutter); bottom: clamp(2rem, 6vh, 4.5rem); margin: 0;
  display: grid; justify-items: center; gap: .15rem; padding: .7rem 1.1rem .8rem;
  border: 3px solid var(--flag); border-radius: 6px; color: var(--flag);
  font-stretch: 66%; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; line-height: 1.05;
  transform: rotate(-6deg); background: rgba(12, 24, 17, .62); backdrop-filter: blur(3px);
  box-shadow: inset 0 0 0 2px rgba(12, 24, 17, .25);
}
.stamp__big { font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); letter-spacing: .04em; line-height: .9; }
.stamp__row { display: flex; gap: .8rem; font-size: .82rem; }
.stamp__row + .stamp__row { border-top: 2px solid currentColor; padding-top: .3rem; margin-top: .15rem; font-size: 1rem; color: var(--birch); }

/* ---------- the roadbook ---------- */
.roadbook { position: relative; }
.line { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.line path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.line__case { stroke: rgba(12, 24, 17, .55); stroke-width: 9; }
.line__ghost { stroke: rgba(243, 233, 213, .22); stroke-width: 2; stroke-dasharray: 2 9; }
.line__draw { stroke: var(--flag); stroke-width: 4.5; }
.line__car rect { fill: var(--flag); stroke: var(--ink); stroke-width: 1.5; }
.line__car .line__glass { fill: var(--ink); stroke: none; }
.line__car .line__lamp { fill: #fff6dc; stroke: none; }

.entry {
  position: relative;
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  padding: clamp(5rem, 11vh, 8.5rem) var(--gutter) clamp(5rem, 11vh, 8.5rem) 0;
}
.entry--spruce { background: var(--spruce-800); }
.entry--deep { background: var(--spruce-950); }
.entry--ink { background: var(--ink-800); }
.entry--gravel { background: var(--gravel-400); color: var(--gravel-900); --text-2: #4a3216; }
.entry--birch { background: var(--birch-200); color: var(--ink); --text-2: #4b4637; }

.entry__rail { position: relative; z-index: 4; }
.note {
  margin: 0; display: grid; justify-items: center; gap: .55rem; text-align: center;
  font-stretch: 66%; font-weight: 780; text-transform: uppercase; letter-spacing: .05em; line-height: 1.12; font-size: .9rem;
}
.note__km { font-size: 1.05rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--text-2); }
.note__call { max-width: 9rem; }
.note__call > span { display: block; }
.tulip {
  display: grid; place-items: center; width: 4.6rem; height: 4.6rem;
  border: 2px solid currentColor; border-radius: 6px; background: var(--spruce-800);
}
.entry--gravel .tulip { background: var(--gravel-300); }
.entry--birch .tulip { background: var(--birch); }
.entry--deep .tulip { background: var(--spruce-950); }
.entry--ink .tulip { background: var(--ink-800); }
.tulip svg { width: 78%; height: 78%; overflow: visible; }
.tulip svg .t-road { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.tulip svg .t-dot { fill: currentColor; }
.tulip svg .t-head { fill: currentColor; }

.entry__body { min-width: 0; max-width: var(--max); }
.entry__body--split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }

.h2 {
  margin: 0 0 1.4rem;
  font-size: clamp(2.6rem, 1.4rem + 4.6vw, 6rem); line-height: .94; letter-spacing: -.02em;
  font-weight: 820; font-stretch: 72%; text-wrap: balance;
}
.copy p { margin: 0 0 1.1em; max-width: 60ch; color: var(--text-2); text-wrap: pretty; }
.copy--wide { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(2rem, 5vw, 5rem); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.copy--wide .h2 { margin: 0; }
.copy--wide p { margin: 0 0 .35rem; }

/* physics */
.surfaces { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.8rem 0 0; }
.surfaces li {
  padding: .35rem .85rem; border: 1.5px solid rgba(243, 233, 213, .4); border-radius: 999px;
  font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .82rem;
}
.stack { position: relative; margin: 0 0 3rem; }
.stack__main { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .6); }
.stack__detail {
  position: absolute; left: -8%; bottom: -3rem; width: 38%; aspect-ratio: 1; object-fit: cover;
  border: 6px solid var(--spruce-800); border-radius: 4px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55);
}

/* the field */
.field {
  display: grid; gap: clamp(.6rem, 1.2vw, 1rem);
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
.field img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.field__pano { grid-column: 1 / -1; aspect-ratio: 21 / 9; }
.field__tall { grid-column: span 3; aspect-ratio: 4 / 5; }
.field__wide { grid-column: span 6; aspect-ratio: auto; }
.entry--gravel .h2 { color: var(--ink); }

/* roads */
.land { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(.6rem, 1.2vw, 1rem); }
.land img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.land__pano { grid-column: 1 / -1; aspect-ratio: 21 / 9; }
.land__tall { grid-column: span 4; aspect-ratio: 4 / 5; }
.land__wide { grid-column: span 8; }
.land__band { grid-column: 1 / -1; aspect-ratio: 3 / 1; }

/* cars */
.lineup { margin: 0; }
.lineup img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: 3px; box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .45); }
.lineup figcaption { margin-top: .9rem; font-size: .92rem; color: var(--text-2); }

/* weather */
.wx { display: grid; gap: 1.25rem; }
.wx__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: #000; }
.wx__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.02); transition: opacity .7s var(--ease-out), transform 1.2s var(--ease-out); }
.wx__frame img.is-on { opacity: 1; transform: none; }
.wx__dial { display: flex; flex-wrap: wrap; gap: .5rem; }
.wx__dial button {
  min-height: 2.75rem; padding: 0 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid rgba(243, 233, 213, .35); background: transparent;
  font-weight: 700; font-stretch: 78%; letter-spacing: .02em;
  transition: background-color .25s, color .25s, border-color .25s;
}
.wx__dial button:hover { border-color: var(--birch); }
.wx__dial button[aria-checked="true"] { background: var(--birch); color: var(--ink); border-color: var(--birch); }

/* the photo roll */
.roll { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(.6rem, 1.2vw, 1rem); }
.roll img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.roll__a { grid-column: 1 / -1; aspect-ratio: 21 / 9; }
.roll__b { grid-column: span 4; aspect-ratio: 4 / 5; }
.roll__c { grid-column: span 4; aspect-ratio: 4 / 5; }
.roll__d { grid-column: span 4; aspect-ratio: 4 / 5; }
.roll__e { grid-column: span 5; aspect-ratio: 1; }
.roll__f { grid-column: span 7; aspect-ratio: auto; }

/* ---------- finish ---------- */
.finish { background: var(--flag); color: var(--ink); padding: clamp(5rem, 12vh, 9rem) var(--gutter); position: relative; overflow: hidden; }
.finish::before {
  /* the chequered finish line, across the top */
  content: ""; position: absolute; inset: 0 0 auto; height: 28px;
  background:
    conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 28px 28px;
  opacity: .9;
}
.finish__inner { max-width: 60rem; margin-left: var(--rail); }
.finish__date {
  display: inline-flex; margin: 0 0 1.4rem; border: 3px solid var(--ink); border-radius: 6px; overflow: hidden;
  font-stretch: 66%; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: clamp(1rem, .9rem + .5vw, 1.3rem);
}
.finish__date span { padding: .35rem .9rem; }
.finish__date span + span { background: var(--ink); color: var(--flag); }
.finish__title { margin: 0 0 1.25rem; font-size: clamp(3rem, 1.6rem + 6vw, 7.5rem); line-height: .9; letter-spacing: -.025em; font-weight: 860; font-stretch: 68%; text-wrap: balance; }
.finish__lede { max-width: 46ch; margin: 0; font-size: clamp(1.1rem, 1rem + .4vw, 1.35rem); line-height: 1.45; color: #2b1407; }
.finish :focus-visible { outline-color: var(--ink); }

.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 2rem;
  padding: 2.5rem var(--gutter); background: var(--ink); color: #b7b4a8; font-size: .9rem;
}
.foot p { margin: 0; }
.foot p:last-child { margin-left: auto; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .bar__nav { display: none; }
  .trip { margin-left: auto; }
  .entry__body--split, .copy--wide { grid-template-columns: 1fr; }
  .copy--wide .h2 { margin-bottom: 1.2rem; }
  .stack { margin-bottom: 3.5rem; }
  .stack__detail { left: auto; right: 4%; }
  .field__tall { grid-column: span 6; }
  .field__wide { grid-column: 1 / -1; aspect-ratio: 3 / 2; }
  .land__tall { grid-column: span 5; }
  .land__wide { grid-column: span 7; }
}
@media (max-width: 760px) {
  :root { --rail: 3.25rem; --gutter: 1rem; }
  .bar { height: 3.75rem; gap: .75rem; }
  .bar__mark img { width: 7.5rem; }
  .bar .btn--small { display: none; }
  .trip { font-size: .7rem; padding: .3rem .6rem; }
  .trip__next { display: none; }
  .hero { padding-bottom: 2.25rem; }
  .stamp { position: static; justify-self: start; margin-top: 1.4rem; padding: .45rem .7rem .55rem; transform: rotate(-3deg); }
  .hero { grid-template-rows: 1fr auto; }
  .hero__slide { object-position: 38% 30%; }
  .hero__progress { bottom: .6rem; }
  .stamp__big { font-size: 1.8rem; }
  .stamp__row { font-size: .75rem; gap: .5rem; }
  .stamp__row + .stamp__row { font-size: .8rem; }
  .entry { padding-top: 4rem; padding-bottom: 4.5rem; }
  .entry__rail { position: static; }
  /* on a phone the rail is the racing line alone; the roadbook entry sits at the head of the section */
  .note {
    position: absolute; left: calc(var(--rail) + 0px); top: 1.25rem; right: var(--gutter);
    display: flex; align-items: center; gap: .7rem; text-align: left; justify-items: start; font-size: .78rem;
  }
  .note__call { max-width: none; }
  .note__call > span { display: inline; }
  .note__call > span + span::before { content: "· "; opacity: .6; }
  .tulip { width: 2.6rem; height: 2.6rem; border-width: 1.5px; order: -1; }
  .note__km { order: 0; }
  .h2 { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  .land__tall, .land__wide { grid-column: 1 / -1; }
  .land__wide { aspect-ratio: 16 / 9; }
  .land__band { aspect-ratio: 2 / 1; }
  .lineup img { aspect-ratio: 16 / 9; }
  .field__tall { grid-column: span 6; }
  .roll__b, .roll__c, .roll__d { grid-column: span 6; }
  .roll__d { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
  .roll__e, .roll__f { grid-column: 1 / -1; }
  .roll__a { aspect-ratio: 16 / 9; }
  .stack__detail { width: 44%; bottom: -2.5rem; border-width: 4px; }
  .finish__inner { margin-left: 0; }
  .foot p:last-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .hero__slide, .hero__slide.is-on { animation: none; transform: none; }
}
