/* The scroll show (home page only). Three layers, in this order:
   1. the still page: complete and readable; the layout for phones, reduced motion and no JavaScript;
   2. CSS-only motion tied to the scroll, at any width, when motion is welcome;
   3. the performing layout under .show (flag.js: wide screen, motion welcome, scripts on).
   Smooth scrolling in CSS breaks ScrollTrigger's measuring, so it is forced off here. */
html { scroll-behavior: auto !important; }
.home main > section { position: relative; padding: clamp(4rem, 10vw, 8rem) var(--gut) clamp(4rem, 9vw, 7rem); }
.home main > section:focus { outline: none; }

/* ---------- the course line and the watch: decoration, hidden from assistive technology ---------- */
.course { display: none; }
.watch { display: none; }
.js .watch { display: flex; position: fixed; right: 0.5rem; bottom: 0.5rem; z-index: 30; align-items: baseline; gap: 0.25rem; margin: 0; padding: 0.25rem 0.55rem 0.3rem; background: var(--pine); color: var(--tyvek); border-radius: 3px; pointer-events: none; }
.watch__km { font-family: var(--display); font-weight: 800; font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; min-width: 2.7ch; text-align: right; }
.watch__unit { font-size: 0.75rem; color: #c9cec9; }
@media (min-width: 900px) {
  .home main > section { padding-left: calc(var(--gut) + 3.5rem); }
  .js .course { display: block; position: fixed; z-index: 30; left: calc(var(--gut) * 0.5 + 0.25rem); top: calc(var(--chrome) + 1.25rem); bottom: 1.75rem; width: 2.5rem; pointer-events: none; }
  .course__track { position: absolute; left: 0.45rem; top: 0; bottom: 0; width: 3px; background: rgba(128, 138, 132, 0.35); border-radius: 2px; overflow: hidden; }
  .course__fill { position: absolute; inset: 0; background: var(--bib); transform: scaleY(0); transform-origin: top center; will-change: transform; }
  .course__flags { position: absolute; inset: 0; list-style: none; margin: 0; padding: 0; }
  .course__flags li { position: absolute; left: 0; width: 1rem; height: 1rem; margin-top: -0.5rem; font: 800 0.8125rem/1 var(--display); color: #858d87; padding-left: 1.35rem; }
  .course__flags li::before { content: ''; position: absolute; left: 0.18rem; top: 0.18rem; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--tyvek); border: 2px solid #858d87; transition: background-color 200ms var(--out), border-color 200ms var(--out), transform 250ms var(--out); }
  .course__flags li.is-past { color: var(--bib); }
  .course__flags li.is-past::before { background: var(--bib); border-color: var(--bib); transform: scale(1.15); }
  .course__flags li:nth-child(1) { top: 0; } .course__flags li:nth-child(2) { top: 20%; } .course__flags li:nth-child(3) { top: 40%; }
  .course__flags li:nth-child(4) { top: 60%; } .course__flags li:nth-child(5) { top: 80%; } .course__flags li:nth-child(6) { top: 100%; }
  /* on a wide screen the watch sits in the middle of the chrome, where nothing else is */
  .js .watch { top: 0; bottom: auto; left: 50%; right: auto; z-index: 45; height: var(--chrome); transform: translateX(-50%); align-items: center; padding: 0; background: none; color: var(--pine); }
  .watch__km { font-size: 1.75rem; }
  .watch__unit { color: var(--graphite); font-size: 0.8125rem; }
}

/* ---------- 1. the still page ---------- */

/* the start */
.open { display: grid; gap: 2.5rem; min-height: calc(100svh - var(--chrome)); align-content: end; padding-top: 2.5rem !important; padding-bottom: 3rem !important; }
.open__h { font-size: clamp(4rem, 15vw, 9.25rem); line-height: 0.84; margin-bottom: 1.5rem; }
.line { display: block; overflow: hidden; padding-bottom: 0.04em; } /* the mask a line rises out of */
.line > span { display: block; }
.open__lead { font-size: clamp(1.125rem, 1.6vw, 1.3rem); line-height: 1.45; max-width: 44ch; }
.open__go a { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; font-weight: 600; }
.open__go a::before { content: ''; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--bib); }
.open__pic { max-width: 34rem; }
.chute__clip { overflow: hidden; border-radius: 2px; }
@media (min-width: 900px) {
  .open { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; gap: 3rem; }
  .open__pic { align-self: center; justify-self: end; width: 100%; }
}

/* the sentence */
.say { min-height: 80svh; display: grid; align-content: center; }
.say__text { font-weight: 600; font-size: clamp(1.75rem, 4.2vw, 3.75rem); line-height: 1.12; max-width: 24ch; margin: 0; letter-spacing: -0.01em; text-wrap: pretty; }
.say .w--red { color: var(--bib); }

/* race day: the night ground */
.side { background: var(--pine); color: var(--tyvek); --ink: var(--tyvek); --dim: #b9c0bb; --rule: rgba(241, 242, 236, 0.2); }
.side .km { color: var(--bib-lite); }
.side :focus-visible { outline-color: var(--bib-lite); }
.side__head { margin-bottom: 2.5rem; }
.side__row { list-style: none; margin: 0; padding: 0; display: grid; gap: 3rem; }
.item { max-width: 36rem; }
.item:nth-child(even) { justify-self: end; }
.item--small { max-width: 22rem; }
.item--tall, .item--hero { max-width: 26rem; }
@media (min-width: 900px) { .side__row { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; column-gap: 3rem; } .item:nth-child(even) { justify-self: start; margin-top: 6rem; } }

/* the coaches */
.coach { display: grid; gap: 3rem; }
.coach__lead { font-size: 1.25rem; line-height: 1.45; max-width: 46ch; }
.coach .staff { margin: 2rem 0 1rem; max-width: 44rem; }
@media (min-width: 1100px) { .coach { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } .coach__pic { position: sticky; top: calc(var(--chrome) + 2rem); } }

/* 185 */
.score { border-top: 1px solid var(--rule); }
.score__intro { max-width: 52ch; }
.score__board { margin-top: 2.5rem; max-width: 62rem; }
.score__total { display: flex; align-items: baseline; gap: 0.75rem; margin: 0 0 2rem; }
.score__sum { font-family: var(--display); font-weight: 800; font-size: clamp(6rem, 18vw, 13rem); line-height: 0.8; color: var(--bib); font-variant-numeric: tabular-nums; }
.score__of { font-weight: 600; }
.strip { position: relative; margin: 0 0 2.5rem; padding-top: 2.4rem; }
.strip__lane { position: relative; height: 3px; background: var(--pine); }
.strip__axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--dim); position: absolute; top: 5.2rem; left: 0; right: 0; }
.dot { position: absolute; top: -0.55rem; width: 1.15rem; height: 1.15rem; margin-left: -0.575rem; border-radius: 50%; background: var(--bib); border: 2px solid var(--tyvek); }
.dot::after { content: attr(data-place); position: absolute; bottom: 1.45rem; left: 50%; transform: translateX(-50%); font: 800 1.125rem/1 var(--display); color: var(--bib); }
.dot--push { background: var(--tyvek); border-color: var(--bib); }
.dot--push::after { color: var(--graphite); }
.dot[data-place="3"] { left: 2.02%; } .dot[data-place="22"] { left: 21.21%; } .dot[data-place="38"] { left: 37.37%; }
.dot[data-place="60"] { left: 59.6%; } .dot[data-place="62"] { left: 61.62%; } .dot[data-place="63"] { left: 62.63%; } .dot[data-place="99"] { left: 98.99%; }
.dot[data-place="60"]::after { transform: translateX(-100%); } .dot[data-place="62"]::after { transform: translateX(-10%); }
.dot--push::after { bottom: auto; top: 1.35rem; }
.steps { list-style: none; padding: 0; margin: 4.5rem 0 0; display: grid; gap: 0.5rem; max-width: 46rem; counter-reset: s; }
.step { display: grid; grid-template-columns: 4.5rem 1fr; align-items: baseline; padding: 0.6rem 0; border-top: 1px solid var(--rule); }
.step__n { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; color: var(--bib); }
.step--push .step__n { color: var(--graphite); }

