/* ============================================================
   RowPal — the home page (index.html) and the help page (help.html)
   Built from the "Redesign" page of the RowPal Paper file:
   "Home — Desktop, data panels" (1440 wide), "Home — Mobile,
   redesign" (390 wide), the two "Help — … redesign" frames and
   "Motion notes". It's still called v2.css from when the redesign
   sat beside the old home page.

   index.html and help.html use this file. styles.css is only for the
   old home page, kept as v1.html.

   Every type size is a variable in the :root block below, so the
   typography can be adjusted in one place.
   ============================================================ */

:root {
  /* ---- section backgrounds ---- */
  --sky:            #c3eeff;
  --mint:           #edf4ea;
  --blue:           #005aae;
  --rose:           #e9dadb;   /* data steps: heart rate */
  --peach:          #e9dbd3;   /* data steps: power */
  --heather:        #e3dbe5;   /* data steps: force curve */
  --cream:          #f7eee2;
  --navy:           #000d36;
  --cloud:          #e6ecee;   /* header, hero and How it works */

  /* ---- ink ---- */
  --ink:            #000000;
  --ink-soft:       #1b2a3a;   /* hero intro                */
  --ink-invert:     #f7fdff;
  --cyan:           #06b6d4;   /* "ANY", and PAL in the logo */
  --red:            #ea1628;   /* Stay in the zone          */
  --grey:           #4e4e4e;   /* Zone text                 */
  --gold:           #9c6f1a;   /* FAQs                      */
  --cta-bg:         #272727;
  --teal:           #12a99a;   /* footer links              */
  --footer-grey:    #a8b3d5;
  --footer-rule:    #1e2c54;

  /* ---- new in v2, from the app icon and the app's screens ---- */
  --yellow:         #ffbe3b;   /* the R in the app icon: stickers, badges, footer button */
  --wave-light:     #a7d6ff;   /* the app icon's waves      */
  --wave-mid:       #62aef1;
  --pal-card:       #1e293b;   /* pal cards                 */

  /* ---- fonts ---- */
  --font-heading: "Plein", ui-rounded, "SF Pro Rounded", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* The pal cards, the race labels and the footer links: Apple's rounded
     system font where the browser has it (Safari, and browsers on iPhone),
     otherwise Nunito, a free rounded font from Google Fonts. */
  --font-ui:      ui-rounded, "SF Pro Rounded", "Nunito", "Inter", system-ui, sans-serif;

  /* ---- type sizes ----
     One line per size, running smoothly between the two Paper frames:
     the Mobile number on a 390px phone, the Desktop number once the
     window is 1245px wide (where the column reaches its full 1200px).
     In between, the size slides between the two.
     The two biggest also shrink in a short window (14.25% and 10% of
     its height), so a laptop shows more than the headline.
             (mobile)  (how far it grows)  (desktop) */
  --fs-display:    min(clamp(3.625rem, calc(3.625rem + 70 * (100vw - 390px) / 855), 8rem),
                       calc(14.25 * var(--vh)));                                             /* hero    58 → 128 */
  --fs-title:      min(clamp(3rem,     calc(3rem     + 40 * (100vw - 390px) / 855), 5.5rem),
                       calc(10 * var(--vh)));                                                /* titles  48 → 88  */
  --fs-intro:      clamp(1.1875rem, calc(1.1875rem +  7 * (100vw - 390px) / 855), 1.625rem);  /* intros  19 → 26  */
  --fs-body:       clamp(1.0625rem, calc(1.0625rem +  3 * (100vw - 390px) / 855), 1.25rem);   /* body    17 → 20  */
  --fs-faq:        clamp(1.3125rem, calc(1.3125rem +  7 * (100vw - 390px) / 855), 1.75rem);   /* FAQ q   21 → 28  */
  --fs-cta:        clamp(1.5rem,    calc(1.5rem    +  6 * (100vw - 390px) / 855), 1.875rem);  /* button  24 → 30  */
  --fs-note:       clamp(1rem,      calc(1rem      +  3 * (100vw - 390px) / 855), 1.1875rem); /* note    16 → 19  */
  --fs-card-title: clamp(1.875rem,  calc(1.875rem  + 10 * (100vw - 390px) / 855), 2.5rem);    /* cards   30 → 40  */
  --fs-card-body:  clamp(1.25rem,   calc(1.25rem   +  4 * (100vw - 390px) / 855), 1.5rem);    /* cards   20 → 24  */
  --fs-label:      0.9375rem;                                                                  /* captions   15   */

  /* ---- layout ---- */
  --content:       75rem;                                /* 1200px  */
  --pad-x:         clamp(1.25rem, 4vw, 1.375rem);        /* 20 → 22 */

  /* The waves where the water starts, from the app icon: 56 → 96px tall.
     The 3D waves need the taller box (81 → 139px) for their far layers. */
  --wave-h:        clamp(3.5rem, calc(3.5rem + 40 * (100vw - 390px) / 855), 6rem);
  --waves-h:       calc(var(--wave-h) * 1.45);

  /* ---- the header ----
     It stays on screen, so the sections fit themselves into what's left
     of the window under it: --header-h. */
  --header-pad:    clamp(0.875rem, calc(0.875rem + 8 * (100vw - 390px) / 855), 1.375rem);  /* 14 → 22 */
  --logo-h:        clamp(2.875rem, calc(2.875rem + 14 * (100vw - 390px) / 855), 3.75rem);  /* 46 → 60 */
  --header-h:      calc(2 * var(--header-pad) + var(--logo-h));

  /* ---- one percent of the window height ----
     svh ignores the toolbars that come and go on phones; older
     browsers fall back to plain vh. */
  --vh:            1vh;
}

@supports (height: 1svh) {
  :root { --vh: 1svh; }
}

/* ---- Short windows ----
   A laptop's browser window is often only 650–800px tall. There the
   header slims down to 70px. The big type, the gaps around it and each
   section's main picture also shrink with the window's height (the
   min() lines further down), so every section fits on screen. Phones
   and tall windows keep the full sizes. */
@media (max-height: 880px) and (min-width: 700px) {
  :root {
    --header-pad: 0.75rem;                       /* 12px */
    --logo-h:     2.875rem;                      /* 46px */
  }

  /* The header's Download button, no taller than the logo. */
  .header .button--small { padding-block: 0.5625rem; }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;              /* safety net: never scroll sideways */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--cloud);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
