/* ==========================================================================
   Paddock Archive — public site
   Dark archival stage, condensed display type, mono technical labels,
   serif editorial story. Brand colours arrive as --brand / --accent.
   ========================================================================== */

:root {
  --bg: #0e0e10;
  --bg-2: #141417;
  --bg-3: #1c1c20;
  --line: rgba(236, 233, 226, 0.11);
  --line-2: rgba(236, 233, 226, 0.22);
  --text: #ece9e2;
  --muted: #9a978f;
  --faint: #67655f;
  --paper: #eeeae1;
  --paper-2: #e3ded2;
  --ink: #1b1a17;
  --ink-muted: #5d5a52;

  --brand: #e8e4da;      /* raw brand colour (may be dark) */
  --accent: #e8e4da;     /* brand colour lifted for contrast on the dark UI */
  --brand-2: #e8e4da;

  --f-display: "Saira Condensed", "Arial Narrow", Impact, sans-serif;
  --f-body: "Saira", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-serif: "Newsreader", Georgia, "Times New Roman", serif;

  --header: 64px;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1440px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.55, 0, .75, .25);
  --dir: 1;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + 96px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
.mono { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 300; background: var(--text); color: var(--bg); padding: 8px 14px; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ header */

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: var(--header);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(14,14,16,.92), rgba(14,14,16,.78));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
.wordmark-mark { width: 26px; height: 26px; color: var(--text); }
.wordmark-text { font: 700 17px/1 var(--f-display); letter-spacing: .14em; text-transform: uppercase; }

.current-brand {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid transparent;
  transition: border-color .2s;
}
.current-brand:hover { border-color: var(--line-2); }
.current-brand-logo { width: 30px; height: 30px; display: grid; place-items: center; }
.current-brand-logo img { width: 28px; height: 28px; object-fit: contain; }
.current-brand-name { font: 600 20px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; }

.change-team {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2);
  font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase;
  transition: background .2s, border-color .2s, color .2s;
}
.change-team svg { width: 16px; height: 16px; }
.change-team:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ------------------------------------------------------------------ stage states */

.stage { position: relative; min-height: 100vh; }
.intro { display: none; }
.no-brand .hero, .no-brand .timeline, .no-brand .content, .no-brand .site-footer { display: none; }
.no-brand .intro {
  display: grid; place-items: center;
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 60%, rgba(236,233,226,.06), transparent 70%),
    var(--bg);
}
.intro-years {
  display: flex; gap: 6vw; align-items: baseline;
  font: 800 clamp(120px, 24vw, 420px)/.8 var(--f-display);
  color: transparent; -webkit-text-stroke: 1px rgba(236,233,226,.12);
  letter-spacing: -.02em;
}
.intro-years span:last-child { -webkit-text-stroke-color: rgba(236,233,226,.2); }

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative; overflow: hidden;
  padding: calc(var(--header) + clamp(20px, 3vw, 36px)) var(--gutter) clamp(24px, 3vw, 40px);
  min-height: 560px;
  display: flex; flex-direction: column;
  isolation: isolate;
}
.hero::before { /* spotlight + floor glow tinted by brand */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 55% 38% at 50% 70%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(236,233,226,.05), transparent 70%);
  transition: background .8s;
}
.hero-backdrop { position: absolute; inset: 0; z-index: -3; opacity: 0; transition: opacity .8s; }
.hero-backdrop.has-image { opacity: .22; }
.hero-backdrop img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.35) blur(2px); }
.hero-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(14,14,16,.4), var(--bg) 92%); }

.hero-year {
  position: absolute; inset: auto 0 auto 0; top: 14%; z-index: -1;
  text-align: center; pointer-events: none; user-select: none;
  font: 800 clamp(160px, 31vw, 560px)/.8 var(--f-display);
  letter-spacing: -.03em;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--accent) 26%, transparent);
}
.hero-year span { display: inline-block; }

