/* VBonfires
 * ---------
 * Palette sampled from the two court photos so the page and the pictures agree.
 * Layers keep section rhythm in one place: `layout` owns vertical padding,
 * `components` never sets it, so the two can't cancel each other out.
 */

@layer tokens, base, layout, components, motion, responsive, print;

/* ── tokens ──────────────────────────────────────────────────────────── */
@layer tokens {
  :root {
    --sky-zenith: #04406f;
    --sky: #1e86c9;
    --tape: #4fb3e8;
    /* Deep enough to clear 4.5:1 as text on paper, canvas, and a tape-tinted
     * chip. The bright --tape stays for lines and fills only. */
    --tape-deep: #1c6288;
    --sand: #e6c393;
    --sand-shadow: #a87a47;
    --ember: #f4531f;
    --ember-ink: #932a06; /* ember as readable text */
    --flame: #ffb03a;
    --canvas: #f6f0e4;
    --ink: #0e1a24;
    --ink-soft: #3d4d5a;

    --paper: #fffdf8;
    --line: color-mix(in srgb, var(--sand-shadow) 26%, transparent);
    --shadow-lo: 0 1px 2px rgb(14 26 36 / 0.06), 0 4px 12px rgb(14 26 36 / 0.05);
    --shadow-hi: 0 2px 6px rgb(14 26 36 / 0.08), 0 18px 44px rgb(14 26 36 / 0.12);

    /* Accent shifts with the season toggle. --accent-deep is the variant that
     * carries white text at 4.5:1 or better. */
    --accent: var(--ember);
    --accent-deep: #c23509;
    --accent-soft: var(--flame);

    --display: 'Anybody', 'Arial Narrow', sans-serif;
    --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
    --mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --step-0: clamp(1rem, 0.97rem + 0.14vw, 1.09rem);
    --step-1: clamp(1.2rem, 1.12rem + 0.36vw, 1.42rem);
    --step-2: clamp(1.5rem, 1.34rem + 0.75vw, 2rem);
    --step-3: clamp(2rem, 1.66rem + 1.6vw, 3rem);
    --step-4: clamp(2.9rem, 2.1rem + 3.8vw, 5.6rem);

    --gutter: clamp(1.15rem, 4vw, 3.5rem);
    --bandpad: clamp(4rem, 9vh, 7.5rem);
    --measure: 62ch;
    --radius: 14px;
  }

  [data-season='snow'] {
    --accent: var(--tape);
    --accent-deep: #14607f;
    --accent-soft: #9fd8f6;
  }
}

/* ── base ────────────────────────────────────────────────────────────── */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

  body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 400 var(--step-0)/1.62 var(--body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 800; line-height: 0.98; }
  p { margin: 0; }
  ul { margin: 0; padding: 0; list-style: none; }
  img, svg, canvas { display: block; max-width: 100%; }
  em { font-style: italic; }

  a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }

  :focus-visible {
    outline: 3px solid var(--tape);
    outline-offset: 3px;
    border-radius: 3px;
  }

  .skip {
    position: absolute;
    left: 50%;
    top: 0;
    translate: -50% -120%;
    z-index: 100;
    padding: 0.7rem 1.1rem;
    background: var(--ink);
    color: var(--canvas);
    font: 600 var(--step--1)/1 var(--body);
    text-decoration: none;
    border-radius: 0 0 10px 10px;
    transition: translate 0.18s ease;
  }
  .skip:focus { translate: -50% 0; }

  /* Numbers everywhere in the system read as scoreboard type. */
  .chip, .mono, .board__count, .middle__num, .court__fmt { font-family: var(--mono); }
}

