/* ============ Tokens ============ */
:root {
  --tarmac: #202326;
  --tarmac-2: #2a2e32;
  --tarmac-3: #353a3f;
  --kerb-line: #4a5056;
  --paint: #f2f2ee;          /* hard compound / pit-lane paint */
  --paint-dim: #b9bcbd;
  --soft: #e10600;
  --medium: #ffd100;
  --hard: #f2f2ee;
  --inter: #2bb24c;
  --wet: #1e6fd9;
  --ink: #0f1113;

  --f-sans: "Archivo", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 2.441rem;
  --step-4: 3.815rem;
  --step-5: clamp(3.5rem, 11vw, 10rem);

  --gutter: clamp(16px, 4vw, 56px);
  --measure: 62ch;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--tarmac);
  color: var(--paint);
  font-family: var(--f-sans);
  font-size: var(--step-0);
  line-height: 1.5;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--medium); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Display type: expanded, heavy, italic — the "speed" face */
.display {
  font-weight: 900;
  font-style: italic;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  line-height: 0.88;
  text-wrap: balance;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============ Start lights intro ============ */
.lights {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink);
  display: grid; place-items: center; gap: 2rem;
  align-content: center;
  transition: opacity .5s ease, visibility .5s;
}
.lights.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.lights[hidden] { display: none; }
.gantry {
  display: flex; gap: clamp(8px, 2vw, 20px);
  padding: clamp(10px, 2vw, 18px);
  background: #050606;
  border-radius: 10px;
  box-shadow: 0 0 0 2px #1a1c1e inset;
}
.gantry__col {
  display: grid; gap: clamp(6px, 1.4vw, 12px);
  padding: clamp(6px, 1.2vw, 10px);
  background: #111314; border-radius: 8px;
}
.bulb {
  width: clamp(34px, 9vw, 76px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a1a19, #170807 70%);
  transition: background .05s, box-shadow .05s;
}
.gantry__col.is-on .bulb:nth-child(n+3) {
  background: radial-gradient(circle at 40% 35%, #ff6a5c, var(--soft) 45%, #7d0400 100%);
  box-shadow: 0 0 34px 6px rgba(225, 6, 0, .55);
}
.lights__caption {
  font-weight: 700; font-variation-settings: "wdth" 112; font-style: italic;
  color: var(--paint-dim); font-size: var(--step-1); min-height: 1.5em;
}
.lights__skip {
  position: absolute; bottom: 24px; right: var(--gutter);
  background: none; border: 1px solid var(--kerb-line); border-radius: 999px;
  padding: .5rem 1rem; cursor: pointer; color: var(--paint-dim);
}
.lights__skip:hover { color: var(--paint); border-color: var(--paint); }

/* ============ Header + stint bar ============ */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 14px var(--gutter);
  background: linear-gradient(to bottom, rgba(32,35,38,.92), rgba(32,35,38,0));
}
.top.is-solid { background: rgba(32,35,38,.96); backdrop-filter: blur(8px); }
.brand {
  text-decoration: none; display: flex; align-items: baseline; gap: .5rem;
  font-weight: 900; font-style: italic; font-variation-settings: "wdth" 125; font-size: 1.15rem;
}
.brand span { font-weight: 500; font-style: normal; font-variation-settings: "wdth" 100; font-size: .95rem; color: var(--paint-dim); }
.nav { display: flex; gap: clamp(.75rem, 2vw, 1.75rem); }
.nav a {
  text-decoration: none; font-weight: 600; font-size: .95rem; padding: .25rem 0;
  border-bottom: 3px solid transparent;
}
.nav a:hover, .nav a.is-active { border-color: var(--c, var(--paint)); }
@media (max-width: 760px) {
  .nav { display: none; }
}

/* The race is the page, each section is a stint on a tyre compound */
.stints {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  display: flex; height: 6px; background: rgba(0,0,0,.4);
}
.stint { flex: 1; position: relative; overflow: hidden; }
.stint::after {
  content: ""; position: absolute; inset: 0;
  background: var(--c);
  transform-origin: left; transform: scaleX(var(--p, 0));
}
.stint + .stint { margin-left: 2px; }

/* ============ Hero ============ */
.hero {
  position: relative; min-height: 100svh;
  display: grid; align-items: end;
  padding: 120px var(--gutter) clamp(40px, 8vh, 96px);
  overflow: hidden; isolation: isolate;
}
.hero__img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.12);
  filter: saturate(1.1) contrast(1.05);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, var(--tarmac) 2%, rgba(32,35,38,.55) 40%, rgba(32,35,38,.15) 70%, rgba(32,35,38,.6)),
    linear-gradient(to right, rgba(32,35,38,.75), transparent 60%);
}
body.is-go .hero__img { animation: launch 2.4s var(--ease-out) forwards; }
@keyframes launch {
  0% { transform: scale(1.12) translateX(0); filter: blur(6px) saturate(1.1); }
  100% { transform: scale(1.02) translateX(-1.5%); filter: blur(0) saturate(1.1) contrast(1.05); }
}
.hero__title {
  font-size: var(--step-5); margin: 0;
  max-width: 14ch;
}
.hero__title .line { display: block; overflow: hidden; padding-right: .12em; }
.hero__title .line > span { display: inline-block; transform: translateX(-110%); }
body.is-go .hero__title .line > span { animation: dash .9s var(--ease-out) forwards; }
body.is-go .hero__title .line:nth-child(2) > span { animation-delay: .12s; }
@keyframes dash { to { transform: translateX(0); } }
.hero__lede {
  max-width: 46ch; font-size: var(--step-1); color: var(--paint);
  margin: 1.5rem 0 0; opacity: 0;
}
body.is-go .hero__lede { animation: fade .8s .5s forwards; }
@keyframes fade { to { opacity: 1; } }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 2rem 3rem; margin-top: 2.5rem;
  opacity: 0;
}
body.is-go .hero__meta { animation: fade .8s .7s forwards; }
.hero__meta div { display: grid; }
.hero__meta strong { font-size: var(--step-3); font-weight: 900; font-style: italic; font-variation-settings: "wdth" 120; line-height: 1; }
.hero__meta span { color: var(--paint-dim); font-size: var(--step--1); }

