@import './tokens.css';

/* One screen. Tokens are a copy of the app's src/styles/tokens.css, pinned to Royal Blue (the
   `theme-royal-blue` class on <html>) like the app's sign-in page. Values marked LANDING-ONLY are
   not in docs/design-system.md yet. */
*, *::before, *::after { box-sizing: border-box; }
html { margin: 0; background: var(--accent-800); }
body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--text-14);
  color: var(--frame-fg);
  background: var(--accent-800);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* No grey flash on tap: every control has its own pressed and focus states. */
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
a, button { touch-action: manipulation; }

.page {
  position: relative;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(60% 50% at 50% 42%, color-mix(in srgb, var(--accent-400) 20%, transparent), transparent 72%),
    var(--accent-800);
}

/* ---------- header ---------- */
.header {
  position: relative;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  opacity: 0;
  animation: rise var(--duration-slow) var(--ease-standard) 100ms forwards;
}
.logo { display: block; height: 32px; width: auto; overflow: visible; }
/* Wordmark to mark. On reading pages, once you scroll, the wordmark gathers itself into the
   mark (as on anthropic.com): p, b and the second o fade out, then the a, its tail, the red
   arrow, the l, the first o and the k spring across into the mark's pieces, crossfading as
   they go. Back at the top it opens out again. Each piece carries its own offsets: --to is
   where a wordmark piece goes in the mark, --from where a mark piece starts in the wordmark
   (generated from the two logo files' geometry). */
.logo path { transform-box: fill-box; transform-origin: center; }
:root { --logo-spring: cubic-bezier(0.34, 1.2, 0.64, 1); }
/* Opening out (also the resting state) */
.lg-fade { transition: opacity 200ms var(--ease-standard) 220ms; }
.lg-move { transition: transform 480ms var(--logo-spring), opacity 180ms var(--ease-standard) 100ms; }
.mk-move { opacity: 0; transform: var(--from); transition: transform 480ms var(--logo-spring), opacity 150ms var(--ease-standard) 60ms; }
/* Gathering in */
.header.compact .lg-fade { opacity: 0; transition: opacity 120ms var(--ease-standard); }
.header.compact .lg-move { opacity: 0; transform: var(--to); transition: transform 480ms var(--logo-spring) 60ms, opacity 180ms var(--ease-standard) 80ms; }
.header.compact .mk-move { opacity: 1; transform: none; transition: transform 480ms var(--logo-spring) 60ms, opacity 180ms var(--ease-standard) 80ms; }
.logo-link { display: block; border-radius: var(--radius-md); }
.logo-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring-on-frame); }
.nav { display: flex; align-items: center; gap: var(--space-6); }
.link {
  font-family: var(--font-body);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-14);
  color: var(--frame-fg-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}
@media (hover: hover) { .link:hover { color: var(--frame-fg); } }
.btn-outline {
  display: inline-flex; align-items: center;
  background: transparent; cursor: pointer;
  height: var(--footer-control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-14);
  color: var(--frame-fg);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
@media (hover: hover) { .btn-outline:hover { background: var(--frame-surface); border-color: var(--frame-fg-secondary); } }
.link:focus-visible, .btn-outline:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--focus-ring-on-frame);
}

/* ---------- the floor: a half court in perspective, a play running on it ---------- */
.floor {
  /* Decoration, so it gives way first: in short windows the court shrinks (down to a sliver)
     before the headline, button or footer are pushed off-screen. */
  position: relative; flex: 0 1 clamp(290px, 36vh, 440px); min-height: 48px;
  overflow: hidden;
  perspective: 1300px;
  perspective-origin: 50% 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 90%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 90%, transparent 100%);
}
.court {
  position: absolute; left: 50%; top: var(--space-2);
  width: max(1800px, 160vw);
  transform: translateX(-50%) rotateX(63deg) scale(0.5);
  transform-origin: 50% 0;
  will-change: transform;
  opacity: 0;
  animation: fade 1600ms var(--ease-standard) 300ms forwards;
}
.court svg { display: block; width: 100%; height: auto; overflow: visible; shape-rendering: geometricPrecision; }

