@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #f4f5f7;
  --purple: #0e021c;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Anton", "Inter", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html.locked, html.locked body { overflow: hidden; height: 100%; }
body {
  background: #000; color: var(--ink);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
canvas { display: block; }

/* ---------------------------------------------------------------- nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 56px);
  pointer-events: none;
}
.nav a { pointer-events: auto; color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; letter-spacing: .42em; font-size: 13px; font-weight: 500; }
.brand-mark { width: 40px; height: 40px; filter: drop-shadow(0 1px 6px rgba(20, 30, 60, .35)); }
.nav nav { display: flex; gap: clamp(16px, 3vw, 40px); }
.nav nav a { font-size: 11px; letter-spacing: .24em; opacity: .85; transition: opacity .2s; }
.nav nav a:hover, .nav nav a:focus-visible { opacity: 1; }
.nav a:focus-visible { outline: 1px solid #fff; outline-offset: 6px; }
.nav { text-shadow: 0 1px 10px rgba(0,0,0,.22); }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 520px;
  overflow: hidden; background: #d3d5d8;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero canvas.clouds { z-index: 0; }
.hero canvas.streams.glow { z-index: 1; filter: blur(7px); }
.hero canvas.streams { z-index: 2; }
.hero canvas.car3d { z-index: 3; opacity: 0; transition: opacity 1.6s ease; }
.hero canvas.car3d.ready { opacity: 1; }
.hero canvas.dust { z-index: 6; pointer-events: none; }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; z-index: 4;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5) 20%, rgba(255,255,255,.5) 80%, transparent);
}

.title {
  position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; margin: 0;
  text-align: center;
  font-family: var(--display); font-weight: 400;
  font-size: 17vw; line-height: .79;
  color: #f7f7f8;
  text-shadow: 0 .02em .08em rgba(40,44,52,.2);
  transform: translateY(-120vh);
  pointer-events: none; will-change: transform;
}
.title.falling { animation: fall .72s cubic-bezier(.5,0,.95,.55) forwards; }
.title.landed { transform: translateY(0); animation: land .5s cubic-bezier(.2,.8,.3,1); transform-origin: 50% 100%; }
@keyframes fall { from { transform: translateY(-120vh); } to { transform: translateY(0); } }
@keyframes land {
  0%   { transform: scale(1.015, .955); }
  35%  { transform: translateY(-1.2vh) scale(.995, 1.01); }
  70%  { transform: translateY(0) scale(1.002, .997); }
  100% { transform: none; }
}
.hero.shake { animation: shake .42s linear; }
@keyframes shake {
  0%, 100% { transform: none; }
  15% { transform: translate(0, 5px); }
  35% { transform: translate(0, -3px); }
  55% { transform: translate(0, 2px); }
  75% { transform: translate(0, -1px); }
}

.scroll-cue {
  position: absolute; z-index: 7; left: 50%; bottom: 3.2vh; transform: translateX(-50%);
  background: none; border: 0; padding: 10px; cursor: pointer;
  animation: cue 2.4s ease-in-out infinite;
}
.scroll-cue svg { width: 26px; height: 16px; fill: none; stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 1px 4px rgba(0,0,0,.25)); }
.scroll-cue:focus-visible { outline: 1px solid #fff; border-radius: 4px; }
@keyframes cue { 0%, 100% { transform: translate(-50%, 0); opacity: .9; } 50% { transform: translate(-50%, 6px); opacity: .5; } }
html:not(.locked) .scroll-cue { opacity: 0; pointer-events: none; transition: opacity .6s; animation: none; }

/* ------------------------------------------------- zoom stage (2 and 3) */
.zoom-wrap { position: relative; height: 280vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #000; }
.stage > section { position: absolute; inset: 0; will-change: transform, opacity; backface-visibility: hidden; }
.flash {
  position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), rgba(255,255,255,.95) 0%, rgba(236,232,255,.6) 30%, rgba(236,232,255,0) 70%);
}

