/*
 * Site styles. Tokens live in tokens.css; the usage rules come from D-017.
 * Hand-written, no build step (D-010).
 */

/* ---------- Fonts: self-hosted, Latin subset (D-003, D-017, D-020) ---------- */
/* Archivo is instanced to the only axes the site uses: weight 700 to 800 at 87.5%
   width (D-043). Every Archivo heading renders at that width. */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-700-800-condensed.woff2") format("woff2");
  font-weight: 700 800;
  font-stretch: 87.5%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  /* Preloaded; optional means a late font never reflows the header or text (D-031). */
  font-display: optional;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg-0);
}

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img,
video,
svg {
  display: block;
  max-inline-size: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

/* Gold on cream is about 1.6:1, so the ring turns dark green there. */
.band--paper :focus-visible {
  outline-color: var(--paper-text);
}

main:focus {
  outline: none;
}

.container {
  inline-size: 100%;
  max-inline-size: 1280px;
  margin-inline: auto;
  padding-inline: var(--band-inline);
  /* viewport-fit=cover (D-055): stay clear of the notch on landscape iPhones. */
  padding-inline: max(var(--band-inline), env(safe-area-inset-left, 0px)) max(var(--band-inline), env(safe-area-inset-right, 0px));
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-block-start: var(--sp-2);
  inset-inline-start: var(--sp-2);
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--paper);
  color: var(--paper-text);
  font-weight: 600;
  border-radius: 6px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Quantities: tabular numerals, never wrapped, lowercase unit (D-017). */
.qty {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.unit {
  text-transform: none;
  font-size: 0.8em;
  letter-spacing: 0;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Type roles ---------- */
.eyebrow {
  margin-block-end: var(--sp-3);
  color: var(--gold);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  line-height: var(--lh-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.band__title,
.page-hero__title,
.hero__title {
  font-family: var(--font-display);
  font-stretch: 87.5%;
  text-transform: uppercase;
}

.band__title {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: var(--lh-h2);
  letter-spacing: 0.005em;
  text-wrap: balance;
}

.band__title--sm {
  font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.875rem);
}

/* H3: Archivo 700, sentence case (D-017). */
h3,
h4 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: var(--lh-h3);
}

.link-arrow {
  font-weight: 600;
  text-decoration: none;
}

.link-arrow::after {
  content: " →";
}

.link-arrow:hover {
  text-decoration: underline;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--sp-2);
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Buttons (D-017) ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--btn-height);
  padding: 0 var(--sp-5);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.2 var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px rgb(243 238 221 / 0.7);
}

.btn--ghost:hover {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--text);
}

/* 40px button with a 44px hit area. */
.btn--sm {
  min-block-size: var(--btn-height-sm);
  padding: 0 18px;
  font-size: 0.9375rem;
}

.btn--sm::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-block-start: var(--sp-6);
}

@media (max-width: 479px) {
  .cta-row .btn {
    inline-size: 100%;
  }
}

/* ---------- Header (D-031): sticky on every page, constant height ---------- */
:root {
  --header-h: 72px;
}

/* Anchors and focused elements stop below the sticky header. */
html {
  scroll-padding-block-start: calc(var(--header-h) + 1px);
}

/* The page behind the open mobile menu does not scroll. */
html:has(.site-nav:popover-open) {
  overflow: hidden;
}

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  background-color: var(--bg-0);
  border-block-end: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  block-size: var(--header-h);
}

/* Homepage: the header overlays the top of the video hero and turns solid as soon
   as the page scrolls. A scroll-driven animation does this without JS; browsers
   without animation-timeline keep the solid header. */
@supports (animation-timeline: scroll()) {
  .is-home .site-header {
    background-image: linear-gradient(rgb(10 28 19 / 0.55), rgb(10 28 19 / 0));
    animation: header-solid linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 120px;
  }

  .is-home .hero {
    margin-block-start: calc(-1 * var(--header-h) - 1px);
  }

  .is-home .hero__toggle {
    inset-block-start: calc(var(--header-h) + var(--sp-4));
  }
}

