/* ==========================================================================
   Vanguard · teamvanguard.com.au
   Design A's structure (surfaces, rhythm, components, tokens, themes, --beat-y)
   in design C's voice (Hanken Grotesk set large and light, one Instrument Serif
   italic word per headline, the lines). lab/DESIGN.md is the authority.

   1. Tokens          colour, type, space, layout, motion. Every type size, weight,
                      tracking and leading on the page is a token here.
   2. Fonts
   3. Base
   4. Components      eyebrow, label, headlines, the italic word, copy, buttons,
                      links, pill, reveal, the lines
   5. Nav
   6. Film            canvas, chapters, pins, beats (the scroll script drives them)
   7. Sections        hero, race, car, air, results, team, partners, next, footer
   8. Still page      no WebGL2, a lost context, a failed script, no JavaScript
   9. States          loading
   10. Preferences    reduced motion, forced colours, print
   ========================================================================== */


/* 1. Tokens
   ========================================================================== */

:root {
  /* Colour. The interface is neutral; the scene brings the colour. Red is "front." and nothing else. */
  --black: #000;
  --ink: #1d1d1f;               /* text on light */
  --snow: #f5f5f7;              /* text on black; the light-grey panel */
  --white: #fff;
  --grey-on-black: #a1a1a6;     /* secondary text on black, 8.2:1 */
  --grey-on-black-2: #86868b;   /* tertiary text and small print on black, 5.8:1 */
  --grey-on-light: #6e6e73;     /* secondary text on snow 4.7:1, on white 5.1:1 */
  --rule-on-black: #2e2e30;
  --rule-on-light: #d2d2d7;
  --red: #ff3347;               /* start-light red, "front." only (5.8:1 on black). The Slipstream colours
                                   (#ff4fd8, #ff3347, #ff7a3d) live in the drawing of the lines itself. */

  /* Type families */
  --font-sans: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;

  /* Type sizes. Fluid from a 390 px phone to a 1440 px desktop, capped near 1920.
     Given as px at 390 → 1440 (→ cap). The vh terms only bite on a phone on its side. */
  --fs-statement: min(clamp(5rem, 3.15rem + 10.667vw, 15rem), 30vh);        /* 92 → 204 → 240   "1st in Victoria." */
  --fs-display: min(clamp(3.25rem, 1.579rem + 6.857vw, 9.5rem), 17vh);      /* 52 → 124 → 152   National Finals 2027. */
  /* Over the film the type gives way to the car: a clear step below the statement screens. */
  --fs-chapter: min(clamp(2.875rem, 1.621rem + 5.143vw, 7.25rem), 15vh);    /* 46 → 100 → 116   Meet Ferox, Shaped by air */
  --fs-film-title: min(clamp(2.5rem, 1.479rem + 4.19vw, 6rem), 13vh);       /* 40 → 84 → 96     "Leading from the front." at the finish */
  --fs-headline: min(clamp(2.5rem, 1.571rem + 3.81vw, 6rem), 14vh);         /* 40 → 80 → 96     Team, Partners */
  --fs-number: min(clamp(2.75rem, 1.914rem + 3.429vw, 5.75rem), 13vh);      /* 44 → 80 → 92     50 g, 0.376 N, 20 m */
  --fs-award: clamp(1.875rem, 1.364rem + 2.095vw, 3.75rem);                 /* 30 → 52 → 60     the three awards */
  --fs-title: clamp(1.5rem, 1.268rem + 0.952vw, 2.375rem);                  /* 24 → 34 → 38     car feature titles */
  --fs-menu: 1.625rem;                                                        /* 26               the phone menu's links */
  --fs-intro: clamp(1.1875rem, 1.071rem + 0.476vw, 1.625rem);               /* 19 → 24 → 26     the line under a headline */
  --fs-statement-intro: calc(var(--fs-intro) * 1.08);                         /* 21 → 26 → 28     "Senior Professional class." */
  --fs-name: clamp(1.25rem, 1.111rem + 0.571vw, 1.75rem);                   /* 20 → 26 → 28     partner names set in type */
  --fs-body: clamp(1.0625rem, 1.016rem + 0.19vw, 1.25rem);                  /* 17 → 19 → 20     running copy */
  --fs-ui: 1rem;                                                              /* 16               buttons */
  --fs-nav: 0.8125rem;                                                        /* 13               nav, pills in the nav */
  --fs-caption: 0.875rem;                                                     /* 14               cue, hint, captions, small print */
  --fs-fine: 0.8125rem;                                                       /* 13               footer */
  --fs-label: clamp(0.75rem, 0.718rem + 0.131vw, 0.875rem);                 /* 12 → 13 → 14     small tracked labels (eyebrows, tiers) */

  /* Weights (Hanken is variable). Display type never goes below 300. */
  --fw-display: 300;
  --fw-title: 300;
  --fw-text: 400;
  --fw-ui: 450;
  --fw-label: 500;
  --fw-strong: 500;
  --fw-italic: 400;             /* Instrument Serif has one weight */

  /* Tracking */
  --tr-statement: -0.052em;
  --tr-display: -0.045em;
  --tr-headline: -0.04em;
  --tr-number: -0.05em;
  --tr-award: -0.03em;
  --tr-title: -0.028em;
  --tr-intro: -0.012em;
  --tr-body: -0.004em;
  --tr-ui: 0.005em;
  --tr-label: 0.16em;           /* small caps labels */

  /* Leading */
  --lh-statement: 0.92;
  --lh-display: 0.96;
  --lh-headline: 1;
  --lh-number: 1;
  --lh-award: 1.12;
  --lh-title: 1.12;
  --lh-intro: 1.4;
  --lh-body: 1.5;
  --lh-fine: 1.45;
  --lh-label: 1.5;
  --lh-name: 1.25;
  --lh-hint: 1.3;

  /* The one italic word per headline: Instrument Serif Italic beside Hanken. The two share a baseline and
     almost the same proportions (x-height 0.510 against 0.493 em, capitals 0.720 against 0.697), but the
     italic is narrow and fine, so it is set a touch larger to carry the same weight on the line. Each word
     starts differently (a V leans away from the word before it, an F reaches back under it), so the space
     before it is trimmed per headline with --it-before on the <em>. */
  --it-size: 1.04em;
  --it-track: -0.018em;
  --it-before: 0em;

  /* Space. A 4 px ladder for the small things, fluid tokens for the big silences. */
  --sp-2: 0.5rem;    /*  8 */
  --sp-3: 0.75rem;   /* 12 */
  --sp-4: 1rem;      /* 16 */
  --sp-5: 1.5rem;    /* 24 */
  --sp-6: 2rem;      /* 32 */
  --sp-7: 3rem;      /* 48 */
  --sp-8: 4rem;      /* 64 */
  --sp-9: 6rem;      /* 96 */
  --gutter: clamp(1.25rem, 5vw, 5.5rem);                       /* 20 → 72 → 88     page side margin */
  --pad-section: clamp(6rem, 3.2rem + 10.4vw, 15rem);          /* 96 → 201 → 240   top and bottom of every opaque section */
  --gap-block: clamp(4.5rem, 2.2rem + 8.4vw, 12rem);           /* 72 → 156 → 192   between the ideas inside a section */
  --gap-tier: clamp(4rem, 2.86rem + 4.57vw, 7.5rem);           /* 64 → 112 → 120   between sponsor tiers */
  --gap-eyebrow: clamp(1rem, 0.77rem + 0.95vw, 1.75rem);       /* 16 → 24 → 28     eyebrow to headline */
  --gap-intro: clamp(1rem, 0.81rem + 0.76vw, 1.5rem);          /* 16 → 22 → 24     headline to the line under it */
  --gap-statement: clamp(1rem, 0.63rem + 1.52vw, 2.25rem);     /* 16 → 32 → 36     either side of the statement */

  /* Layout */
  --nav-h: 3rem;
  --measure: 24em;            /* the narrow, centred text column: about 34 characters a line at any size */
  --w-content: 61.25rem;      /* 980 */
  --w-head: 90rem;            /* 1440, lets a long headline stay on one line */
  --w-wide: 87.5rem;          /* 1400, media */
  --radius-media: clamp(1rem, 2.2vw, 2rem);
  --screen: 100vh;            /* one screen: the height of a pin (100svh where supported) */
  --beat-y: 26vh;             /* the line every film caption is centred on, unless a chapter or beat says otherwise */
  --beat-w: clamp(26rem, 25vw, 30rem);   /* the column of a caption set to one side (data-align): 416 → 480 at 1920 */
  --footer-h: 12.5rem;        /* the footer's height, for the closing screen. main.js measures the real one; this
                                 estimate is a few px short on purpose, so without the script the closing screen is a
                                 touch tall rather than letting a sliver of the section above show */

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
  --rise: 1.75rem;            /* reveal distance */
  --beat-rise: 1.5rem;        /* how far a caption travels as it enters and leaves */
  --beat-edge: 5;             /* a caption fades over 1/5 of its range at each end */
  --theme-fade: 0.35s;        /* the nav's change of ground */
}

@supports (height: 1svh) {
  :root { --beat-y: max(26svh, 9.5rem); --screen: 100svh; }
}
/* Smaller type wants a little more air between its letters: the phone's display sizes are tracked less tightly. */
@media (max-width: 43.9375em) {
  :root {
    --tr-statement: -0.048em;
    --tr-display: -0.04em;
    --tr-headline: -0.034em;
    --tr-number: -0.042em;
    --tr-award: -0.024em;
    --tr-title: -0.022em;
  }
}
/* On a phone the three numbers are a list, taller than a caption: it sits a little lower, clear of the nav. */
.beat--numbers { --beat-y-portrait: max(30vh, 15.5rem); }
@supports (height: 1svh) {
  .beat--numbers { --beat-y-portrait: max(30svh, 15.5rem); }
}

/* Themes. Each surface declares one; everything inside reads the same roles. */
:root,
[data-theme="dark"] {
  --fw-display: 300;
  --fw-title: 300;
  --bg: var(--black);
  --fg: var(--snow);
  --fg-2: var(--grey-on-black);
  --fg-3: var(--grey-on-black-2);
  --rule: var(--rule-on-black);
  --btn-bg: var(--snow);
  --btn-bg-hover: var(--white);
  --btn-fg: var(--black);
  --focus: var(--snow);
  --pool: 0 0 0;              /* the soft pool of dark behind a caption over a bright scene */
}

[data-theme="light"] {
  /* Ink on a light ground reads finer than light on black: the display weight steps up to hold the same voice. */
  --fw-display: 330;
  --fw-title: 330;
  --bg: var(--snow);
  --fg: var(--ink);
  --fg-2: var(--grey-on-light);
  --fg-3: var(--grey-on-light);
  --rule: var(--rule-on-light);
  --btn-bg: var(--ink);
  --btn-bg-hover: var(--black);
  --btn-fg: var(--white);
  --focus: var(--ink);
  --pool: 245 245 247;
}


/* 2. Fonts
   Hanken Grotesk (variable, 100 to 900) and Instrument Serif Italic, Latin subsets, SIL Open Font Licence
   (licence texts beside the files in /fonts/).
   ========================================================================== */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
}