.lines { fill: none; stroke: #fff; stroke-opacity: .16; stroke-width: 2.5; }
.lines .dash { stroke-dasharray: 10 10; }

.play { opacity: 0; animation: play 11s linear infinite; }
.ring { fill: color-mix(in srgb, var(--accent-strong-200) 14%, transparent); stroke: var(--accent-strong-200); stroke-width: 3.5; transform-box: fill-box; transform-origin: center; shape-rendering: geometricPrecision; }
.ring.idle { animation: idle 3.2s ease-in-out infinite; }
.ring.i2 { animation-delay: -.8s; } .ring.i3 { animation-delay: -1.6s; } .ring.i4 { animation-delay: -2.4s; }
.ring.hot { stroke: var(--logo-red); fill: color-mix(in srgb, var(--logo-red) 16%, transparent); }

.route { fill: none; stroke: var(--logo-red); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 11s linear infinite; }

.mover, .ball { offset-rotate: 0deg; }
.mover { offset-path: path("M200 370 C 270 340, 330 270, 500 190"); animation: cut 11s linear infinite; }
.ball  { offset-path: path("M500 440 L800 350 L500 190 L500 135"); }
.ball.b0 { animation: pass 11s linear infinite; }
.ball.b1 { animation: pass 11s linear infinite .07s; }
.ball.b2 { animation: pass 11s linear infinite .14s; }
.ball circle { fill: var(--logo-red); }
.ball.b0 circle { }

.rim { fill: none; stroke: var(--logo-red); stroke-width: 5; transform-box: fill-box; transform-origin: center; shape-rendering: geometricPrecision; }
.board { stroke: #fff; stroke-opacity: .5; stroke-width: 5; stroke-linecap: round; shape-rendering: geometricPrecision; }
.swish { fill: none; stroke: var(--logo-red); stroke-width: 4; opacity: 0; transform-box: fill-box; transform-origin: center; shape-rendering: geometricPrecision; animation: swish 11s linear infinite; }
.bloom { opacity: 0; transform-box: fill-box; transform-origin: center; animation: bloom 11s linear infinite; }

@keyframes play {
  0% { opacity: 0 } 6% { opacity: 1 } 88% { opacity: 1 } 97%, 100% { opacity: 0 }
}
@keyframes idle { 0%, 100% { transform: scale(1) } 50% { transform: scale(.94) } }
@keyframes draw {
  0%, 12% { stroke-dashoffset: 1 } 40% { stroke-dashoffset: 0 } 100% { stroke-dashoffset: 0 }
}
@keyframes cut {
  0%, 12% { offset-distance: 0% } 40%, 100% { offset-distance: 100% }
}
@keyframes pass {
  0%, 12%   { offset-distance: 0%;    opacity: 1; animation-timing-function: cubic-bezier(.45,0,.2,1) }
  25%, 34%  { offset-distance: 44.2%; animation-timing-function: cubic-bezier(.45,0,.2,1) }
  46%, 50%  { offset-distance: 92.2%; animation-timing-function: cubic-bezier(.3,0,.2,1) }
  55%       { offset-distance: 100%; opacity: 1 }
  60%, 100% { offset-distance: 100%; opacity: 0 }
}
@keyframes swish {
  0%, 54% { opacity: 0; transform: scale(1) } 55% { opacity: .9; transform: scale(1) } 72% { opacity: 0; transform: scale(7) } 100% { opacity: 0 }
}
@keyframes bloom {
  0%, 54% { opacity: 0; transform: scale(.4) } 58% { opacity: 1; transform: scale(1) } 80%, 100% { opacity: 0; transform: scale(1.4) }
}

/* ---------- copy ---------- */
.hero {
  position: relative;
  z-index: var(--z-raised);
  flex: 1 0 auto; /* takes spare height in tall windows; never squeezed below its content */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(var(--space-6), 8vh, var(--space-20)) var(--space-6) var(--space-4);
  text-align: center;
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--font-weight-medium);
  /* LANDING-ONLY: above the app's 44px top size. */
  /* Scales with the window's height as well as its width, so a short window gets a smaller
     headline rather than a missing footer. */
  font-size: clamp(2.5rem, min(6.4vw, 10vh), 5.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
h1 .l1 { white-space: nowrap; }
h1 .l { display: block; opacity: 0; transform: translateY(16px); animation: rise-in 1100ms var(--ease-out-expo) forwards; }
h1 .l1 { animation-delay: 350ms; }
h1 .l2 {
  animation-delay: 550ms;
  padding-bottom: .1em;
  color: var(--color-sky-blue-400);
}
.sub {
  max-width: 40rem;
  margin: var(--space-6) auto 0;
  font-family: var(--font-display);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-18);
  line-height: 1.5;
  text-wrap: balance;
  color: var(--frame-fg-secondary);
  opacity: 0; animation: rise-in 1100ms var(--ease-out-expo) 800ms forwards;
}
/* Lines break only between phrases (see HERO_SUBHEAD_LINES in src/copy.js). Spacing follows one
   scale, wider as things relate less: lead to its lines 8px, headline to this group 24px, group
   to the button 40px. The lines step down in length (66 / 44 / 28 characters), echoing the
   headline's long line over a short one; on narrow screens each phrase takes its own line. */
.sub-lead, .sub-line { display: block; }
.sub-lead { color: var(--frame-fg); margin-bottom: var(--space-2); }
.sub-phrase { display: inline-block; }

.cta { margin-top: var(--space-10); opacity: 0; animation: rise 900ms var(--ease-standard) 1000ms forwards; }
.cta-submit {
  flex: none; height: 44px; padding: 0 var(--space-6);
  border: 0; border-radius: var(--radius-md);
  background: var(--frame-fg); color: var(--accent-500);
  font-family: var(--font-display); font-weight: var(--font-weight-medium); font-size: var(--text-16);
  white-space: nowrap; cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
@media (hover: hover) { .cta-submit:hover { background: var(--accent-100); } }
.cta-submit:active { background: var(--accent-200); }
.cta-submit:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-500), 0 0 0 4px var(--frame-fg); }
.thanks { display: none; font-family: var(--font-display); font-weight: var(--font-weight-medium); font-size: var(--text-18); line-height: 52px; }
.cta.done .cta-btn-wrap { display: none; }
.cta.done .thanks { display: block; animation: rise var(--duration-slow) var(--ease-standard); }

/* ---------- beta line ---------- */
/* ---------- footer ---------- */
/* One quiet row: copyright left, beta line centred, legal links right. */
.footer {
  flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-4);
  /* Same side padding as the header, so the copyright lines up under the logo and the last
     icon under the Contact pill. */
  padding: 0 var(--space-8) max(var(--space-6), env(safe-area-inset-bottom));
  font-size: var(--text-12); font-weight: var(--font-weight-medium);
  text-transform: uppercase; letter-spacing: .06em;
  opacity: 0; animation: rise 900ms var(--ease-standard) 1400ms forwards;
}
.beta { margin: 0; color: var(--frame-fg-secondary); text-align: center; }
.footer-meta { color: color-mix(in srgb, var(--frame-fg) 50%, transparent); }
.footer-copy { justify-self: start; }
.footer-end { justify-self: end; display: flex; align-items: center; gap: var(--space-5); }
.footer-pages { display: flex; align-items: center; gap: var(--space-4); }
.footer-social { display: flex; align-items: center; gap: var(--space-3); }
.footer-social a { display: grid; place-items: center; }
.footer-social svg { width: 16px; height: 16px; display: block; }
.footer-link { text-decoration: none; transition: color var(--duration-fast); }
@media (hover: hover) { .footer-link:hover { color: var(--frame-fg); } }
.footer-link:focus-visible { color: var(--frame-fg); }
.footer-link:focus-visible { outline: none; border-radius: 2px; box-shadow: 0 0 0 2px var(--focus-ring-on-frame); }