.hero-inner {
  position: relative; flex: 1;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "meta meta"
    "car car"
    "title side";
  column-gap: 32px;
  min-height: 0;
}
.hero-side { grid-area: side; align-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 20px; }
.hero-meta { grid-area: meta; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 22px; }
.hero-meta span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 9px; background: var(--line-2); vertical-align: 1px; }
.hero-meta span:first-child::before { background: var(--accent); }

.hero-car {
  grid-area: car;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  min-height: 0;
  padding: 8px 0 0;
}
.hero-car img {
  width: auto; height: auto;
  max-width: min(100%, 1240px);
  max-height: calc(100% - 24px);
  object-fit: contain;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,.55));
}
.hero-car.is-photo img { filter: none; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.hero-credit { margin-top: 10px; color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: none; }

.hero-title { grid-area: title; align-self: end; padding-top: 12px; }
.hero-brand { font: 500 13px/1 var(--f-mono); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.hero-name {
  font: 800 clamp(56px, 8.4vw, 150px)/.84 var(--f-display);
  letter-spacing: -.01em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.hero-season { margin-top: 14px; display: flex; align-items: baseline; gap: 12px; color: var(--muted); }
.hero-season strong { font: 600 clamp(28px, 3vw, 40px)/1 var(--f-display); color: var(--text); letter-spacing: .04em; }

.hero-facts {
  display: grid; grid-auto-flow: column; gap: 0;
  border-left: 1px solid var(--line);
}
.hero-facts > div { padding: 0 22px; border-right: 1px solid var(--line); min-width: 110px; }
.hero-facts dt { font: 500 10px/1.3 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.hero-facts dd { font: 700 clamp(30px, 3.2vw, 48px)/1 var(--f-display); }
.hero-facts dd.is-accent { color: var(--accent); }

.hero-siblings { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.hero-siblings:empty { display: none; }
.hero-siblings .mono { color: var(--muted); margin-right: 6px; }
.sibling {
  padding: 6px 12px; border: 1px solid var(--line-2);
  font: 600 14px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase;
}
.sibling[aria-current="true"] { border-color: var(--accent); color: var(--accent); }

.hero-nav { display: flex; gap: 8px; }
.hero-arrow {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2);
  transition: border-color .2s, background .2s;
}
.hero-arrow svg { width: 18px; height: 18px; }
.hero-arrow:hover:not(:disabled) { border-color: var(--text); }
.hero-arrow:disabled { opacity: .3; cursor: default; }

@media (min-width: 900px) and (min-height: 640px) {
  .hero { height: calc(100vh - 136px); height: calc(100svh - 136px); max-height: 1060px; }
}

/* ------------------------------------------------------------------ timeline */

.timeline {
  position: sticky; top: var(--header); z-index: 50;
  background: rgba(14,14,16,.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.timeline-head {
  display: flex; gap: 16px; align-items: center;
  padding: 10px var(--gutter) 0;
}
.timeline-hint { margin-left: auto; color: var(--faint); }
.timeline-label { color: var(--text); }
.timeline-count { color: var(--faint); }
.timeline-viewport {
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
  scroll-behavior: smooth;
}
.timeline-viewport::-webkit-scrollbar { display: none; }
.timeline-track {
  position: relative;
  display: flex; align-items: stretch;
  width: max-content; min-width: 100%;
  padding: 26px max(var(--gutter), 72px) 12px;
}
.timeline-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 44px;
  height: 1px; background: var(--line-2);
}
.tl-item { position: relative; flex: 0 0 auto; }
.tl-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: 92px; padding: 12px 0 6px;
  color: var(--muted);
  transition: color .2s;
}
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--muted);
  transition: transform .35s var(--ease-out), background .25s, border-color .25s, box-shadow .35s;
}
.tl-item.is-featured .tl-dot { border-color: var(--text); }
.tl-year { margin-top: 12px; font: 600 18px/1 var(--f-display); letter-spacing: .04em; transition: transform .35s var(--ease-out); }
.tl-car {
  margin-top: 6px; max-width: 88px;
  font: 500 9.5px/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(-3px);
  transition: opacity .25s, transform .25s;
}
.tl-btn:hover { color: var(--text); }
.tl-btn:hover .tl-dot { border-color: var(--text); transform: scale(1.2); }
.tl-btn:hover .tl-car { opacity: .7; transform: none; }
.tl-item.is-active .tl-btn { color: var(--text); }
.tl-item.is-active .tl-dot {
  background: var(--accent); border-color: var(--accent);
  transform: scale(1.45);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 55%, transparent);
}
.tl-item.is-active .tl-year { transform: scale(1.32); color: var(--text); font-weight: 700; }
.tl-item.is-active .tl-car { opacity: 1; transform: translateY(3px); color: var(--accent); }
.tl-decade {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  font: 500 10px/1 var(--f-mono); letter-spacing: .14em; color: var(--faint);
  white-space: nowrap;
}
.tl-gap {
  position: relative; flex: 0 0 auto; width: 70px;
  display: flex; justify-content: center;
}
.tl-gap::before { /* dashed break over the rail */
  content: ""; position: absolute; left: 6px; right: 6px; top: 19px; height: 3px;
  background: repeating-linear-gradient(90deg, var(--bg) 0 4px, transparent 4px 8px);
}
.tl-gap span {
  position: absolute; top: 34px;
  font: 500 9px/1 var(--f-mono); letter-spacing: .1em; color: var(--faint); white-space: nowrap;
}
.timeline-scroll {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line-2);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.timeline-scroll svg { width: 16px; height: 16px; }
.timeline-scroll.prev { left: 8px; }
.timeline-scroll.next { right: 8px; }
.timeline-scroll.is-visible { opacity: 1; pointer-events: auto; }

/* ------------------------------------------------------------------ content blocks */

.content { position: relative; }
.block {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) var(--gutter) 0;
}
.block-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 18px;
  padding-bottom: 18px; margin-bottom: clamp(24px, 3vw, 40px);
  border-bottom: 1px solid var(--line-2);
}
.block-head h2 { font: 700 clamp(30px, 3.6vw, 52px)/1 var(--f-display); letter-spacing: .01em; text-transform: uppercase; }
.block-index { color: var(--accent); }
.block-sub { color: var(--muted); text-align: right; }