/* One glyph: the figure 1, redrawn with a sloped flag for "1st in Victoria." (a modified version of Hanken
   Grotesk under the same Open Font Licence, renamed; see /fonts/OFL-vanguard-one.txt). Hanken's own stem at
   weight 330, the display weight on light surfaces (70 units of 1000, cap height 697), and its vertical
   metrics. Outline 178,0 178,624 36,505 36,578 178,697 248,697 248,0; advance 348. Used by .one only. */
@font-face {
  font-family: "Vanguard One";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/vanguard-one.woff2") format("woff2");
  unicode-range: U+31;
}


/* 3. Base
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--black);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-text);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-body);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
  overflow-x: hidden;           /* fallback for overflow: clip */
  overflow-x: clip;
}

h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2, h3 { font-weight: var(--fw-display); text-wrap: balance; }
p { text-wrap: pretty; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; letter-spacing: inherit; color: inherit; }
sub { font-size: 0.68em; line-height: 0; vertical-align: baseline; position: relative; top: 0.22em; }
strong { font-weight: var(--fw-strong); }

/* One clear ring outside every interactive element, from the theme */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--fg); color: var(--bg); }

.nowrap { white-space: nowrap; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 40;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 999px;
  background: var(--snow);
  color: var(--black);
  font-size: var(--fs-caption);
  font-weight: var(--fw-ui);
  text-decoration: none;
  transform: translateY(-300%);
}
.skip:focus-visible { transform: none; outline-color: var(--snow); outline-offset: 3px; }

