/*
 * Squeeze headline: a poster for a six-night track race. Three lines, each set at its own size so
 * all three end on the same right edge (the sizes are measured for Anybody at wdth 115, wght 800;
 * relative to TURNS, LEFT is 1.529 and ONLY. is 1.25). Change the words and you re-measure.
 *
 * Order (one --stagger step is 80ms):
 *   0 to 1.6s    each line squeezes in from 150% width, letter by letter, on a spring.
 *                LEFT and ONLY. close from the right; TURNS closes from the left, like riders
 *                swapping on the banking
 *   0.2 to 1.8s  the track outline draws behind
 *   1.0 to 1.9s  the three lane lines (measure, sprinter, stayer) run out under the headline
 *   1.2 to 2.1s  date, venue, copy and buttons rise in
 *   after        scene.js swells the letters nearest the pointer (width and weight), while the
 *                rest of the line gives way, so each line keeps its length
 */
@font-face {
  font-family: "Host Grotesk";
  src: url("../../fonts/host-grotesk-vf.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #1b26c9; color: #e3e6ff; font: 400 16px/1.5 "Host Grotesk", system-ui, sans-serif; }
a { color: inherit; }
a:focus-visible, .marquee:focus-visible { outline: 2px solid #ffc3d5; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.poster {
  /* one size unit: the TURNS line. Bounded by the column width and by the frame height */
  --u: min(calc(58vw / 4.2), calc((100vh - 200px) / 3.05));
  --pad: clamp(20px, 3.4vw, 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  overflow: clip;
}

/* ---------- bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--pad) 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #ffc3d5; text-decoration: none;
  font: 900 21px/1 "Anybody", system-ui, sans-serif; font-stretch: 150%; text-transform: uppercase; }
.nav { display: flex; gap: clamp(12px, 2.4vw, 28px); }
.nav a { text-decoration: none; font-size: 17px; font-weight: 700; text-transform: uppercase; color: #fff; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: clamp(24px, 4vw, 64px);
  padding: 12px var(--pad) clamp(18px, 3.4vh, 32px);
}
.track { position: absolute; z-index: -1; right: -6%; top: 50%; width: min(70vw, 980px); translate: 0 -50%; color: rgb(255 255 255 / .16); }

.head { grid-row: 1; grid-column: 1; align-self: end; }
.type { width: max-content; margin: 0; color: #ffc3d5; font-family: "Anybody", system-ui, sans-serif; letter-spacing: -.01em; }
/* caps are .655em tall in Anybody; each line-height is .655 + .12 / size, so the gaps between lines match */
.ln { display: block; white-space: nowrap; }
.l1 { font-size: calc(var(--u) * 1.529); line-height: .733; }
.l2 { font-size: var(--u); line-height: .775; }
.l3 { font-size: calc(var(--u) * 1.25); line-height: .751; }
.ch { font-stretch: calc(var(--w, 115) * 1%); font-weight: var(--g, 800); }

.lines { grid-row: 2; grid-column: 1 / -1; display: grid; gap: 7px; margin: clamp(14px, 2.4vh, 24px) calc(var(--pad) * -1) 0 0; }
.lines i { display: block; height: 3px; transform-origin: 0 50%; }
.ln-measure { background: #fff; }
.ln-sprint { background: #ff4b3e; }
.ln-stayer { background: #7fdcff; }

.info { grid-row: 1; grid-column: 2; align-self: end; max-width: 380px; padding-bottom: 4px; }
:where(.info) p { margin: 0; }
.when { color: #ffc3d5; font: 800 clamp(22px, 2.6vw, 34px)/1 "Anybody", system-ui, sans-serif; font-stretch: 125%; }
.where { margin-top: 6px; color: #b9c0ff; font-weight: 600; }
.sub { margin-top: 14px; max-width: 36ch; text-wrap: pretty; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 20px; }
.cta {
  display: inline-block; padding: 13px 20px 12px; background: #ffc3d5; color: #141c9c; border-radius: 2px;
  font-weight: 700; text-decoration: none;
  box-shadow: 4px 4px 0 #0c1170;
  transition: translate var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
.cta:hover { translate: -2px -2px; box-shadow: 6px 6px 0 #0c1170; }
.cta:active { translate: 3px 3px; box-shadow: 1px 1px 0 #0c1170; }
.more { font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: #ff4b3e; }

/* ---------- band ---------- */
.band-wrap { position: relative; background: #ffc3d5; color: #141c9c; }
.band-list { display: flex; align-items: center; justify-content: space-around; gap: 30px; margin: 0; padding: 14px 24px; list-style: none; white-space: nowrap;
  font: 900 24px/1 "Anybody", system-ui, sans-serif; font-stretch: 150%; text-transform: uppercase; }
.band-list li:not(.sep) { transform: skewX(-12deg); }
.band-list .sep { display: flex; color: #ff4b3e; }
.lane { width: 30px; height: 18px; }
.band-pause { position: absolute; right: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 0 16px 0 44px;
  font-size: 13px; font-weight: 700; cursor: pointer; background: linear-gradient(90deg, rgb(255 195 213 / 0), #ffc3d5 36px); }
.band-pause input { accent-color: #141c9c; }

/* ---------- smaller frames ---------- */
@media (max-height: 560px) and (min-width: 721px) {
  .poster { --u: min(calc(58vw / 4.2), calc((100vh - 150px) / 3.05)); }
  .top { padding-top: 12px; }
  .where { display: none; }
  .sub { font-size: 14px; line-height: 1.4; }
  .band-list { padding-block: 10px; font-size: 19px; }
}
@media (max-width: 720px) {
  .poster { --u: calc((100vw - var(--pad) * 2) / 4.25); }
  .nav { display: none; }
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; align-content: center; padding-top: 32px; }
  .head { align-self: start; }
  .lines { grid-row: 2; }
  .info { grid-row: 3; grid-column: 1; margin-top: 28px; }
  .track { top: 22%; right: -30%; width: 120vw; }
}

/* ---------- choreography ---------- */
@keyframes sq-in { from { font-stretch: 150%; font-weight: 300; } }
@keyframes sq-lane { from { transform: scaleX(0); } }
/* backwards, not both: once the entrance ends the letter falls back to var(--w) and var(--g), which scene.js drives */
.js .ch { animation: sq-in calc(var(--dur-slow) * 1.2) var(--ease-spring) backwards; }
.js .l1 .ch:nth-child(4) { animation-delay: 0ms; }
.js .l1 .ch:nth-child(3) { animation-delay: calc(var(--stagger) * .5); }
.js .l1 .ch:nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.js .l1 .ch:nth-child(1) { animation-delay: calc(var(--stagger) * 1.5); }
.js .l2 .ch:nth-child(1) { animation-delay: calc(var(--stagger) * 3); }
.js .l2 .ch:nth-child(2) { animation-delay: calc(var(--stagger) * 3.5); }
.js .l2 .ch:nth-child(3) { animation-delay: calc(var(--stagger) * 4); }
.js .l2 .ch:nth-child(4) { animation-delay: calc(var(--stagger) * 4.5); }
.js .l2 .ch:nth-child(5) { animation-delay: calc(var(--stagger) * 5); }
.js .l3 .ch:nth-child(5) { animation-delay: calc(var(--stagger) * 6); }
.js .l3 .ch:nth-child(4) { animation-delay: calc(var(--stagger) * 6.5); }
.js .l3 .ch:nth-child(3) { animation-delay: calc(var(--stagger) * 7); }
.js .l3 .ch:nth-child(2) { animation-delay: calc(var(--stagger) * 7.5); }
.js .l3 .ch:nth-child(1) { animation-delay: calc(var(--stagger) * 8); }
/* LEFT and ONLY. close from the right edge; TURNS from the left */
.js .l1, .js .l3 { text-align: right; }

.js .go .track path { animation-delay: calc(var(--stagger) * 2); }
.js .go .track path:nth-of-type(2) { animation-delay: calc(var(--stagger) * 4); }

.js .lines i { transform: scaleX(0); }
.js .go .lines i { transform: none; animation: sq-lane var(--dur-slow) var(--ease-inout) both; animation-delay: calc(var(--stagger) * 12); }
.js .go .lines .ln-sprint { animation-delay: calc(var(--stagger) * 13); }
.js .go .lines .ln-stayer { animation-delay: calc(var(--stagger) * 14); }

.js .info > .rise-in:nth-child(1) { animation-delay: calc(var(--stagger) * 15); }
.js .info > .rise-in:nth-child(2) { animation-delay: calc(var(--stagger) * 16); }
.js .info > .rise-in:nth-child(3) { animation-delay: calc(var(--stagger) * 17); }
.js .info > .rise-in:nth-child(4) { animation-delay: calc(var(--stagger) * 18); }

@media (prefers-reduced-motion: reduce) {
  .js .ch { animation: none; }
  .js .lines i, .js .go .lines i { transform: none; animation: none; }
  .cta { transition: none; }
  /* the band stops and wraps (marquee pattern); smaller words and no separators keep it to a few lines */
  .band-list { justify-content: flex-start; gap: 6px 22px; font-size: 18px; }
  .band-list .sep { display: none; }
  .cta:hover, .cta:active { translate: none; box-shadow: 4px 4px 0 #0c1170; }
}