/* Performance */
.perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0;
  border-left: 1px solid var(--line);
}
.stat {
  padding: 22px 22px 26px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  min-height: 132px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.stat-value { font: 700 clamp(40px, 4.6vw, 68px)/.9 var(--f-display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-label { font: 500 10.5px/1.35 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stat.is-headline {
  grid-column: span 2; grid-row: span 2;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%);
}
.stat.is-headline .stat-value { font-size: clamp(88px, 11vw, 168px); color: var(--accent); }
.stat.is-headline .stat-value sup { font-size: .38em; vertical-align: top; position: relative; top: .25em; margin-left: .03em; }
.perf-empty, .block-empty { color: var(--muted); font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; padding: 24px 0; }

/* The car */
.car-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 72px); }
.spec-group { border-top: 1px solid var(--line); }
.spec-group:last-child { border-bottom: 1px solid var(--line); }
.spec-group summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0;
  font: 500 11px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase;
}
.spec-group summary::-webkit-details-marker { display: none; }
.spec-group summary .count { color: var(--faint); }
.spec-group summary::after {
  content: ""; width: 9px; height: 9px; margin-left: 14px;
  border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .25s;
}
.spec-group[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.spec-group summary .title { flex: 1; }
.spec-list { padding: 0 0 18px; }
.spec-row { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; }
.spec-row dt { color: var(--muted); font-size: 14px; white-space: nowrap; }
.spec-row::after { content: none; }
.spec-row .leader { flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-4px); min-width: 20px; }
.spec-row dd { font: 600 18px/1.25 var(--f-display); letter-spacing: .02em; text-align: right; }