@media (prefers-reduced-motion: reduce) {
  .hero__title .line > span { transform: none; }
  .hero__lede, .hero__meta { opacity: 1; }
  body.is-go .hero__img, body.is-go .hero__title .line > span,
  body.is-go .hero__lede, body.is-go .hero__meta { animation: none; }
}

/* ============ Sections shared ============ */
.section { padding: clamp(72px, 12vh, 140px) var(--gutter); position: relative; }
.section__head { max-width: 1400px; margin: 0 auto clamp(32px, 6vh, 64px); display: grid; gap: 1rem; }
.section__title { font-size: var(--step-4); margin: 0; }
.section__title::before {
  content: ""; display: block; width: 64px; height: 8px; margin-bottom: 1.25rem;
  background: var(--c); transform: skewX(-20deg);
}
.section__intro { max-width: var(--measure); color: var(--paint-dim); font-size: var(--step-1); margin: 0; line-height: 1.45; }
.wrap { max-width: 1400px; margin: 0 auto; }

/* ============ Eras: horizontal track ============ */
.eras { padding-inline: 0; }
.eras .section__head { padding-inline: var(--gutter); }
.track {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: min(86vw, 520px);
  gap: clamp(16px, 2vw, 28px);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 var(--gutter) 28px;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin; scrollbar-color: var(--kerb-line) transparent;
}
.era {
  scroll-snap-align: start;
  display: grid; grid-template-rows: auto 1fr;
  background: var(--tarmac-2);
  border-radius: 4px; overflow: hidden;
}
.era__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--tarmac-3); }
.era__media img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(var(--gs, 0)); }
.era__years {
  position: absolute; left: 14px; bottom: 6px;
  font-size: clamp(2.6rem, 6vw, 4.2rem); color: var(--paint);
  text-shadow: 0 2px 30px rgba(0,0,0,.6);
}
.era__body { padding: 22px 24px 28px; display: grid; gap: .75rem; align-content: start; }
.era__body h3 { margin: 0; font-size: var(--step-2); font-weight: 800; font-variation-settings: "wdth" 110; line-height: 1.1; }
.era__body p { margin: 0; color: var(--paint-dim); }
.era__facts { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; margin: .5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--kerb-line); }
.era__facts dt { font-size: var(--step--1); color: var(--paint-dim); }
.era__facts dd { margin: 0; font-weight: 700; }
.era__stat { grid-column: 1 / -1; }
.era__stat dd { font-size: var(--step-1); font-style: italic; font-weight: 800; color: var(--medium); }
.track-controls { display: flex; gap: .5rem; padding: 0 var(--gutter); max-width: 1400px; margin: 0 auto 1.25rem; justify-content: flex-end; }
.btn-round {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--kerb-line); background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.btn-round:hover { background: var(--paint); color: var(--ink); }
.btn-round svg { width: 20px; height: 20px; }