p, h1, h2, h3 { margin: 0; }

/* The header stays on screen, so a link to a section stops just below it. */
[id] { scroll-margin-top: calc(var(--header-h) + 1.5rem); }

/* Each band paints one full-width stripe of colour; .wrap holds the
   1200px column in the middle of it. */
.band { width: 100%; }
.band--cloud { background: var(--cloud); }
.band--blue  { background: var(--blue); }
.band--rose  { background: var(--rose); }
.band--cream { background: var(--cream); }
.band--navy  { background: var(--navy); }

.wrap {
  max-width: calc(var(--content) + 2 * var(--pad-x));
  margin: 0 auto;
  padding-inline: var(--pad-x);
}

/* ===================== Header ===================== */

/* Stays at the top while the page scrolls. Once the page has moved, the
   script adds .is-scrolled and the bar turns see-through and blurs what
   passes under it. */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header.is-scrolled {
  background: color-mix(in srgb, var(--cloud) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 rgba(0, 13, 54, 0.08);
}

.header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--header-pad);
}

.logo-link { display: block; }

.header .logo {
  width: auto;
  height: var(--logo-h);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;                                  /* 28px */
}

.header__link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.0625rem;                          /* 17px */
  line-height: 1.5rem;
  color: var(--ink);
  text-decoration: none;
}

.header__link:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* On a phone the header keeps only the logo and the Download button. */
@media (max-width: 699px) {
  .header__link { display: none; }
}

/* ===================== Download buttons ===================== */

.button {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.875rem, calc(0.875rem + 4 * (100vw - 390px) / 855), 1.125rem);           /* 14 → 18 */
  padding-block: clamp(0.8125rem, calc(0.8125rem + 5 * (100vw - 390px) / 855), 1.125rem); /* 13 → 18 */
  padding-inline: clamp(1.75rem, calc(1.75rem + 10 * (100vw - 390px) / 855), 2.375rem)    /* 28 → 38 */
                  clamp(0.8125rem, calc(0.8125rem + 5 * (100vw - 390px) / 855), 1.125rem);
  border-radius: 999px;
  background: var(--cta-bg);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-cta);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;                         /* it's a link to the App Store */
  /* A solid shadow straight underneath, so the button sits up like a key. */
  box-shadow: 0 0.375rem 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button__arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(2.5rem, calc(2.5rem + 8 * (100vw - 390px) / 855), 3rem);  /* 40 → 48 */
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  transition: transform 0.2s ease;
}

.button__arrow svg { width: 46%; height: 46%; }

/* Pointing at a button nudges its arrow down; pressing sinks the button
   into its shadow. */
.button:hover .button__arrow { transform: translateY(3px); }

.button:active {
  transform: translateY(0.25rem);
  box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.15);
}

.button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.button--small {
  gap: clamp(0.5rem, calc(0.5rem + 2 * (100vw - 390px) / 855), 0.625rem);                /* 8 → 10 */
  padding-block: clamp(0.5625rem, calc(0.5625rem + 3 * (100vw - 390px) / 855), 0.75rem); /* 9 → 12 */
  padding-inline: clamp(1rem, calc(1rem + 6 * (100vw - 390px) / 855), 1.375rem)          /* 16 → 22 */
                  clamp(0.5625rem, calc(0.5625rem + 5 * (100vw - 390px) / 855), 0.875rem);
  font-size: clamp(1rem, calc(1rem + 3 * (100vw - 390px) / 855), 1.1875rem);             /* 16 → 19 */
  box-shadow: none;
}

.button--small .button__arrow {
  width: clamp(1.5rem, calc(1.5rem + 4 * (100vw - 390px) / 855), 1.75rem);               /* 24 → 28 */
}

.button--small:active { box-shadow: none; transform: translateY(1px); }

.button--yellow {
  background: var(--yellow);
  color: var(--navy);
  box-shadow: 0 0.375rem 0 rgba(0, 0, 0, 0.35);
}

.button--yellow:active { box-shadow: 0 0.125rem 0 rgba(0, 0, 0, 0.35); }

.button--yellow .button__arrow {
  background: var(--navy);
  color: var(--yellow);
}

.button--yellow:focus-visible { outline-color: var(--yellow); }

/* ===================== Hero ===================== */

/* The hero and How it works share one colour, so the phone with the video
   runs straight on into the next section. --phone-w is the phone's width:
   224px on a phone, 312px at full size, and in a short window never taller
   than the space under the header, less 40px. */
.hero {
  --phone-w:  min(clamp(14rem, calc(14rem + 88 * (100vw - 390px) / 855), 19.5rem),        /* 224 → 312 */
                  calc((100 * var(--vh) - var(--header-h) - 2.5rem) * 312 / 652));
  background: var(--cloud);
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: min(clamp(1.875rem, calc(1.875rem + 22 * (100vw - 390px) / 855), 3.25rem),  /* 30 → 52 */
                   calc(5.8 * var(--vh)));
  text-align: center;
}

.hero__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-display);
  line-height: 1.08;
  letter-spacing: -0.045em;
  color: var(--ink);
  text-wrap: balance;
}

/* ANY carries a hand-drawn wave under it. The em is a box of its own so
   the wave can hang from it. */
.hero__title em {
  position: relative;
  display: inline-block;
  font-style: normal;
}

.hero__title em { color: var(--cyan); }

.squiggle {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  overflow: visible;
  pointer-events: none;
}

.squiggle path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The hero wave: 240 x 27px under a 128px ANY, scaled with the type. */
.hero__title .squiggle {
  bottom: -0.07em;                               /* its top edge just clears the baseline */
  width: 1.875em;
  height: auto;
  aspect-ratio: 252 / 28;
}

.hero__title .squiggle path { stroke-width: 9; }

.hero__lede {
  max-width: 33em;                               /* 860px at full size */
  margin-top: min(clamp(1.5rem, calc(1.5rem + 12 * (100vw - 390px) / 855), 2.25rem),  /* 24 → 36 */
                  calc(4 * var(--vh)));
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-intro);
  line-height: 1.46;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.hero__cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, calc(1rem + 6 * (100vw - 390px) / 855), 1.375rem);              /* 16 → 22 */
  margin-top: min(clamp(1.875rem, calc(1.875rem + 14 * (100vw - 390px) / 855), 2.75rem), /* 30 → 44 */
                  calc(4.9 * var(--vh)));
}