@keyframes header-solid {
  from {
    background-color: rgb(10 28 19 / 0);
    border-block-end-color: rgb(47 94 69 / 0);
  }

  to {
    background-color: var(--bg-0);
    border-block-end-color: var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-home .site-header {
    animation-timing-function: steps(1, end);
  }
}

/* Wider than "Register" in Inter or any fallback, so the font swap moves nothing. */
.site-header__actions .btn {
  min-inline-size: 7.25rem;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-inline-start: auto;
}

/* Official logo (D-049): the full lockup at every width, 48px tall from 768px,
   36px on phones and 32px below 360px. The ratio is the SVG's own viewBox, so the
   box is exact before the file loads and nothing shifts. */
.site-logo {
  display: block;
  flex-shrink: 0;
}

.site-logo img {
  inline-size: auto;
  block-size: 48px;
  aspect-ratio: 273.183 / 41.738;
}

/* Phones (D-050): Register leaves the bar and leads the menu panel instead. */
@media (max-width: 767px) {
  .site-logo img {
    block-size: 36px;
  }

  .site-header__register {
    display: none;
  }
}

@media (max-width: 359px) {
  .site-logo img {
    block-size: 32px;
  }
}

.site-nav__register {
  display: none;
}

@media (max-width: 767px) {
  .site-nav__register {
    display: flex;
    inline-size: 100%;
    margin-block: var(--sp-3) var(--sp-4);
  }
}
/* Nav: a native popover on small screens, an inline list from 960px (D-026). */
.site-nav__list {
  display: flex;
  flex-direction: column;
}

.site-nav__link {
  display: flex;
  align-items: center;
  min-block-size: 48px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-nav__link:hover,
.site-nav__link[aria-current] {
  color: var(--gold);
}

.menu-toggle {
  display: inline-grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.menu-toggle:hover {
  background: var(--bg-2);
}

@media (max-width: 959px) {
  .site-nav:popover-open {
    position: fixed;
    inset: calc(var(--header-h) + 1px) 0 auto;
    inline-size: 100%;
    /* Full height below the header, so the panel never stops short. */
    block-size: calc(100dvh - var(--header-h) - 1px);
    margin: 0;
    padding: var(--sp-3) var(--band-inline) var(--sp-6);
    padding-inline: max(var(--band-inline), env(safe-area-inset-left, 0px)) max(var(--band-inline), env(safe-area-inset-right, 0px));
    padding-block-end: max(var(--sp-6), env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    border: 0;
    border-block-end: 1px solid var(--border);
    background: var(--bg-0);
    color: var(--text);
  }

  /* The popover and its backdrop sit in the top layer, above any z-index, so the
     backdrop starts below the header instead: the header stays undimmed. */
  .site-nav::backdrop {
    inset: calc(var(--header-h) + 1px) 0 0;
    background: rgb(10 28 19 / 0.6);
  }

  .site-nav__list li + li {
    border-block-start: 1px solid var(--border);
  }

  .site-nav__link {
    min-block-size: 56px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
  }
}

@media (min-width: 960px) {
  .site-nav {
    position: static;
    display: block;
    inset: auto;
    inline-size: auto;
    block-size: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    color: inherit;
  }

  .site-nav__list {
    flex-direction: row;
    gap: clamp(var(--sp-4), 2vw, var(--sp-6));
  }

  .site-nav__link {
    position: relative;
    min-block-size: 44px;
    font-size: 0.9375rem;
  }

  .site-nav__link[aria-current]::after {
    content: "";
    position: absolute;
    inset: auto 0 6px;
    block-size: 2px;
    background: var(--gold);
  }

  .menu-toggle {
    display: none;
  }

  .site-header__actions {
    margin-inline-start: auto;
  }
}

/* Browsers without popover support get the plain list. */
@supports not selector(:popover-open) {
  .site-nav {
    display: block;
  }

  .menu-toggle {
    display: none;
  }

  /* The wrapped nav needs more than the fixed header height. */
  .site-header__inner {
    block-size: auto;
    min-block-size: var(--header-h);
  }

  @media (max-width: 959px) {
    .site-header__inner {
      flex-wrap: wrap;
    }

    .site-nav {
      order: 3;
      inline-size: 100%;
    }

    .site-nav__list {
      flex-flow: row wrap;
      column-gap: var(--sp-5);
    }
  }
}

/* ---------- Home hero (D-013, D-017, D-018) ---------- */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  /* The hero fills the first screen; the header overlays it, so nothing is
     subtracted (D-048). lvh, not svh: iOS 26 Safari draws the page behind its
     floating toolbar, so svh leaves the next band showing under the bar. lvh never
     changes while scrolling, so nothing jumps (D-055). */
  min-block-size: 100vh;
  min-block-size: 100lvh;
  overflow: hidden;
  background: var(--bg-0);
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero__poster,
.hero__video {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* hero.js marks a video that failed to load or play; the poster image shows instead. */
.hero__video.is-failed {
  visibility: hidden;
}

/* The overlay ends on bg-1, the colour of the next band, so there is no seam. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* The vertical fade is the top layer so its solid bg-1 end covers the side shade. */
  background:
    linear-gradient(180deg, rgb(10 28 19 / 0.35) 0%, rgb(10 28 19 / 0.2) 30%, rgb(16 40 27 / 0.8) 80%, var(--bg-1) 100%),
    linear-gradient(90deg, rgb(10 28 19 / 0.6) 0%, rgb(10 28 19 / 0) 60%);
}

/* The content ends above the browser toolbar (100lvh - 100svh) and the home
   indicator, so the headline and button are clear of them on load (D-055). */
.hero__content {
  padding-block: var(--sp-10) clamp(40px, 5vw, 72px);
  padding-block-end: calc(max(clamp(40px, 5vw, 72px), env(safe-area-inset-bottom, 0px)) + 100lvh - 100svh);
}

.hero + .band {
  padding-block-start: clamp(48px, 3rem + 2vw, 80px);
}

.hero__eyebrow {
  color: var(--text);
}

.hero__title {
  max-inline-size: 12ch;
  margin-block-end: var(--sp-4);
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: var(--lh-hero);
  letter-spacing: -0.005em;
}

.hero__lead {
  max-inline-size: var(--measure-hero);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.5;
}

.hero__note {
  max-inline-size: var(--measure-hero);
  margin-block-start: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-small);
}

.hero__toggle {
  position: absolute;
  inset-block-start: var(--sp-4);
  inset-inline-end: var(--band-inline);
  inset-inline-end: max(var(--band-inline), env(safe-area-inset-right, 0px));
  display: grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(10 28 19 / 0.65);
  box-shadow: inset 0 0 0 1.5px rgb(243 238 221 / 0.7);
  color: var(--text);
  cursor: pointer;
}

.hero__toggle::after {
  content: "";
  position: absolute;
  inset: -2px;
}

.hero__toggle:hover {
  box-shadow: inset 0 0 0 1.5px var(--text);
}

.hero__toggle[hidden] {
  display: none;
}

.hero__icon--play,
.hero__toggle.is-paused .hero__icon--pause {
  display: none;
}

.hero__toggle.is-paused .hero__icon--play {
  display: block;
}

/* Reduced motion: poster only (D-013). */
@media (prefers-reduced-motion: reduce) {
  .hero__video,
  .hero__toggle {
    display: none;
  }
}

/* ---------- Bands ---------- */
.band {
  padding-block: var(--band-block);
  background: var(--bg-1);
}

.band--rule {
  border-block-start: 1px solid var(--border);
}

.band__head {
  margin-block-end: var(--sp-6);
}

.band__more {
  margin-block-start: var(--sp-6);
}

.band__note {
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/* Cream "paper" band: at most twice per page (D-017). */
.band--paper {
  background: var(--paper);
  color: var(--paper-text);
}

.band--paper .eyebrow {
  color: var(--paper-gold);
}

.band--paper a {
  color: var(--paper-link);
}

.story__text {
  max-inline-size: var(--measure);
}

/* The story photo sits beside the text on wide screens (D-068; it replaces the
   decorative year of D-039). */
.story__photo {
  display: block;
  inline-size: 100%;
  block-size: auto;
  max-block-size: 70vh;
  margin-block-start: var(--sp-7);
  border-radius: var(--radius-card);
  object-fit: cover;
}

@media (min-width: 1024px) {
  .story {
    display: grid;
    grid-template-columns: 7fr 5fr;
    align-items: center;
    gap: var(--sp-7);
  }

  .story__photo {
    margin-block-start: 0;
    aspect-ratio: 4 / 5;
  }
}

.story__body {
  margin-block-start: var(--sp-4);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
}

.story__link {
  margin-block-start: var(--sp-6);
}

/* ---------- Race cards (D-017) ---------- */
.race-grid,
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--sp-5);
}

/* Two columns of three news cards would orphan the third. */
@media (min-width: 600px) and (max-width: 899px) {
  .news-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.race-card,
.news-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--card-pad);
  border: 1px solid var(--border-on-surface);
  border-radius: var(--radius-card);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.race-card:hover,
.news-card:hover {
  border-color: var(--muted-on-surface);
  background: color-mix(in oklab, var(--surface), white 4%);
  transform: translateY(-2px);
}

.race-card:has(:focus-visible),
.news-card:has(:focus-visible) {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.race-card a:focus-visible,
.news-card a:focus-visible {
  outline: none;
}

/* Gold only on the flagship card: a thin top rule and the code. */
.race-card--flagship {
  box-shadow: inset 0 2px 0 var(--gold);
}

.race-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  color: var(--muted-on-surface);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.race-card--flagship .race-card__top {
  color: var(--gold);
}

.race-card__distance {
  margin-block: var(--sp-3) var(--sp-2);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 1.6vw, 3.25rem);
  font-stretch: 87.5%;
  font-weight: 800;
  line-height: 1;
}

.race-card__name {
  margin-block-end: var(--sp-5);
  font-stretch: 87.5%;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.race-card__link,
.news-card__link {
  color: var(--text);
  text-decoration: none;
}

.race-card__link::after,
.news-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.race-card__stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: var(--sp-3);
  /* Auto top margin lines the stats up across a row whatever the name length. */
  margin-block: auto var(--sp-4);
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--border-on-surface);
}

.race-card__stats dt,
.stat-row dt {
  color: var(--muted-on-surface);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.race-card__stats dd {
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.race-card__start {
  color: var(--muted-on-surface);
  font-size: var(--fs-small);
}

.race-card__more {
  padding-block-start: var(--sp-4);
  font-size: var(--fs-small);
  font-weight: 600;
}

.race-card__more::after {
  content: " →";
}

.race-card--flagship .race-card__more {
  color: var(--gold);
}

/* ---------- Testimonials (D-029): a compact band, three quotes ---------- */
.band--compact {
  padding-block: clamp(40px, 2rem + 3vw, 80px);
}

.quotes {
  display: grid;
  gap: var(--sp-5) var(--sp-6);
}

@media (min-width: 900px) {
  .quotes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.quote {
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--border);
}

/* The opening mark hangs in the margin, so the text edge stays aligned. */
.quote__text p {
  font-size: var(--fs-h3);
  line-height: 1.4;
  text-indent: -0.45em;
}

@media (max-width: 899px) {
  .quote {
    max-inline-size: 60ch;
  }
}

/* A decorative opening mark; empty alt text hides it from screen readers. */
.quote__text p::before {
  content: "“" / "";
  margin-inline-end: 0.1em;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 800;
}

.quote__credit {
  margin-block-start: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}
/* ---------- News ---------- */
.news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-block-end: var(--sp-3);
  color: var(--muted-on-surface);
  font-size: var(--fs-small);
}

.news-card__title {
  text-wrap: balance;
}

/* A single post is a wider lead card rather than one column of three. */
.news-grid:has(> .news-card:only-child) {
  grid-template-columns: minmax(0, 46rem);
}

.news-grid:has(> .news-card:only-child) .news-card__title {
  font-size: var(--fs-h2);
}

.news-grid:has(> .news-card:only-child) .news-card__summary {
  max-inline-size: 60ch;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.news-card__source::before,
.page-hero__source::before {
  content: "·" / "";
  margin-inline-end: var(--sp-3);
}

.news-card__summary {
  margin-block-start: var(--sp-3);
  color: var(--muted-on-surface);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/* ---------- Partners ---------- */
.sponsor__name {
  margin-block-start: var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-stretch: 87.5%;
  font-weight: 700;
  line-height: 1.1;
}

/* Archivo has no Chinese, so name the system fonts and scale the characters,
   which fill the em box, down to the height of the English capitals. */
.sponsor__name :lang(zh-Hans) {
  margin-inline-start: 0.1em;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.sponsor__more {
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-5);
  color: var(--muted);
}

.partners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: var(--sp-3);
}

.partner {
  display: grid;
  place-content: center;
  gap: var(--sp-1);
  min-block-size: 104px;
  padding: var(--sp-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  text-align: center;
}

.partner__role {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Inner pages ---------- */
.page-hero {
  padding-block: clamp(48px, 3rem + 3vw, 104px);
  background: var(--bg-0);
}

/* The page head already ends in its own padding, so the first band needs less. */
.page-hero + .band,
.page-hero + .band--race-grid + .band {
  padding-block-start: var(--sp-7);
}

@media (min-width: 768px) {
  .page-hero + .band,
  .page-hero + .band--race-grid + .band {
    padding-block-start: var(--sp-8);
  }
}

.page-hero--stub {
  min-block-size: 50vh;
}

/* On /races the table turns into cards below 1024px, so the race cards would repeat it. */
@media (max-width: 1023px) {
  .band--race-grid {
    display: none;
  }
}

.link-back {
  margin-block-end: var(--sp-5);
  font-size: var(--fs-small);
  font-weight: 600;
}

.link-back a {
  text-decoration: none;
}

.link-back a::before {
  content: "← " / "";
}

.link-back a:hover {
  text-decoration: underline;
}

.page-hero__title {
  max-inline-size: 20ch;
  font-size: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.page-hero__title--article {
  max-inline-size: 28ch;
  text-wrap: balance;
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.1;
  text-transform: none;
}

.page-hero__lead {
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-4);
  color: var(--text);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
}

.page-hero__cta {
  margin-block-start: var(--sp-5);
}

.page-hero__note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-small);
}

.breadcrumb ol {
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block-end: var(--sp-5);
  font-size: var(--fs-small);
}

.breadcrumb li + li::before {
  content: "/";
  margin-inline-end: var(--sp-2);
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--gold);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: var(--sp-5);
  max-inline-size: 960px;
  margin-block-start: var(--sp-6);
  padding-block-start: var(--sp-5);
  border-block-start: 1px solid var(--border);
}

@media (min-width: 720px) {
  .stat-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.stat-row dt {
  color: var(--muted);
}

.stat-row dd {
  margin-block-start: var(--sp-1);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  font-stretch: 87.5%;
  font-weight: 700;
  line-height: 1.1;
}

.facts {
  display: grid;
  gap: var(--sp-8);
}

@media (min-width: 900px) {
  .facts {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-8) clamp(var(--sp-7), 5vw, var(--sp-9));
  }
}

.fact-list {
  margin-block-start: var(--sp-4);
}

.fact-list > div {
  display: grid;
  gap: var(--sp-1) var(--sp-5);
  padding-block: var(--sp-3);
  border-block-end: 1px solid var(--border);
}

@media (min-width: 480px) {
  .fact-list > div {
    grid-template-columns: 10rem 1fr;
  }

  .fact-list--wide > div {
    grid-template-columns: 15rem 1fr;
  }
}

.facts__intro {
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-4);
}

.fact-list dt {
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.7;
}

.contact-list {
  max-inline-size: 40rem;
  margin-block-start: 0;
}

.contact-list > div {
  align-items: baseline;
}

.contact-list a {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.contact-list__note {
  color: var(--muted);
  font-size: var(--fs-small);
}

ul.rule-list {
  display: grid;
  gap: var(--sp-3);
  margin-block-start: var(--sp-4);
  padding-inline-start: 1.25em;
  list-style: disc;
}

ul.rule-list li::marker {
  color: var(--gold);
}

.placeholder {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  inline-size: 100%;
  overflow: hidden;
  margin-block-start: var(--sp-4);
  padding: var(--sp-5);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-0);
  color: var(--muted);
  font-size: var(--fs-small);
  text-align: center;
}

/* Faint contour lines behind the note, a hint of the map to come. */
.placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.08;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160' viewBox='0 0 240 160' fill='none' stroke='%23d9b865' stroke-width='1.5'%3E%3Cpath d='M-10 120c40-30 70-10 100-30s50-60 90-50 50 30 70 20'/%3E%3Cpath d='M-10 140c45-25 80-5 110-25s55-55 95-45 40 25 55 18'/%3E%3Cpath d='M-10 100c35-35 60-15 90-35s45-65 85-55 55 35 85 22'/%3E%3Cpath d='M-10 160c50-20 90 0 120-20s60-50 100-40 30 20 40 15'/%3E%3Cpath d='M-10 80c30-40 55-20 80-40s40-70 80-60 60 40 100 25'/%3E%3C/svg%3E") 0 0 / 240px 160px repeat;
}