/* ============ Legends: timing tower ============ */
.legends__grid {
  display: grid; gap: clamp(24px, 4vw, 56px);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 900px) { .legends__grid { grid-template-columns: 1fr; } }
.tower { background: var(--ink); border-radius: 6px; overflow: hidden; }
.tower__sort { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; background: #16181b; }
.tower__sort button {
  flex: 1 1 0; min-width: 0; white-space: nowrap;
  background: transparent; border: 0; border-radius: 3px; padding: .55rem .75rem;
  cursor: pointer; font-weight: 700; color: var(--paint-dim);
}
.tower__sort button[aria-pressed="true"] { background: var(--paint); color: var(--ink); }
.tower__list { list-style: none; margin: 0; padding: 0; position: relative; }
.row {
  display: grid; grid-template-columns: 44px 6px 1fr auto; align-items: center; gap: 12px;
  height: 52px; padding-right: 16px;
  border-top: 1px solid #1d2023;
  transition: transform .5s var(--ease-out), background .2s;
  cursor: pointer; width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
}
.row:hover { background: #1a1d20; }
.row[aria-selected="true"] { background: #23272b; }
.row__pos { text-align: center; font-weight: 800; color: var(--paint-dim); }
.row__team { width: 6px; height: 28px; background: var(--team); transform: skewX(-12deg); }
.row__name { display: flex; gap: .75rem; align-items: baseline; min-width: 0; }
.row__code { font-weight: 900; font-variation-settings: "wdth" 115; letter-spacing: .02em; }
.row__full { color: var(--paint-dim); font-size: var(--step--1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__val { font-weight: 800; font-size: var(--step-1); }
.row__val small { font-weight: 500; color: var(--paint-dim); font-size: .75rem; margin-left: .35rem; }
.row[aria-selected="true"] .row__pos { color: var(--medium); }

.driver { position: sticky; top: 92px; display: grid; gap: 1.25rem; }
.driver__photo {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 4px; background: var(--tarmac-3);
}
.driver__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.driver__photo::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 45%;
  background: linear-gradient(to top, rgba(15,17,19,.95), transparent);
}
.driver__photo.is-empty {
  display: grid; place-items: center;
  background: repeating-linear-gradient(-20deg, var(--tarmac-3) 0 18px, var(--tarmac-2) 18px 36px);
}
.driver__code { font-size: clamp(6rem, 16vw, 11rem); color: var(--team); opacity: .9; margin-bottom: 18%; }
.driver__name {
  position: absolute; left: 20px; right: 20px; bottom: 16px; z-index: 1; margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}
.driver__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--kerb-line); border-radius: 4px; overflow: hidden; }
.driver__stats div { background: var(--tarmac-2); padding: 14px 12px; display: grid; }
.driver__stats strong { font-size: var(--step-2); font-weight: 900; font-style: italic; font-variation-settings: "wdth" 115; line-height: 1.1; }
.driver__stats span { font-size: var(--step--1); color: var(--paint-dim); }
.driver__bio { margin: 0; max-width: var(--measure); }
.driver__years { color: var(--paint-dim); margin: 0; font-size: var(--step--1); }
.driver.is-swapping .driver__photo img { animation: swap .5s var(--ease-out); }
@keyframes swap { from { opacity: 0; transform: translateX(24px) scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .driver.is-swapping .driver__photo img { animation: none; } .row { transition: none; } }

/* ============ Circuits ============ */
.circuits { background: var(--tarmac-2); }
.circuits__layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); }
@media (max-width: 900px) { .circuits__layout { grid-template-columns: 1fr; } }
.circuit-tabs { display: grid; gap: 2px; align-content: start; }
@media (max-width: 900px) {
  .circuit-tabs { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 8px; }
}
.circuit-tab {
  text-align: left; background: transparent; border: 0; border-left: 4px solid transparent;
  padding: .8rem 1rem; cursor: pointer; display: grid;
}
.circuit-tab strong { font-weight: 800; font-size: var(--step-1); font-variation-settings: "wdth" 108; }
.circuit-tab span { font-size: var(--step--1); color: var(--paint-dim); }
.circuit-tab:hover { background: var(--tarmac-3); }
.circuit-tab[aria-selected="true"] { border-color: var(--inter); background: var(--tarmac); }
.circuit-view { display: grid; gap: 1.5rem; }
.circuit-hero { position: relative; aspect-ratio: 16 / 8; border-radius: 4px; overflow: hidden; background: var(--tarmac-3); }
@media (max-width: 600px) { .circuit-hero { aspect-ratio: 4 / 3; } }
.circuit-hero > img { width: 100%; height: 100%; object-fit: cover; }
.circuit-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(15,17,19,.88), transparent 60%); }
.circuit-hero__name { position: absolute; left: 24px; bottom: 18px; right: 24px; z-index: 1; margin: 0; font-size: clamp(2rem, 5.5vw, 4.4rem); }
.circuit-map {
  position: absolute; right: 18px; top: 18px; z-index: 1; width: min(34%, 260px);
  background: rgba(15,17,19,.72); border-radius: 4px; padding: 12px; backdrop-filter: blur(6px);
}
.circuit-map img { width: 100%; filter: grayscale(1) invert(1) brightness(1.3) contrast(1.2); mix-blend-mode: screen; }
@media (max-width: 600px) { .circuit-map { display: none; } }
.circuit-data { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--kerb-line); border-radius: 4px; overflow: hidden; }
.circuit-data div { background: var(--tarmac); padding: 16px 18px; display: grid; gap: .15rem; }
.circuit-data strong { font-size: var(--step-2); font-weight: 900; font-style: italic; font-variation-settings: "wdth" 115; line-height: 1.1; }
.circuit-data span { font-size: var(--step--1); color: var(--paint-dim); }
.circuit-desc { margin: 0; max-width: var(--measure); font-size: var(--step-1); line-height: 1.45; }
.circuit-view.is-swapping .circuit-hero > img { animation: swap .6s var(--ease-out); }