.car-aside { display: flex; flex-direction: column; gap: 28px; }
.car-engine {
  position: relative; padding: 28px;
  background: var(--bg-2); border: 1px solid var(--line);
  overflow: hidden;
}
.car-engine::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.car-engine .mono { color: var(--muted); }
.car-engine-value { margin-top: 14px; font: 700 clamp(32px, 3.4vw, 50px)/.95 var(--f-display); text-transform: uppercase; }
.car-engine-sub { margin-top: 12px; color: var(--muted); font-size: 14px; }
.people-title { color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.person { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.person-role { color: var(--muted); font-size: 14px; }
.person-name { font: 600 18px/1.2 var(--f-display); letter-spacing: .02em; text-align: right; }

/* Drivers */
.driver {
  display: grid;
  grid-template-columns: 120px 72px minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: center; gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.driver:first-child { border-top: 1px solid var(--line); }
.driver-number {
  font: 800 clamp(64px, 7vw, 104px)/.8 var(--f-display);
  color: transparent; -webkit-text-stroke: 1.2px var(--accent);
  letter-spacing: -.02em; text-align: left;
}
.driver-number.is-empty { -webkit-text-stroke-color: var(--line-2); }
.driver-avatar {
  width: 72px; height: 72px; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--line);
  display: grid; place-items: center;
  font: 600 22px/1 var(--f-display); letter-spacing: .06em; color: var(--muted);
}
.driver-avatar img { width: 100%; height: 100%; object-fit: cover; }
.driver-name { font: 700 clamp(26px, 2.6vw, 38px)/1 var(--f-display); text-transform: uppercase; letter-spacing: .01em; }
.driver-name a { text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size .35s var(--ease-out); }
.driver-name a:hover { background-size: 100% 2px; }
.driver-name .first { display: block; font: 500 14px/1.3 var(--f-body); text-transform: none; letter-spacing: 0; color: var(--muted); margin-bottom: 4px; }
.driver-meta { margin-top: 10px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.driver-meta .flag { font-size: 14px; letter-spacing: 0; margin-right: 6px; }
.driver-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 14px 8px; }
.driver-stat-value { font: 700 30px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.driver-stat-label { margin-top: 6px; font: 500 9.5px/1.2 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.driver-stat.is-champ .driver-stat-value { color: var(--accent); }

/* Story — editorial, light paper */
.story {
  margin-top: clamp(72px, 10vw, 140px);
  background: var(--paper); color: var(--ink);
  padding: clamp(64px, 9vw, 128px) var(--gutter);
}
.story-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 680px); gap: clamp(32px, 6vw, 96px); }
.story-head { position: relative; }
.story-head .block-index { color: var(--ink-muted); display: block; padding-bottom: 18px; margin-bottom: 26px; border-bottom: 2px solid var(--ink); }
.story-head h2 {
  font: 400 clamp(38px, 4.4vw, 64px)/1.02 var(--f-serif);
  font-style: italic; letter-spacing: -.015em;
  position: sticky; top: calc(var(--header) + 140px);
}
.story-dek { margin-top: 22px; color: var(--ink-muted); }
.story-body { font: 400 clamp(18px, 1.35vw, 20.5px)/1.68 var(--f-serif); }
.story-body p + p { margin-top: 1.1em; }
.story-body > p:first-of-type::first-letter {
  float: left; font: 500 5.3em/.8 var(--f-serif);
  margin: .06em .1em 0 -.02em; color: var(--brand);
}
.story-body h2, .story-body h3 { font: 600 1.15em/1.3 var(--f-body); margin: 1.6em 0 .5em; letter-spacing: .01em; }
.story-body blockquote {
  margin: 1.6em 0; padding: .2em 0 .2em 1.1em;
  border-left: 3px solid var(--brand);
  font-style: italic; font-size: 1.32em; line-height: 1.38;
}
.story-body a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.story-body ul, .story-body ol { margin: 1em 0; padding-left: 1.3em; }
.story-body ul { list-style: square; }
.story-body ol { list-style: decimal; }
.story-body img { margin: 1.5em 0; width: 100%; height: auto; }
.story-body em { font-style: italic; }

/* Gallery */
.gallery { padding-bottom: clamp(56px, 8vw, 112px); }
.gallery-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 34%);
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px;
  scrollbar-color: var(--line-2) transparent;
}
.gallery-item { scroll-snap-align: start; position: relative; text-align: left; }
.gallery-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg-2); transition: opacity .3s; }
.gallery-item:hover img { opacity: .85; }
.gallery-item figcaption { margin-top: 10px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ year transition */

[data-anim] { will-change: opacity, transform; }
.stage.is-out [data-anim] {
  opacity: 0; transform: translate3d(calc(var(--dir) * -28px), 0, 0);
  transition: opacity .22s var(--ease-in), transform .22s var(--ease-in);
}
.stage.is-out .hero-car img[data-anim] { transform: translate3d(calc(var(--dir) * -9vw), 0, 0); }
.stage.is-out .hero-year [data-anim] { transform: translate3d(0, -10%, 0); }
.stage.is-prep [data-anim] {
  opacity: 0; transform: translate3d(calc(var(--dir) * 44px), 0, 0);
  transition: none;
}
.stage.is-prep .hero-car img[data-anim] { transform: translate3d(calc(var(--dir) * 12vw), 0, 0); }
.stage.is-prep .hero-year [data-anim] { transform: translate3d(0, 12%, 0); }
.stage.is-in [data-anim] {
  transition: opacity .6s var(--ease-out), transform .75s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 45ms);
}
.stage.is-team-out [data-anim] { opacity: 0; transition: opacity .25s; }

