/* Count the steps: the same change of plan done two ways, side by side. On
   first view both columns play on one clock, a step at a time; the right
   column is done at three while the left keeps going to seven. The count is
   the memorable thing; everything else stays quiet. Without script or with
   reduced motion every step is shown at once. */
.race-section {
  width: min(100%, 1120px);
  margin-inline: auto;
  /* Opens the lower half: the story showed the tidy desk, this counts it. */
  padding-block: clamp(64px, 9vw, 128px) clamp(24px, 4vw, 48px);
}
.race-copy {
  max-width: 34rem;
  margin-bottom: clamp(28px, 4vw, 48px);
}
.race-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(34px, 4.8vw, 68px);
  font-weight: 550;
  line-height: 1;
  letter-spacing: -0.05em;
  text-wrap: balance;
}
.race-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
}
.race {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2vw, 24px);
  margin: 0;
}
.race-lane {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 2.6vw, 32px);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: rgb(27 23 19 / 62%);
}
/* The lane with the bots sits in the lamp's light. */
.race-lane--with {
  border-color: rgb(204 255 0 / 28%);
  background:
    radial-gradient(90% 70% at 100% 0%, rgb(255 176 104 / 9%), rgb(255 176 104 / 0%) 70%),
    rgb(30 26 20 / 72%);
}
.race-lane h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}
.race-lane--with h3 {
  color: var(--ink);
}
.race-lane h3 img {
  width: 28px;
  height: 28px;
}
.race-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.race-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: baseline;
  gap: 10px;
  padding-block: 9px;
  border-top: 1px solid var(--hairline);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}
.race-steps li::before {
  content: counter(step);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}
/* The change of plan is the same moment in both lanes. */
.race-steps li.is-change {
  color: var(--accent);
}
.race-lane--without .race-steps li.is-repeat {
  color: var(--ink-soft);
}
.race-count {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--edge);
}
.race-count strong {
  font-size: clamp(56px, 7vw, 96px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}
.race-lane--with .race-count strong {
  color: var(--accent);
}
.race-count span {
  max-width: 14rem;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
}
.race-note {
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
}

/* Playback: steps wait, then arrive one beat at a time. */
.race.is-armed .race-steps li,
.race.is-armed .race-count {
  opacity: 0;
  transform: translateY(8px);
}
.race.is-armed .race-steps li.is-in,
.race.is-armed .race-count.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 420ms var(--ease-out),
    transform 420ms var(--ease-out);
}
/* The left lane is still working when the right one is done: its count
   keeps ticking while the right count has landed. */
.race.is-armed .race-lane--with.is-done {
  box-shadow: inset 0 0 0 1px rgb(204 255 0 / 40%);
  transition: box-shadow 600ms var(--ease-out);
}

/* Phones keep the two lanes side by side, because the comparison is the
   difference in length; the lanes just get tighter. */
@media (max-width: 700px) {
  .race {
    gap: 8px;
  }
  .race-lane {
    padding: 14px 12px;
    border-radius: 18px;
  }
  .race-lane h3 {
    gap: 6px;
    margin-bottom: 10px;
    font-size: 13px;
  }
  .race-lane h3 img {
    width: 22px;
    height: 22px;
  }
  .race-steps li {
    grid-template-columns: 16px 1fr;
    gap: 6px;
    padding-block: 7px;
    font-size: 13px;
    line-height: 1.3;
  }
  .race-count {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
  }
  .race-count strong {
    font-size: 48px;
  }
  .race-count span {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .race.is-armed .race-steps li,
  .race.is-armed .race-count {
    opacity: 1;
    transform: none;
  }
}
