/* ------------------------------------------------------------------
   Three scenes tell the story: sea → earth → energy.
   Each section's photograph sits at its foot and washes up to the text;
   the next section's colour picks up where the photograph fades out.
   ------------------------------------------------------------------ */
:root {
  --ink: #060d18;
  --sea: #0a1a33;
  --sea-light: #8fb3d6;
  --earth: #15110e;
  --clay: #c47a52;
  --bone: #e9dfcf;
  --energy: #0c1116;
  --amber: #d9a441;
  --text: #eef2f6;
  --muted: #a3afbd;
  --line: rgba(255, 255, 255, 0.1);
  --header-height: 4.5rem;
  --page-width: 72rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Space Mono", ui-monospace, Consolas, monospace;
  interpolate-size: allow-keywords;
}

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

html {
  background: var(--sea);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  min-width: 20rem;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent, var(--sea-light)); outline-offset: 4px; }

.skip-link {
  position: fixed; z-index: 100; top: 1rem; left: 1rem;
  padding: 0.75rem 1rem; border-radius: 0.4rem;
  background: var(--text); color: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

/* Draft-only helpers ------------------------------------------------ */
.placeholder {
  padding: 0.05em 0.3em; border-radius: 0.25em;
  background: rgba(255, 214, 102, 0.16); color: #ffd666;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.draft-banner {
  position: fixed; z-index: 60; bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem); overflow: hidden; text-overflow: ellipsis;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(255, 214, 102, 0.35); border-radius: 999px;
  background: rgba(6, 13, 24, 0.92); color: var(--muted);
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.04em; white-space: nowrap;
  backdrop-filter: blur(10px);
}
.draft-tag {
  position: absolute; z-index: 2; right: var(--gutter); bottom: 1.5rem;
  padding: 0.3rem 0.6rem; border-radius: 999px;
  background: rgba(255, 214, 102, 0.9); color: #1d1606;
  font-family: var(--mono); font-size: 0.5625rem; letter-spacing: 0.06em; text-transform: uppercase;
}

/* Header ------------------------------------------------------------- */
.site-header {
  position: fixed; z-index: 50; inset: 0 0 auto;
  border-bottom: 1px solid transparent;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.site-header.is-scrolled, .site-header.is-open {
  border-color: var(--line);
  background: rgba(6, 13, 24, 0.82);
  backdrop-filter: blur(16px);
}
.site-header__inner {
  position: relative; display: flex;
  width: min(100% - 2 * var(--gutter), var(--page-width)); min-height: var(--header-height);
  margin-inline: auto; align-items: center; justify-content: space-between;
}
.wordmark-title { position: relative; z-index: 2; margin: 0; font: inherit; }
.wordmark {
  text-decoration: none; text-transform: uppercase;
  font-family: var(--mono); font-size: 0.8125rem; font-weight: 400; letter-spacing: 0.18em;
}
.wordmark span { color: var(--muted); }

.menu-toggle {
  position: relative; z-index: 2; display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--text); cursor: pointer;
}
.menu-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.menu-toggle__mark, .menu-toggle__mark::before, .menu-toggle__mark::after {
  display: block; width: 1.1rem; height: 1px; background: currentColor; transition: transform 180ms ease;
}
.menu-toggle__mark::before, .menu-toggle__mark::after { content: ""; }
.menu-toggle__mark::before { transform: translateY(-0.33rem); }
.menu-toggle__mark::after { transform: translateY(0.28rem); }
.menu-toggle[aria-expanded="true"] .menu-toggle__mark { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__mark::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__mark::after { transform: translateY(-1px) rotate(-45deg); }

.site-nav {
  position: absolute; top: 0; right: calc(-1 * var(--gutter)); left: calc(-1 * var(--gutter));
  display: grid; padding: calc(var(--header-height) + 1rem) var(--gutter) 2rem;
  transform: translateY(-115%); visibility: hidden;
  background: rgba(6, 13, 24, 0.98);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), visibility 260ms;
}
.site-nav.is-open { transform: none; visibility: visible; }
.site-nav a {
  display: flex; min-height: 3.25rem; align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-size: 0.9375rem;
}
.site-nav a:hover, .site-nav a[aria-current="true"] { color: var(--text); }