@keyframes rise { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@keyframes fade { to { opacity: 1 } }

/* ---------- legal pages (about, privacy) ---------- */
/* Less, but better. The same navy room as the home page: one glow from the top, header and footer
   sitting on the frame, and the text set straight onto it. One grid orders the page; three columns
   share a single top hairline. Type and space carry the hierarchy; colour stays white at a few
   strengths, and sky blue appears twice: the title's full stop and the section you are reading.
   LANDING-ONLY: the --legal-* strengths below are not in docs/design-system.md. On --accent-800
   they measure: text 80% 12.0:1, muted 55% 6.1:1 (both pass AA at 13px). */
.legal-page {
  display: flex; flex-direction: column; min-height: 100svh;
  /* A fixed-size glow, so a long page doesn't stretch it into a wash. */
  --legal-glow: radial-gradient(1400px 720px at 50% -120px, color-mix(in srgb, var(--accent-400) 18%, transparent), transparent 70%) no-repeat;
  background: none; /* the navy comes from <html>, the glow from the layer below */
}
/* The glow is pinned to the window rather than the page, so the sticky header can wear the
   exact same background and disappear into it (a fixed layer, not background-attachment:
   fixed, which iOS ignores). */
.legal-page::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--legal-glow);
}
.legal {
  flex: 1 0 auto; /* short pages still put the footer at the bottom of the window */
  --legal-strong: var(--frame-fg);
  --legal-text:   color-mix(in srgb, var(--frame-fg) 80%, var(--accent-800));
  --legal-muted:  color-mix(in srgb, var(--frame-fg) 55%, var(--accent-800));
  --legal-rule:   var(--frame-line);
  --legal-rule-strong: color-mix(in srgb, var(--frame-fg) 60%, transparent);
  --legal-dot:    var(--color-sky-blue-400);
  color: var(--legal-text);
}
.legal-bottom { padding-top: var(--space-5); }
/* The header stays at the top of the window while reading, so the logo (the way home) and
   Contact are always in reach, but it should feel like it isn't there: no bar, no blur, no
   line. It wears the same glow as the window behind it, so text simply passes out of view. */