.placeholder--map {
  aspect-ratio: 21 / 9;
  max-block-size: 360px;
}

.placeholder--profile {
  block-size: 160px;
}

/* The section after the key facts: notes, map and profile. */
.band--course {
  padding-block-start: var(--sp-8);
}

/* ---------- Course map (D-058) ----------
 * MapLibre's own stylesheet loads after this one (course-map.js), so overrides
 * of its classes are scoped under .course-map to win on specificity. */
.course-map {
  position: relative;
  aspect-ratio: 1;
  /* Short enough that the profile below fits on the same screen (D-061), but
     never a letterbox: at least 400px tall. */
  max-block-size: clamp(400px, 100svh - var(--header-h) - 300px, 640px);
  inline-size: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-block-start: var(--sp-5);
  border-radius: var(--radius-card);
  background: #0f2218; /* the basemap's ground colour (tools/build-map.mjs) */
  font-family: var(--font-body);
}

@media (min-width: 768px) {
  .course-map {
    aspect-ratio: 16 / 9;
  }
}

.course-map__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: var(--sp-5);
  color: var(--muted);
  font-size: var(--fs-small);
  text-align: center;
}

.course-map__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: center;
  /* The profile's reserved readout line already spaces it from the profile. */
  margin-block-start: 0;
}