/* The button and its sticker. The sticker hangs off the button's right end. */
.cta-group {
  position: relative;
  --sticker: clamp(4.875rem, calc(4.875rem + 26 * (100vw - 390px) / 855), 6.5rem);  /* 78 → 104 */
}

.sticker {
  position: absolute;
  top: calc(var(--sticker) * -0.3);
  right: calc(var(--sticker) * -1.03);
  width: var(--sticker);
  height: var(--sticker);
  rotate: 12deg;
  pointer-events: none;
}

.sticker__inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.sticker svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--yellow);
}

.sticker__text {
  position: relative;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: calc(var(--sticker) * 0.25);   /* 26px on the 104px sticker */
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--navy);
}

/* On the narrowest phones there's no room beside the button, so the
   sticker overlaps its end instead. */
@media (max-width: 359px) {
  .sticker { right: calc(var(--sticker) * -0.6); }
}

.hero__note {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-note);
  line-height: 1.38;
  color: var(--blue);
}

/* The app in action: the App Store video, without its sound, in a phone
   with a 10px dark edge at 312px wide. The screen's corners follow the
   app's control panel, as an iPhone's do: in the 720px video the panel's
   corners are 88px round and sit about 18px in, so the screen's are 106px
   round (43px here), and the outside corner adds the 10px edge. */
.hero__art {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: min(clamp(2.5rem, calc(2.5rem + 32 * (100vw - 390px) / 855), 4.5rem),  /* 40 → 72 */
                  calc(8 * var(--vh)));
}

.hero__phone {
  width: var(--phone-w);
  border: calc(var(--phone-w) * 10 / 312) solid #0c2d3a;
  border-radius: calc(var(--phone-w) * 53 / 312);
  overflow: hidden;
  background: #0c2d3a;
}

.hero__video {
  display: block;
  width: 100%;
  height: auto;
}

/* Pause and play, beside the phone's bottom corner. The script shows it. */
.hero__pause {
  position: absolute;
  bottom: 1rem;
  left: calc(50% + var(--phone-w) / 2 + 1rem);
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #0c2d3a;
  color: #fff;
  cursor: pointer;
}

.hero__pause[hidden] { display: none; }

.hero__pause svg { width: 0.875rem; height: 0.875rem; }
.hero__pause .icon-play,
.hero__pause.is-paused .icon-pause { display: none; }
.hero__pause.is-paused .icon-play { display: block; }

.hero__pause:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ===================== Shared section shell ===================== */

.section__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, calc(0.75rem + 6 * (100vw - 390px) / 855), 1.125rem);  /* 12 → 18 */
  text-align: center;
}

.section__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.section__intro {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-intro);
  line-height: 1.4;
  text-wrap: balance;
}

/* ===================== How it works ===================== */

.section--how {
  /* Between the title and its intro (12 → 18px), and between the intro
     and the cards (32 → 64px, less in a short window). */
  --head-inner: clamp(0.75rem, calc(0.75rem + 6 * (100vw - 390px) / 855), 1.125rem);
  --head-gap:   min(clamp(2rem, calc(2rem + 32 * (100vw - 390px) / 855), 4rem), calc(7.1 * var(--vh)));
}

.section--how > .wrap {
  padding-top: min(clamp(4rem, calc(4rem + 56 * (100vw - 390px) / 855), 7.5rem),   /* 64 → 120 */
                   calc(13.3 * var(--vh)));
  /* Room at the bottom for the waves of the next section, plus a gap. */
  padding-bottom: calc(var(--waves-h) + clamp(2.75rem, calc(2.75rem + 10 * (100vw - 390px) / 855), 3.375rem));
}

.section--how .section__head { gap: var(--head-inner); }

.section--how .section__title { color: var(--ink); }
.section--how .section__intro { color: color-mix(in srgb, var(--ink) 85%, transparent); }

.cards {
  --cards-gap: clamp(1.5rem, 3.2vw, 2.5rem);     /* 24 → 40px */
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--cards-gap);
  margin-top: var(--head-gap);
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--ink);
  border-radius: 1.875rem;                       /* 30px */
  overflow: hidden;                              /* keeps the artwork inside the rounded corners */
  color: #ffffff;
}

.card__copy {
  position: relative;
  z-index: 1;                                    /* stays above the artwork's clear top edge */
  display: flex;
  flex-direction: column;
  gap: 0.625rem;                                 /* 10px */
  padding: clamp(1.5rem, 3.2vw, 2.5rem) clamp(1.5rem, 3.2vw, 2.5rem) 0;
}

.card__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-card-title);
  line-height: 1.29;
}

.card__body {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-card-body);
  line-height: 1.4;
}

/* The artwork is a transparent SVG, so the card's own colour shows
   behind it. Each one sits against the bottom of the card. The numbers
   are percentages of the 580px card width, so the artwork keeps its
   position as the card gets narrower. */
.card__art--erg    { margin-top: -5.941%; }     /* starts 34.5px above the copy's bottom edge */
.card__art--camera { margin-top: 0.814%; }      /* starts 4.7px below the copy */

.card__art-svg {
  display: block;
  /* When the picture has to shrink, it shrinks towards the bottom centre
     of the card, so it still sits on the card's bottom edge. */
  object-fit: contain;
  object-position: 50% 100%;
  /* Stacked on a phone: never taller than most of the screen. */
  max-height: calc(60 * var(--vh));
}

.card__art--erg .card__art-svg    { width: 100%; }                         /* 580 of 580px */
.card__art--camera .card__art-svg { width: 92.759%; margin-left: 1.728%; } /* 538 of 580px, 10px in */

/* The Bluetooth badge's signal rings, drawn inside the PM5 picture. */
.bt-ring {
  transform-box: fill-box;
  transform-origin: center;
}

/* The yellow "or" between the two cards. Side by side it sits in the
   middle of the gap; stacked, it sits in the gap between the two cards,
   overlapping both. */
.or-badge {
  --or: clamp(4.25rem, calc(4.25rem + 32 * (100vw - 390px) / 855), 6.25rem);  /* 68 → 100 */
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  justify-self: center;
  width: var(--or);
  height: var(--or);
  margin-block: calc(var(--cards-gap) * -0.5 - var(--or) / 2);
  border: calc(var(--or) * 0.08) solid var(--cloud);   /* the section's colour, so it looks cut out */
  border-radius: 50%;
  background: var(--yellow);
  rotate: -10deg;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: calc(var(--or) * 0.38);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--navy);
}