/* Anchored sections land flush with the top of the window, under the nav: a panel then fills the screen
   and the nav takes its ground (every panel's own top padding is far taller than the nav, so nothing is
   covered), and a film chapter lands exactly where its scene starts. */
main > section { scroll-margin-top: 0; }


/* 4. Components
   ========================================================================== */

/* Small tracked label: the line over a headline, tier names, the awards label */
.eyebrow,
.label {
  color: var(--fg-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  letter-spacing: var(--tr-label);
  padding-left: var(--tr-label);   /* tracking leaves a space after the last letter: this centres the letters themselves */
  text-transform: uppercase;
  text-wrap: balance;
}
.eyebrow + :is(.display, .headline, .statement__title) { margin-top: var(--gap-eyebrow); }

/* Headlines: large, light, tight */
.display,
.headline,
.statement__title,
.title-film {
  font-weight: var(--fw-display);
  text-wrap: balance;
}
.statement__title {
  font-size: var(--fs-statement);
  line-height: var(--lh-statement);
  letter-spacing: var(--tr-statement);
}
.display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}
.chapter .display { font-size: var(--fs-chapter); }   /* over the film: the car leads */
.title-film {
  font-size: var(--fs-film-title);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}
.headline {
  font-size: var(--fs-headline);
  line-height: var(--lh-headline);
  letter-spacing: var(--tr-headline);
}

/* The italic word: exactly one per headline, the last word, in the headline's own colour */
:is(.statement__title, .display, .headline, .title-film) em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: var(--fw-italic);
  font-size: var(--it-size);
  line-height: 0;
  letter-spacing: var(--it-track);
  margin-left: var(--it-before);
  padding-right: 0.02em;
}

/* "front." takes the red, as in the team's slogan. Nothing else does. */
.front { color: var(--red); }

/* The "1" of "1st in Victoria." Hanken's own 1 has a flat flag that reads as a bracket at display size,
   and the font has no alternate. This is a redrawn 1 in a font of one glyph (see 2. Fonts): Hanken's own
   stem with the flag as a straight arm falling from its top, and the side bearings of a letter rather
   than a table figure, so "1st" reads as one word. Without the file the span falls back to Hanken's 1. */
.one { font-family: "Vanguard One", var(--font-sans); }

/* The line under a headline */
.intro {
  max-width: var(--measure);
  margin-inline: auto;
  color: var(--fg-2);
  font-size: var(--fs-intro);
  font-weight: var(--fw-text);
  line-height: var(--lh-intro);
  letter-spacing: var(--tr-intro);
  text-wrap: balance;
}
:is(.display, .headline, .statement__title, .title-film) + .intro { margin-top: var(--gap-intro); }

/* A short paragraph in two tones: grey, with the phrase that matters in full colour */
.copy {
  max-width: var(--measure);
  margin-inline: auto;
  color: var(--fg-2);
  font-size: var(--fs-intro);
  font-weight: var(--fw-text);
  line-height: var(--lh-intro);
  letter-spacing: var(--tr-intro);
  text-wrap: balance;
}
.copy strong { color: var(--fg); font-weight: var(--fw-text); }
.headline + .copy { margin-top: clamp(1.5rem, 2.6vw, 2.25rem); }

.fine {
  color: var(--fg-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-fine);
  letter-spacing: var(--tr-body);
}

/* Solid pill button */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.625rem;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-ui);
  font-weight: var(--fw-ui);
  line-height: 1;
  letter-spacing: var(--tr-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s linear, transform 0.2s var(--ease);
}
.button:hover { background: var(--btn-bg-hover); }
.button:active { transform: scale(0.98); }
.button:focus-visible { border-radius: 999px; }

/* Quiet text link with a chevron */
.link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-height: 3rem;
  padding-inline: 0.25rem;
  color: var(--fg);
  font-size: var(--fs-ui);
  font-weight: var(--fw-ui);
  letter-spacing: var(--tr-ui);
  text-decoration: none;
}
.link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.link__chevron { width: 0.42em; height: auto; flex: none; transition: transform 0.25s var(--ease); }
.link:hover .link__chevron { transform: translateX(2px); }

/* Glass pill over the scene ("Watch at real speed"). Three states from data-state: idle, playing, done. */
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5625rem;
  min-height: 2.75rem;
  padding: 0 1.375rem 0 1.125rem;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  color: var(--snow);
  font-size: var(--fs-caption);
  font-weight: var(--fw-ui);
  line-height: 1;
  letter-spacing: var(--tr-ui);
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  -webkit-tap-highlight-color: transparent;   /* :active gives the press; no square flash on a round pill */
  transition: background-color 0.2s linear, box-shadow 0.2s linear, transform 0.2s var(--ease);
}
.pill[hidden] { display: none; }
.pill:hover { background: rgb(255 255 255 / 0.18); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.28); }
.pill:active { transform: scale(0.98); }
.pill:focus-visible { border-radius: 999px; outline-color: var(--snow); }
.pill__icon { flex: none; width: 0.6875rem; height: 0.6875rem; }
.pill__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgb(255 255 255 / 0.18);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.replay__again { display: none; }
.replay[data-state="done"] .replay__play { display: none; }
.replay[data-state="done"] .replay__again { display: block; }
/* While the replay runs the pill fills from the left over the length of the race (--replay, set by the script). */
.replay[data-state="playing"] { cursor: default; }
.replay[data-state="playing"] .pill__fill { transform: scaleX(1); transition: transform var(--replay, 1.3s) linear; }

/* Reveal on scroll, for the opaque sections: a fade and a short rise, once. Only while the script runs. */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--rise), 0);
  transition: opacity 0.9s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* The lines: about a dozen fine continuous hairlines, magenta to red to orange, with a soft glow under
   the sharp core. The flat drawing of the site's signature, used where there is no 3D. */
.lines {
  width: 100%;
  height: clamp(9rem, 24vh, 22rem);
  overflow: visible;
  fill: none;
}
@media (orientation: portrait) {
  .lines { height: clamp(7rem, 15vh, 12rem); }   /* squeezed sideways on a phone: lower, so the rise stays gentle */
}
.lines path { vector-effect: non-scaling-stroke; }
.lines__core { stroke-width: 1; }
.lines__glow { stroke-width: 7; opacity: 0.4; filter: blur(9px); }