/* ── layout ──────────────────────────────────────────────────────────── */
@layer layout {
  .wrap {
    width: min(100% - var(--gutter) * 2, 1180px);
    margin-inline: auto;
  }
  .wrap--narrow { width: min(100% - var(--gutter) * 2, 800px); }

  /* Every section's vertical rhythm lives here and nowhere else. */
  .band { padding-block: var(--bandpad); }
  .band + .band { border-top: 3px solid var(--tape); }

  .band--crux { background: var(--paper); }
  .band--flow { background: linear-gradient(180deg, #f2f7fb, #eaf2f8); }
  .band--rules { background: var(--paper); }
  .band--house { background: var(--canvas); }
  .band--open {
    background: var(--sky-zenith);
    color: var(--canvas);
    --ink: var(--canvas);
    --ink-soft: color-mix(in srgb, var(--canvas) 74%, transparent);
    --line: color-mix(in srgb, var(--canvas) 22%, transparent);
  }
  .band--play {
    position: relative;
    isolation: isolate;
    background: radial-gradient(120% 90% at 50% 118%, #4a1206 0%, #1a0b14 46%, #0b1220 100%);
    color: var(--canvas);
    --ink: var(--canvas);
    --ink-soft: color-mix(in srgb, var(--canvas) 72%, transparent);
    --line: color-mix(in srgb, var(--canvas) 20%, transparent);
    overflow: hidden;
  }

  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
    color: var(--tape-deep);
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }
  .eyebrow::before {
    content: '';
    width: 26px;
    height: 3px;
    background: var(--tape);
  }
  .band--open .eyebrow, .band--play .eyebrow { color: var(--accent-soft); }
  .band--open .eyebrow::before, .band--play .eyebrow::before { background: currentColor; }

  .h2 {
    max-width: 22ch;
    font-size: var(--step-3);
    font-variation-settings: 'wdth' 112;
    letter-spacing: -0.015em;
    text-wrap: balance;
  }
  .lead {
    max-width: var(--measure);
    margin-top: 1.1rem;
    color: var(--ink-soft);
    font-size: var(--step-1);
    line-height: 1.5;
  }
  .fineprint {
    max-width: var(--measure);
    margin-top: 2rem;
    color: var(--ink-soft);
    font-size: var(--step--1);
    line-height: 1.55;
  }
}

/* ── components ──────────────────────────────────────────────────────── */
@layer components {

  /* Buttons ---------------------------------------------------------- */
  .btn {
    --btn-bg: var(--ink);
    --btn-fg: var(--canvas);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: 2px solid transparent;
    border-radius: 999px;
    font: 600 var(--step-0)/1 var(--body);
    text-decoration: none;
    cursor: pointer;
    transition: translate 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  }
  .btn:hover { translate: 0 -2px; box-shadow: var(--shadow-hi); }
  .btn:active { translate: 0 0; }
  /* White on raw --ember is only 3.4:1, so filled buttons use a deeper burn.
   * The bright ember stays for rules, marks, and the flame itself. */
  .btn--hot { --btn-bg: var(--accent-deep); --btn-fg: #fff; }
  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: currentColor;
    border-color: color-mix(in srgb, currentColor 45%, transparent);
  }
  .btn--ghost:hover { --btn-bg: color-mix(in srgb, currentColor 10%, transparent); }
  .btn--bare {
    --btn-bg: transparent;
    --btn-fg: var(--ink-soft);
    padding-inline: 0.6rem;
    text-decoration: underline;
  }
  .btn--bare:hover { box-shadow: none; color: var(--ink); }
  .btn--sm { padding: 0.65rem 1.15rem; font-size: var(--step--1); }

  /* Topbar ----------------------------------------------------------- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem var(--gutter);
    background: color-mix(in srgb, var(--canvas) 82%, transparent);
    backdrop-filter: blur(12px) saturate(1.3);
    border-bottom: 1px solid var(--line);
  }
  .topbar__mark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font: 800 var(--step-1)/1 var(--display);
    font-variation-settings: 'wdth' 118;
    letter-spacing: 0.01em;
    text-decoration: none;
    text-transform: uppercase;
  }
  .topbar__flame {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, var(--flame), var(--ember) 62%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 18%, transparent);
  }
  .topbar__nav { display: flex; align-items: center; gap: clamp(0.7rem, 2vw, 1.7rem); }
  .topbar__nav a {
    font: 500 var(--step--1)/1 var(--body);
    text-decoration: none;
    color: var(--ink-soft);
    transition: color 0.15s ease;
  }
  .topbar__nav a:hover { color: var(--ink); }
  .topbar__cta {
    padding: 0.5rem 0.95rem;
    background: var(--ink);
    color: var(--canvas) !important;
    border-radius: 999px;
    font-weight: 600 !important;
  }

  /* Hero ------------------------------------------------------------- */
  .hero {
    position: relative;
    display: grid;
    align-content: end;
    min-height: min(92svh, 860px);
    padding: clamp(2.5rem, 8vh, 6rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
    color: var(--canvas);
    overflow: hidden;
  }
  .hero__frame { position: absolute; inset: 0; z-index: -1; background: var(--sky-zenith); }
  .hero__photo { position: absolute; inset: 0; }
  .hero__photo img { width: 100%; height: 100%; object-fit: cover; }
  .hero__photo--sand img { object-position: 50% 62%; }
  /* Portrait source in a landscape frame: hold the net and the horizon. */
  .hero__photo--snow img { object-position: 50% 34%; }
  .hero__photo--snow { opacity: 0; }
  .hero[data-season='snow'] .hero__photo--sand { opacity: 0; }
  .hero[data-season='snow'] .hero__photo--snow { opacity: 1; }

  .hero__scrim {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(183deg, rgb(4 32 56 / 0.42) 0%, rgb(4 32 56 / 0) 34%),
      linear-gradient(357deg, rgb(6 14 24 / 0.9) 2%, rgb(6 14 24 / 0.55) 34%, rgb(6 14 24 / 0.05) 68%);
  }
  /* Snow reflects far more light than sand, so its scrim has to work harder to
   * keep the text above it readable. */
  .hero[data-season='snow'] .hero__scrim {
    background:
      linear-gradient(183deg, rgb(4 32 56 / 0.45) 0%, rgb(4 32 56 / 0.05) 32%),
      linear-gradient(357deg, rgb(6 14 24 / 0.94) 2%, rgb(6 14 24 / 0.74) 38%, rgb(6 14 24 / 0.22) 72%);
  }

  /* One tape line under the headline. The photo supplies the rest. */
  .hero__tape {
    display: block;
    width: min(19rem, 62%);
    height: 4px;
    margin-top: 1.15rem;
    background: var(--tape);
    border-radius: 4px;
    box-shadow: 0 0 14px color-mix(in srgb, var(--tape) 60%, transparent);
    transform-origin: left center;
  }

  .hero__body { position: relative; max-width: 46rem; }
  /* Small caps this high in the frame can land on bright snow, so the eyebrow
   * carries its own scrim instead of relying on the hero-wide one. */
  .hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
    padding: 0.45rem 0.85rem;
    background: rgb(6 14 24 / 0.62);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--canvas);
  }
  .hero__eyebrow .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--flame); }

  .hero__title {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.28em;
    font-size: var(--step-4);
    font-variation-settings: 'wdth' 118;
    letter-spacing: -0.022em;
    text-transform: uppercase;
    text-shadow: 0 2px 30px rgb(4 14 24 / 0.45);
  }
  .hero__word--hot {
    color: var(--flame);
    -webkit-text-stroke: 0;
  }
  .hero__sub {
    margin-top: 0.5rem;
    font: 400 var(--step-2)/1.1 var(--display);
    font-variation-settings: 'wdth' 100;
    letter-spacing: -0.01em;
    color: color-mix(in srgb, var(--canvas) 92%, transparent);
  }
  .hero__lede {
    max-width: 44ch;
    margin-top: 1.4rem;
    font-size: var(--step-1);
    line-height: 1.5;
    color: color-mix(in srgb, var(--canvas) 88%, transparent);
  }
  .hero__actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

  .hero__season {
    position: absolute;
    right: var(--gutter);
    bottom: clamp(2rem, 5vh, 3.5rem);
    max-width: 15rem;
    text-align: right;
  }
  .hero__season-label {
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--canvas) 80%, transparent);
  }
  .seasons {
    display: inline-flex;
    gap: 4px;
    margin-top: 0.6rem;
    padding: 4px;
    background: rgb(8 18 28 / 0.5);
    border: 1px solid color-mix(in srgb, var(--canvas) 26%, transparent);
    border-radius: 999px;
    backdrop-filter: blur(8px);
  }
  .seasons__btn {
    padding: 0.5rem 0.9rem;
    background: transparent;
    color: color-mix(in srgb, var(--canvas) 78%, transparent);
    border: 0;
    border-radius: 999px;
    font: 600 var(--step--1)/1 var(--body);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
  }
  .seasons__btn.is-on { background: var(--canvas); color: var(--ink); }
  .hero__season-note {
    margin-top: 0.7rem;
    font-size: var(--step--1);
    line-height: 1.45;
    color: color-mix(in srgb, var(--canvas) 72%, transparent);
  }

  /* Chips ------------------------------------------------------------ */
  .chip {
    display: inline-block;
    padding: 0.4rem 0.7rem;
    background: color-mix(in srgb, var(--tape) 15%, transparent);
    color: var(--tape-deep);
    border: 1px solid color-mix(in srgb, var(--tape) 42%, transparent);
    border-radius: 7px;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }
  .chip--hot {
    background: color-mix(in srgb, var(--ember) 13%, transparent);
    color: var(--ember-ink);
    border-color: color-mix(in srgb, var(--ember) 45%, transparent);
  }
  .chip--alt { background: transparent; color: var(--ink-soft); border-color: var(--line); }

  /* The happy middle ------------------------------------------------- */
  .middle {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: clamp(1.5rem, 4vw, 3rem);
    margin-top: 2.5rem;
    padding: clamp(1.3rem, 3vw, 2.2rem);
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lo);
  }
  .middle__meters { display: grid; gap: 1.1rem; }
  .meter__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
  .meter__name { font: 600 var(--step-0)/1 var(--body); }
  .meter__val { font: 600 var(--step--1)/1 var(--mono); color: var(--ink-soft); }
  .meter__track {
    height: 10px;
    margin-top: 0.5rem;
    background: color-mix(in srgb, var(--sand-shadow) 16%, transparent);
    border-radius: 999px;
    overflow: hidden;
  }
  .meter__fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    transition: width 0.28s cubic-bezier(0.22, 0.9, 0.28, 1);
  }
  [data-meter='flow'] .meter__fill { background: linear-gradient(90deg, var(--tape-deep), var(--tape)); }
  [data-meter='feel'] .meter__fill { background: linear-gradient(90deg, var(--sand-shadow), var(--flame)); }
  .meter__hint { margin-top: 0.35rem; font-size: var(--step--1); color: var(--ink-soft); }

  .middle__control { margin-top: 1.8rem; }
  .middle__label {
    display: block;
    margin-bottom: 0.7rem;
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  /* Marks live in a strip entirely below the track: never colliding with the
   * field label above, never hidden under the thumb. */
  .middle__slider { position: relative; }
  .middle__marks {
    position: absolute;
    inset-inline: 0;
    top: 30px;
    height: 1.5rem;
    pointer-events: none;
  }
  .middle__band, .middle__tick {
    position: absolute;
    top: 0;
    /* Track inset matches the thumb radius so marks line up with values. */
    left: calc(11px + (var(--from, var(--at)) - 1) / 20 * (100% - 22px));
    height: 7px;
    border-radius: 2px;
  }
  .middle__band {
    width: calc((var(--to) - var(--from)) / 20 * (100% - 22px) + 7px);
    translate: -3.5px 0;
    background: var(--ember);
  }
  .middle__tick {
    width: 2px;
    background: color-mix(in srgb, var(--tape-deep) 70%, transparent);
  }
  .middle__band i, .middle__tick i {
    position: absolute;
    top: 9px;
    left: 50%;
    translate: -50% 0;
    font: 600 0.66rem/1 var(--body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-style: normal;
    white-space: nowrap;
  }
  .middle__band i { color: var(--ember-ink); }
  .middle__tick i { color: var(--tape-deep); }

  .middle__slider input[type='range'] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    margin: 6px 0 0;
    background: transparent;
    cursor: pointer;
  }
  .middle__slider input::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(90deg, var(--tape) 0%, var(--sand-shadow) 100%);
    border-radius: 999px;
  }
  .middle__slider input::-moz-range-track {
    height: 6px;
    background: linear-gradient(90deg, var(--tape) 0%, var(--sand-shadow) 100%);
    border-radius: 999px;
  }
  .middle__slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -8px;
    background: var(--canvas);
    border: 3px solid var(--ember);
    border-radius: 50%;
    box-shadow: var(--shadow-lo);
  }
  .middle__slider input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--canvas);
    border: 3px solid var(--ember);
    border-radius: 50%;
    box-shadow: var(--shadow-lo);
  }
  .middle__scale {
    display: flex;
    justify-content: space-between;
    margin-top: 2.05rem;
    font: 400 var(--step--1)/1 var(--mono);
    color: var(--ink-soft);
  }

  .middle__out {
    align-self: start;
    padding-left: clamp(0rem, 2vw, 1.6rem);
    border-left: 3px solid var(--ember);
  }
  .middle__num {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: var(--step-3);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.04em;
  }
  .middle__num small {
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .middle__title {
    margin-top: 0.9rem;
    font-size: var(--step-1);
    font-variation-settings: 'wdth' 105;
    line-height: 1.1;
  }
  .middle__body { margin-top: 0.6rem; color: var(--ink-soft); font-size: var(--step-0); }

  /* Flow board ------------------------------------------------------- */
  .board {
    margin-top: 2.5rem;
    padding: clamp(1.2rem, 3vw, 2rem);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lo);
  }
  .board__controls {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1rem, 3vw, 2.4rem);
    padding-bottom: 1.3rem;
    border-bottom: 1px solid var(--line);
  }
  .ctl__label {
    display: block;
    margin-bottom: 0.55rem;
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .chips { display: flex; flex-wrap: wrap; gap: 5px; }
  .chips button {
    min-width: 2.6rem;
    padding: 0.45rem 0.7rem;
    background: var(--canvas);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 600 var(--step--1)/1 var(--mono);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .chips button:hover { border-color: var(--tape); color: var(--ink); }
  .chips button[aria-checked='true'] {
    background: var(--ink);
    color: var(--canvas);
    border-color: var(--ink);
  }
  .chips--words button { font-family: var(--body); letter-spacing: 0; }

  .ctl { max-width: 22rem; }
  .ctl__why {
    margin-top: 0.45rem;
    font-size: var(--step--1);
    line-height: 1.4;
    color: var(--ink-soft);
  }
  .ctl__why::before { content: '↳ '; color: var(--tape-deep); }

  /* Add or remove a player by hand. */
  .people {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: 9px;
  }
  .people__btn {
    width: 2rem;
    height: 1.9rem;
    display: grid;
    place-items: center;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: 600 1rem/1 var(--body);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .people__btn:hover { border-color: var(--tape); background: #fff; }
  .people__count {
    min-width: 2.4rem;
    text-align: center;
    font: 600 var(--step-0)/1 var(--mono);
  }

  /* ---- 3D scene ---------------------------------------------------- *
   * Two courts as ground planes tilted back under a fixed camera, with a
   * queue panel beside them. Players are markers that stand on the sand and
   * animate between slots.
   */
  .scene {
    /* --tilt drives both the floor rotation and the counter-rotation that
     * stands players and the net upright, so they always agree. Kept moderate
     * so the far half of the court stays readable. */
    --tilt: 46deg;
    --court-d: 240px;
    /* Vertical space a tilted floor actually occupies: depth * cos(tilt). */
    --court-h: calc(var(--court-d) * 0.695);
    --net-h: 44px;
    margin-top: 1.6rem;
    padding: clamp(1.5rem, 3.5vw, 2.6rem) clamp(0.8rem, 2.5vw, 2rem);
    background:
      radial-gradient(125% 105% at 50% -10%, #dff0ff 0%, #e9f3fa 52%, #e2ecf5 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  .scene__stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 200px);
    align-items: start;
    gap: clamp(1rem, 3vw, 2.4rem);
  }
  /* Both courts share the left column, stacked with the king's court behind. */
  .scene__stage > .court3d { grid-column: 1; }
  .scene__stage > .queue3d { grid-column: 2; grid-row: 1 / span 2; }

  .court3d {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    /* Room for the label above, the tilted floor, the net standing up, and the
     * name tags on the front row. */
    padding-top: calc(var(--net-h) + 1.9rem);
    height: calc(var(--court-h) + var(--net-h) + 4.2rem);
  }
  .court3d--kings { margin-bottom: clamp(0.6rem, 2vw, 1.4rem); }

  /* Each court is its own perspective root, centred on its own box, so the
   * sand recedes straight back instead of skewing off to one side. */
  .court3d__floor {
    position: relative;
    width: 100%;
    height: var(--court-h);
    /* Longer lens: less extreme foreshortening, so the far pair stays legible. */
    perspective: 1500px;
    perspective-origin: 50% 0%;
  }
  /* The plane: full court depth, hinged at its front edge and laid back. */
  .court3d__plane {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: var(--court-d);
    transform-origin: 50% 0%;
    transform: rotateX(var(--tilt));
    transform-style: preserve-3d;
  }
  /* Everything on the plane fills it; the plane carries the tilt. */
  .court3d__sand,
  .court3d__lines,
  .court3d__slots { position: absolute; inset: 0; }

  .court3d__sand {
    background:
      radial-gradient(85% 70% at 50% 30%, #f0d3a3 0%, #e4c08a 48%, #cfa46d 100%),
      linear-gradient(180deg, #ecd0a0, #d8b47c);
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--sand-shadow) 40%, transparent),
      0 24px 40px -18px rgb(20 40 60 / 0.5);
    border-radius: 2px;
  }
  /* Sand grain, cheap and static. */
  .court3d__sand::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.32;
    background-image:
      radial-gradient(1px 1px at 12% 22%, #b98d55 40%, transparent 41%),
      radial-gradient(1px 1px at 63% 14%, #c69a62 40%, transparent 41%),
      radial-gradient(1px 1px at 34% 68%, #b98d55 40%, transparent 41%),
      radial-gradient(1px 1px at 81% 54%, #c69a62 40%, transparent 41%),
      radial-gradient(1px 1px at 47% 88%, #b1834a 40%, transparent 41%),
      radial-gradient(1px 1px at 22% 47%, #c69a62 40%, transparent 41%),
      radial-gradient(1px 1px at 91% 79%, #b98d55 40%, transparent 41%),
      radial-gradient(1px 1px at 71% 36%, #b1834a 40%, transparent 41%);
    background-size: 44px 44px;
  }
  /* Boundary + centre line, in the same blue tape as the photos. */
  .court3d__lines {
    inset: 8% 7%;
    border: 2px solid color-mix(in srgb, var(--tape) 80%, #fff 20%);
    border-radius: 1px;
  }
  /* Centre line, under the net, running across the court. */
  .court3d__lines::before {
    content: '';
    position: absolute;
    left: -2px;
    right: -2px;
    top: 50%;
    height: 2px;
    translate: 0 -50%;
    background: color-mix(in srgb, var(--tape) 64%, #fff 36%);
  }

  /* Player slots share the tilted plane's box (set by .court3d__floor > *),
   * so a marker at 74% top stands 74% of the way down the real court. */
  .court3d__slots { transform-style: preserve-3d; }

  /* The net stands upright on the centre line. It sits on the tilted plane so
   * it lands at the right depth, then counter-rotates and lifts so it rises
   * vertically out of the sand rather than lying along it. */
  .court3d__net {
    position: absolute;
    left: 0;
    width: 100%;
    top: 50%;
    height: var(--net-h);
    transform-origin: 50% 100%;
    transform:
      translateY(calc(var(--net-h) * -0.5))
      rotateX(calc(var(--tilt) * -1));
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 2;
  }
  .court3d__mesh {
    position: absolute;
    inset: 5px 0 0;
    background-image:
      repeating-linear-gradient(90deg, rgb(46 58 68 / 0.34) 0 1px, transparent 1px 9px),
      repeating-linear-gradient(180deg, rgb(46 58 68 / 0.34) 0 1px, transparent 1px 9px);
    border-bottom: 1px solid rgb(46 58 68 / 0.22);
  }
  .court3d__tape {
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    background: linear-gradient(180deg, #fffdf6, #e8e0cd);
    box-shadow: 0 1px 3px rgb(20 30 40 / 0.3);
    border-radius: 1px;
  }
  /* Net posts. */
  .court3d__net::before,
  .court3d__net::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(90deg, #6b4426, #8d5c33 45%, #5c3a20);
    border-radius: 1px;
  }
  .court3d__net::before { left: -2px; }
  .court3d__net::after { right: -2px; }

  /* Label on the left, score on the right, sharing one row that cannot
   * collide however long the format text gets. */
  .court3d__label {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.15rem 0.5rem;
    /* Room for the score, which is positioned in the same band. */
    padding-right: 4.6rem;
  }
  .court3d__name {
    font: 800 var(--step-0)/1 var(--display);
    font-variation-settings: 'wdth' 110;
    text-transform: uppercase;
  }
  .court3d__fmt {
    font: 600 0.72rem/1 var(--mono);
    letter-spacing: -0.02em;
    color: var(--tape-deep);
    transition: color 0.3s ease;
  }
  .court3d--base .court3d__fmt { color: var(--ember-ink); }
  /* A round robin is a different mode of play, so mark it. */
  .court3d.is-rr .court3d__fmt { color: #6b4a12; }
  .court3d.is-rr .court3d__lines {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--flame) 70%, #fff 30%);
  }

  /* Live score, top right of the court block. */
  .court3d__score {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: baseline;
    gap: 0.1rem;
    font: 600 var(--step-2)/1 var(--mono);
    letter-spacing: -0.05em;
  }
  .court3d__score i { font-style: normal; opacity: 0.35; padding-inline: 0.12rem; }
  .court3d__score span {
    display: inline-block;
    transition: color 0.25s ease, scale 0.25s ease;
  }
  .court3d__score span.is-scored { color: var(--ember); scale: 1.3; }

  /* Sits over the middle of the empty sand. */
  .court3d__empty {
    position: absolute;
    left: 50%;
    top: calc(var(--net-h) + 1.6rem + var(--court-h) * 0.52);
    width: 62%;
    translate: -50% 0;
    text-align: center;
    font-size: var(--step--1);
    line-height: 1.35;
    color: #5f4a2a;
    text-shadow: 0 1px 0 rgb(255 255 255 / 0.5);
    z-index: 3;
  }
  .court3d.is-live .court3d__empty { display: none; }
  .court3d:not(.is-live) .court3d__score { display: none; }
  /* A court that cannot open tonight recedes rather than sitting there empty. */
  .court3d.is-shut { opacity: 0.5; filter: saturate(0.55); }

  /* ---- players ------------------------------------------------------ */
  /* A marker standing on the sand: a body that leans with the court and a
   * shadow that lies flat on it. */
  .p3d {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    transition:
      left 0.62s cubic-bezier(0.34, 0.9, 0.28, 1),
      top 0.62s cubic-bezier(0.34, 0.9, 0.28, 1),
      opacity 0.35s ease;
  }
  /* The shadow lies flat on the sand, so it keeps the floor's tilt. */
  .p3d__shadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 14px;
    translate: -50% -50%;
    background: radial-gradient(50% 50%, rgb(60 40 20 / 0.45), transparent 70%);
    border-radius: 50%;
  }
  /* The body counter-rotates so it stands up out of the tilted floor. */
  .p3d__body {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    translate: -50% 0;
    transform-origin: center bottom;
    transform: rotateX(calc(var(--tilt) * -1));
    display: grid;
    justify-items: center;
    gap: 2px;
  }
  .p3d__pip {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(165deg, #6fc4f0, var(--tape) 55%, #2d90c6);
    border: 2px solid #14567a;
    box-shadow: 0 2px 5px rgb(20 40 60 / 0.4);
    font: 600 0.6rem/1 var(--mono);
    color: #062430;
    transition: background 0.3s ease, border-color 0.3s ease, scale 0.3s ease;
  }
  .p3d__tag {
    padding: 1px 4px;
    background: rgb(255 253 246 / 0.9);
    border-radius: 3px;
    font: 600 0.58rem/1.25 var(--body);
    color: var(--ink);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgb(20 30 40 / 0.18);
  }

  /* Team colours: one side warm, one side cool. */
  .p3d--team1 .p3d__pip {
    background: linear-gradient(165deg, #ffd07a, var(--flame) 55%, #e08a12);
    border-color: #9a5a05;
    color: #3d2101;
  }
  /* Points earned so far, shown on the pip. */
  .p3d.has-points .p3d__pip { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 45%, transparent), 0 2px 5px rgb(20 40 60 / 0.4); }
  .p3d.is-leader .p3d__pip { scale: 1.15; box-shadow: 0 0 0 3px var(--ember), 0 3px 7px rgb(20 40 60 / 0.45); }
  .p3d.is-scoring .p3d__pip { animation: pop 0.5s cubic-bezier(0.3, 1.4, 0.4, 1); }
  @keyframes pop { 40% { scale: 1.4; } }
  .p3d.is-promoting .p3d__pip { animation: rise 0.7s ease-out; }
  @keyframes rise { 50% { scale: 1.35; box-shadow: 0 0 0 8px color-mix(in srgb, var(--ember) 35%, transparent); } }

  /* The ball, hopping over the net on each rally. Counter-rotated so it reads
   * as a round ball above the sand rather than an ellipse painted on it. */
  .ball3d {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 15px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    transform-origin: center bottom;
    background:
      radial-gradient(circle at 34% 30%, #fff6cf 0%, var(--flame) 42%, #e28d0a 74%, #b76c04 100%);
    box-shadow: 0 2px 5px rgb(30 20 0 / 0.4);
    pointer-events: none;
    opacity: 0;
    z-index: 3;
  }
  .ball3d::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border-top: 1.5px solid rgb(255 255 255 / 0.55);
    border-left: 1px solid rgb(255 255 255 / 0.3);
  }

  /* ---- queue panel -------------------------------------------------- */
  .queue3d {
    align-self: stretch;
    padding: 0.9rem 0.95rem 1rem;
    background: rgb(255 253 248 / 0.86);
    border: 1px solid var(--line);
    border-left: 3px solid var(--tape);
    border-radius: 10px;
    backdrop-filter: blur(3px);
  }
  .queue3d__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
  }
  .queue3d__name {
    font: 800 var(--step-0)/1 var(--display);
    font-variation-settings: 'wdth' 110;
    text-transform: uppercase;
  }
  .queue3d__count { font: 600 var(--step-0)/1 var(--mono); color: var(--tape-deep); }
  .queue3d__list {
    display: grid;
    gap: 3px;
    margin-top: 0.6rem;
    list-style: none;
    /* Tall enough for a big turnout, so it never needs its own scrollbar and
     * never becomes a stray tab stop. */
    max-height: none;
  }
  .queue3d__item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.22rem 0.4rem;
    border-radius: 5px;
    font-size: var(--step--1);
    line-height: 1.3;
    animation: slidein 0.4s ease both;
  }
  /* Past the first eight the queue is just depth, so show it more compactly. */
  .queue3d__item:nth-child(n + 9) {
    padding-block: 0.1rem;
    font-size: 0.72rem;
    opacity: 0.72;
  }
  @keyframes slidein { from { opacity: 0; translate: 8px 0; } }
  /* The next four are who comes on, so mark them. */
  .queue3d__item.is-next { background: color-mix(in srgb, var(--tape) 16%, transparent); font-weight: 600; }
  .queue3d__pos {
    min-width: 1.25rem;
    font: 600 0.66rem/1 var(--mono);
    color: var(--ink-soft);
  }
  .queue3d__pts {
    margin-left: auto;
    font: 600 0.66rem/1 var(--mono);
    color: var(--ember-ink);
  }
  .queue3d__hint {
    margin-top: 0.7rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--ink-soft);
  }
  .queue3d__none { font-size: var(--step--1); color: var(--ink-soft); padding: 0.4rem 0; }

  /* ---- board chrome ------------------------------------------------- */
  .board__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
  }
  .board__count {
    margin-left: auto;
    font: 400 var(--step--1)/1 var(--mono);
    color: var(--ink-soft);
  }
  .board__say {
    display: grid;
    gap: 0.3rem;
    min-height: 2.9em;
    margin-top: 1.1rem;
    font-size: var(--step-0);
    line-height: 1.45;
  }
  .board__say b { font-weight: 600; }
  /* One line per court, each tagged so you can tell them apart when both
   * played in the same beat. */
  .board__line {
    padding-left: 0.9rem;
    border-left: 3px solid var(--ember);
  }
  .board__line--kings { border-left-color: var(--tape-deep); }
  .board__line--kings::before,
  .board__line--base::before {
    display: inline-block;
    margin-right: 0.4rem;
    font: 600 0.66rem/1 var(--body);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    vertical-align: 0.06em;
  }
  .board__line--kings::before { content: "King's"; color: var(--tape-deep); }
  .board__line--base::before { content: 'Base'; color: var(--ember-ink); }

  .ladder { margin-top: 1.3rem; }
  .ladder__head {
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .ladder__list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 0.65rem;
    list-style: none;
  }
  .ladder__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.55rem;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: var(--step--1);
    transition: background 0.3s ease, border-color 0.3s ease;
  }
  .ladder__item.is-top {
    background: color-mix(in srgb, var(--ember) 12%, transparent);
    border-color: color-mix(in srgb, var(--ember) 50%, transparent);
    font-weight: 600;
  }
  .ladder__pts { font: 600 0.7rem/1 var(--mono); color: var(--ember-ink); }
  .ladder__none { font-size: var(--step--1); color: var(--ink-soft); }

  /* The standard ----------------------------------------------------- *
   * Numbered clauses, set like a document rather than a card grid: the
   * numbering is real here, because a standard gets cited by clause.
   */
  .spec__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 1.6rem;
    padding-bottom: 0.9rem;
    border-bottom: 3px solid var(--tape);
  }
  .spec__ver {
    padding: 0.25rem 0.6rem;
    background: var(--ink);
    color: var(--canvas);
    border-radius: 5px;
    font: 600 var(--step--1)/1 var(--mono);
  }
  .spec__date {
    font: 400 var(--step--1)/1 var(--mono);
    color: var(--ink-soft);
  }
  .spec__meta .btn { margin-left: auto; }

  .spec {
    margin-top: 0;
    list-style: none;
    counter-reset: none;
  }
  .rule {
    display: grid;
    grid-template-columns: minmax(2.6rem, auto) minmax(0, 1fr);
    gap: 0 clamp(0.9rem, 2.5vw, 1.8rem);
    padding: clamp(1.4rem, 3vw, 2rem) 0;
    border-bottom: 1px solid var(--line);
  }
  .rule:last-child { border-bottom: 0; }

  /* The clause number carries the document feel. */
  .rule__no {
    font: 800 var(--step-3)/0.85 var(--display);
    font-variation-settings: 'wdth' 118;
    color: color-mix(in srgb, var(--tape-deep) 30%, transparent);
    letter-spacing: -0.03em;
  }
  .rule__when {
    font-size: var(--step-2);
    font-variation-settings: 'wdth' 108;
    line-height: 1.05;
    text-wrap: balance;
  }
  .rule__fmt { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 0.7rem; }
  .rule__body {
    max-width: 58ch;
    margin-top: 0.8rem;
    color: var(--ink-soft);
    font-size: var(--step-0);
  }
  /* Sub-clauses: hanging indent so the number sits in the margin. */
  .rule__sub {
    max-width: 58ch;
    margin-top: 0.55rem;
    padding-left: 1.1rem;
    border-left: 2px solid color-mix(in srgb, var(--tape) 45%, transparent);
    color: var(--ink-soft);
    font-size: var(--step--1);
    line-height: 1.55;
  }

  @media (width <= 620px) {
    .rule { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
    .rule__no { font-size: var(--step-2); }
  }

  /* House rules ------------------------------------------------------ */
  .house {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(230px, 27vw, 320px), 1fr));
    gap: clamp(1.4rem, 3vw, 2.4rem);
    margin-top: 2.5rem;
  }
  .house__item { padding-top: 1rem; border-top: 3px solid var(--tape); }
  .house__item h3 {
    font-size: var(--step-1);
    font-variation-settings: 'wdth' 106;
    line-height: 1.15;
  }
  .house__item p { margin-top: 0.5rem; color: var(--ink-soft); }

  /* Run it: the first-night walkthrough --------------------------------- */
  .adopt {
    margin-top: clamp(2rem, 5vw, 3rem);
    padding-top: clamp(1.6rem, 3vw, 2.2rem);
    border-top: 3px solid var(--tape);
  }
  .adopt__head {
    font-size: var(--step-2);
    font-variation-settings: 'wdth' 108;
    line-height: 1.05;
  }
  .adopt__steps {
    display: grid;
    gap: 1rem;
    margin-top: 1.4rem;
    max-width: 68ch;
    list-style: none;
  }
  .adopt__steps li {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0 0.9rem;
    align-items: start;
  }
  .adopt__n {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--ink);
    color: var(--canvas);
    border-radius: 50%;
    font: 600 0.78rem/1 var(--mono);
  }
  .adopt__steps p { color: var(--ink-soft); }

  /* Where it runs: the lead sits on a dark band, so it needs the lighter ink. */
  .lead--play { max-width: 56ch; }

  /* Open for all ----------------------------------------------------- */
  .open { margin-top: 2.5rem; }
  .open__big {
    font: 400 var(--step-2)/1.22 var(--display);
    font-variation-settings: 'wdth' 100;
    letter-spacing: -0.012em;
    text-wrap: pretty;
  }
  .open__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.3rem;
    margin: 2.4rem 0;
    padding-block: 1.8rem;
    border-block: 1px solid var(--line);
  }
  .open__grid li { display: grid; gap: 0.3rem; }
  .open__no {
    font: 800 var(--step-1)/1 var(--display);
    font-variation-settings: 'wdth' 112;
    text-transform: uppercase;
    color: var(--accent-soft);
  }
  .open__grid span:last-child { color: var(--ink-soft); font-size: var(--step--1); }
  .open__body { color: var(--ink-soft); max-width: var(--measure); }

  /* The ball, sitting alongside the pitch. */
  .open__ball {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(1.4rem, 4vw, 2.6rem);
  }
  .ballshot { margin: 0; }
  .ballshot picture { display: block; }
  .ballshot img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.25), 0 20px 40px -16px rgb(0 0 0 / 0.5);
  }
  .ballshot figcaption {
    margin-top: 0.65rem;
    font-size: var(--step--1);
    line-height: 1.4;
    color: var(--ink-soft);
  }

  @media (width <= 720px) {
    .open__ball { grid-template-columns: 1fr; }
    .ballshot { max-width: 320px; }
  }

  /* Come play -------------------------------------------------------- */
  .embers { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
  .play {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1px;
    margin-top: 2.5rem;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .play__card { padding: clamp(1.2rem, 3vw, 1.9rem); background: rgb(255 255 255 / 0.045); }
  .play__label {
    font: 600 var(--step--1)/1 var(--body);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-soft);
  }
  .play__where { margin-top: 0.8rem; color: var(--ink-soft); }
  .play__name {
    margin-top: 0.8rem;
    font: 800 var(--step-2)/1 var(--display);
    font-variation-settings: 'wdth' 108;
  }
  .play__cred { margin-top: 0.35rem; font-size: var(--step--1); color: var(--ink-soft); }
  .play__reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 1.1rem; }
  .play__phone a {
    font: 600 var(--step-1)/1 var(--mono);
    letter-spacing: -0.03em;
    color: var(--flame);
    text-decoration: none;
    white-space: nowrap;
  }
  .play__phone a:hover { text-decoration: underline; }
  .play__close {
    max-width: var(--measure);
    margin-top: 2.2rem;
    color: var(--ink-soft);
  }

  /* Footer ----------------------------------------------------------- */
  .foot {
    padding-block: clamp(2.5rem, 6vh, 4rem);
    background: #08121c;
    color: color-mix(in srgb, var(--canvas) 66%, transparent);
    font-size: var(--step--1);
  }
  .foot__mark {
    font: 800 var(--step-2)/1 var(--display);
    font-variation-settings: 'wdth' 118;
    text-transform: uppercase;
    color: var(--canvas);
  }
  .foot__line { max-width: 54ch; margin-top: 0.8rem; line-height: 1.55; }
  .foot__cred { margin-top: 0.8rem; color: color-mix(in srgb, var(--canvas) 60%, transparent); }
}

/* ── motion ──────────────────────────────────────────────────────────── */
@layer motion {
  .hero__photo { transition: opacity 0.7s ease, filter 0.7s ease; }
  .hero[data-season] .hero__photo { filter: blur(0); }
  .hero.is-swapping .hero__photo { filter: blur(5px); }

  /* The tape line draws itself in, left to right. */
  .hero__tape { scale: 0 1; }
  .hero.is-ready .hero__tape {
    animation: tape 0.75s cubic-bezier(0.22, 0.8, 0.2, 1) 0.56s forwards;
  }
  @keyframes tape { to { scale: 1 1; } }

  /* Hero load sequence. Guarded by .js: if scripts never run, nothing is
   * hidden in the first place. */
  .js .hero__eyebrow,
  .js .hero__word,
  .js .hero__sub,
  .js .hero__lede,
  .js .hero__actions,
  .js .hero__season {
    opacity: 0;
    translate: 0 18px;
  }
  .hero.is-ready .hero__eyebrow,
  .hero.is-ready .hero__word,
  .hero.is-ready .hero__sub,
  .hero.is-ready .hero__lede,
  .hero.is-ready .hero__actions,
  .hero.is-ready .hero__season {
    animation: rise 0.72s cubic-bezier(0.2, 0.75, 0.2, 1) forwards;
  }
  .hero.is-ready .hero__eyebrow { animation-delay: 0.1s; }
  .hero.is-ready .hero__word:nth-child(1) { animation-delay: 0.24s; }
  .hero.is-ready .hero__word:nth-child(2) { animation-delay: 0.32s; }
  .hero.is-ready .hero__word:nth-child(3) { animation-delay: 0.4s; }
  .hero.is-ready .hero__word:nth-child(4) { animation-delay: 0.48s; }
  .hero.is-ready .hero__sub { animation-delay: 0.62s; }
  .hero.is-ready .hero__lede { animation-delay: 0.74s; }
  .hero.is-ready .hero__actions { animation-delay: 0.86s; }
  .hero.is-ready .hero__season { animation-delay: 1s; }
  @keyframes rise { to { opacity: 1; translate: 0 0; } }

  /* Photo settles. */
  .hero.is-ready .hero__photo img { animation: settle 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
  @keyframes settle { from { scale: 1.05; } to { scale: 1; } }

  /* Scroll reveal, once per section. */
  .reveal { opacity: 0; translate: 0 22px; transition: opacity 0.6s ease, translate 0.6s cubic-bezier(0.2, 0.75, 0.2, 1); }
  .reveal.is-in { opacity: 1; translate: 0 0; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-delay: 0ms !important;
      transition-duration: 0.001ms !important;
    }
    .hero__eyebrow, .hero__word, .hero__sub, .hero__lede, .hero__actions, .hero__season,
    .reveal { opacity: 1; translate: 0 0; }
    .hero__tape { scale: 1 1; }
    .embers { display: none; }
  }
}

/* ── responsive ──────────────────────────────────────────────────────── */
@layer responsive {
  @media (width <= 1000px) {
    .middle { grid-template-columns: 1fr; }
    .middle__out { padding-left: 0; padding-top: 1.2rem; border-left: 0; border-top: 3px solid var(--ember); }
  }

  @media (width <= 860px) {
    .topbar__nav a:not(.topbar__cta) { display: none; }
    .hero { align-content: end; }
    .hero__season {
      position: static;
      max-width: none;
      margin-top: 2.2rem;
      text-align: left;
    }

    /* Not enough width for courts and a queue side by side, so stack them. */
    .scene__stage { grid-template-columns: minmax(0, 1fr); }
    .scene__stage > .queue3d {
      grid-column: 1;
      grid-row: auto;
      margin-top: 0.5rem;
    }
    .queue3d__list {
      grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    }
  }

  /* Shallower courts on small screens: less vertical space, still readable. */
  @media (width <= 620px) {
    .scene {
      --tilt: 42deg;
      --court-d: 200px;
      --court-h: calc(var(--court-d) * 0.743);
      --net-h: 38px;
    }
    .court3d__score { font-size: var(--step-1); }
    .p3d__tag { font-size: 0.54rem; }
    .p3d__pip { width: 21px; height: 21px; }
  }

  /* Narrow screens stack more text over the photo, so the scrim has to carry
   * more of the contrast, especially over snow. */
  @media (width <= 860px) {
    .hero__scrim {
      background:
        linear-gradient(183deg, rgb(4 32 56 / 0.5) 0%, rgb(4 32 56 / 0.1) 30%),
        linear-gradient(357deg, rgb(6 14 24 / 0.94) 6%, rgb(6 14 24 / 0.78) 42%, rgb(6 14 24 / 0.3) 76%);
    }
  }

  @media (width <= 560px) {
    .hero__title { gap: 0 0.22em; }
    .board__foot { gap: 0.5rem; }
    .board__count { margin-left: 0; width: 100%; }
  }
}

/* ── print ───────────────────────────────────────────────────────────── *
 * The standard should print to a clean sheet you can pin to a fence, the way
 * the original flyers were. Everything that is not the standard comes off.
 */
@layer print {
  @media print {
    @page { margin: 14mm; }

    html, body {
      background: #fff;
      color: #000;
      font-size: 10.5pt;
      overflow: visible;
    }

    /* Only the standard prints. */
    .topbar,
    .hero,
    .band--crux,
    .band--flow,
    .band--house,
    .band--open,
    .band--play,
    .foot,
    .skip,
    .embers,
    .spec__meta .btn { display: none !important; }

    .band { padding: 0 !important; border: 0 !important; }
    .band--rules { background: #fff !important; }
    .wrap { width: 100% !important; }

    /* A masthead, since the page header is gone. */
    #spec::before {
      content: 'VBonfires · a standard for open pickup volleyball';
      display: block;
      padding-bottom: 3mm;
      margin-bottom: 5mm;
      border-bottom: 2pt solid #000;
      font: 800 15pt/1.1 var(--display);
      text-transform: uppercase;
      letter-spacing: 0.01em;
    }

    .eyebrow { display: none; }
    .h2 {
      max-width: none;
      font-size: 16pt;
      margin-bottom: 2mm;
    }
    .lead { font-size: 11pt; color: #000; margin-top: 0; }

    .spec__meta {
      margin-top: 3mm;
      padding-bottom: 2mm;
      border-bottom: 1pt solid #000;
    }
    .spec__ver { background: #000 !important; color: #fff !important; font-size: 9pt; }
    .spec__date { color: #000; font-size: 9pt; }

    /* Keep a clause together across a page break. */
    .rule {
      break-inside: avoid;
      padding: 4mm 0;
      border-bottom: 0.5pt solid #999;
    }
    .rule__no { color: #000; font-size: 20pt; }
    .rule__when { font-size: 12.5pt; }
    .rule__body, .rule__sub { color: #000; max-width: none; }
    .rule__sub { border-left: 1pt solid #999; font-size: 9.5pt; }

    .chip {
      background: transparent !important;
      color: #000 !important;
      border: 0.5pt solid #000 !important;
      font-size: 8.5pt;
    }

    .fineprint { color: #000; font-size: 9pt; margin-top: 4mm; }

    /* A footer with attribution, since the page footer is hidden. */
    .band--rules::after {
      content: 'Play system by James Duncan, USAV II CAP Certified. Full version at vbonfires.pages.dev';
      display: block;
      margin-top: 6mm;
      padding-top: 2mm;
      border-top: 1pt solid #000;
      font-size: 8.5pt;
    }

    /* No animation, no reveal-hidden content. */
    .reveal { opacity: 1 !important; translate: none !important; }
    * { animation: none !important; transition: none !important; }
  }
}