.legal-page { --header-h: calc(var(--footer-control-height) + 2 * var(--space-6)); }
.legal-top {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: var(--legal-glow), var(--accent-800);
}
.legal-bottom .footer { animation: none; opacity: 1; } /* below the fold: no delayed fade-in */
.legal ::selection { background: color-mix(in srgb, var(--color-sky-blue-400) 35%, transparent); color: var(--frame-fg); }

.legal-layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 40rem) 14rem;
  grid-template-areas: ".   title ." "toc main meta";
  justify-content: center; align-items: start;
  column-gap: var(--space-16);
  padding: var(--space-16) var(--space-6) var(--space-20);
}
.legal-toc, .legal-meta { position: sticky; top: calc(var(--header-h) + var(--space-6)); }

/* Contents: quiet until used. */
.legal-toc { grid-area: toc; max-height: calc(100vh - var(--header-h) - var(--space-12)); overflow-y: auto; }
.legal-toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--legal-rule-strong); }
.legal-toc li { border-bottom: 1px solid var(--legal-rule); }
.legal .legal-toc a {
  display: grid; grid-template-columns: 2rem 1fr; padding: var(--space-3) 0;
  font-size: var(--text-13); line-height: 1.45; color: var(--legal-muted); text-decoration: none;
  transition: color var(--duration-fast);
}
.legal-toc-num { font-variant-numeric: tabular-nums; color: var(--legal-muted); }
.legal .legal-toc a:hover, .legal .legal-toc a[aria-current="true"] { color: var(--legal-strong); }
.legal .legal-toc a[aria-current="true"] .legal-toc-num { color: var(--legal-dot); }

/* Details: labels recede, values read. */
.legal-meta { grid-area: meta; }
.legal-meta dl { margin: 0; border-top: 1px solid var(--legal-rule-strong); font-size: var(--text-13); line-height: 1.45; }
.legal-meta dl > div { display: grid; grid-template-columns: 5.5rem 1fr; padding: var(--space-3) 0; border-bottom: 1px solid var(--legal-rule); }
.legal-meta dt { color: var(--legal-muted); }
.legal-meta dd { margin: 0; color: var(--legal-strong); }

/* The policy. */
.legal-body {
  grid-area: main;
  /* LANDING-ONLY: long-form reading size; the app's body size is --text-14. */
  font-size: var(--text-16); line-height: 1.7;
}
/* The title speaks like the home page's headline: lowercase Satoshi, closed with a sky-blue stop.
   It sits on its own row, so the contents, the policy and the details all start level. */
.legal h1 {
  grid-area: title; margin: 0 0 var(--space-12); font-family: var(--font-display); font-weight: var(--font-weight-medium);
  /* LANDING-ONLY: above the app's 44px top size, below the hero's. */
  font-size: clamp(2.5rem, 5vw, 3.75rem); line-height: 1; letter-spacing: -0.03em; color: var(--legal-strong);
  text-wrap: balance;
}
.legal-dot { color: var(--legal-dot); }
.legal h2 {
  scroll-margin-top: calc(var(--header-h) + var(--space-6));
  margin: var(--space-12) 0 var(--space-3);
  font-family: var(--font-display); font-weight: var(--font-weight-medium);
  font-size: var(--text-18); line-height: 1.4; letter-spacing: -0.005em; color: var(--legal-strong);
}
/* The side columns open with a rule; the first heading drops by the rule plus the row
   padding, less 4px because its 18px text sits lower in its line than the 13px entries. */