.or-badge span { translate: 0 -0.08em; }        /* "or" has no tall letters: lift it to look centred */

@media (min-width: 801px) {
  .or-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 0;
    translate: -50% -50%;
  }
}

@media (max-width: 800px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Fit the cards to the window height ----
   While the cards sit side by side, the heading and both cards fit in
   the window under the header. The cards get what's left after the
   header, the title, its one-line intro, the gaps and 2rem to spare,
   between 416px and the design's 695px. The artwork shrinks to fit the
   room left under the text. */
@media (min-width: 801px) {
  .card {
    height: clamp(26rem,
                  calc(100 * var(--vh) - var(--header-h) - var(--fs-title) * 1.05 - var(--head-inner)
                       - var(--fs-intro) * 1.4 - var(--head-gap) - 2rem),
                  43.4375rem);
  }
  .card__copy  { flex-shrink: 0; }

  .card__art {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .card__art-svg {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
  }
}

/* ===================== Waves ===================== */

/* The app icon's water, sitting on top of the band above. Where the
   browser can, the script draws it in 3D on a canvas (.waves__canvas):
   five layers of water at different distances, with the far ones smaller,
   paler and slower. The box is taller than the flat waves to leave room
   for the far layers.

   Without the script, or with Reduce Motion on, three flat layers stand
   in. Each is a wave shape repeated sideways, so it fits any window width
   and can drift forever. --tile is one wave length. */
.waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 1px);                      /* 1px overlap: no hairline gap */
  height: var(--waves-h);
  overflow: hidden;
  pointer-events: none;
}

/* The 3D water fades in over the flat layers, which then hide. */
.waves__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.waves.is-3d .waves__canvas { opacity: 1; }

.waves.is-3d .waves__layer {
  visibility: hidden;
  transition: visibility 0s linear 0.6s;
}

/* --phase starts each layer part of the way along its wave (in wave
   lengths), so the three layers don't line up. */
.waves__layer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(100% + var(--tile));
  height: var(--wave-h);
  background: var(--colour);
  -webkit-mask: var(--shape) repeat-x;
  mask: var(--shape) repeat-x;
  -webkit-mask-size: var(--tile) 100%;
  mask-size: var(--tile) 100%;
  -webkit-mask-position: calc(var(--tile) * var(--phase, 0)) 0;
  mask-position: calc(var(--tile) * var(--phase, 0)) 0;
}

/* The back two layers stop 6px short of the bottom, where the front layer
   covers them anyway. Otherwise their soft bottom edges show through the
   front layer's as a faint line across the top of the band. */
.waves__layer--back,
.waves__layer--mid { clip-path: inset(0 0 6px 0); }

.waves__layer--back {
  --tile: calc(var(--wave-h) * 340 / 96);
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 96' preserveAspectRatio='none'%3E%3Cpath d='M0 30Q85 8 170 30T340 30V96H0Z'/%3E%3C/svg%3E");
  --colour: var(--wave-light);
}

.waves__layer--mid {
  --tile: calc(var(--wave-h) * 420 / 96);
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 96' preserveAspectRatio='none'%3E%3Cpath d='M0 48Q105 26 210 48T420 48V96H0Z'/%3E%3C/svg%3E");
  --colour: var(--wave-mid);
  --phase: -0.4;
}

.waves__layer--front {
  --tile: calc(var(--wave-h) * 480 / 96);
  --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 96' preserveAspectRatio='none'%3E%3Cpath d='M0 66Q120 42 240 66T480 66V96H0Z'/%3E%3C/svg%3E");
  --colour: var(--blue);
  --phase: -0.2;
}

/* Over the footer, the water gets deeper: light, lake blue, then navy. */
.footer .waves__layer--mid   { --colour: var(--blue); --phase: -0.7; }
.footer .waves__layer--front { --colour: var(--navy); --phase: -0.55; }

/* ===================== Don't row alone ===================== */

.section--alone {
  position: relative;
  padding-top: min(clamp(3.5rem, calc(3.5rem + 48 * (100vw - 390px) / 855), 6.5rem),   /* 56 → 104 */
                   calc(11.5 * var(--vh)));
  padding-bottom: min(clamp(4rem, calc(4rem + 56 * (100vw - 390px) / 855), 7.5rem),    /* 64 → 120 */
                      calc(13.3 * var(--vh)));
}

.section--alone .section__head {
  margin-bottom: min(clamp(1.75rem, calc(1.75rem + 28 * (100vw - 390px) / 855), 3.5rem),  /* 28 → 56 */
                     calc(6.2 * var(--vh)));
}

.section--alone .section__title { color: var(--ink-invert); }

.section--alone .section__intro {
  max-width: 31.5em;                             /* 820px at full size */
  color: color-mix(in srgb, var(--ink-invert) 86%, transparent);
}

/* Everything in the scene is sized in em, where 1em is 16 Paper pixels,
   so the whole scene scales by changing one font size. It's drawn at
   full size unless one of these makes it smaller:
   - on phones narrower than about 557px, so the phone fits across;
   - in a window too short for the 940px scene, so the phone and the
     cards fit under the header with 2rem to spare. It stops shrinking
     at 10px to the em (62.5%), where the card text is still 12.5px. */
.race {
  position: relative;
  font-size: min(1rem, 2.87vw,
                 max(0.625rem, calc((100 * var(--vh) - var(--header-h) - 2rem) / 58.75)));
  height: 58.75em;                         /* the 940px scene */
  overflow: hidden;                        /* the scene is wider than most windows: trim it at the edges */
}

/* The scene, the ghost and the labels share one box: the 1719 x 940
   picture. The phone sits 2.5px left of the picture's middle; this puts
   the phone, not the picture, in the middle of the window. */
.race__stage {
  position: absolute;
  top: 0;
  left: 50%;
  width: 107.4375em;                       /* 1719px */
  height: 58.75em;                         /* 940px  */
  transform: translateX(calc(-50% + 0.15625em));
}

.race__scene {
  width: 100%;
  max-width: none;
  height: auto;
}

/* The rower, with its oars fading into the water and its boat's shadow.
   Its box is its place in the scene (530.7, 163, 672.8 x 345). */