/* 5. Nav
   48 px, takes the theme of whatever is under it. A clean ground per theme (no colour picked up from the
   scene), cross-faded when the theme changes. Bare at the very top, over the lights.
   ========================================================================== */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  color: var(--fg);
  font-size: var(--fs-nav);
  font-weight: var(--fw-ui);
  letter-spacing: var(--tr-ui);
  line-height: 1;
  transition: color var(--theme-fade) linear;
}
/* The ground: ::before is the dark one, ::after the light one; the two cross-fade. Each is the colour of
   the surface under it (main.js copies a section's data-ground to the nav: the Partners section is white,
   the other light sections snow), so the bar is not seen until something passes beneath it. Opaque: it
   takes no colour from what is under it. */
.nav::before,
.nav::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--theme-fade) linear, background-color var(--theme-fade) linear;
}
.nav::before { background-color: var(--black); }
.nav::after { background-color: var(--snow); }
.nav[data-ground="white"]::after { background-color: var(--white); }
.nav[data-theme="dark"]:not(.is-top)::before,
.nav[data-theme="light"]:not(.is-top)::after { opacity: 1; }
/* Over the film there is no bar across the picture: the ground is a soft fall of the void's own black,
   enough to hold the links if something bright passes under them. (main.js sets data-over.) */
.film .nav[data-over="film"]::before {
  bottom: -2rem;
  background: linear-gradient(rgb(0 0 0 / 0.72), rgb(0 0 0 / 0.5) 45%, rgb(0 0 0 / 0));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.nav__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: var(--nav-h);
  max-width: calc(var(--w-content) + 2 * var(--gutter));   /* the footer's column: the two logos share a left edge */
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.nav__logo {
  position: relative;
  display: grid;
  align-items: center;
  height: 2.75rem;
  margin-right: auto;
  padding-inline: 0.375rem;      /* a 44 px square target */
  margin-left: -0.375rem;
}
/* The bar is only 4 px taller than the logo's target: its ring is drawn just inside the target, still clear of
   the emblem, so the top of it is not cut off by the window. */
.nav__logo:focus-visible { outline-offset: -2px; }
.nav__emblem {
  grid-area: 1 / 1;
  width: 2rem;
  height: auto;
  transition: opacity var(--theme-fade) linear;
}
.nav[data-theme="dark"] .nav__emblem--on-light,
.nav[data-theme="light"] .nav__emblem--on-dark { opacity: 0; }

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
}
.nav__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.2s linear;
}
.nav__links a::after { content: ""; position: absolute; inset: -0.5rem 0; }   /* a 44 px tall target */
.nav__links a:hover,
.nav__links a:focus-visible { opacity: 1; }
.nav__links a:focus-visible { outline-offset: 1px; border-radius: 999px; }   /* the ring sits round the word, clear of it */

/* Follow, and Menu on a phone: the same small pill, a 44 px target */
.nav__pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 1.875rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-nav);
  font-weight: var(--fw-ui);
  letter-spacing: var(--tr-ui);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--theme-fade) linear, color var(--theme-fade) linear;
}
.nav__pill::after { content: ""; position: absolute; inset: -0.4375rem -0.25rem; }   /* 44 px tall target */
.nav__pill:hover { background: var(--btn-bg-hover); }
.nav__pill:focus-visible { border-radius: 999px; }
.nav__follow { margin-left: clamp(1rem, 2.4vw, 2rem); }

.nav__toggle { display: none; }
/* Without the script nothing follows the theme under the nav: it stays over the dark first screen and
   scrolls away with it. */
html:not(.js) .nav { position: absolute; }

/* Phone: the links fold into a sheet behind the Menu pill */
@media (max-width: 43.9375em) {
  .nav__follow { margin-left: 0; }
  .js .nav__toggle {
    display: inline-flex;
    margin-left: 0.625rem;
    background: transparent;
    color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--fg-3);
  }
  .js .nav__toggle:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--fg); }

  .nav__links {
    position: fixed;
    inset: calc(var(--nav-h) + env(safe-area-inset-top)) 0 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: var(--sp-5) var(--gutter) var(--sp-8);
    background: var(--bg);
    visibility: hidden;
    opacity: 0;
    overflow-y: auto;
    transition: opacity 0.3s linear, visibility 0s linear 0.3s;
  }
  /* Without the script there is no Menu: the four links take a second row under the logo and Follow. */
  html:not(.js) .nav { height: auto; }
  html:not(.js) .nav__inner { flex-wrap: wrap; height: auto; min-height: var(--nav-h); padding-top: 2px; }
  html:not(.js) .nav__links {
    position: static;
    order: 1;
    flex: 0 0 calc(100% + 1rem);
    flex-direction: row;
    justify-content: space-between;
    margin-inline: -0.5rem;        /* the links' own padding: the words line up with the logo and Follow */
    padding: 0 0 var(--sp-2);
    background: none;
    visibility: visible;
    opacity: 1;
    overflow: visible;
  }
  html:not(.js) .nav__links li { width: auto; opacity: 1; transform: none; }
  html:not(.js) .nav__links a {
    min-height: 2.75rem;
    padding-inline: 0.5rem;
    border-bottom: 0;
    opacity: 0.8;
    font-size: var(--fs-nav);
    font-weight: var(--fw-ui);
    letter-spacing: var(--tr-ui);
  }
  .nav.is-open .nav__links {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
  }
  .nav.is-open::before,
  .nav.is-open::after { transition-duration: 0.2s; }
  .nav.is-open[data-theme="dark"]::before,
  .nav.is-open[data-theme="light"]::after { opacity: 1; }
  /* The open menu is one opaque sheet with the bar above it, in the colour of the surface under it. */
  .nav.is-open::before,
  .film .nav.is-open[data-over="film"]::before { bottom: 0; background: var(--black); }
  .nav.is-open::after { background-color: var(--snow); }
  .nav.is-open[data-ground="white"]::after,
  .nav[data-ground="white"] .nav__links { background-color: var(--white); }
  .nav__links li {
    width: 100%;
    opacity: 0;
    transform: translate3d(0, 0.75rem, 0);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  }
  .nav.is-open .nav__links li {
    opacity: 1;
    transform: none;
    transition-delay: calc(60ms + var(--i, 0) * 50ms);
  }
  .nav__links a {
    display: flex;
    width: 100%;
    min-height: 3.75rem;
    padding-inline: 0;
    border-radius: 0;
    opacity: 1;
    border-bottom: 1px solid var(--rule);
    font-size: var(--fs-menu);
    font-weight: var(--fw-title);
    letter-spacing: var(--tr-title);
  }
  .nav__links a::after { content: none; }
  .nav__links a:focus-visible { outline-offset: 3px; border-radius: 4px; }
}