.legal-body > h2:first-child { margin-top: calc(1px + var(--space-3) - var(--space-1)); }
/* Numbers hang in the gutter so every line of text shares one left edge. They stay inline
   (pulled left by their own width), so they always sit on the text's baseline. */
.legal-num, .legal-principles li::before {
  display: inline-block; width: 3rem; margin-left: -3rem; padding-right: var(--space-4); text-align: right;
  font-family: var(--font-body); font-size: var(--text-13); font-weight: var(--font-weight-regular);
  font-variant-numeric: tabular-nums; color: var(--legal-muted);
}
/* Top-aligned: raise each 13px number by the difference in cap height, so its top meets the
   top of the capitals beside it (18px Satoshi headings, 16px Inter principles). */
.legal-num { vertical-align: 4px; }
.legal-principles li::before { vertical-align: 2px; }
.legal p { margin: 0 0 var(--space-4); }
.legal strong { font-weight: var(--font-weight-medium); color: var(--legal-strong); }
.legal ul { margin: 0 0 var(--space-4); padding-left: 1.1em; }
.legal li { margin-bottom: var(--space-1); padding-left: var(--space-1); }
.legal li::marker { color: var(--legal-muted); }
.legal ol.legal-principles { list-style: none; margin: var(--space-5) 0; padding: 0; counter-reset: principle; }
.legal-principles li { counter-increment: principle; margin-bottom: var(--space-4); padding-left: 0; }
.legal-principles li::before { content: counter(principle); }
.legal a {
  color: var(--legal-strong); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--frame-fg) 35%, transparent);
  text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color var(--duration-fast);
}
.legal a:hover { text-decoration-color: var(--legal-strong); }
.legal a:focus-visible { outline: none; border-radius: var(--radius-sm); box-shadow: 0 0 0 3px var(--focus-ring-on-frame); }

/* Tables: rules, not boxes. */
.legal-table { margin: var(--space-5) 0 var(--space-6); overflow-x: auto; }
.legal-table table { width: 100%; border-collapse: collapse; font-size: var(--text-14); line-height: 1.5; }
.legal-table th, .legal-table td { padding: var(--space-3) var(--space-4) var(--space-3) 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--legal-rule); }
.legal-table th { border-bottom-color: var(--legal-rule-strong); font-size: var(--text-13); font-weight: var(--font-weight-regular); color: var(--legal-muted); }
.legal-table td:first-child { color: var(--legal-strong); white-space: nowrap; }

.legal-contact { font-style: normal; }

/* About and FAQ: the same white page with one reading column, no contents or details. */
.legal-layout.simple { grid-template-columns: minmax(0, 40rem); grid-template-areas: "title" "main"; }

/* Laptop: details sit above the policy; contents stay beside it. */
@media (max-width: 1240px) {
  .legal-layout { grid-template-columns: 13rem minmax(0, 40rem); grid-template-areas: ". title" "toc meta" "toc main"; column-gap: var(--space-16); }
  .legal-meta { position: static; margin-bottom: var(--space-10); }
}
/* Tablet and phone: one column. Numbers come back inline; headings carry the structure. */
@media (max-width: 860px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "meta" "main"; padding: var(--space-12) var(--space-5) var(--space-12); }
  .legal-toc { display: none; }
  .legal-num { width: 2rem; margin-left: 0; padding-right: 0; text-align: left; }
  .legal ol.legal-principles { padding-left: 1.5rem; }
  .legal-principles li::before { width: 1.5rem; margin-left: -1.5rem; padding-right: 0; text-align: left; }
}