/* ============ Car anatomy ============ */
.anatomy__layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
@media (max-width: 900px) { .anatomy__layout { grid-template-columns: 1fr; } }
.car { position: relative; width: 100%; }
.car svg { width: 100%; height: auto; display: block; }
.car .body { fill: #3e444a; stroke: #6c737a; stroke-width: 2; }
.car .tyre { fill: #0f1113; stroke: #4a5056; stroke-width: 2; }
.car .tyre-band { fill: none; stroke: var(--soft); stroke-width: 3; }
.car .accent { fill: var(--paint); opacity: .9; }
.car .halo { fill: none; stroke: var(--paint-dim); stroke-width: 6; stroke-linecap: round; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--paint); background: rgba(15,17,19,.7);
  display: grid; place-items: center; cursor: pointer; font-weight: 900; font-size: .9rem;
  transition: background .2s, color .2s, transform .2s var(--ease-out);
}
.hotspot:hover { transform: translate(-50%, -50%) scale(1.1); }
.hotspot[aria-pressed="true"] { background: var(--medium); border-color: var(--medium); color: var(--ink); }
.part { display: grid; gap: 1rem; min-height: 280px; align-content: start; }
.part__num { font-size: clamp(4rem, 10vw, 7.5rem); color: var(--medium); margin: 0; }
.part__name { font-size: var(--step-3); margin: 0; font-weight: 900; font-variation-settings: "wdth" 112; line-height: 1; }
.part__text { margin: 0; color: var(--paint-dim); font-size: var(--step-1); max-width: 48ch; line-height: 1.45; }
.part__unit { font-size: .35em; font-style: normal; font-weight: 700; color: var(--paint); margin-left: .25em; }
.part-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .5rem; }
.part-list button {
  border: 1px solid var(--kerb-line); background: transparent; border-radius: 999px; padding: .4rem .9rem; cursor: pointer; font-size: var(--step--1);
}
.part-list button[aria-pressed="true"] { background: var(--paint); color: var(--ink); border-color: var(--paint); }
.part.is-swapping .part__num { animation: dash-in .5s var(--ease-out); }
@keyframes dash-in { from { opacity: 0; transform: translateX(-30px) skewX(-10deg); } }