.course-map__download {
  gap: var(--sp-2);
  white-space: nowrap;
}

.course-map__size {
  color: var(--muted);
  font-size: var(--fs-small);
}

.course-map__source {
  flex: 1 1 30ch;
  max-inline-size: var(--measure);
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/* Map/Satellite and 3D buttons, top left. */
.course-map .course-map__views {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.course-map__toggle {
  display: inline-flex;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 1px var(--border), 0 2px 8px rgb(0 0 0 / 0.45);
  background: var(--bg-0);
}

.course-map__views button {
  min-block-size: var(--btn-height-sm);
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--bg-0);
  color: var(--text);
  font: 600 var(--fs-small)/1 var(--font-body);
  cursor: pointer;
}

.course-map .course-map__3d {
  box-shadow: 0 0 0 1px var(--border), 0 2px 8px rgb(0 0 0 / 0.45);
}

/* Scoped twice over to beat MapLibre's .maplibregl-ctrl button:not(:disabled):hover. */
.course-map .course-map__views button:not([aria-pressed="true"]):hover {
  background: var(--bg-2);
}

.course-map .course-map__views button[aria-pressed="true"],
.course-map .course-map__views button[aria-pressed="true"]:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.course-map .course-map__views button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.course-map__views button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* MapLibre's zoom, compass and full-screen buttons in the site palette. */
.course-map .maplibregl-ctrl-group {
  background: var(--bg-0);
  box-shadow: 0 0 0 1px var(--border), 0 2px 8px rgb(0 0 0 / 0.45);
}

.course-map .maplibregl-ctrl-group button {
  inline-size: var(--btn-height-sm);
  block-size: var(--btn-height-sm);
}

.course-map .maplibregl-ctrl-group button + button {
  border-top-color: var(--border);
}

.course-map .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1) sepia(0.2);
}