@media (max-width: 640px) {
  .header { padding: var(--space-4); }
  .legal-page { --header-h: calc(var(--footer-control-height) + 2 * var(--space-4)); }
  .logo { height: 26px; }
  .nav { gap: var(--space-4); }
  /* Phones: the headline is the page, so it grows into the height a tall phone has spare
     (wider than the old 40px cap) and steps down on short ones. */
  h1 { font-size: clamp(2.25rem, min(12vw, 6.2vh), 3.25rem); line-height: 1.02; }
  h1 .l1 { white-space: normal; }
  .sub { font-size: var(--text-16); line-height: 1.5; margin-top: var(--space-5); }
  /* Two thoughts, each narrowing towards its end: the sentence over two lines, a small gap,
     then the closing phrases, their last one on a line of its own. (The desktop's single
     closing line would be the widest line here and turn the block upside down.) */
  .sub-line:last-child { margin-top: var(--space-3); }
  .sub-line:last-child .sub-phrase:last-child { display: block; }
  /* The court is only as tall as it looks at this width (it scales with the width), so no
     empty band opens between it and the footer on tall phones. */
  /* The first screen is the headline, the button, the court and the beta line under it; the
     rest of the footer (links, social, copyright) waits just below the fold and comes up with
     the first scroll. Header, hero, court and the beta band fill the small viewport height
     exactly (100svh: with the browser's bars showing), and a wide gap after the beta line keeps
     the links from peeking in. */
  .page {
    height: auto; min-height: 100svh;
    /* The court takes what the words leave: on short phones it gives way (down to a sliver) so
       the beta line still makes the first screen. */
    --floor-h: clamp(72px, min(32vh, 50vw, 100svh - 490px), 300px);
    --beta-band: calc(var(--space-4) + 16px + var(--space-5)); /* footer padding + beta line + room above the fold */
  }
  .hero { min-height: calc(100svh - var(--footer-control-height) - 2 * var(--space-4) - var(--floor-h) - var(--beta-band)); }
  .page > .footer { padding-top: var(--space-4); }
  .page > .footer .beta { line-height: 16px; margin-bottom: calc(var(--space-5) + var(--space-4)); }
  .floor {
    flex: 0 0 var(--floor-h);
    /* Faded at the sides as well as top and bottom: at this width the court's far baseline
       runs edge to edge, and a line ending abruptly at both edges of the screen reads as a seam. */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 85%, transparent 100%),
                        linear-gradient(to right, transparent 0, #000 22%, #000 78%, transparent 100%);
    -webkit-mask-composite: source-in;
            mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 85%, transparent 100%),
                        linear-gradient(to right, transparent 0, #000 22%, #000 78%, transparent 100%);
            mask-composite: intersect;
  }
  .court { width: 280vw; }
  .hero { padding: var(--space-4) var(--space-6) var(--space-2); }
  /* Same button as on desktop, a little taller for a thumb. */
  .cta { margin-top: var(--space-8); }
  .cta-submit { height: 48px; padding: 0 var(--space-8); }

  /* Touch targets: at least 44px to hit, without changing how anything looks. Each control
     gets an invisible hit area around it. */
  .link, .btn-outline, .footer-link { position: relative; }
  .link::after, .btn-outline::after, .footer-link::after { content: ""; position: absolute; }
  .link::after { inset: -14px -8px; }
  .btn-outline::after { inset: -4px; }
  .footer-pages .footer-link::after { inset: -14px -8px; }
  .footer-social { gap: var(--space-5); }
  .footer-social svg { width: 18px; height: 18px; }
  .footer-social .footer-link::after { inset: -13px -10px; }
  .footer {
    grid-template-columns: auto auto; justify-content: center; row-gap: var(--space-2); column-gap: var(--space-4);
    padding: 0 var(--space-4) max(var(--space-4), env(safe-area-inset-bottom)); letter-spacing: 0;
  }
  .beta { grid-column: 1 / -1; grid-row: 1; white-space: nowrap; }
  .footer-copy, .footer-end { justify-self: center; }
  .legal-body { font-size: var(--text-14); }
  .legal h1 { font-size: clamp(2rem, 10vw, 2.5rem); margin-bottom: var(--space-8); }
  .legal h2 { margin-top: var(--space-10); }
  .legal-table td:first-child { white-space: normal; }
  .footer-end { gap: var(--space-6); }
  /* Three short rows: beta line, page and social links, copyright. */
  .footer-end { grid-column: 1 / -1; grid-row: 2; }
  .footer-copy { grid-column: 1 / -1; grid-row: 3; }

  /* Forms on a phone: a little less frame, taller fields and buttons, a bigger close target. */
  .dialog { padding: var(--space-6); }
  .dialog-head { margin-bottom: var(--space-5); }
  .dialog-close { width: 44px; height: 44px; margin: -7px -10px -7px 0; font-size: var(--text-24); }
  .dialog .input { height: 44px; }
  .dialog textarea.input { height: 160px; }
  .dialog .cta-submit { height: 48px; font-size: var(--text-16); }
}

