/* The number that was the screen: a racing team's home page. While it loads, the white of the screen is the inside
   of a giant number; five lights come on, the count rolls up to the car's number, then the giant number shrinks
   into its place in the page and the page appears around it. */
:root {
  --night: #0d0f14;         /* the page under the loader */
  --paper: #f5f4f0;         /* the giant number and the text */
  --ink: #0d0f14;           /* the count and the lights before they come on */
  --accent: #ff4b1f;        /* the lights and the copy of the number that chases the white one */
  --muted: rgba(245, 244, 240, 0.62);
  --edge: clamp(18px, 3vw, 44px);
  --land-y: 50%;            /* where the number lands, from the top of the screen */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  background: var(--night);
  color: var(--paper);
  font-family: 'Barlow', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* while the loader runs, the page's own background is white too: on iPhones it shows under the toolbar */
html.is-loading,
html.is-loading body {
  background: var(--paper);
}

a,
button {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

/* the bar stays over the loader: in difference mode it is dark on the white and light on the night */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 36px);
  padding: 22px var(--edge);
  font-size: 14px;
  color: #fff;
  mix-blend-mode: difference;
}

.brand {
  margin-right: auto;
  font-family: 'Big Shoulders Display Variable', Impact, sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bar__nav {
  display: flex;
  gap: clamp(16px, 2.4vw, 32px);
}

.bar__nav a {
  transition: opacity 0.2s;
}

.replay {
  padding: 9px 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

@media (hover: hover) {
  .bar__nav a:hover,
  .replay:hover {
    opacity: 0.6;
  }
}

.bar a:focus-visible,
.replay:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- the page under the loader */
.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--night);
}

.lines {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 var(--edge);
  pointer-events: none;
}

.lines i {
  border-left: 1px solid rgba(245, 244, 240, 0.08);
  transform-origin: 50% 0;
}

.lines i:last-child {
  border-right: 1px solid rgba(245, 244, 240, 0.08);
}

.art {
  position: absolute;
  left: 35%;
  top: 47%;
  width: min(43vw, 68vh, 720px);
  translate: -50% -50%;
}

.art svg {
  will-change: transform, filter;
}

.art svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero__stats,
.hero__facts,
.hero__name,
.hero__next {
  position: absolute;
  z-index: 2;
}

.hero__stats {
  top: 22%;
  left: var(--edge);
  display: grid;
  gap: 18px;
}

.stat {
  margin: 0;
  display: grid;
}

.stat b {
  font-family: 'Big Shoulders Display Variable', Impact, sans-serif;
  font-size: clamp(30px, 2.8vw, 40px);
  font-weight: 800;
  line-height: 1;
}

.stat > span {
  font-size: 12px;
  color: var(--muted);
}

.hero__facts {
  top: 22%;
  right: var(--edge);
  display: grid;
  gap: 14px;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
}

.hero__facts p {
  margin: 0;
}

.hero__facts p > span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.hero__name {
  left: var(--edge);
  bottom: 6%;
  max-width: min(46vw, 560px);
}

.hero__name h1 {
  margin: 0;
  font-family: 'Big Shoulders Display Variable', Impact, sans-serif;
  font-size: clamp(64px, 10vw, 170px);
  font-weight: 900;
  line-height: 0.82;
  text-transform: uppercase;
}

.hero__name p {
  margin: 14px 0 0;
  max-width: 36ch;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.hero__next {
  right: var(--edge);
  bottom: 6%;
  text-align: right;
}

.hero__next p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.hero__next .countdown {
  margin-top: 6px;
  font-family: 'Big Shoulders Display Variable', Impact, sans-serif;
  font-size: clamp(38px, 4.6vw, 70px);
  font-weight: 800;
  line-height: 1;
  color: var(--paper);
}

/* ---------------------------------------------------------------- the rolling digits */
.roll {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  vertical-align: top;
}

.roll__strip {
  display: block;
}

.roll__strip span {
  display: block;
  height: 1em;
  line-height: 1;
}

[data-roll],
[data-count],
[data-countdown] {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
}

/* the words that rise from under a line */
.rise-mask {
  overflow: clip;
  overflow-clip-margin: 0.12em;
}

/* ---------------------------------------------------------------- the loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

/* until the giant number is drawn, a plain white sheet hides the page */
.loader:not(.is-ready) {
  background: var(--paper);
}

.loader:not(.is-ready) .count {
  visibility: hidden;
}

.giant {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.giant--white path {
  fill: var(--paper);
}

.giant--accent path {
  fill: var(--accent);
}

.count {
  position: absolute;
  left: 50%;
  top: var(--land-y);
  font-family: 'Big Shoulders Display Variable', Impact, sans-serif;
  font-size: clamp(120px, 15vw, 230px);
  font-weight: 900;
  color: var(--ink);
}

.lights {
  position: absolute;
  left: 50%;
  bottom: 3.75rem;
  translate: -50% 0;
  display: flex;
  gap: 3rem;
}

.lights i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--ink);
}

/* without the loader (reduced motion, or after it): the number simply sits in the page */
.is-still .loader .count,
.is-still .loader .lights,
.is-still .giant--accent {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --land-y: 36%;
  }

  .bar__nav {
    display: none;
  }

  .art {
    left: 50%;
    top: 37%;
    width: 112vw;
  }

  .hero__stats {
    top: 76px;
    display: flex;
    gap: 22px;
  }

  .stat b {
    font-size: 28px;
  }

  .hero__facts {
    display: none;
  }

  .hero__name {
    bottom: 128px;
    max-width: none;
    right: var(--edge);
  }

  .hero__name h1 {
    font-size: 23vw;
  }

  .hero__name p {
    font-size: 14px;
  }

  .hero__next {
    left: var(--edge);
    right: auto;
    bottom: 26px;
    text-align: left;
  }

  .count {
    font-size: 34vw;
  }

  .lights {
    gap: 2rem;
    bottom: 2.5rem;
  }
}