/* Chapters ------------------------------------------------------------ */
.chapter {
  --accent: var(--sea-light);
  --chapter-bg: var(--ink);
  --next-bg: var(--ink);
  position: relative; isolation: isolate;
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  background: var(--chapter-bg);
}
.chapter--sea    { --accent: var(--sea-light); --chapter-bg: var(--sea);    --next-bg: var(--earth); }
.chapter--earth  { --accent: var(--clay);      --chapter-bg: var(--earth);  --next-bg: var(--energy); }
.chapter--energy { --accent: var(--amber);     --chapter-bg: var(--energy); --next-bg: var(--ink); }
.chapter--plain  { --accent: var(--sea-light); --chapter-bg: var(--ink); }

.chapter__inner {
  display: grid; width: min(100% - 2 * var(--gutter), var(--page-width)); margin-inline: auto;
  gap: clamp(2.5rem, 6vw, 5rem); align-items: start;
}
.chapter__copy, .chapter__visual { min-width: 0; }
.chapter__copy { max-width: 38rem; }

.chapter__index {
  margin: 0; color: var(--accent);
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.chapter__headline {
  margin: 0.75rem 0 0;
  font-family: var(--serif); font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 300; letter-spacing: -0.015em; line-height: 1.02;
}
.chapter__quote { margin: 1.25rem 0 0; color: #dbe1e8; font-size: clamp(1.0625rem, 1.45vw, 1.1875rem); }

/* Lede and full story read as one continuous text */
.chapter__lede, .chapter__prose {
  color: #dbe1e8; font-size: clamp(1.0625rem, 1.45vw, 1.1875rem); line-height: 1.72;
}
.chapter__lede { margin-top: 1.25rem; }
.chapter__lede p, .chapter__prose p { margin: 0; }
.chapter__lede p + p, .chapter__prose p + p, .chapter__prose h3 + p { margin-top: 1.05em; }
.chapter__prose { padding-top: 1.05em; }
.chapter__prose h3 {
  margin: 1.6em 0 0.5em;
  font-family: var(--serif); font-size: 1.375rem; font-weight: 400; color: var(--text);
}

/* "Continue reading": quiet, one way */
.chapter__more { margin-top: 0.9rem; }
.chapter__more summary {
  display: inline-flex; min-height: 2.75rem; align-items: center; gap: 0.45rem;
  color: var(--muted); cursor: pointer; list-style: none;
  font-size: 0.875rem; font-weight: 400;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent), transparent 55%);
  text-underline-offset: 0.35em; text-decoration-thickness: 1px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}
.chapter__more summary::after { content: "↓"; color: var(--accent); text-decoration: none; }
.chapter__more summary::-webkit-details-marker { display: none; }
.chapter__more summary:hover { color: var(--text); text-decoration-color: var(--accent); }
.chapter__more[open] { margin-top: 0; }
.chapter__more[open] summary { display: none; }
.chapter__more::details-content {
  block-size: 0; overflow: clip;
  transition: block-size 520ms cubic-bezier(0.16, 1, 0.3, 1), content-visibility 520ms allow-discrete;
}
.chapter__more[open]::details-content { block-size: auto; }

/* Outbound-link arrow (drawn, so every device renders it the same) */
.arrow-out { display: inline-block; width: 0.7em; height: 0.7em; vertical-align: -0.02em; }
.inline-link { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent), transparent 40%); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.inline-link:hover { text-decoration-color: var(--accent); }