/* 6. Film
   The canvas is fixed behind everything. With the film running (html.film) a chapter is a tall,
   transparent section (--len viewports) holding one sticky, full-viewport pin, so the scene shows
   through. scroll.js measures the chapters and, every frame, sets on each chapter --p (progress through
   the pinned part), --enter and --exit (0 → 1 while it slides in and out), and on each .beat adds
   .is-on while the chapter's progress is inside data-from..data-to, with --p running 0 → 1 through it.
   CSS does the rest. Directors set from markup alone:
     on a chapter    style="--len: 5"   its length in screens; data-theme="light" over a bright scene;
                     --beat-y / --beat-y-portrait for all its captions; data-arrive="in-place" (below)
     on a beat       data-from / data-to; data-theme; style="--beat-y: 40svh" (and --beat-y-portrait);
                     data-align="start|end" (a column at one side from 64em up and on a phone on its
                     side; --beat-w its width);
                     --beat-edge (fade length, 1/n of the range); class beat--lead (only leaves) or
                     beat--hold (only enters)
   ========================================================================== */

#stage {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100lvh;               /* the largest viewport: a phone's URL bar never resizes the canvas */
  background: var(--black);
  touch-action: pan-y pinch-zoom; /* vertical drags scroll the page; horizontal ones reach the scene */
}

main,
.footer {
  position: relative;
  z-index: 1;
}

.chapter {
  position: relative;
  color: var(--fg);
  text-align: center;
}
/* Let the pointer through to the canvas: <main> and the film chapters are transparent to it; the opaque
   panels, and links and buttons inside chapters, take it back. */
.film main,
.film .chapter { pointer-events: none; }
.film main > :not(.chapter),
.film .chapter :is(a, button) { pointer-events: auto; }

/* A chapter is --len screens tall, the pin one screen: it is pinned for --len - 1 screens of scroll. Both in
   svh, so a phone's URL bar coming and going changes neither (when the bar is hidden the canvas, at lvh,
   simply shows a little more below the pin). */
.film .chapter {
  height: calc(var(--len, 1) * 100vh);
  height: calc(var(--len, 1) * 100svh);
}
.film .chapter__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.film .chapter__still { display: none; }

/* Captions: placement and motion, with the film running. Every caption is centred on --beat-y. */
.film .beat {
  position: absolute;
  top: var(--beat-y);
  right: var(--gutter);
  left: var(--gutter);
  max-width: var(--w-head);
  margin-inline: auto;
  color: var(--fg);
  opacity: 0;                    /* off-screen captions stay readable to assistive tech */
  transform: translate3d(0, -50%, 0);
  will-change: opacity, transform;
}
@media (orientation: portrait) {
  .film .beat { top: var(--beat-y-portrait, var(--beat-y)); }
}
.film .beat:not(.is-on) :is(a, button) { visibility: hidden; }
.film .beat.is-on {
  /* in over the first 1/edge of the range, out over the last */
  opacity: clamp(0, min(var(--p) * var(--beat-edge), (1 - var(--p)) * var(--beat-edge)), 1);
  /* rises into place, rests, rises away */
  transform: translate3d(0, calc(-50%
    + (1 - min(var(--p) * var(--beat-edge), 1)) * var(--beat-rise)
    - (1 - min((1 - var(--p)) * var(--beat-edge), 1)) * var(--beat-rise)), 0);
}
/* First caption of a chapter: arrives with the page, so it only needs to leave. */
.film .beat--lead.is-on {
  opacity: clamp(0, (1 - var(--p)) * var(--beat-edge), 1);
  transform: translate3d(0, calc(-50% - (1 - min((1 - var(--p)) * var(--beat-edge), 1)) * var(--beat-rise)), 0);
}
/* Last caption of a chapter: enters, then leaves with the page. */
.film .beat--hold.is-on {
  opacity: clamp(0, var(--p) * var(--beat-edge), 1);
  transform: translate3d(0, calc(-50% + (1 - min(var(--p) * var(--beat-edge), 1)) * var(--beat-rise)), 0);
}
/* A soft pool of the theme's ground travels with each caption, so the type holds 4.5:1 when the scene
   behind it is lit. Invisible over the dark void. */
.film .beat::before {
  content: "";
  position: absolute;
  inset: -4rem -12%;
  z-index: -1;
  background: radial-gradient(closest-side, rgb(var(--pool) / 0.42), rgb(var(--pool) / 0.32) 40%, rgb(var(--pool) / 0.12) 72%, rgb(var(--pool) / 0));
  pointer-events: none;
}
/* data-arrive="in-place" on a chapter that follows another film chapter: its standing copy (everything in the
   pin except beats) does not ride in over the picture with the page; it waits where it will settle and
   fades up as the chapter arrives. */
.film .chapter[data-arrive="in-place"] .chapter__pin { overflow: visible; }
.film .chapter[data-arrive="in-place"] .chapter__pin > :not(.chapter__still, .beat) {
  opacity: clamp(0, (var(--enter, 1) - 0.5) * 2, 1);
  translate: 0 calc((var(--enter, 1) - 1) * var(--screen));
}

/* Side captions: on wide screens, and on a phone on its side (short and wide). main.js reads the same query
   (ctx.view.sideCaptions), so a scene knows when to slide the car away from them. */
@media (min-width: 64em), (orientation: landscape) and (max-height: 32em) and (min-width: 40em) {
  .film .beat[data-align] {
    max-width: var(--beat-w);
    margin-inline: 0;
    text-align: left;
  }
  /* The column's outer edge is one gutter in from the side of a 1440 px stage, so on a wider screen a
     caption stays near the car instead of drifting to the edge of the window. */
  .film .beat[data-align="start"] { right: auto; left: max(var(--gutter), calc((100vw - var(--w-head)) / 2 + var(--gutter))); }
  .film .beat[data-align="end"] { left: auto; right: max(var(--gutter), calc((100vw - var(--w-head)) / 2 + var(--gutter))); }
  .film .beat[data-align] .feature__text { margin-inline: 0; }
}


/* 7. Sections
   ========================================================================== */