.race__rower {
  position: absolute;
  left: 33.1709em;
  top: 10.1871em;
  width: 42.0474em;
  height: 21.5608em;
  max-width: none;
}

/* The ghost rower is its own picture so it can fade out when nobody is
   picked. Its box is its place in the scene (585, 100, 295 x 185). */
.race__ghost {
  position: absolute;
  left: 36.5625em;
  top: 6.25em;
  width: 18.4375em;
  height: 11.5625em;
  transition: opacity 0.4s ease;
}

.race__ghost img {
  width: 100%;
  max-width: none;
  height: auto;
}

/* With "Just me and my thoughts" picked, the ghost leaves the water. */
.race__ghost.is-gone { opacity: 0; }

.race__label {
  position: absolute;
  display: flex;
  align-items: center;
  border-radius: 999px;
  font-family: var(--font-ui);
  line-height: 1.2;
  white-space: nowrap;
}

/* The ghost's label: who it is. Its right end stays just inside the
   phone's edge, so it reads from the outside in, whatever the name. */
.race__label--ghost {
  right: 14em;
  top: 0.75em;
  padding: 0.5em 0.875em;
  background: color-mix(in srgb, var(--ink-invert) 18%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--ink-invert) 35%, transparent);
  rotate: -4deg;
  font-weight: 700;
  font-size: 1.0625em;                     /* 17px */
  color: var(--ink-invert);
}

.race__label--you {
  left: 61.1875em;                         /* (979, 168) in the scene: by the rower's cap */
  top: 10.5em;
  padding: 0.47em 0.94em;
  background: var(--yellow);
  rotate: 5deg;
  box-shadow: 0 0.25em 0 rgba(0, 0, 0, 0.15);
  font-weight: 800;
  font-size: 1.0625em;                     /* 17px */
  color: var(--navy);
}

/* When the edge of the window cuts close to the phone, the ghost's label
   moves inside the phone, above the ghost (centred where the old, longer
   label was centred). */
@media (max-width: 899px) {
  .race__label--ghost { right: auto; left: 11.85em; top: -1.75em; translate: -50% 0; }
  .race__label--you   { left: 58.625em; }
}

/* The strip of cards, laid over the phone's "Choose Your Pal" panel. It runs
   the full window width and pages one card at a time; the card that comes to
   rest in the middle, over the phone, is the selected one. */
.pal-cards {
  position: absolute;
  left: 0;
  right: 0;
  top: 36.96875em;                         /* 591.5px down the scene */
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;           /* a swipe comes to rest with a card centred */
  overscroll-behavior-x: contain;          /* a sideways swipe moves the cards, not the browser back */
  scrollbar-width: none;
  cursor: grab;                            /* mouse users can click and drag the row */
  -webkit-user-select: none;               /* dragging shouldn't select the card text */
  user-select: none;
}

.pal-cards::-webkit-scrollbar { display: none; }

.pal-cards.is-grabbing { cursor: grabbing; }

/* While a mouse drags the row, and while it glides to a card afterwards,
   snapping is off so it can't fight the mouse. */
.pal-cards.is-settling { scroll-snap-type: none; }

.pal-card img { -webkit-user-drag: none; }  /* no ghost image when dragging over an icon */

.pal-cards:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: -3px;
}

.pal-cards__track {
  display: flex;
  gap: 1em;                                /* 16px */
  width: max-content;
  margin: 0;
  /* Half a window, less half a card, before the first card and after the last,
     so even the end cards can scroll to the middle. 5px underneath for the shadow. */
  padding: 0 calc(50% - 10.3125em) 0.3125em;
  list-style: none;
}

/* Page dots, one per card, under the cards. The script moves .is-active
   to whichever card is centred. */
.pal-dots {
  position: absolute;
  top: 49.281em;                           /* 788.5px down the scene */
  left: 50%;
  transform: translateX(-50%);             /* centred on the phone, which sits in the middle of the window */
  display: flex;
  gap: 0.4375em;                           /* 7px */
}

.pal-dots__dot {
  width: 0.9375em;                         /* 15px */
  height: 0.9375em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: background-color 0.2s ease;
}

.pal-dots__dot.is-active { background: rgba(255, 255, 255, 0.95); }

.pal-card {
  flex: 0 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;       /* title, number, note */
  row-gap: 0.5625em;                       /* 9px */
  width: 20.625em;                         /* 330px */
  height: 11em;                            /* 176px */
  padding: 1.25em;                         /* 20px */
  border-radius: 0.875em;                  /* 14px */
  background: var(--pal-card);
  box-shadow: 0.3125em 0.3125em 0 rgba(0, 0, 0, 0.12);
  color: #ffffff;
  font-family: var(--font-ui);
  scroll-snap-align: center;
  scroll-snap-stop: always;                /* one card per swipe, never flung past */
}

/* The selected card's 2px outline sits inside the card, without moving
   anything in it, so it's an inset shadow rather than a border. */
.pal-card--selected {
  box-shadow: inset 0 0 0 0.125em rgba(213, 213, 213, 0.18),
              0.3125em 0.3125em 0 rgba(0, 0, 0, 0.12);
}

.pal-card__title,
.pal-card__note {
  font-size: 1.25em;                       /* 20px */
  line-height: 1.2;                        /* 24px row */
  min-height: 1.2em;                       /* keeps the first card's empty note row */
  white-space: nowrap;
}

.pal-card__title { font-weight: 700; }

.pal-card__note {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* The big number sits on the bottom of its row, with its box trimmed to the
   tops of the capitals. */
.pal-card__value {
  align-self: end;
  font-size: 3.625em;                      /* 58px */
  font-weight: 700;
  line-height: 1;
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}

.pal-card__small { font-size: 0.65517em; }  /* 38px */

.pal-card__unit {
  font-size: 0.31034em;                    /* 18px */
  color: rgba(255, 255, 255, 0.5);
  margin-left: 0.16667em;                  /* 3px */
}

.pal-card__trophy {
  display: inline-block;
  width: 1.0675em;                         /* 21.35px, in 20px title units */
  height: 1.1645em;                        /* 23.29px */
  margin: 0 0.3em 0 0.1em;                 /* 2px in from the edge, 6px before the words */
  vertical-align: -0.225em;                /* bottom 4.5px under the baseline */
}

.pal-card--pace {
  display: flex;
  align-items: center;
  gap: 0.625em;                            /* 10px */
}

.pal-card__main {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 0.5625em;
}

.pal-card__stepper {
  display: flex;
  flex-direction: column;
  gap: 0.5em;                              /* 8px */
}

.pal-card__stepper img {
  width: 4em;                              /* 64px */
  height: 4em;
}

.pal-card--solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.53125em;                          /* 8.5px: the fish file has 0.5px spare at its top */
}

