/* The top of the home, races and clubs pages: a two-line title over the racetrack.
   The sizes live only here, so the title and the track sit in the same spot on every page. */
.hero {
  --pad: clamp(44px, 8vw, 108px); --size: clamp(3.4rem, 8.2vw, 7.5rem); /* space above and below the title; the title's size */
  position: relative; overflow: hidden; padding: var(--pad) 0;
}
.lanes {
  position: absolute; pointer-events: none;
  width: max(1100px, 95vw); right: -22%; top: calc(var(--pad) + 0.86 * var(--size)); translate: 0 -50%; /* centered on the title */
}
.lanes > rect { fill: none; stroke: url(#lane-color); stroke-width: 2; stroke-opacity: 0.6; } /* peanut butter to jelly */
.field { fill: url(#field-color); }
#sandwich { fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pattern-sm { display: none; } /* phones get fewer, bigger sandwiches */
@media (min-width: 1400px) { .lanes { width: 1330px; right: auto; left: calc(50% - 322px); } }
.hero .hero-title { position: relative; font-size: var(--size); line-height: 0.86; }
.hero-title span { display: block; }
.hero-title .t2 { color: var(--pb); }
/* races and clubs: a purple second word, and the track runs on a little behind the page below, fading out */
.hero.is-jelly { --under: 24px; padding-bottom: calc(var(--pad) + var(--under)); margin-bottom: calc(-1 * var(--under)); }
.hero.is-jelly .t2 { color: var(--jelly); }
.hero.is-jelly .lanes {
  --end: calc(50% + var(--pad) + 0.86 * var(--size));
  mask-image: linear-gradient(#000 var(--end), transparent calc(var(--end) + var(--under)));
}

/* ── MOTION: the track draws itself and the infield fills in on every page; the title only rises on the first one you open ── */
@keyframes rise { from { opacity: 0; transform: translateY(0.35em); } to { opacity: 1; transform: none; } }
@keyframes fill-in { from { clip-path: inset(0 100% 0 0 round 150px); } to { clip-path: inset(0 0 0 0 round 150px); } } /* left to right */
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.hero.is-first .hero-title span { animation: rise 0.9s var(--ease-out) both; }
.hero.is-first .hero-title .t2 { animation-delay: 0.08s; }
.lanes > rect { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.2s calc(var(--i) * 80ms) var(--ease-out) forwards; }
.infield { animation: fill-in 1.5s 0.4s cubic-bezier(0.45, 0, 0.2, 1) backwards; }
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } } /* fade between pages instead of a blink */
@media (prefers-reduced-motion: reduce) { .lanes > rect { stroke-dashoffset: 0; } }

@media (max-width: 640px) {
  .hero { --size: clamp(2.25rem, 12.6vw, 4.2rem); }
  .hero .hero-title { font-stretch: 112%; }
  .hero.is-jelly { --under: 4px; } /* stops short of the next lane */
  /* the same track as on a computer, sized so both ends of the infield show */
  .lanes { --w: calc(2.96 * (2 * var(--pad) + 1.72 * var(--size))); width: var(--w); max-width: none; right: calc(6px - 0.2143 * var(--w)); }
  .lanes > rect { stroke-width: 3.5; }
  .pattern { display: none; }
  .pattern-sm { display: inline; }
  #sandwich { stroke-width: 0.9; }
}