/* first reveal after choosing a team */
.stage.is-reveal .hero-car img { animation: carIn 1.1s var(--ease-out) both; }
.stage.is-reveal .hero-name, .stage.is-reveal .hero-brand, .stage.is-reveal .hero-meta, .stage.is-reveal .hero-facts { animation: rise .9s var(--ease-out) both; animation-delay: .15s; }
.stage.is-reveal .hero-year span { animation: fadeIn 1.4s ease both; }
.stage.is-reveal .timeline-track { animation: fadeIn .8s ease .3s both; }
@keyframes carIn { from { opacity: 0; transform: translate3d(14vw, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 24px, 0); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ team selector */

.selector { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.selector-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 8, 10, .7);
  -webkit-backdrop-filter: blur(16px) saturate(.8); backdrop-filter: blur(16px) saturate(.8);
  animation: fadeIn .35s ease both;
}
.selector-panel {
  position: relative;
  width: min(1120px, 100%); max-height: min(88vh, 940px);
  overflow: auto; overscroll-behavior: contain;
  background: #121215; border: 1px solid var(--line-2);
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
  animation: panelIn .55s var(--ease-out) both;
}
.selector.is-closing .selector-panel { animation: panelOut .3s var(--ease-in) both; }
.selector.is-closing .selector-backdrop { animation: fadeIn .3s ease reverse both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes panelOut { to { opacity: 0; transform: translateY(-10px) scale(.985); } }

.selector-head { position: relative; padding: clamp(28px, 4vw, 48px) clamp(20px, 4vw, 48px) 24px; }
.selector-kicker { color: var(--accent); margin-bottom: 14px; }
.selector-head h2 { font: 800 clamp(40px, 6vw, 84px)/.88 var(--f-display); text-transform: uppercase; letter-spacing: -.005em; max-width: 12ch; }
.selector-sub { margin-top: 16px; color: var(--muted); max-width: 52ch; }
.selector-close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line-2);
}
.selector-close svg { width: 18px; height: 18px; }
.no-brand .selector-close { display: none; }
.selector-tools {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(20px, 4vw, 48px);
  background: rgba(18,18,21,.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.selector-search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-2); padding: 6px 0; }