.course-map .maplibregl-ctrl-group button:not(:disabled):hover {
  background: var(--bg-2);
}

.course-map .maplibregl-ctrl button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.course-map .maplibregl-ctrl-scale {
  border-color: var(--muted);
  background: rgb(10 28 19 / 0.75);
  color: var(--text);
}

.course-map .maplibregl-ctrl.maplibregl-ctrl-attrib,
.course-map .maplibregl-ctrl-attrib.maplibregl-compact {
  background: rgb(10 28 19 / 0.85);
  color: var(--muted);
}

.course-map .maplibregl-ctrl-attrib a {
  color: var(--text);
}

.course-map .maplibregl-ctrl-attrib-button {
  filter: invert(1);
}

.course-map .maplibregl-cooperative-gesture-screen {
  background: rgb(10 28 19 / 0.8);
  color: var(--text);
  font-size: var(--fs-body);
}

.course-map__popup .maplibregl-popup-content {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-0);
  color: var(--text);
  font: var(--fs-small)/var(--lh-small) var(--font-body);
}

.course-map__popup-body {
  display: grid;
  gap: 2px;
}

.course-map__popup strong {
  padding-inline-end: var(--sp-6); /* clear of the close button; the rest uses the full width */
  color: var(--gold);
}

.course-map__popup-zh {
  color: var(--muted);
}