.pal-card--solo .pal-card__note { min-height: 0; }

.pal-card__fish {
  width: 1.858em;                          /* 29.73px */
  height: 1.5375em;                        /* 24.6px */
}

/* ===================== Heart rate, power, force curve ===================== */

/* Three steps, each some words and a panel from the app's row screen.
   On a phone, and in a short window, they sit one after another. */

/* Each step has its own background: rose for heart rate, peach for power
   and heather for the force curve, all equally light. The script sets
   data-step on the section when the words change, and the whole section
   fades to the new colour with them. */
.section--data { transition: background-color 0.6s ease; }
.section--data[data-step="1"] { background-color: var(--peach); }
.section--data[data-step="2"] { background-color: var(--heather); }

.data {
  display: grid;
  row-gap: clamp(1.375rem, calc(1.375rem + 8 * (100vw - 390px) / 855), 1.875rem);    /* 22 → 30 */
  padding-top: min(clamp(4.5rem, calc(4.5rem + 78 * (100vw - 390px) / 855), 9.375rem),     /* 72 → 150 */
                   calc(16.7 * var(--vh)));
  padding-bottom: min(clamp(5.25rem, calc(5.25rem + 66 * (100vw - 390px) / 855), 9.375rem), /* 84 → 150 */
                      calc(16.7 * var(--vh)));
}

/* Stacked, the two columns step aside and each part takes its own row:
   words, panel, words, panel, words, panel. */
.data__copy,
.data__pin,
.data__texts,
.data__panels { display: contents; }

.data__text:nth-child(1) { grid-row: 1; }
.data__slot:nth-child(1) { grid-row: 2; }
.data__text:nth-child(2) { grid-row: 3; }
.data__slot:nth-child(2) { grid-row: 4; }
.data__text:nth-child(3) { grid-row: 5; }
.data__slot:nth-child(3) { grid-row: 6; }

/* More room before the next step's words than inside a step. */
.data__text + .data__text {
  margin-top: clamp(2.5rem, calc(2.5rem + 24 * (100vw - 390px) / 855), 4rem);      /* 40 → 64 */
}

.data__text {
  display: flex;
  flex-direction: column;
  gap: clamp(1.375rem, calc(1.375rem + 8 * (100vw - 390px) / 855), 1.875rem);       /* 22 → 30 */
}

.data__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--red);
  text-wrap: balance;
}

/* Titles are two lines where the words stay put, as in Paper; stacked,
   they wrap where they need to. */
.data__break { display: none; }

.data__lede {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-intro);
  line-height: 1.4;
  color: var(--grey);
  text-wrap: pretty;
}

/* The two app icons with arrows between them, and a line under them. */
.data__pair {
  display: flex;
  align-items: center;
  gap: 0.875rem;                                 /* 14px */
}

.data__pair img { width: 11.25rem; flex: none; } /* 180px */

.data__caption {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;                           /* 14px */
  line-height: 1.36;
  color: var(--grey);
}

/* The steps: a bar for each, which fills red once its panel has come up,
   and its name. Only shown when the words stay put. */
.data__steps {
  display: none;
  gap: 0.75rem;                                  /* 12px */
  margin: 0;
  padding: 0;
  list-style: none;
}

.data__steps li { flex: 1 1 0; min-width: 0; }

.data__step {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;                                 /* 10px */
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-label);
  line-height: 1.33;
  letter-spacing: 0.01em;
  color: var(--grey);
  text-decoration: none;
  transition: color 0.3s ease;
}

.data__step::before {
  content: "";
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(var(--red), var(--red)) left / 0% 100% no-repeat,
              rgba(234, 22, 40, 0.2);
  transition: background-size 0.3s ease-out;
}

.data__step.is-done::before { background-size: 100% 100%; }

.data__step[aria-current],
.data__step:hover { color: var(--ink); }

.data__step:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 4px;
}

/* The panels: 620px wide at most. Stacked, each sits a little further
   from the words above it than the gap between the rest. */
.data__slot {
  display: flex;
  justify-content: center;
  padding-top: 0.75rem;
}

.data__panel {
  display: block;
  width: 100%;
  max-width: 38.75rem;                           /* 620px */
  height: auto;
}

.panel-heart {
  transform-box: fill-box;
  transform-origin: center;
}

/* ---- The words stay put ----
   From 900px wide, in a window at least 600px tall. --view is the part
   of the window below the header. */
@media (min-width: 900px) and (min-height: 600px) {
  .data {
    --view: calc(100 * var(--vh) - var(--header-h));
    grid-template-columns: minmax(0, 31.25rem) minmax(0, 38.75rem);   /* 500 + 620px */
    justify-content: space-between;
    column-gap: 3rem;
    padding-block: 0;
  }

  .data__copy { display: block; }

  /* As tall as the view, with the words centred in it, for as long as
     the panels take to scroll by. */
  .data__pin {
    position: sticky;
    top: var(--header-h);
    height: var(--view);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2.75rem;                                /* 44px, steps to title */
  }

  .data__steps { display: flex; }

  .data__break { display: inline; }

  /* The three sets of words lie on top of each other, titles level.
     Only the active one shows; the others fade out. */
  .data__texts { display: grid; }

  .data__text:nth-child(n) {
    grid-area: 1 / 1;
    margin-top: 0;
    opacity: 0;
    transform: translateY(0.75rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .data__text.is-active { opacity: 1; transform: none; }

  .data__pair {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 0.625rem;
  }

  .data__pair img { width: 18.75rem; }           /* 300px */

  .data__caption { font-size: var(--fs-label); }

  /* The panels scroll by at the page's own speed, each in a slot 90% of
     the view's height, so the next one comes up as the last one leaves
     (and is out of sight under the header once the next is centred).
     The padding puts the first and last panels level with the words. */
  .data__panels {
    display: block;
    padding-block: calc(var(--view) * 0.05);
  }

  .data__slot {
    min-height: calc(var(--view) * 0.9);
    align-items: center;
    padding-top: 0;
  }

  /* Never taller than its slot in a short window (380 × 302 is the force
     curve panel, the tallest). */
  .data__panel { max-width: min(38.75rem, calc((var(--view) * 0.8 - 2rem) * 380 / 302)); }
}

/* ===================== FAQs ===================== */

.section--faqs > .wrap {
  display: grid;
  gap: 2rem;
  padding-top: min(clamp(4.5rem, calc(4.5rem + 78 * (100vw - 390px) / 855), 9.375rem),  /* 72 → 150 */
                   calc(16.7 * var(--vh)));
  /* Room at the bottom for the footer's waves, plus a gap. */
  padding-bottom: calc(var(--waves-h) + clamp(4rem, calc(4rem + 10 * (100vw - 390px) / 855), 4.625rem));
}

.faqs__side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(1rem, calc(1rem + 10 * (100vw - 390px) / 855), 1.625rem);  /* 16 → 26 */
}

.faqs__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--gold);
}