/* Hero: the lights alone. Only the loading hairline, then the scroll cue, at the foot. ------------- */

.hero__foot {
  display: grid;
  justify-items: center;
  align-items: end;
}
.hero__foot > * { grid-area: 1 / 1; }
.film .hero__foot {
  position: absolute;
  right: var(--gutter);
  bottom: calc(clamp(1.5rem, 4.5vh, 2.75rem) + env(safe-area-inset-bottom));
  left: var(--gutter);
  /* lets go as soon as the page moves */
  opacity: clamp(0, 1 - var(--exit, 0) * 4, 1);
}

.cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  color: var(--fg-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  transition: opacity 0.8s linear;
}
.cue span { padding-left: var(--tr-label); }
.cue__chevron { animation: cue 2.6s var(--ease) infinite; }
@keyframes cue {
  0%, 100% { transform: translateY(-2px); opacity: 0.5; }
  50% { transform: translateY(3px); opacity: 1; }
}
/* A scene can hold the cue back (page.cue('hide')) or bring it early (page.cue('show')). */
.cue-hidden .cue { opacity: 0; }

/* Race: the film's title at the finish, and the replay control under it ---------------------------- */

.beat--title { --beat-y: max(30vh, 9.5rem); }
.beat--title .replay { margin-top: clamp(1.5rem, 3.6vh, 2.5rem); }
/* When the race leaves, its pin rides up with the page: the title lets go within about an eighth of a screen,
   before its top reaches the nav. */
.film .beat--title.is-on {
  opacity: min(clamp(0, var(--p) * var(--beat-edge), 1), clamp(0, 1 - var(--exit, 0) * 8, 1));
}
/* While the race replays, the picture has the screen: the title steps aside and only the pill stays, filling
   as the race runs; the title comes back when it ends. */
.beat--title .title-film { transition: opacity 0.35s linear; }
.beat--title:has(.replay[data-state="playing"]) .title-film { opacity: 0; }

/* The car: features and the numbers -------------------------------------------------------------- */

.beat--lead .eyebrow + .display { margin-top: var(--gap-eyebrow); }
.feature__title {
  font-size: var(--fs-title);
  font-weight: var(--fw-title);
  line-height: var(--lh-title);
  letter-spacing: var(--tr-title);
  text-wrap: balance;
}
.feature__text {
  max-width: 26em;
  margin: clamp(0.75rem, 1.4vw, 1.125rem) auto 0;
  color: var(--fg-2);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-body);
  text-wrap: pretty;
}

/* Three numerals across, each with its unit small beside it and its label under it; on a phone, rows of
   one ruled list (label left, numeral right). */
.stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: var(--sp-4) clamp(3rem, 8vw, 8.5rem);
  margin-inline: auto;
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: clamp(0.375rem, 0.7vw, 0.75rem);
}
.stat dd {
  font-size: var(--fs-number);
  font-weight: var(--fw-display);
  line-height: var(--lh-number);
  letter-spacing: var(--tr-number);
  white-space: nowrap;
  font-variant-numeric: lining-nums;
}
.stat .unit {
  color: var(--fg-2);
  font-size: 0.4em;
  font-weight: var(--fw-text);
  letter-spacing: 0;
}
.stat dt {
  padding-left: var(--tr-label);
  color: var(--fg-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
}
.stats__fine {
  max-width: 24em;
  margin: clamp(1.5rem, 4vh, 2.5rem) auto 0;
  color: var(--fg-3);
  text-wrap: balance;
}
@media (max-width: 43.9375em) {
  .stats {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 24rem;
    border-bottom: 1px solid var(--rule);
  }
  .stat {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.75rem 0 0.875rem;
    border-top: 1px solid var(--rule);
  }
  .stat dt { align-self: center; padding-left: 0; }
}

/* Air: headline above the car, the invitation to touch below it ---------------------------------- */

.air__head .intro {
  max-width: 30em;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-body);
}
.film .air__head {
  position: absolute;
  top: var(--beat-y);
  right: var(--gutter);
  left: var(--gutter);
  transform: translateY(-50%);
}
.film .air__foot {
  position: absolute;
  right: var(--gutter);
  bottom: calc(clamp(1.25rem, 3.6vh, 2.25rem) + env(safe-area-inset-bottom));
  left: var(--gutter);
}
/* When the chapter leaves, its pin rides up with the page and the foot would travel the height of the picture,
   across the car. It lets go as soon as the page moves on, as the scroll cue does on the first screen. (It
   still fades up with the chapter's arrival: the first term is data-arrive's.) */
.film .chapter[data-arrive="in-place"] .chapter__pin > .air__foot {
  opacity: min(clamp(0, (var(--enter, 1) - 0.5) * 2, 1), clamp(0, 1 - var(--exit, 0) * 8, 1));
}
/* The headline goes too, before it reaches the nav (about a tenth of a screen of travel). */
.film .chapter[data-arrive="in-place"] .chapter__pin > .air__head {
  opacity: min(clamp(0, (var(--enter, 1) - 0.5) * 2, 1), clamp(0, 1 - var(--exit, 0) * 10, 1));
}
.hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg);
  font-size: var(--fs-caption);
  line-height: var(--lh-hint);
}
.hint__icon { color: var(--fg-2); }
.hint__touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint__fine { display: none; }
  .hint__touch { display: inline; }
}
.air__foot .fine {
  margin-top: 0.625rem;
  color: var(--fg-3);
}
/* A phone on its side has no room under the car: the invitation moves to the corner. */
@media (orientation: landscape) and (max-height: 32em) {
  .stats__fine { margin-top: 0.75rem; }
  .film .air__foot { left: auto; max-width: 15rem; text-align: right; }
  .film .air__foot .hint { align-items: flex-end; }
  .film .air__foot .hint__icon { display: none; }
}

/* Opaque panels ------------------------------------------------------------------------------------ */

.panel {
  position: relative;
  padding: var(--pad-section) var(--gutter);
  background: var(--bg);
  color: var(--fg);
  text-align: center;
}
.panel__head {
  max-width: var(--w-head);
  margin-inline: auto;
}

/* Results: two screens. The statement alone, centred in a full viewport; then the awards. ---------- */