/* ---------------------------------------------------------------- engine */
.engine-sec {
  background: radial-gradient(circle at 100% 100%, #0e021c 0%, #0b0217 26%, #060110 50%, #020005 70%, #000 84%), #000;
}
.engine3d, .plume { position: absolute; inset: 0; width: 100%; height: 100%; }
.engine3d { z-index: 1; }
.plume { z-index: 2; pointer-events: none; }
.engine-copy {
  position: absolute; z-index: 3;
  left: 50%; top: clamp(92px, 13vh, 150px); transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px)); text-align: center;
  user-select: text; -webkit-user-select: text;
}
.engine-copy h2 {
  margin: 0 0 14px; font-weight: 600; letter-spacing: -.022em;
  font-size: clamp(26px, 3.2vw, 48px); line-height: 1.1; color: #fbfaff;
}
.lede { margin: 0; font-size: clamp(15px, 1.15vw, 17px); line-height: 1.6; color: #b7b0c6; }

/* ---------------------------------------------------------------- tunnel */
.tunnel-sec { background: #6e675d; opacity: 0; pointer-events: none; }
.tunnel { position: absolute; inset: 0; width: 100%; height: 100%; }
/* front half of the car: the rear is cut off by the left edge of the screen.
   Layers come from assets/f1/f1-body.png via the build script (front crop, warm tunnel grade, rim, gloss mask). */
.f1 {
  --w: min(66vw, 124vh);
  position: absolute; z-index: 2; left: 0;
  width: var(--w); aspect-ratio: 1132 / 434;
  bottom: calc(9% - var(--w) * .0247);          /* tyre contact patch (6.45% of the image height) sits on the road */
}
.f1-shake { position: absolute; inset: 0; animation: rumble .11s steps(2) infinite; }
@keyframes rumble { 50% { transform: translateY(.6px); } }
.f1-body { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
.f1-shadow {
  position: absolute; left: 0; right: 1%; bottom: 3.5%; height: 12%;
  background: radial-gradient(ellipse at 58% 50%, rgba(0,0,0,.8), rgba(0,0,0,.4) 45%, transparent 72%);
  filter: blur(7px);
}
/* the front wheel, drawn by a small shader: the whole wheel turns inside the tyre's fixed outline, lighting stays put */
.f1-wheel { position: absolute; left: 41.935%; top: 20.069%; width: 31.449%; height: 82.028%; pointer-events: none; }
/* tunnel ceiling lights sliding back over the glossy bodywork */
.f1-gloss {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  -webkit-mask: url(assets/f1/f1-gloss.png) 0 0 / 100% 100% no-repeat;
          mask: url(assets/f1/f1-gloss.png) 0 0 / 100% 100% no-repeat;
  background:
    linear-gradient(90deg, transparent 0 30%, rgba(255,222,176,.55) 40%, rgba(255,236,206,.85) 45%, rgba(255,222,176,.55) 50%, transparent 62% 100%) 0 0 / 46% 100% repeat-x,
    linear-gradient(90deg, transparent 0 46%, rgba(255,214,160,.3) 50%, transparent 54% 100%) 0 0 / 23% 100% repeat-x;
  animation: sweep .26s linear infinite;
}
@keyframes sweep { to { background-position: calc(var(--w) * -.46) 0, calc(var(--w) * -.23) 0; } }

.download {
  position: absolute; z-index: 3; right: clamp(16px, 6vw, 96px); bottom: 24%;
  display: flex; flex-direction: column; align-items: center;
}
.buttons { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.dl {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 26px; border-radius: 14px;
  color: #fff; text-decoration: none; font-size: 15px; font-weight: 500;
  background: rgba(28,26,24,.3);
  border: 1.5px solid rgba(255,255,255,.78);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.18);
  transition: background .2s, transform .2s, box-shadow .2s;
}
.dl svg { width: 22px; height: 22px; fill: currentColor; }
a.dl:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.25); }
a.dl:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.dl.disabled { color: rgba(255,255,255,.4); border-color: rgba(255,255,255,.22); background: rgba(28,26,24,.18); cursor: not-allowed; box-shadow: none; }
.dl-note { margin: 10px auto 0; max-width: 440px; text-align: center; font-size: 12px; line-height: 1.5; color: rgba(255,255,255,.75); text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.dl-label { margin: 20px 0 0; font-size: 11px; letter-spacing: .32em; color: rgba(255,255,255,.85); text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.credit { position: absolute; z-index: 3; right: clamp(16px, 4vw, 56px); bottom: 14px; margin: 0; font-size: 11px; color: rgba(255,255,255,.4); }
.credit a { color: inherit; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 820px) {
  .f1 { --w: 100vw; }
  .download { left: 16px; right: 16px; bottom: auto; top: 16vh; }
  .dl { padding: 12px 16px; font-size: 14px; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .nav nav a { letter-spacing: .16em; }
}

@media (prefers-reduced-motion: reduce) {
  .f1-shake, .f1-gloss, .scroll-cue { animation: none; }
}