.selector-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.selector-search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: 400 16px var(--f-body); outline: none; }
.selector-search:focus-within { border-color: var(--accent); }
.selector-count { color: var(--faint); white-space: nowrap; }
.selector-notice { margin: 18px clamp(20px, 4vw, 48px) 0; padding: 12px 14px; border-left: 2px solid #e0a43a; background: rgba(224,164,58,.08); font-size: 14px; }
.selector-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 48px) clamp(28px, 4vw, 48px);
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.selector-grid > li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.team-card {
  --c: var(--text);
  position: relative; width: 100%; height: 100%;
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto; column-gap: 16px; row-gap: 4px;
  align-items: center; text-align: left;
  padding: 22px 20px 20px;
  background: #121215;
  transition: background .25s;
  animation: rise .6s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms + 120ms);
}
.team-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--c); transform: scaleY(0); transform-origin: bottom;
  transition: transform .35s var(--ease-out);
}
.team-card:hover:not(:disabled), .team-card:focus-visible { background: #19191d; }
.team-card:hover:not(:disabled)::before, .team-card:focus-visible::before, .team-card[aria-current="true"]::before { transform: scaleY(1); }
.team-card:disabled { cursor: default; opacity: .42; }
.team-logo { grid-row: 1 / span 3; width: 56px; height: 56px; display: grid; place-items: center; }
.team-logo img { width: 52px; height: 52px; object-fit: contain; }
.team-logo .ph { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--line-2); font: 700 18px var(--f-display); }
.team-name { font: 700 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.team-meta { color: var(--muted); font: 400 13px/1.3 var(--f-body); }
.team-meta .flag { margin-right: 4px; }
.team-seasons { font: 500 10px/1.3 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.team-card[aria-current="true"] .team-seasons { color: var(--c); }
.selector-empty { padding: 0 48px 48px; color: var(--muted); }

/* ------------------------------------------------------------------ lightbox */

.lightbox { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; color: var(--text); }
.lightbox::backdrop { background: rgba(6,6,8,.92); }
.lightbox img { max-width: 92vw; max-height: 84vh; object-fit: contain; margin: 0 auto; }
.lightbox p { margin-top: 12px; text-align: center; color: var(--muted); text-transform: none; letter-spacing: .04em; }
.lightbox-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--bg); }
.lightbox-close svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; background: var(--text); color: var(--bg);
  font: 500 12px/1.4 var(--f-mono); letter-spacing: .06em;
  transition: opacity .3s, transform .3s var(--ease-out);
  max-width: calc(100vw - 32px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.is-loading .hero-car::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 120px; height: 2px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%; animation: loadbar 1s linear infinite;
}
.hero-car { position: relative; }
@keyframes loadbar { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--line); padding: 40px var(--gutter) 56px; }
.site-footer-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: baseline; }
.site-footer-name { font: 700 16px var(--f-display); letter-spacing: .14em; text-transform: uppercase; }
.site-footer-note, .site-footer-meta { color: var(--faint); font-size: 13px; }
.story + .gallery[hidden] + * { margin-top: 0; }

.noscript { padding: 120px var(--gutter); max-width: 760px; margin: 0 auto; }
.noscript a { color: var(--accent); }

/* ------------------------------------------------------------------ driver profile page */