.panel--results {
  padding-top: 0;
  padding-bottom: clamp(3rem, 10vh, 6rem);
}
.statement {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: clamp(30rem, 100vh, 68rem);
  min-height: clamp(30rem, 100svh, 68rem);
  padding-block: var(--sp-9);
}
.statement .eyebrow + .statement__title { margin-top: var(--gap-statement); }
.statement .intro { margin-top: var(--gap-statement); font-size: var(--fs-statement-intro); }
/* The awards own the next screen: centred in most of a viewport, so that when they rest in the middle of
   the window the statement has just left the top and the car chapter has not yet arrived at the bottom. */
.awards {
  display: grid;
  align-content: center;
  justify-items: center;
  max-width: var(--w-content);
  min-height: clamp(24rem, 80vh, 54rem);
  min-height: clamp(24rem, 80svh, 54rem);
  margin-inline: auto;
}
.awards__list {
  margin-top: clamp(1.5rem, 2.6vw, 2.25rem);
  font-size: var(--fs-award);
  font-weight: var(--fw-display);
  line-height: var(--lh-award);
  letter-spacing: var(--tr-award);
}
.awards__list li + li { margin-top: 0.22em; }
.awards__fine { margin-top: clamp(2.25rem, 4.4vw, 4rem); }

/* Team --------------------------------------------------------------------------------------------- */

.media {
  max-width: var(--w-wide);
  margin: var(--gap-block) auto 0;
}
.media img {
  width: 100%;
  aspect-ratio: 2400 / 1091;     /* stated, so nothing moves when the photo arrives */
  object-fit: cover;
  border-radius: var(--radius-media);
  background: var(--rule);
}
@media (max-width: 43.9375em) {
  .media img { aspect-ratio: 3 / 2; }   /* the phone gets a taller crop of the same photo */
}
.media figcaption { margin-top: var(--sp-4); }

/* Partners: one calm centred column. A quiet label over each tier; the three supplied logos sit on
   white, untouched; the other names are set in type, a step below the headline. ----------------- */

.panel--partners { --bg: var(--white); }

.tiers {
  max-width: var(--w-content);
  margin: var(--gap-block) auto 0;
}
.tier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 2.6vw, 2.25rem) clamp(2.5rem, 7vw, 6rem);
}
.tier + .tier { margin-top: var(--gap-tier); }
.tier dt {
  flex: 0 0 100%;
  padding-left: var(--tr-label);
  color: var(--fg-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  line-height: var(--lh-label);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
}
/* Hierarchy by size alone: title sponsors largest, then gold, then the names in type.
   Logo sizes are optical, matched by weight rather than by height. */
.tier__logo { width: auto; max-width: 100%; }
.tier__logo--mcdental { height: clamp(2.125rem, 1.521rem + 2.476vw, 3.75rem); }   /* 34 → 60: a fine line mark, set wide */
.tier__logo--scorptec { height: clamp(2.625rem, 1.929rem + 2.857vw, 4.5rem); }    /* 42 → 72: a solid oval, held back */
.tier__logo--hzw { height: clamp(2.125rem, 1.707rem + 1.714vw, 3.25rem); }        /* 34 → 52: one step down at every width */

/* The names set in type keep the column: one under another, like credits. */
.tier--names { flex-direction: column; flex-wrap: nowrap; gap: clamp(0.375rem, 0.6vw, 0.5rem); }
.tier--names dt { flex: none; margin-bottom: clamp(0.625rem, 1vw, 0.875rem); }
.tier--names dd {
  font-size: var(--fs-name);
  font-weight: var(--fw-text);
  line-height: var(--lh-name);
  letter-spacing: var(--tr-intro);
}

/* Next: the closing screen. The statement and the footer share one window, so the page comes to rest on a
   composed frame: the statement centred in the space the footer leaves, never pushed up under the nav.
   Measured against the largest viewport (lvh): with a phone's URL bar away, the usual state at the end of
   a long scroll, the two fill the window exactly. ------------------------------------------------- */

.panel--next {
  display: grid;
  align-content: center;
  min-height: calc(100vh - var(--footer-h));
  min-height: calc(100lvh - var(--footer-h));
  padding-block: calc(var(--nav-h) + var(--sp-6)) var(--sp-7);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3) var(--sp-6);
  margin-top: clamp(2rem, 3.6vw, 3.25rem);
}

/* Footer ------------------------------------------------------------------------------------------- */

.footer {
  padding: 0 var(--gutter) calc(var(--sp-7) + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--fg-3);
  font-size: var(--fs-fine);
  line-height: var(--lh-fine);
}
.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-5) var(--sp-6);
  max-width: var(--w-content);
  margin-inline: auto;
  padding-top: var(--sp-7);
  border-top: 1px solid var(--rule);
}
.footer__logo { justify-self: start; border-radius: 4px; }
.footer__logo img { width: auto; height: clamp(3.25rem, 4.6vw, 4rem); }
.footer__id { grid-area: 2 / 1; }
.footer__ig { grid-area: 1 / 2; justify-self: end; }
.footer__legal { grid-area: 2 / 2; justify-self: end; }
.footer a {
  display: inline-block;
  padding-block: 0.8rem;         /* a 44 px tall target */
  color: var(--fg-2);
  text-decoration: none;
}
.footer a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 0.22em; }
.footer .footer__logo { padding-block: 0; }

/* Phone: a short footer, so the closing statement keeps its room above it. The logo, the two lines of who
   we are, then Instagram and the year on one line. */
@media (max-width: 43.9375em) {
  :root { --footer-h: 13.25rem; }
  .footer { padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom)); }
  .footer__inner { gap: var(--sp-2) var(--sp-4); padding-top: var(--sp-6); }
  .footer__logo { grid-area: 1 / 1 / auto / -1; margin-bottom: var(--sp-3); }
  .footer__id { grid-area: 2 / 1 / auto / -1; }
  .footer__ig { grid-area: 3 / 1; justify-self: start; }
  .footer__legal { grid-area: 3 / 2; }
  .footer__id .nowrap { display: block; }
  .footer__dot { display: none; }
}


/* 404: one quiet screen. The logo, one line, the way home, and the lines of air rising under them. ------ */

.error {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--sp-6) + env(safe-area-inset-top)) var(--gutter) 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  text-align: center;
}
.error__logo { justify-self: center; border-radius: 4px; }
.error__logo img { width: auto; height: clamp(2.75rem, 4vw, 3.5rem); }
.error__body {
  position: relative;
  z-index: 1;
  align-self: center;
  padding-bottom: clamp(8rem, 22vh, 18rem);   /* the type stands clear above the air */
}
.error__home { margin-top: clamp(2rem, 3.6vw, 3.25rem); }
.error__lines {
  position: absolute;
  right: 0;
  bottom: clamp(2rem, 8vh, 6rem);
  left: 0;
}