/* Footnotes and sources */
.footnote { font-size: 0.65em; line-height: 0; margin-left: 0.1em; }
.footnote a { color: var(--accent); text-decoration: none; padding: 0 0.1em; }
.footnote a:hover { text-decoration: underline; }
.chapter__sources {
  margin: 1.75rem 0 0; padding: 1rem 0 0 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8125rem; line-height: 1.6;
}
.chapter__sources li { padding-left: 0.25rem; scroll-margin-top: calc(var(--header-height) + 1rem); }
.chapter__sources li::marker { color: var(--accent); font-family: var(--mono); font-size: 0.75rem; }
.chapter__sources a { color: var(--muted); text-decoration: none; }
.chapter__sources a:hover { color: var(--text); }
.chapter__sources a span { color: var(--accent); margin-left: 0.2rem; }
.chapter__sources li:target a { color: var(--text); }

/* Links */
.chapter__actions { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 1rem; }
.chapter__cta {
  display: inline-block; padding: 0.6rem 0; line-height: 1.5;
  color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 400;
}
.chapter__cta .nowrap { white-space: nowrap; }
.chapter__cta-arrow { margin-left: 0.35rem; color: var(--accent); }
.chapter__cta:hover { color: var(--text); }
.chapter__cta--pending { color: var(--muted); }

/* Scenes: photograph at the foot of the section, washing up to the text.
   --edge is how far above the section's bottom the text ends: the photo's edge plus breathing room. */
.chapter--scene { padding-bottom: var(--edge); }
.chapter--sea    { --scene-h: 75vw;   --edge: 15rem; }
.chapter--earth  { --scene-h: 66.7vw; --edge: 16rem; }
.chapter--energy { --scene-h: 56.25vw; --edge: 24rem; }
.chapter--earth, .chapter--energy, .chapter--plain { padding-top: clamp(4.5rem, 8vw, 7rem); }
.chapter--hero { padding-top: calc(var(--header-height) + clamp(3.5rem, 8vw, 6.5rem)); }
.chapter__scene {
  position: absolute; z-index: -1; inset: 0;
  overflow: hidden; pointer-events: none;
}
.chapter__scene img {
  position: absolute; bottom: 0; left: 0;
  width: 100%; height: max(34rem, var(--scene-h, 75vw)); max-height: 100%;
  object-fit: cover; object-position: var(--scene-position, 50% 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
  transform-origin: 50% 100%;
}
.chapter--sea .chapter__scene img { animation: swell 22s ease-in-out infinite alternate; }
.chapter--scene .chapter__copy { text-shadow: 0 1px 18px rgba(0, 0, 0, 0.45); }
@keyframes swell {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.04); }
}

/* Bio: a quiet, centred closing note ------------------------------------ */
.chapter--plain { padding-bottom: clamp(4.5rem, 8vw, 7rem); }
.chapter--plain .chapter__inner { justify-items: center; text-align: center; }
.chapter--plain .chapter__copy { max-width: 34rem; }
.chapter--plain .chapter__headline { font-size: clamp(2rem, 4.5vw, 2.75rem); }
.chapter--plain .chapter__lede { color: var(--muted); }
.chapter--plain .chapter__actions { justify-content: center; }
.chapter__portrait {
  width: 5rem; height: 5rem; margin: 0 auto 1.5rem;
  border-radius: 50%; object-fit: cover;
  filter: grayscale(1) contrast(1.04);
}
.chapter__roles {
  margin: 1.25rem 0 0; color: var(--text);
  font-size: 0.875rem; line-height: 1.8;
}
.chapter__roles span { color: var(--accent); }
.chapter__education { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8125rem; }