.course-map__popup-note {
  max-inline-size: none;
  margin-block-start: var(--sp-2);
  text-wrap: pretty;
}

.course-map__popup .maplibregl-popup-close-button {
  inline-size: 32px;
  block-size: 32px;
  color: var(--text);
  font-size: 1.25rem;
}

.course-map__popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.course-map__popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.course-map__popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--bg-0);
}

.course-map__popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.course-map__popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.course-map__popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--bg-0);
}

/* The point on the map that matches the cursor on the profile. */
.course-map__hover {
  inline-size: 16px;
  block-size: 16px;
  border: 3px solid var(--bg-0);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Elevation profile ---------- */
.profile {
  margin: var(--sp-3) 0 0;
}

.profile__svg {
  display: block;
  inline-size: 100%;
  block-size: clamp(140px, 22vw, 220px);
  overflow: visible;
  touch-action: pan-y;
  cursor: crosshair;
}

/* A fading orange fill; a flat tint over the green turns brown. */
.profile__area {
  fill: url(#profile-fill);
}

.profile__fill-top {
  stop-color: var(--accent);
  stop-opacity: 0.38;
}

.profile__fill-bottom {
  stop-color: var(--accent);
  stop-opacity: 0.04;
}

.profile__dot {
  fill: var(--text);
  stroke: var(--accent);
  stroke-width: 2;
  visibility: hidden;
}

.profile.is-active .profile__dot {
  visibility: visible;
}

.profile__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.profile__grid {
  stroke: var(--border);
  stroke-width: 1;
}

.profile__cp {
  stroke: var(--gold);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.6;
}

.profile__cursor {
  stroke: var(--text);
  stroke-width: 1.5;
  visibility: hidden;
}

.profile.is-active .profile__cursor {
  visibility: visible;
}

/* A halo in the band colour keeps the labels clear of the line and fill. */
.profile__label {
  fill: var(--muted);
  font: 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--bg-1);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* Short laptop screens: a shorter profile keeps it on screen with the map (D-061). */
@media (max-height: 760px) and (min-width: 768px) {
  .profile__svg {
    block-size: 160px;
  }
}

/* Every other distance label on narrow screens. */
@media (max-width: 599px) {
  .profile__label--alt {
    display: none;
  }
}

.profile__readout {
  min-block-size: 1.5em;
  margin-block-start: var(--sp-2);
  color: var(--text);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.profile__readout b {
  font-weight: 600;
}

/* Two lines on phones, reserved so the page doesn't jump. */
@media (max-width: 599px) {
  .profile__readout {
    min-block-size: 3em;
  }
}

.profile__readout[hidden] {
  display: block;
  visibility: hidden;
}

.other-races {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--sp-3);
  margin-block-start: var(--sp-5);
}

.other-races a {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  min-block-size: 56px;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.other-races a:hover {
  background: var(--bg-2);
}

.other-races__code {
  color: var(--gold);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.other-races .qty {
  margin-inline-start: auto;
  color: var(--muted);
}

/* Sub-sections inside one band, so short sections do not each get a full band. */
.band__section + .band__section {
  margin-block-start: var(--sp-8);
}

/* Comparison table (D-030): never scrolls sideways. A real table from 1024px;
   below that each row is a card with data-label captions. */
.race-table {
  inline-size: 100%;
  margin-block-start: var(--sp-5);
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.race-table tbody th a {
  color: var(--text);
  text-decoration: none;
}

.race-table tbody th a:hover .race-table__name {
  color: var(--gold);
}

.race-table__code {
  display: block;
  color: var(--gold);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.race-table__name {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.race-table__day,
.race-table__time {
  display: block;
  white-space: nowrap;
}

.race-table__time {
  color: var(--muted);
}

/* Shown only on the cards below 1024px, where the race cards above are hidden. */
.race-table__more {
  display: none;
}

@media (min-width: 1024px) {
  .race-table {
    border: 1px solid var(--border);
  }

  .race-table th,
  .race-table td {
    padding: var(--sp-3);
    border-block-end: 1px solid var(--border);
    text-align: start;
    vertical-align: top;
  }

  .race-table thead th {
    background: var(--bg-0);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .race-table tbody th {
    inline-size: 15rem;
  }

  .race-table .num {
    text-align: end;
    white-space: nowrap;
  }
}

@media (max-width: 1023px) {
  .race-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .race-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: var(--sp-4);
  }

  .race-table tr {
    display: block;
    padding: var(--sp-4) var(--card-pad) var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
  }

  .race-table th,
  .race-table td {
    display: block;
    text-align: start;
  }

  .race-table tbody th {
    padding-block-end: var(--sp-3);
    border-block-end: 1px solid var(--border);
  }

  .race-table__more {
    display: block;
    margin-block-start: var(--sp-2);
    color: var(--gold);
    font-size: var(--fs-small);
    font-weight: 600;
  }

  .race-table__more::after {
    content: " →";
  }

  .race-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-block: var(--sp-2);
  }

  .race-table td + td {
    border-block-start: 1px solid rgb(47 94 69 / 0.5);
  }

  .race-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--fs-small);
  }

  /* Day and time on one line inside a card. */
  .race-table td > .race-table__day,
  .race-table td > .race-table__time {
    display: inline;
  }

  .race-table td:has(.race-table__day) {
    flex-wrap: wrap;
  }

  .race-table td:has(.race-table__day) .race-table__day {
    margin-inline-start: auto;
  }
}
/* Travel: the tour name is set as an H3 (Archivo 700, sentence case), price below. */
.tour__title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: var(--lh-h3);
}

.tour__price {
  margin-block-start: var(--sp-2);
  color: var(--gold);
  font-size: var(--fs-small);
  font-weight: 600;
}

.tour__body {
  display: grid;
  gap: var(--sp-7);
  margin-block-start: var(--sp-6);
}

@media (min-width: 900px) {
  .tour__body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: clamp(var(--sp-7), 5vw, var(--sp-9));
  }
}

.tour__label {
  margin-block-end: var(--sp-4);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.tag-list li {
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
}

.day-list {
  display: grid;
  gap: var(--sp-5);
}

.day-list li {
  display: grid;
  gap: var(--sp-1);
  padding-inline-start: var(--sp-4);
  border-inline-start: 2px solid var(--border);
}

.day-list__day {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-list__title {
  font-size: 1.125rem;
}

.day-list__summary {
  max-inline-size: var(--measure);
  color: var(--muted);
}

.disclosure {
  margin-block-start: var(--sp-4);
  border-block-start: 1px solid var(--border);
}

.disclosure:first-of-type {
  margin-block-start: var(--sp-6);
}

.disclosure summary {
  display: flex;
  align-items: center;
  min-block-size: 48px;
  font-weight: 600;
  cursor: pointer;
}

.disclosure ul {
  display: grid;
  gap: var(--sp-2);
  padding-block-end: var(--sp-4);
  padding-inline-start: 1.25em;
  color: var(--muted);
  font-size: var(--fs-small);
}

/* Stub, 404 and register pages */
.band--stub {
  min-block-size: 50vh;
  padding-block: clamp(64px, 4rem + 4vw, 144px);
}

.stub__note {
  margin-block-start: var(--sp-4);
  color: var(--muted);
  font-size: 1.125rem;
}

.link-list {
  display: grid;
  gap: var(--sp-2);
  margin-block-start: var(--sp-6);
}

.band--stub .link-arrow {
  display: inline-block;
  margin-block-start: var(--sp-6);
}

.link-list .link-arrow {
  margin-block-start: 0;
}

/* Article body from Markdown */
.prose {
  max-inline-size: calc(68ch + 2 * var(--band-inline));
  margin-inline: 0 auto;
}

@media (min-width: 1280px) {
  .prose {
    margin-inline: auto;
    max-inline-size: 1280px;
  }

  .prose > * {
    max-inline-size: 68ch;
  }
}

.prose > * + * {
  margin-block-start: var(--sp-4);
}

.prose h2 {
  margin-block-start: var(--sp-7);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-stretch: 87.5%;
  font-weight: 800;
  line-height: var(--lh-h3);
  text-transform: uppercase;
}

.prose h2 + * {
  margin-block-start: var(--sp-4);
}

.venue__name {
  color: var(--gold);
  font-weight: 600;
}

.venue__note {
  color: var(--muted);
  font-size: var(--fs-small);
}

/* ---------- Videos ---------- */
.band__lead {
  max-inline-size: var(--measure);
  margin-block-start: var(--sp-3);
  color: var(--muted);
}

.video-grid {
  display: grid;
  gap: var(--sp-7) var(--sp-5);
  margin-block-start: var(--sp-5);
}

.video-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}

.video-grid--tall {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .video-grid--tall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.video__player {
  display: block;
  inline-size: 100%;
  block-size: auto;
  border-radius: var(--radius-card);
  background: var(--bg-0);
}

.video__title {
  margin-block-start: var(--sp-3);
  font-weight: 600;
}

.video__summary {
  margin-block-start: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.video__meta {
  margin-block-start: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/* A post that summarizes an article ends with one link to it: set it apart as
   the sign-off, and mark links that leave the site. */
.prose > p:last-child:has(> a:only-child[href^="https://"]) {
  margin-block-start: var(--sp-6);
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid var(--border);
}

.prose > p:last-child > a:only-child[href^="https://"] {
  font-weight: 600;
  text-decoration: none;
}

.prose > p:last-child > a:only-child[href^="https://"]:hover {
  text-decoration: underline;
}

.prose a[href^="https://"]::after {
  content: "\00a0↗" / "";
}

.prose code {
  font-size: 0.9em;
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: var(--sp-8) var(--sp-6);
  /* Clear of the home indicator at the end of the page (viewport-fit=cover, D-055). */
  padding-block-end: max(var(--sp-6), env(safe-area-inset-bottom, 0px));
  background: var(--bg-0);
  border-block-start: 1px solid var(--border);
  font-size: 0.9375rem;
}

.site-footer__top {
  display: grid;
  gap: var(--sp-7);
}

/* The brand (logo and dates) sits above the links at every width (D-051): a side
   column next to six link columns would squeeze the official logo below 48px. */
.footer-logo {
  display: block;
  max-inline-size: 366px;
}

/* Official logo (D-051): 56px tall (366px wide), where 安踏冠军 is 18px. On
   phones it narrows with the column, to 44px tall (14px characters) at 320. */
.footer-logo img {
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 273.183 / 41.738;
}

.site-footer__event {
  margin-block-start: var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-small);
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-6) var(--sp-5);
}

@media (min-width: 720px) {
  .footer-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .footer-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: var(--sp-5);
  }
}

.footer-nav__title {
  margin-block-end: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: var(--lh-small);
  text-transform: uppercase;
}

.footer-nav__title a {
  color: var(--gold);
  text-decoration: none;
}

.footer-nav__list a {
  display: inline-block;
  padding-block: var(--sp-1);
  color: var(--muted);
  text-decoration: none;
}

.footer-nav__list a:hover,
.footer-nav__title a:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-block-start: var(--sp-7);
  padding-block-start: var(--sp-5);
  border-block-start: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--fs-small);
}

.site-footer__legal a {
  color: var(--muted);
}

/* The organizer's photo and video notice (D-059), on its own line. */
.site-footer__rights {
  flex: 0 0 100%;
  order: 1;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .btn:hover,
  .race-card:hover,
  .news-card:hover {
    transform: none;
  }
}

/* A band that runs straight into the next one, without doubled padding (D-067). */
.band--lead-in {
  padding-block-end: 0;
}

.band--lead-in + .band {
  padding-block-start: var(--sp-8);
}

/* Long reading text: about 75 characters a line. */
.prose--long > p {
  max-inline-size: 60ch;
}

/* A small qualifier after a figure, e.g. "6 proposed". */
.qual {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-stretch: 100%;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

/* A heading that opens its band takes the band's padding, not extra margin. */
.prose > h2:first-child {
  margin-block-start: 0;
}

/* ---------- Photos (D-068) ---------- */
/* A race card's photo bleeds to the card's edges at the top. */
.race-card__photo {
  display: block;
  order: -1;
  inline-size: calc(100% + 2 * var(--card-pad));
  max-inline-size: none;
  block-size: auto;
  aspect-ratio: 3 / 2;
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) var(--card-pad);
  object-fit: cover;
}

.race-card--photo {
  overflow: clip;
}

/* The flagship's gold rule sits over its photo. */
.race-card--flagship.race-card--photo::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  block-size: 2px;
  background: var(--gold);
  pointer-events: none;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  padding: 0;
  list-style: none;
}