.faqs__lede {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: #3d3424;
}

/* The help address as a white pill with a gold envelope. */
.email-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 1.125rem 0.6875rem 0.75rem;
  border-radius: 999px;
  background: #ffffff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1rem, calc(1rem + 2 * (100vw - 390px) / 855), 1.125rem);  /* 16 → 18 */
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
}

.email-pill:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.email-pill__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--gold);
  color: #ffffff;
}

.faqs {
  display: flex;
  flex-direction: column;
  gap: clamp(0.625rem, calc(0.625rem + 4 * (100vw - 390px) / 855), 0.875rem);  /* 10 → 14 */
}

.faq {
  border-radius: clamp(1.25rem, calc(1.25rem + 4 * (100vw - 390px) / 855), 1.5rem);  /* 20 → 24 */
  background: #ffffff;
  box-shadow: 0 0.25rem 0 rgba(156, 111, 26, 0.12);
}

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.125rem, calc(1.125rem + 8 * (100vw - 390px) / 855), 1.625rem)       /* 18 → 26 */
           clamp(1.125rem, calc(1.125rem + 12 * (100vw - 390px) / 855), 1.875rem)      /* 18 → 30 */
           clamp(1.125rem, calc(1.125rem + 8 * (100vw - 390px) / 855), 1.625rem)
           clamp(1.375rem, calc(1.375rem + 12 * (100vw - 390px) / 855), 2.125rem);     /* 22 → 34 */
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-faq);
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  transition: padding-bottom 0.25s ease-out;
}

/* Open, the question sits closer to its answer: 10 → 14px between them. */
.faq[open] .faq__q {
  padding-bottom: clamp(0.625rem, calc(0.625rem + 4 * (100vw - 390px) / 855), 0.875rem);
}

.faq__q::-webkit-details-marker { display: none; }

.faq__q:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: inherit;
}

/* The round plus that turns into a cross. Two bars, one flat and one
   upright: both turn 45 degrees when the answer opens. */
.faq__toggle {
  position: relative;
  flex: none;
  width: clamp(2.25rem, calc(2.25rem + 8 * (100vw - 390px) / 855), 2.75rem);  /* 36 → 44 */
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cream);
  transition: background-color 0.25s ease;
}

.faq__toggle::before,
.faq__toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36%;
  height: 0.16rem;
  border-radius: 1px;
  background: var(--gold);
  translate: -50% -50%;
  transition: rotate 0.25s ease-out, background-color 0.25s ease;
}

.faq__toggle::after { rotate: 90deg; }

.faq[open] .faq__toggle { background: var(--gold); }

.faq[open] .faq__toggle::before,
.faq[open] .faq__toggle::after { background: #ffffff; }

.faq[open] .faq__toggle::before { rotate: 45deg; }
.faq[open] .faq__toggle::after  { rotate: 135deg; }

.faq__a {
  padding: 0 clamp(1.125rem, calc(1.125rem + 12 * (100vw - 390px) / 855), 1.875rem)
             clamp(1.375rem, calc(1.375rem + 12 * (100vw - 390px) / 855), 2.125rem)
             clamp(1.375rem, calc(1.375rem + 12 * (100vw - 390px) / 855), 2.125rem);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: #2e2a24;
  text-wrap: pretty;
}

/* The answer slides open, where the browser can animate to "auto". */
@supports (interpolate-size: allow-keywords) {
  .faqs { interpolate-size: allow-keywords; }

  .faq::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.25s ease-out, content-visibility 0.25s allow-discrete;
  }

  .faq[open]::details-content { block-size: auto; }
}

@media (min-width: 700px) {
  .faq__a { padding-right: calc(4.25rem + clamp(1.125rem, calc(1.125rem + 12 * (100vw - 390px) / 855), 1.875rem)); }
}

/* Side by side: the title and the help address stay in view while the
   questions scroll past. */
@media (min-width: 1000px) {
  .section--faqs > .wrap {
    grid-template-columns: 22.5rem minmax(0, 1fr);  /* 360px */
    column-gap: 5rem;                               /* 80px  */
    align-items: start;
  }

  .faqs__side {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
  }
}

/* ===================== Footer ===================== */

.footer { position: relative; }

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: min(clamp(4.5rem, calc(4.5rem + 48 * (100vw - 390px) / 855), 7.5rem),  /* 72 → 120 */
                   calc(13.3 * var(--vh)));
  padding-bottom: clamp(2.25rem, calc(2.25rem + 12 * (100vw - 390px) / 855), 3rem); /* 36 → 48 */
}

/* The page ends with one last chance to download. */
.footer__call {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.125rem, calc(1.125rem + 8 * (100vw - 390px) / 855), 1.625rem);         /* 18 → 26 */
  padding-bottom: min(clamp(4.5rem, calc(4.5rem + 58 * (100vw - 390px) / 855), 8.125rem),  /* 72 → 130 */
                      calc(14.4 * var(--vh)));
  text-align: center;
}

.footer__title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--fs-title);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--ink-invert);
  text-wrap: balance;
}

.footer__title em {
  font-style: normal;
  color: var(--yellow);
}

.footer__lede {
  padding-top: 0.375rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-intro);
  line-height: 1.4;
  color: var(--footer-grey);
}

