:root {
  --lime: #d2ff00;
  --dark: #282c20;
  --ink: #535450;      /* card text, as in the reference */
  --light: #f4f4ed;
  --paper: #fcfcfa;    /* what the WebGL background renders to (#F8F8F3 through sRGB twice) */
  --sans: "Mona Sans", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--dark);
  color: var(--dark);
  font-family: var(--sans);
  overflow: hidden;
}

/* ---------- WebGL ---------- */
canvas.gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  height: 100vh;
  pointer-events: none;
}
.hero a, .hero button, .side-card { pointer-events: auto; }

/* ---------- Nav (above the menu) ---------- */
.nav {
  position: fixed;
  inset: 17px 17px auto 17px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 6;
  pointer-events: none;
}
.nav a, .nav button { pointer-events: auto; }

.nav-wordmark {
  display: flex;
  flex-direction: column;
  height: 60px;
  color: var(--dark);
  text-decoration: none;
  line-height: 0.86;
  transition: color 0.4s ease;
}
.nav-wordmark-top { font-family: var(--serif); font-size: 36px; letter-spacing: -0.02em; }
.nav-wordmark-bottom { font-weight: 800; font-size: 31px; letter-spacing: -0.03em; }
.is-menu-open .nav-wordmark { color: var(--light); }

.nav-mark {
  position: absolute;
  left: calc(50% - 18.5px);
  top: 6px;
  width: 37px;
  height: 37px;
}
.nav-mark svg { width: 100%; height: 100%; fill: none; stroke: var(--dark); stroke-width: 9; stroke-linejoin: round; }

.nav-actions { display: flex; gap: 10px; }

.nav-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 118px;
  height: 60px;
  border-radius: 8px;
  background: var(--lime);
  color: var(--dark);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-cta svg { width: 20px; height: 20px; fill: none; stroke: var(--dark); stroke-width: 1.8; }

/* menu button: 60x60, 2px border; lime "liquid" fill on hover (see ui.js) */
.nav-menu {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 2px solid var(--dark);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.nav-menu:focus-visible { outline: 2px solid var(--dark); outline-offset: 3px; }
.nav-menu-fill {
  position: absolute;
  inset: -2px;
  background: var(--lime);
  clip-path: ellipse(90% 0% at 50% 0%);
}
/* click: the button goes dark, a light layer then the lime drop in from the top (ui.js) */
.nav-menu-dark { position: absolute; inset: -2px; background: var(--dark); opacity: 0; }
.nav-menu-light {
  position: absolute;
  inset: -2px;
  background: var(--light);
  clip-path: ellipse(90% 0% at 50% 0%);
}
/* the two lines, drawn as paths in button coordinates (0..60, border included) */
.nav-menu-icon {
  position: absolute;
  inset: -2px;
  width: 60px;
  height: 60px;
  overflow: visible;
}
.nav-menu-path {
  fill: none;
  stroke: var(--dark);
  stroke-width: 2;
  stroke-linecap: butt;
  stroke-linejoin: round;
}

/* ---------- Side card ("next race") ---------- */
.side-card {
  position: absolute;
  left: 17px;
  bottom: 17px;
  width: 99px;
  height: 203px;
  color: var(--ink);
  font-size: 8.33px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  text-align: center;
}
.side-card-outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
}
.side-card-label { position: absolute; left: 0; top: 0; }
.side-card-track { position: absolute; left: 13px; top: 24px; width: 73px; height: 63px; }
.side-card-title {
  position: absolute;
  left: 0; right: 0;
  top: 95px;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.side-card-rule { position: absolute; left: 10px; top: 109px; width: 79px; height: 1px; background: var(--ink); }
.side-card-badge { position: absolute; left: 9px; top: 122px; width: 81px; height: 43px; }
.side-card-foot {
  position: absolute;
  left: 0; right: 0;
  top: 173px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

/* text lines revealed by a lime block (ui.js) */
[data-anim-high] .line,
[data-nav-link-highlight] { position: relative; display: inline-block; }
.high-line-reveal {
  position: absolute;
  inset: 0;
  background: var(--lime);
  transform-origin: right center;
  z-index: 5;
}

/* badge: laurels + helmet, drawn by ui.js */
.badge { overflow: visible; }
.badge .leaf { fill: none; stroke: currentColor; stroke-width: 0.9; }
.badge .stem { fill: none; stroke: currentColor; stroke-width: 0.9; }
.badge .helmet { fill: none; stroke: currentColor; stroke-width: 0.9; }

/* ---------- Menu ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  background: var(--dark);
  color: var(--light);
  clip-path: ellipse(120% 0% at 50% 0%);
}
.menu-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.4;
}
.menu-images {
  position: absolute;
  left: 47px;
  top: 95px;
  display: flex;
  gap: 50px;
}
.menu-col { display: flex; flex-direction: column; gap: 50px; }
.menu-img { width: 306px; height: 333px; overflow: hidden; }
.menu-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.menu-right {
  position: absolute;
  left: 50%;
  right: 0;
  top: 0;
  bottom: 0;
}
.menu-links {
  position: absolute;
  left: 0; right: 0;
  top: 254px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.menu-link {
  position: relative;
  color: var(--light);
  text-decoration: none;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 68px;
  line-height: 66px;
  letter-spacing: -0.02em;
  font-variation-settings: "wdth" 85;
}
.menu-link.is-current { color: #8e9084; }
.menu-link-current {
  position: absolute;
  left: -4px;
  right: -4px;
  top: 22px;
  width: calc(100% + 8px);
  height: 30px;
  fill: none;
  stroke: var(--lime);
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.menu-link:not(.is-current):hover { color: var(--lime); }

.menu-badge {
  position: absolute;
  left: 0; right: 0;
  top: 548px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #a7a99c;
  font-size: 8.5px;
  font-weight: 700;
}
.menu-badge .badge { width: 81px; height: 43px; }

.menu-footer {
  position: absolute;
  left: 0; right: 0;
  top: 819px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.menu-footer a { color: var(--light); text-decoration: none; }
.menu-social { display: flex; gap: 25px; }

/* ---------- Loader + wipe ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  visibility: hidden; /* frame 0 shows the page before the loader paints */
  pointer-events: none;
}
.loader.is-on { visibility: visible; }
.loader.is-done { display: none; }
.loader-svg { width: 100%; height: 100%; display: block; }
.loader-bg { fill: var(--lime); }
.loader-mark path {
  fill: none;
  stroke: var(--dark);
  stroke-width: 9;
  stroke-linecap: butt;
  stroke-linejoin: round;
}
.loader-caption {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  fill: var(--dark);
}

@media (prefers-reduced-motion: reduce) {
  .loader { display: none; }
}