/* ============ 2026 ============ */
.season { background: var(--paint); color: var(--ink); }
.season .section__intro { color: #3c4146; }
.regs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2px; background: var(--ink); border: 2px solid var(--ink); margin-bottom: clamp(48px, 8vh, 88px); }
.reg { background: var(--paint); padding: 24px 22px 26px; display: grid; gap: .5rem; align-content: start; }
.reg strong { font-size: clamp(2.4rem, 4vw, 3.4rem); line-height: .95; white-space: nowrap; }
.reg h3 { margin: 0; font-size: var(--step-1); font-weight: 800; }
.reg p { margin: 0; color: #3c4146; font-size: var(--step--1); line-height: 1.5; }
.grid-title { font-size: var(--step-3); margin: 0 0 1.5rem; }
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.team {
  position: relative; background: #fff; padding: 18px 18px 16px 26px; border-radius: 3px;
  display: grid; gap: .35rem; overflow: hidden;
}
.team::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--team); }
.team h4 { margin: 0; font-size: var(--step-1); font-weight: 800; font-variation-settings: "wdth" 108; line-height: 1.15; }
.team__drivers { margin: 0; font-weight: 600; }
.team__pu { margin: 0; font-size: var(--step--1); color: #5a6066; }
.team__new { position: absolute; right: 12px; top: 12px; font-size: .75rem; font-weight: 800; background: var(--medium); padding: .1rem .5rem; border-radius: 2px; }
.standings { margin-top: clamp(48px, 8vh, 88px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .standings { grid-template-columns: 1fr; } }
.standings__note { margin: 0; color: #3c4146; max-width: var(--measure); }
.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bar { display: grid; grid-template-columns: 9ch 1fr 5ch; gap: 12px; align-items: center; font-weight: 700; }
.bar__track { height: 22px; background: #dcdcd6; position: relative; }
.bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--team, var(--ink)); width: var(--w); transform: skewX(-12deg); transform-origin: left; }
.bar__val { text-align: right; }

/* ============ Numbers ============ */
.numbers__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 56px); }
.fact { display: grid; gap: .5rem; align-content: start; border-top: 2px solid var(--kerb-line); padding-top: 1rem; }
.fact strong { font-size: clamp(2.8rem, 6vw, 4.6rem); color: var(--paint); line-height: .95; }
.fact strong small { font-size: .38em; font-style: normal; font-weight: 700; margin-left: .2em; color: var(--paint-dim); }
.fact p { margin: 0; color: var(--paint-dim); max-width: 40ch; }

/* ============ Footer ============ */
.foot { padding: 48px var(--gutter) 64px; border-top: 1px solid var(--kerb-line); color: var(--paint-dim); font-size: var(--step--1); }
.foot .wrap { display: grid; gap: 1rem; }
.foot p { margin: 0; max-width: 90ch; }
.foot details summary { cursor: pointer; color: var(--paint); font-weight: 600; }
.foot ul { columns: 2 320px; padding-left: 1rem; }
.foot li { break-inside: avoid; margin-bottom: .25rem; }