/* Two columns: the first photo spans both, so 33 photos leave no orphan. */
.gallery__item:first-child {
  grid-column: 1 / -1;
}

.gallery__item:first-child .gallery__photo {
  aspect-ratio: 3 / 2;
}

@media (min-width: 640px) {
  .gallery {
    gap: var(--sp-4);
  }
}

@media (min-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery__item:first-child {
    grid-column: auto;
  }

  .gallery__item:first-child .gallery__photo {
    aspect-ratio: 1;
  }
}

.gallery__link {
  display: block;
  border-radius: var(--radius-card);
  overflow: hidden;
}

@media (max-width: 639px) {
  .gallery__link {
    border-radius: 8px;
  }
}

.gallery__link:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

.gallery__photo {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery__link:hover .gallery__photo {
  transform: scale(1.02);
}

@media (prefers-reduced-motion: reduce) {
  .gallery__photo {
    transition: none;
  }

  .gallery__link:hover .gallery__photo {
    transform: none;
  }
}

/* Where a cropped photo centres vertically (data/photos.php `focus`; D-068). */
.photo--y20 { object-position: 50% 20%; }
.photo--y40 { object-position: 50% 40%; }
.photo--y60 { object-position: 50% 60%; }
.photo--y70 { object-position: 50% 70%; }
.photo--y85 { object-position: 50% 85%; }