/* 8. The still page
   Whenever the film is off (html without .film): no WebGL2, a lost context, a script that failed, or no
   JavaScript at all. No canvas and no pins. Every chapter is a full-screen still (img/posters/<chapter>.jpg;
   the Air chapter's is the drawing of the lines) with its first caption set over it where the film puts
   it, and the rest of its copy stacked below on the dark page. A slot marked data-poster="pending" is
   still waiting for its frame and takes no room.
   ========================================================================== */

html:not(.film) #stage { display: none; }

html:not(.film) .chapter { isolation: isolate; }
html:not(.film) .chapter__pin {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
html:not(.film) .chapter__still {
  grid-area: 1 / 1;
  position: relative;
  z-index: -1;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 30rem;
  overflow: hidden;
  background: var(--black);
}
html:not(.film) .chapter__still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(#000 72%, transparent);
  mask-image: linear-gradient(#000 72%, transparent);
}
@media (orientation: portrait) {
  /* Keep the whole composition on a phone: the dark frame sits across the screen, the page around it. */
  html:not(.film) .chapter__still img { object-fit: contain; }
}
/* A slot still waiting for its frame of the film (data-poster="pending") takes no room: the chapter shows its
   copy alone, and a chapter with no visible copy (Lights) folds away. Remove the attribute with the real frame. */
html:not(.film) .chapter__still[data-poster="pending"] { display: none; }
html:not(.film) .chapter__pin:not(:has(> :not(.chapter__still[data-poster="pending"], .visually-hidden))) { padding: 0; }
/* The first caption sits over the still, where the film puts it */
html:not(.film) .chapter__still ~ .beat--lead,
html:not(.film) .chapter__still ~ .beat--title,
html:not(.film) .chapter__still ~ .air__head {
  grid-area: 1 / 1;
  align-self: start;
  margin-top: max(calc(var(--nav-h) + 2.5rem), calc(var(--beat-y) - 5rem));
}
html:not(.film) :is(.beat, .air__head, .air__foot) {
  width: 100%;
  max-width: var(--w-head);
  padding-inline: var(--gutter);
}
html:not(.film) :is(.beat--feature, .beat--numbers) { margin-top: clamp(4rem, 9vw, 7.5rem); }
html:not(.film) [data-replay],
html:not(.film) .hero__foot,
html:not(.film) .hint { display: none; }

/* Air: the drawing of the lines is the still; the headline over it, the small print below */
html:not(.film) .chapter__still--lines {
  display: grid;
  align-items: end;
  padding-bottom: 18vh;
}
html:not(.film) .air__foot { grid-area: 1 / 1; align-self: end; margin-bottom: clamp(2rem, 6vh, 3.5rem); }


/* 9. States
   ========================================================================== */

/* Loading. No curtain: the first frame of the film is live at once. A hairline holds the scroll cue's
   place until the scene is ready, then the two cross-fade. A scene can take the bar away
   (html.loader-off) and tell the loading story itself. */
.loader {
  display: flex;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s linear, visibility 0s linear 0.5s;
}
.loader__track {
  position: relative;
  display: block;
  width: 4.5rem;
  height: 1px;
  background: rgb(255 255 255 / 0.18);
  overflow: hidden;
}
/* Before the first download reports (the page's own scripts are still arriving) a short light runs along
   the track, so the hairline is never a dead line; main.js adds .loader-moving once there is progress. */
.loader__track::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  background: var(--snow);
  opacity: 0;
  transform: translateX(-100%);
}
.is-loading:not(.loader-moving) .loader__track::after {
  opacity: 0.75;
  animation: loader-seek 1.5s var(--ease) infinite;
}
@keyframes loader-seek {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}
@keyframes loader-breathe {
  from { opacity: 0.1; }
  to { opacity: 0.45; }
}
.loader__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--snow);
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  transition: transform 0.4s var(--ease);
}
.is-loading .loader { visibility: visible; opacity: 1; transition-delay: 0s; }
.is-loading.loader-off .loader { visibility: hidden; opacity: 0; }
.is-loading:not(.cue-shown) .cue { opacity: 0; }


/* 10. Preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --rise: 0rem;
    --beat-rise: 0rem;
  }
  .js [data-reveal] { transition-duration: 0.4s; transition-delay: 0s; }
  .cue__chevron { animation: none; }
  .is-loading:not(.loader-moving) .loader__track::after { inset: 0; width: auto; transform: none; animation: loader-breathe 1.6s ease-in-out infinite alternate; }
  .replay[data-state="playing"] .pill__fill { transition: none; }
  .nav__links li,
  .link__chevron,
  .button,
  .pill { transition-duration: 0.01s; }
}

@media (forced-colors: active) {
  .button,
  .pill,
  .nav__pill { border: 1px solid ButtonText; }
  .loader__track { border: 1px solid CanvasText; height: 4px; }
  /* One opaque bar in the system's canvas colour, everywhere (over the film too), and the logo that reads on
     it: the system palette, not the section under the bar, decides which. */
  .nav::before { bottom: 0 !important; background: Canvas !important; opacity: 1 !important; }
  .nav::after { opacity: 0 !important; }
  .nav .nav__emblem--on-dark { opacity: 0 !important; }
  .nav .nav__emblem--on-light { opacity: 1 !important; }
  /* The full logo exists only reversed: it keeps a black plate of its own. */
  .footer__logo,
  .error__logo { padding: 0.5rem 0.75rem !important; background: #000; forced-color-adjust: none; }
  .lines { forced-color-adjust: none; }
  /* The browser paints an opaque plate behind each block of text, and a large headline's plate reaches up over
     the label above it: the label is lifted clear. */
  .eyebrow,
  .label { position: relative; z-index: 1; }
}
@media (forced-colors: active) and (prefers-color-scheme: dark) {
  .nav .nav__emblem--on-dark { opacity: 1 !important; }
  .nav .nav__emblem--on-light { opacity: 0 !important; }
}

@media print {
  #stage, .nav, .cue, .loader, .skip, [data-replay], .hint { display: none !important; }
  .chapter, .chapter__pin { height: auto !important; position: static !important; }
  .beat { position: static !important; opacity: 1 !important; transform: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