/* Races page ------------------------------------------------------------ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.races { padding-top: calc(var(--header-height) + clamp(3rem, 7vw, 5.5rem)); }
.races .chapter__scene img { animation: none; }
.races__inner { width: 100%; max-width: 44rem; }
.races__back {
  display: inline-flex; min-height: 2.75rem; align-items: center; gap: 0.4rem;
  color: var(--muted); text-decoration: none; font-size: 0.875rem;
}
.races__back span { color: var(--accent); }
.races__back:hover { color: var(--text); }
.races .chapter__headline { margin-top: 0.5rem; font-size: clamp(2.25rem, 5vw, 3.25rem); }
.races__group { margin-top: clamp(2.5rem, 6vw, 3.5rem); }
.races__group h2 {
  margin: 0 0 0.5rem; color: var(--accent);
  font-family: var(--mono); font-size: 0.6875rem; font-weight: 400;
  letter-spacing: 0.2em; text-transform: uppercase;
}
.races__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.race {
  display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--line);
}
.race__event { grid-column: 1 / -1; color: var(--text); font-size: 1rem; }
.race__distance { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.race__results { display: grid; gap: 0.2rem; justify-items: end; }
.race__result { display: inline-flex; gap: 0.9rem; align-items: baseline; font-size: 0.875rem; }
.race__result a, .race__year {
  display: inline-flex; gap: 0.2rem; color: var(--muted); text-decoration: none;
}
.race__result a span { color: var(--accent); }
.race__result a:hover { color: var(--text); }
.race__time {
  min-width: 4.25rem; text-align: right; color: var(--text);
  font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums;
}
.race__podium {
  display: inline-block; width: 0.4rem; height: 0.4rem; margin-left: 0.35rem;
  border-radius: 50%; background: var(--amber); vertical-align: 0.2em; opacity: 0.85;
}
.race__club {
  display: inline-block; margin-left: 0.45rem; padding: 0.05rem 0.4rem;
  border: 1px solid color-mix(in srgb, var(--sea-light), transparent 65%); border-radius: 999px;
  color: var(--sea-light); text-decoration: none;
  font-family: var(--mono); font-size: 0.5625rem; letter-spacing: 0.1em; vertical-align: 0.2em;
}
.race__club:hover { border-color: var(--sea-light); }
.races__legend {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem;
  margin: 1.25rem 0 0; color: var(--muted); font-size: 0.75rem;
}
.races__legend .race__podium, .races__legend .race__club { margin: 0 0.3rem 0 0; }
.races__legend a:not(.race__club) { color: var(--muted); text-decoration: none; }
.races__legend a:not(.race__club) span { color: var(--accent); }

@media (min-width: 44rem) {
  .race { grid-template-columns: 1fr 4.5rem 10rem; align-items: baseline; }
  .race__event { grid-column: auto; }
}

/* Footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: #04080f; }
.site-footer__inner {
  display: flex; flex-direction: column; gap: 0.5rem;
  width: min(100% - 2 * var(--gutter), var(--page-width)); margin-inline: auto; padding: 2rem 0 4.5rem;
  color: var(--muted); font-size: 0.8125rem;
}
.site-footer p { margin: 0; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-footer a { display: inline-flex; min-height: 2.75rem; align-items: center; text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* Reveal -------------------------------------------------------------- */
.js .reveal { transition: opacity 700ms ease, transform 700ms cubic-bezier(0.16, 1, 0.3, 1); }
.js .reveal:not(.is-visible) { opacity: 0; transform: translateY(1rem); }

/* Larger screens ------------------------------------------------------ */
@media (min-width: 44rem) {
  .chapter--sea    { --edge: calc(25vw + 5rem); }
  .chapter--earth  { --edge: calc(23vw + 5rem); }
  .chapter--energy { --edge: max(24rem, calc(35vw + 3rem)); }
  .record > div { grid-template-columns: 7rem 1fr; gap: 1rem; }
  .site-footer__inner { flex-direction: row; align-items: center; justify-content: space-between; padding-bottom: 2rem; }
}

@media (min-width: 64rem) {
  :root { --header-height: 5rem; }
  .menu-toggle { display: none; }
  .site-nav {
    position: static; display: flex; gap: 2rem; padding: 0;
    transform: none; visibility: visible; background: transparent;
  }
  .site-nav a { min-height: 2.75rem; border: 0; font-size: 0.875rem; }
  .chapter--right .chapter__copy { margin-left: auto; }
  .chapter--energy { --edge: calc(38vw + 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .js .reveal:not(.is-visible) { opacity: 1; transform: none; }
}