.profile { padding: calc(var(--header) + 48px) var(--gutter) 0; max-width: var(--maxw); margin: 0 auto; }
.profile-back { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); text-decoration: none; margin-bottom: 40px; }
.profile-back:hover { color: var(--text); }
.profile-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: end; padding-bottom: 40px; border-bottom: 1px solid var(--line-2); }
.profile-first { font: 500 clamp(20px, 2vw, 28px)/1 var(--f-body); color: var(--muted); }
.profile-last { font: 800 clamp(64px, 11vw, 180px)/.84 var(--f-display); text-transform: uppercase; letter-spacing: -.01em; margin-top: 8px; }
.profile-meta { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); }
.profile-photo { aspect-ratio: 4 / 5; background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo .ph { font: 800 120px/1 var(--f-display); color: transparent; -webkit-text-stroke: 1px var(--line-2); }
.profile-bio { max-width: 760px; font: 400 20px/1.6 var(--f-serif); margin-top: 48px; }
.profile-bio p + p { margin-top: 1em; }
.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.car-card { background: var(--bg); padding: 20px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; transition: background .2s; }
.car-card:hover { background: var(--bg-2); }
.car-card img { width: 100%; aspect-ratio: 16 / 7; object-fit: contain; }
.car-card .yr { font: 700 30px/1 var(--f-display); }
.car-card .nm { font: 600 18px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; }
.car-card .mono { color: var(--muted); }
.profile + .site-footer, .profile ~ .site-footer { margin-top: 96px; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "meta" "car" "title" "side";
  }
  .hero-side { align-items: flex-start; margin-top: 26px; }
  .driver { grid-template-columns: 96px 64px minmax(0, 1fr); }
  .driver-stats { grid-column: 1 / -1; }
  .driver-avatar { width: 64px; height: 64px; }
}

@media (max-width: 860px) {
  .car-layout { grid-template-columns: 1fr; }
  .story-inner { grid-template-columns: 1fr; }
  .story-head h2 { position: static; }
  .gallery-strip { grid-auto-columns: 78%; }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-photo { max-width: 260px; }
  .site-footer-inner { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 640px) {
  :root { --header: 56px; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 8px; }
  .wordmark-text { display: none; }
  .current-brand { justify-self: start; padding-right: 6px; }
  .current-brand-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36vw; }
  .change-team { padding: 0 12px; height: 36px; }
  .hero { min-height: auto; padding-bottom: 28px; }
  .hero-year { top: 22%; }
  .hero-car { min-height: 0; margin: 8px calc(var(--gutter) * -1) 0; padding-top: 24px; }
  .hero-car img { width: 100%; max-height: none; max-width: 100%; }
  .hero-credit { padding: 0 var(--gutter); text-align: center; }
  .hero-meta { gap: 6px 14px; font-size: 10px; }
  .hero-facts { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .hero-facts > div { padding: 0 12px; min-width: 0; }
  .hero-facts dd { font-size: 30px; }
  .hero-side { width: 100%; align-items: stretch; }
  .hero-nav { width: 100%; justify-content: space-between; }
  .timeline-hint { display: none; }
  .hero-arrow { flex: 1; justify-content: center; }
  .hero-arrow:last-child { justify-content: center; }
  .timeline-head { top: 8px; }
  .timeline-track { padding: 30px 40px 10px; }
  .timeline-track::before { top: 50px; }
  .tl-btn { width: 74px; }
  .tl-gap { width: 48px; }
  .tl-gap span { display: none; }
  .timeline-scroll { display: none; }
  .block-head { grid-template-columns: auto 1fr; }
  .block-sub { grid-column: 1 / -1; text-align: left; }
  .perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 18px 14px 20px; min-height: 112px; }
  .stat.is-headline { grid-column: span 2; grid-row: auto; }
  .stat.is-headline .stat-value { font-size: 96px; }
  .driver { grid-template-columns: 64px minmax(0, 1fr); gap: 14px 16px; }
  .driver-number { font-size: 60px; grid-row: span 2; }
  .driver-avatar { display: none; }
  .driver-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-column: 1 / -1; }
  .driver-stat-value { font-size: 24px; }
  .spec-row dt { white-space: normal; }
  .selector { padding: 0; place-items: stretch; }
  .selector-panel { max-height: 100vh; height: 100%; border: 0; }
  .selector-grid { grid-template-columns: 1fr; margin-left: 16px; margin-right: 16px; }
  .team-card { padding: 16px; }
  .selector-count { display: none; }
}

@media (max-width: 360px) {
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .driver-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .change-team span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .stage.is-out [data-anim], .stage.is-prep [data-anim] { transform: none !important; }
}