/* Touch screens: 16px in fields, so iOS doesn't zoom the page when one is tapped. */
@media (max-width: 640px), (pointer: coarse) {
  .dialog .input { font-size: var(--text-16); }
}

/* Phones on their side: no room for the court, so the page scrolls as a plain column instead
   of squeezing the headline, button and footer together. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .page { height: auto; min-height: 100svh; }
  .floor { display: none; }
  .hero { padding-top: var(--space-6); padding-bottom: var(--space-10); }
}

/* ---------- motion ---------- */
/* One vocabulary for the whole site. Things arrive by rising a few pixels and coming into focus
   on a long, soft ease-out; presses answer instantly with a small scale; pages crossfade while the
   header and footer stay put. Nothing moves far, nothing bounces, and all of it is switched off
   for people who ask for reduced motion (see the prefers-reduced-motion block below). */
:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);   /* arrivals: fast start, long settle */
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);  /* exits and crossfades */
  --duration-enter: 600ms;
  --duration-exit:  220ms;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* Page to page: a quick crossfade with the content lifting slightly into place. The header is
   named, so it holds still instead of fading out and back in. (Not the footer: on long pages it
   sits far below the window and would fly across the screen.) */
/* The opt-in sits at the top level: inside a media query Chrome sometimes hasn't evaluated it
   on the new page's first frame and skips the transition. Reduced motion turns the animations
   off instead (see the prefers-reduced-motion block below). */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
.header { view-transition-name: site-header; }
/* The header is the same on every page: show the new one at once rather than morphing the old
   snapshot into it (a morph stretches the image if the sizes differ by a pixel, and crossfades
   two Contact pills). The reserved scrollbar gutter keeps the header the same width on short
   and long pages alike. */
html { scrollbar-gutter: stable; }
::view-transition-group(site-header) { animation: none; }
::view-transition-old(site-header) { display: none; }
::view-transition-new(site-header) { animation: none; }
::view-transition-old(root) { animation: 180ms var(--ease-in-out) both vt-out; }
::view-transition-new(root) { animation: 420ms var(--ease-out-expo) 60ms both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(10px); } }
/* Arriving from another page of the site: header and footer are already on screen. */
.returning .header, .returning .footer { animation: none; opacity: 1; }

/* About and privacy: reading pages arrive as one piece (title, text and side columns together),
   with no blur and only a few pixels of travel. The header band is the frame, so it doesn't move.
   Arriving from another page, the page crossfade is the only motion. No per-paragraph scroll
   effects: on a page meant for reading they make the text look like it is still loading. */
.legal-layout { animation: settle 500ms var(--ease-out-expo) both; }
.legal-top .header { animation: none; opacity: 1; }
.returning .legal-layout { animation: none; }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } }

/* Dialogs: rise and sharpen in; on close, sink back and fade quickly. The backdrop fades with it. */
.dialog { opacity: 0; transform: translateY(12px) scale(.97); }
/* The exit needs the dialog to stay in the top layer while it fades (the overlay property);
   browsers without it (Safari today) still animate the entrance and close instantly. */
@supports (overlay: auto) {
  .dialog {
    transition:
      opacity var(--duration-exit) var(--ease-in-out),
      transform var(--duration-exit) var(--ease-in-out),
      overlay var(--duration-exit) allow-discrete,
      display var(--duration-exit) allow-discrete;
  }
  .dialog::backdrop { transition: opacity var(--duration-exit) var(--ease-in-out), overlay var(--duration-exit) allow-discrete, display var(--duration-exit) allow-discrete; }
}
.dialog[open] {
  opacity: 1; transform: none;
  transition:
    opacity 300ms var(--ease-out-expo),
    transform var(--duration-enter) var(--ease-out-expo),
    overlay var(--duration-enter) allow-discrete,
    display var(--duration-enter) allow-discrete;
}
@starting-style { .dialog[open] { opacity: 0; transform: translateY(12px) scale(.97); } }
.dialog::backdrop { opacity: 0; }
.dialog[open]::backdrop { opacity: 1; transition: opacity 400ms var(--ease-out-expo), overlay 400ms allow-discrete, display 400ms allow-discrete; }
@starting-style { .dialog[open]::backdrop { opacity: 0; } }
.dialog.sent .dialog-done { animation: rise-in 700ms var(--ease-out-expo) both; }