.footer__bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.125rem;
  width: 100%;
  padding-top: clamp(2rem, calc(2rem + 8 * (100vw - 390px) / 855), 2.5rem);  /* 32 → 40 */
  border-top: 1.5px solid var(--footer-rule);
}

.footer__bar .logo { width: auto; height: 3.5rem; }   /* 56px */

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1.5rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: clamp(1rem, calc(1rem + 1 * (100vw - 390px) / 855), 1.0625rem);  /* 16 → 17 */
  line-height: 1.3;
}

.footer__nav a { color: var(--teal); text-decoration: none; }
.footer__nav a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.footer__copy { color: var(--footer-grey); }

@media (min-width: 700px) {
  .footer__bar {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer__nav { gap: 2rem; }
}

/* ===================== Help page (help.html) ===================== */

/* The header, the help message and the footer fill the window. The
   message sits in the middle of the space between the header and the
   footer's waves. */
.page--help {
  display: flex;
  flex-direction: column;
  min-height: calc(100 * var(--vh));
}

.page--help main,
.section--help {
  display: flex;
  flex: 1;
}

.section--help { align-items: center; }

.help {
  /* Above the words, between the words and the button, and above the
     waves: 30 → 40px, less in a short window so it all fits on screen. */
  --help-gap: min(clamp(1.875rem, calc(1.875rem + 10 * (100vw - 390px) / 855), 2.5rem),
                  calc(4.4 * var(--vh)));
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: var(--help-gap);
  padding-top: var(--help-gap);
  /* Room at the bottom for the footer's waves, plus the gap. */
  padding-bottom: calc(var(--waves-h) + var(--help-gap));
}

.section--help .section__intro {
  max-width: 37.5rem;                            /* 600px: two lines on a laptop */
  color: color-mix(in srgb, var(--ink) 85%, transparent);
}

/* On the narrowest phones the address needs a smaller size to fit. */
@media (max-width: 359px) {
  .help__email { font-size: 1.3125rem; }         /* 21px */
}

/* The footer is just the bar, without the last call or the line above it. */
.footer--short .footer__inner {
  padding-top: clamp(2rem, calc(2rem + 8 * (100vw - 390px) / 855), 2.5rem);  /* 32 → 40 */
}

.footer--short .footer__bar {
  padding-top: 0;
  border-top: 0;
}

/* In a short laptop window the bar moves closer to the waves and the
   bottom edge (24 and 36px), so the footer fits on screen too. */
@media (max-height: 880px) and (min-width: 700px) {
  .footer--short .footer__inner { padding-block: 1.5rem 2.25rem; }
}

/* ===================== Motion =====================

   Everything that moves, from the "Motion notes" board in Paper. The
   page sets .motion on <html> only when the visitor hasn't asked for
   Reduce Motion (and the browser can tell when things are on screen).
   Without it, nothing moves and the page shows the still design: every
   animation below ends on the still design's frame.

   Sections marked data-motion pause their loops while they're off
   screen (the script adds .is-paused). The rule names each looping
   part rather than everything in the section: matching every element
   made Safari restyle thousands of picture parts whenever a section
   came on or off screen, and scrolling stopped for up to 0.2s. A new
   looping animation needs its own line here. */

.motion .is-paused .bt-ring,
.motion .is-paused .pm5-dot,
.motion .is-paused .panel-heart,
.motion .is-paused .waves__layer { animation-play-state: paused !important; }

/* ---- Sections coming into view ----
   Each title and the content under it rise 24px and fade in, once. */
.motion [data-reveal] {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  transition-delay: calc(var(--i, 0) * 80ms);
}

.motion [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(24px);
}

/* ---- 1. Wave underline ----
   Under ANY in the hero. Draws itself from left to right as the page
   opens. The script then keeps it rippling sideways (6s for one wave
   length). */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

.motion .squiggle path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-line 0.9s ease-out 0.2s forwards;
}

/* ---- 2. The hero video ----
   Handled by the script: it plays, without sound and on a loop, while
   it's on screen. With Reduce Motion on it waits on its first frame until
   someone presses play. (It took the place of the bobbing phones.) */

/* ---- 3. Free! sticker ----
   Lands just after the button, a little too big, then settles at its
   tilt. Pointing at the button gives it a wiggle. */
@keyframes sticker-in {
  0%   { opacity: 0; transform: scale(0.6) rotate(22deg); }
  60%  { opacity: 1; transform: scale(1.1) rotate(-8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-6deg); }
  75%      { transform: rotate(6deg); }
}

.motion .sticker { animation: sticker-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both; }
.motion .cta-group:hover .sticker__inner { animation: wiggle 0.4s ease-in-out; }

/* ---- 4. Bluetooth signal ----
   Rings grow out of the badge and fade; the dot after Connect blinks
   in time. */
@keyframes signal {
  0%   { opacity: 0; transform: scale(0.78); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35); }
}

@keyframes blink {
  0%, 55%  { opacity: 1; }
  60%, 95% { opacity: 0.15; }
  100%     { opacity: 1; }
}

.motion .bt-ring { animation: signal 2s ease-out infinite; }
.motion .bt-ring--outer { animation-delay: 0.6s; }
.motion .pm5-dot { animation: blink 2s linear infinite; }

/* ---- 5. Drifting waves ----
   Each layer slides left one wave length per loop, at its own speed. */
@keyframes drift {
  to { transform: translateX(calc(-1 * var(--tile))); }
}

.motion .waves__layer--back  { animation: drift 40s linear infinite; }
.motion .waves__layer--mid   { animation: drift 28s linear infinite; }
.motion .waves__layer--front { animation: drift 20s linear infinite; }

/* ---- 6. The ghost rower ----
   Nothing here moves on its own. When someone moves the pal cards, the
   script changes the ghost's label to match, and the ghost fades out for
   "Just me and my thoughts" (the transition on .race__ghost). */

/* ---- 7. Heartbeat ----
   The heart beats at 145 a minute, the number beside it. */
@keyframes beat {
  0%, 45%, 100% { transform: scale(1); }
  18%           { transform: scale(1.22); }
}

.motion .panel-heart { animation: beat 0.414s ease-in-out infinite; }

/* Belt and braces: if Reduce Motion is switched on with the page open,
   stop everything. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .motion [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
  .motion .squiggle path { stroke-dasharray: none; stroke-dashoffset: 0; }
}