/* four seasons */
.seasons { border-top: 1px solid var(--rule); }

/* off the clock: the team-green ground */
.clock { background: var(--forest); color: var(--tyvek); --ink: var(--tyvek); --dim: #c4d0c7; --rule: rgba(241, 242, 236, 0.22); }
.clock .km { color: #ffb3a8; }
.clock :focus-visible { outline-color: #ffb3a8; }
.clock__head { max-width: 46rem; margin-bottom: 3rem; }
.cols { display: grid; gap: 1.5rem; }
.col { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; align-content: start; }
@media (min-width: 640px) { .cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cols { grid-template-columns: repeat(3, 1fr); gap: 2rem; } .col--b { padding-top: 6rem; } .col--c { padding-top: 2.5rem; } }

/* since 1976 */
.since__lead { font-size: 1.25rem; line-height: 1.45; max-width: 52ch; }
.years { margin-top: 2.5rem; }
.years__row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.5rem; font-family: var(--display); font-weight: 800; font-size: clamp(3rem, 9vw, 7rem); line-height: 0.95; }
.years__row li:nth-child(odd) { color: var(--forest); }

/* the finish */
.finish { background: var(--pine); color: var(--tyvek); --ink: var(--tyvek); min-height: 80svh; display: grid; align-content: center; }
.finish :focus-visible { outline-color: var(--bib-lite); }
.finish__km { font-family: var(--display); font-weight: 800; color: var(--bib-lite); font-size: clamp(7rem, 24vw, 20rem); line-height: 0.8; margin: 0 0 1rem; font-variant-numeric: tabular-nums; }
.finish h2 { font-size: clamp(2.5rem, 6vw, 5rem); }

/* ---------- 2. CSS-only motion tied to the scroll ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
    .say .w { animation: ink linear both; animation-timeline: view(); animation-range: entry 20% cover 48%; }
    @keyframes ink { from { opacity: 0.18; } to { opacity: 1; } }
  }
}
.is-off * { animation-play-state: paused !important; }

/* ---------- 3. the performing layout ---------- */
/* Starting states that hide something are written under .js or .show only, never for a page without scripts. */
.show .open .line > span { transform: translateY(105%); }
.show .open .chute__clip { clip-path: inset(10% 14% 10% 14%); }
.show .open__lead, .show .open__go, .show .open figcaption, .show .open .kicker { opacity: 0; }
/* (the photo is not scaled as it opens: measured, its zoom ending cost one 370 to 470 ms frame; tools/hitch.mjs) */

/* race day travels sideways: the section is as tall as the row has to travel */
.show .side { height: max(100svh, calc(var(--travel, 0) * 1px)); padding: 0 !important; }
.show .side__pin { position: sticky; top: 0; height: 100svh; overflow: clip; padding: calc(var(--chrome) + 2rem) 0 2rem; display: grid; grid-template-rows: auto 1fr; }
.show .side__head { padding-left: calc(var(--gut) + 3.5rem); margin: 0; }
.show .side__row { display: flex; gap: 3.25rem; align-items: center; width: max-content; padding: 0 22vw 0 55vw; will-change: transform; }
.show .side__row a { text-decoration-skip-ink: none; }
.show .item { flex: none; max-width: none; justify-self: auto; }
.show .item img { width: auto; height: 46svh; }
.show .item--tall img { height: 56svh; }
.show .item--hero img { height: 62svh; }
.show .item--sq img { height: 40svh; }
.show .item--small { align-self: end; margin-bottom: 4svh; }
.show .item--small img { height: 31svh; }
.show .item--wide:nth-child(5) { align-self: start; }
.show .item figcaption { max-width: 34ch; }

/* 185 is pinned and built in stages */
.show .score { padding: 0 !important; border-top: 0; }
.show .score__pin { height: 100svh; padding: calc(var(--chrome) + 2.5rem) var(--gut) 2.5rem calc(var(--gut) + 3.5rem); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 4rem; align-items: center; }
.show .score__board { margin: 0; }
.show .steps { margin-top: 5.5rem; display: block; position: relative; min-height: 5.5rem; }
.show .step { position: absolute; inset: 0 0 auto 0; border: 0; opacity: 0; transform: translateY(0.75rem); transition: opacity 260ms var(--out), transform 320ms var(--out); }
.show .step.is-on { opacity: 1; transform: none; }
.show .dot { opacity: 0; transform: translateY(-1.5rem); transition: opacity 240ms var(--out), transform 380ms cubic-bezier(0.34, 1.4, 0.64, 1); }
.show .dot.is-in { opacity: 1; transform: none; }

/* off the clock: columns drift at different rates */
.show .col { will-change: transform; }

/* since 1976: the years run as one line, moved by the scroll */
.show .years { overflow: clip; margin-left: calc(-1 * (var(--gut) + 3.5rem)); margin-right: calc(-1 * var(--gut)); }
.show .years__row { flex-wrap: nowrap; width: max-content; font-size: clamp(6rem, 13vw, 12rem); padding-left: 8vw; will-change: transform; }

/* the finish */
.show .finish__km { transform-origin: left bottom; }