/* Presses: buttons give a little under the finger, then spring back. */
.cta-submit, .btn-outline, .dialog-close {
  transition-property: background-color, border-color, color, transform;
  transition-duration: var(--duration-fast), var(--duration-fast), var(--duration-fast), 400ms;
  transition-timing-function: var(--ease-standard), var(--ease-standard), var(--ease-standard), var(--ease-out-expo);
}
.cta-submit:active, .btn-outline:active, .dialog-close:active { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast), var(--duration-fast), 80ms; }
.dialog .cta-submit:disabled { transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .header, h1 .l, .sub, .cta, .footer, .legal-layout { opacity: 1; transform: none; filter: none; }
  .dialog { transform: none; }
  /* The court keeps its transform: it is the 3D tilt, not an animation. */
  .court { opacity: 1; }
  .play { opacity: 1; }
  .route { stroke-dashoffset: 0; }
  .mover { offset-distance: 100%; }
  .ball { offset-distance: 100%; }
  .bloom, .swish { opacity: 0; }
}

/* ---------- shared bits ---------- */
.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { margin: var(--space-3) 0 0; font-size: var(--text-13); color: var(--frame-fg-secondary); }
.form-error a { color: var(--frame-fg); }
.email-reveal { cursor: pointer; }

/* ---------- contact dialog ---------- */
.dialog {
  width: min(440px, calc(100vw - var(--space-8)));
  padding: var(--space-8);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-lg);
  background: var(--accent-800);
  color: var(--frame-fg);
  box-shadow: var(--shadow-xl);
}
.dialog::backdrop { background: color-mix(in srgb, var(--accent-900) 72%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
.dialog h2 { margin: 0; font-family: var(--font-display); font-weight: var(--font-weight-medium); font-size: var(--text-24); letter-spacing: -0.01em; }
.dialog-close {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: var(--radius-md); background: transparent;
  color: var(--frame-fg-secondary); font-size: var(--text-20); line-height: 1; cursor: pointer;
}
@media (hover: hover) { .dialog-close:hover { background: var(--frame-surface); color: var(--frame-fg); } }
.dialog-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring-on-frame); }
.dialog label { display: block; margin: 0 0 var(--space-1); font-size: var(--text-13); line-height: 18px; color: var(--frame-fg-secondary); }
.dialog .input {
  display: block; width: 100%; margin-bottom: var(--space-4);
  padding: 0 var(--space-3); height: var(--footer-control-height);
  border: 1px solid var(--frame-line); border-radius: var(--radius-md);
  background: var(--frame-surface); color: var(--frame-fg);
  font: inherit; font-size: var(--text-14);
}
/* Sized so the contact popup matches the request-access popup: that form has two more
   fields (league, team, role vs. message), each 18px label + 4px gap + 38px input + 16px gap. */
.dialog textarea.input { height: 190px; padding: var(--space-3); resize: vertical; line-height: 1.5; }
.dialog .input:focus { outline: none; border-color: var(--frame-fg); box-shadow: 0 0 0 3px var(--focus-ring-on-frame); }
.dialog .select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23ffffff' stroke-opacity='.7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-3) center;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
/* One muted tone for every hint (placeholders and the unselected league prompt). It sits
   between the white labels/values and the field background, so hints never read as answers. */
.dialog .input::placeholder { color: color-mix(in srgb, var(--frame-fg) 50%, transparent); opacity: 1; }
.dialog .select:invalid { color: color-mix(in srgb, var(--frame-fg) 50%, transparent); }
.dialog .select option { color: var(--color-neutral-900); background: #fff; }
.dialog .cta-submit { width: 100%; height: var(--footer-control-height); padding: 0 var(--space-4); font-size: var(--text-14); border-radius: var(--radius-md); }
.dialog .cta-submit:disabled { opacity: .6; cursor: default; }
.dialog-done { display: none; padding: var(--space-6) 0 var(--space-2); text-align: center; }
.dialog-done p { margin: 0; font-family: var(--font-display); font-weight: var(--font-weight-medium); font-size: var(--text-18); }
.dialog-done span { display: block; margin-top: var(--space-2); font-size: var(--text-14); color: var(--frame-fg-secondary); }
.dialog.sent form { display: none; }
.dialog.sent .dialog-done { display: block; }
