/* ==========================================================================
   Andrew Chang — the whole site is one volleyball rally.
   ========================================================================== */

:root {
  --night: oklch(0.09 0 0);
  --navy: oklch(0.13 0 0);
  --navy-2: oklch(0.18 0 0);
  --panel: oklch(0.11 0 0);
  --panel-edge: oklch(1 0 0 / 0.16);

  --text: oklch(0.97 0 0);
  --muted: oklch(0.72 0 0);
  --faint: oklch(1 0 0 / 0.42);

  --accent: oklch(1 0 0);
  --accent-dim: oklch(0.8 0 0);
  --blue: oklch(0.14 0 0);
  --red: oklch(0.55 0 0);
  --floor: oklch(0.12 0 0);
  --floor-dark: oklch(0.1 0 0);
  --free-zone: oklch(0.07 0 0);
  --line: oklch(0.98 0 0);

  --header-h: 4rem;
  --court-h: clamp(170px, 25vh, 300px);
  --gutter: clamp(1rem, 3.5vw, 4rem);
  --max: 92rem;
  --ball: 3.75rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: dark;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

/* Everything is sized in rem, so the whole match scales up on big screens. */
html { font-size: clamp(15px, 0.55vw + 8.5px, 21px); }

body {
  overflow: hidden;
  background: var(--night);
  color: var(--text);
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

/* Readouts, labels, and calls are set in mono */
.brand,
.team-name,
.team-score,
.board-play,
.touches i,
.header-links,
.eyebrow,
.scene-call,
.scene-sub,
.tags,
.set-top,
.set-role,
.option-pos,
.playbook-title,
.play em,
.playbook-note,
.player-meta,
.ball-hint,
.ball-aim,
.attacker-call,
.attacker-name,
.chip {
  font-family: "Geist Mono", ui-monospace, monospace;
}

a { color: inherit; }

h1, h2, h3, p { margin: 0; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--night);
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Scoreboard header ---------- */

.scoreboard {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, oklch(0.11 0 0), oklch(0.11 0 0 / 0.88));
  border-bottom: 1px solid oklch(1 0 0 / 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  justify-self: start;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-num {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--night);
  font-weight: 900;
  font-size: 1.05rem;
}

.board {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.team-name {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-score {
  min-width: 2.6rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: oklch(0.06 0 0);
  border: 1px solid oklch(1 0 0 / 0.08);
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 0 12px oklch(1 0 0 / 0.55);
}

.team--away .team-score {
  color: oklch(0.62 0 0);
  text-shadow: none;
}

.team-score.is-bumped { animation: score-bump 0.5s var(--ease-bounce); }

@keyframes score-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.board-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 8.5rem;
  padding: 0 0.5rem;
}

.board-play {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.touches {
  display: flex;
  gap: 0.35rem;
}

.touches i {
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1.5px solid oklch(1 0 0 / 0.3);
  font-style: normal;
  font-size: 0.55rem;
  font-weight: 900;
  color: var(--night);
  transition: background 0.2s, border-color 0.2s, transform 0.3s var(--ease-bounce);
}

.touches i.is-on {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.header-links {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.header-links a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}

.header-links a:hover { color: var(--accent); }

.timeout {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

body.in-play .timeout {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Arena + gym ---------- */

.arena {
  position: fixed;
  inset: var(--header-h) 0 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.gym {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 55% at 50% 0%, oklch(1 0 0 / 0.07), transparent 70%),
    linear-gradient(oklch(1 0 0 / 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, oklch(1 0 0 / 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--night);
  transition: filter 0.5s ease;
}

.gym-lights {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.5) 20%, oklch(1 0 0 / 0.5) 80%, transparent);
  box-shadow: 0 0 40px 10px oklch(1 0 0 / 0.06);
}

.arena:not([data-scene="home"]) .gym { filter: brightness(0.85); }

/* 3D court: drawn in perspective by main.js into the bottom band of the arena */
.court {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.court-band {
  position: absolute;
  inset: auto 0 0;
  height: var(--court-h);
  visibility: hidden;
}

.court-free { fill: var(--free-zone); }
.court-grid { stroke: oklch(1 0 0 / 0.07); stroke-width: 1; }
.court-boards { fill: oklch(0.06 0 0); stroke: oklch(1 0 0 / 0.14); stroke-width: 1; }
.court-boards-top { stroke: oklch(1 0 0 / 0.55); stroke-width: 1.5; }
.court-wood { fill: var(--floor); }
.court-front { fill: oklch(0.15 0 0); }

.court-line {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px oklch(1 0 0 / 0.55));
}

.court-dash { stroke-width: 1.5; stroke-dasharray: 6 6; filter: none; opacity: 0.6; }

.net-mesh { fill: oklch(0 0 0 / 0.35); }
.net-thread { stroke: oklch(1 0 0 / 0.18); stroke-width: 1; }
.net-cable { stroke: oklch(1 0 0 / 0.5); stroke-width: 2; }

.net-tape {
  stroke: var(--line);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px oklch(1 0 0 / 0.6));
}

.antenna { stroke: oklch(0.35 0 0); stroke-width: 4; }
.antenna--w { stroke: var(--line); }

.post {
  stroke: oklch(0.55 0 0);
  stroke-width: 6;
  stroke-linecap: round;
}
/* ---------- Ball ---------- */

.ball {
  position: absolute;
  z-index: 20;
  left: 0;
  top: 0;
  width: var(--ball);
  height: var(--ball);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  will-change: transform;
}

.ball-shadow {
  position: absolute;
  z-index: 11;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, oklch(0.08 0 0 / 0.6), oklch(0.08 0 0 / 0));
  pointer-events: none;
  will-change: transform, opacity;
}

.ball:active { cursor: grabbing; }

.ball:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}

.ball-skin {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  will-change: transform;
}

/* Molten-style colours: the one splash of colour on the court. */
.ball-base { fill: #f7f7f4; }
.ball-navy { fill: #1f2a86; }
.ball-red { fill: #e2262e; }

.ball-seams {
  fill: none;
  stroke: oklch(0.25 0 0 / 0.35);
  stroke-width: 1;
}

#ball-hex path {
  fill: none;
  stroke: oklch(0 0 0 / 0.1);
  stroke-width: 0.45;
}

.ball.is-floating:not(.is-held):not(.is-flying) .ball-skin {
  animation: ball-float 2.6s ease-in-out infinite;
}

@keyframes ball-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-7px) rotate(-10deg); }
}

.ball-rim {
  fill: none;
  stroke: oklch(0.2 0 0 / 0.35);
  stroke-width: 1;
}

.arena[data-scene="home"] .ball:not(.is-held):not(.is-flying) .ball-skin {
  animation: ball-breathe 2.4s ease-in-out infinite;
}

@keyframes ball-breathe {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-5px) rotate(8deg); }
}

.ball::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  margin: -50% 0 0 -50%;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}

.arena[data-scene="home"] .ball:not(.is-held):not(.is-flying)::before {
  animation: ball-ping 2.4s ease-out infinite;
}

@keyframes ball-ping {
  0% { transform: scale(1); opacity: 0.7; }
  70%, 100% { transform: scale(2.1); opacity: 0; }
}

.ball-aim {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--night);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.ball.is-held .ball-aim:not(:empty) { opacity: 1; }

.ball-hint {
  position: absolute;
  z-index: 19;
  left: calc(var(--ball-x, 6rem) + var(--ball) / 2 + 1rem);
  top: calc(var(--ball-y, 80%) - 0.7rem);
  display: flex;
  gap: 0.9rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.4s, transform 0.4s var(--ease-out), left 0.5s var(--ease-out), top 0.5s var(--ease-out);
}

.arena.is-rallying .ball-hint { opacity: 0; }

.ball-hint b { color: var(--accent); font-weight: 900; }

body.in-play .ball-hint {
  opacity: 1;
  transform: none;
}

.arena.is-called .ball-hint { opacity: 0; }

/* ---------- Attackers: one per project, standing on the court ---------- */

.attackers {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.attacker {
  --s: 1;
  --i: 0;
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0 0.55rem;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transform: translate(-50%, -100%) scale(var(--s));
  transform-origin: 50% 100%;
  pointer-events: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s, visibility 0s 0.25s;
}

.attacker:nth-child(2) { --i: 1; }
.attacker:nth-child(3) { --i: 2; }
.attacker:nth-child(4) { --i: 3; }
.attacker:nth-child(5) { --i: 4; }

.arena.is-called .attacker {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.4s var(--ease-out) calc(var(--i) * 70ms + 250ms), visibility 0s;
}

.attacker:focus-visible { outline: none; }
.attacker:focus-visible .attacker-call { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Floor ring where the hitter stands */
.attacker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 3.4rem;
  height: 1.1rem;
  margin: 0 0 -0.55rem -1.7rem;
  border-radius: 50%;
  border: 2px solid oklch(1 0 0 / 0.55);
  background: oklch(0.1 0 0 / 0.25);
  transition: border-color 0.2s, background 0.2s;
}

.attacker-call {
  min-width: 2.6rem;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  border: 1px solid oklch(1 0 0 / 0.5);
  background: oklch(0.06 0 0 / 0.92);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 8px 18px oklch(0.05 0 0 / 0.45);
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.25s var(--ease-bounce);
}

.attacker-name {
  max-width: 6.75rem;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  background: oklch(0.06 0 0 / 0.8);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
}

.attacker:hover .attacker-call {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.attacker[aria-pressed="true"] .attacker-call {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--night);
  box-shadow: 0 0 18px oklch(1 0 0 / 0.45);
}

.attacker[aria-pressed="true"] .attacker-name { color: var(--text); }

.attacker[aria-pressed="true"]::after {
  border-color: var(--accent);
  background: oklch(1 0 0 / 0.28);
}

.attacker.is-hitting { animation: hitter-jump 0.55s var(--ease-out); }

@keyframes hitter-jump {
  0%, 100% { translate: 0 0; }
  40% { translate: 0 -1.1rem; }
}

.impact {
  position: absolute;
  z-index: 15;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  pointer-events: none;
  animation: impact 0.7s var(--ease-out) forwards;
}

@keyframes impact {
  from { transform: scale(0.4) scaleY(0.5); opacity: 1; }
  to { transform: scale(9) scaleY(0.35); opacity: 0; }
}

.impact--echo {
  border-width: 2px;
  animation: impact-echo 0.85s var(--ease-out) forwards;
}

@keyframes impact-echo {
  from { transform: scale(0.6) scaleY(0.5); opacity: 0.8; }
  to { transform: scale(15) scaleY(0.32); opacity: 0; }
}

.impact--flash {
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border: 0;
  background: radial-gradient(closest-side, oklch(1 0 0 / 0.9), oklch(1 0 0 / 0.25) 45%, oklch(1 0 0 / 0));
  animation: impact-flash 0.45s ease-out forwards;
}

@keyframes impact-flash {
  from { transform: scale(0.3) scaleY(0.45); opacity: 1; }
  to { transform: scale(1.6) scaleY(0.4); opacity: 0; }
}

/* The hand hitting the ball. */
.impact--hand {
  z-index: 21;
  border-width: 2px;
  animation: impact-hand 0.35s var(--ease-out) forwards;
}

@keyframes impact-hand {
  from { transform: scale(0.6); opacity: 1; }
  to { transform: scale(4.5); opacity: 0; }
}

.streak {
  position: absolute;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 0 6px oklch(1 0 0 / 0.6));
}

.arena.is-shaking { animation: shake 0.45s cubic-bezier(0.3, 0.7, 0.4, 1); }

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  12% { transform: translate(-3px, 9px); }
  28% { transform: translate(6px, -5px); }
  44% { transform: translate(-5px, 3px); }
  62% { transform: translate(3px, -2px); }
  80% { transform: translate(-1px, 1px); }
}

/* ---------- Referee call ---------- */

.call {
  position: absolute;
  z-index: 25;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: clamp(3.5rem, 13vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent);
  -webkit-text-stroke: 1px var(--night);
  text-shadow: 0 0 30px oklch(1 0 0 / 0.35), 0 10px 40px oklch(0 0 0 / 0.8);
  pointer-events: none;
  opacity: 0;
}

.call.is-away {
  color: transparent;
  -webkit-text-stroke: 2px oklch(0.8 0 0);
  text-shadow: none;
}

.call.is-showing { animation: call 1s var(--ease-out) forwards; }
.call.is-point.is-showing { animation: call-slam 1.25s var(--ease-out) forwards; }

@keyframes call-slam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); filter: blur(6px); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(0.94); filter: blur(0); }
  22% { transform: translate(-50%, -50%) scale(1.03); }
  32%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1); }
}

@keyframes call {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1); }
}

/* ---------- Scenes ---------- */

.scene {
  position: absolute;
  inset: 0 0 calc(var(--court-h) + 0.25rem);
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: clamp(1.25rem, 4vh, 3rem) var(--gutter) 1.5rem;
  pointer-events: none;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.25rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.25rem), transparent);
}

.scene[hidden] { display: none; }

.scene * { pointer-events: auto; }

.scene .scene-inner,
.scene .home-grid,
.scene .home-side,
.scene .sets,
.scene .hitters,
.scene .hitter-body,
.scene .kill {
  pointer-events: none;
}

.scene-inner,
.home-grid {
  width: 100%;
  max-width: var(--max);
  min-height: 100%;
  margin: 0 auto;
}

.scene-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.scene[data-enter="home"] { animation: enter-fade 0.5s var(--ease-out) both; }
.scene[data-enter="dig"] { animation: enter-dig 0.6s var(--ease-out) both; }
.scene[data-enter="set"] { animation: enter-set 0.6s var(--ease-out) both; }
.scene[data-enter="spike"] { animation: enter-spike 0.5s var(--ease-bounce) both; }

@keyframes enter-fade { from { opacity: 0; } }
@keyframes enter-dig { from { opacity: 0; transform: translateY(60px); } }
@keyframes enter-set { from { opacity: 0; transform: translateX(-80px); } }
@keyframes enter-spike { from { opacity: 0; transform: translateY(-50px) scale(1.04); } }

.scene[data-enter] .set {
  animation: enter-dig 0.6s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}

.scene-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  column-gap: 1.25rem;
  margin-bottom: clamp(1rem, 3vh, 1.75rem);
}

.scene-call {
  grid-row: span 2;
  font-size: clamp(2.6rem, 6vw, 4.75rem);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.scene-head h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
}

.scene-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Tags often sit over the net, so each glyph gets a dark halo that knocks the mesh out behind it. */
.tags {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-shadow: 0 0 2px var(--night), 0 0 6px var(--night), 0 0 10px var(--night);
}

/* Project text has no card behind it, so the antennas would still run through the gaps. */
.hitter-body .tags {
  width: fit-content;
  margin-left: -0.4rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  background: var(--night);
  box-shadow: 0 0 12px 6px var(--night);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid oklch(1 0 0 / 0.22);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  background: oklch(0.13 0 0);
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s var(--ease-bounce);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.chip--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--night);
}

.chip--solid:hover {
  background: oklch(0.86 0 0);
  color: var(--night);
}

/* ---------- Warmups (home) ---------- */

.home-grid {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
}

.eyebrow {
  margin-bottom: 1rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-intro h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.lede {
  max-width: 34rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
}

.home-side {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
}

.player-card {
  position: relative;
  margin: 0;
  width: clamp(8.5rem, 13vw, 11rem);
  padding: 0.5rem 0.5rem 0;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 0 20px 40px oklch(0.05 0 0 / 0.55);
  transform: rotate(-4deg);
  transition: transform 0.4s var(--ease-bounce);
}

.player-card:hover { transform: rotate(0deg) scale(1.03); }

.player-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  filter: grayscale(1) contrast(1.08);
  transition: filter 0.5s var(--ease-out);
}

.player-card:hover img,
.player-card:active img {
  filter: grayscale(0) contrast(1);
}

.player-card figcaption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.1rem 0.55rem;
  color: var(--night);
}

.player-num {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
}

.player-meta {
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.player-meta b {
  display: block;
  font-size: 0.85rem;
  font-weight: 900;
}

.playbook {
  padding: 1.1rem 1.2rem;
  border-radius: 6px;
  background: oklch(0.07 0 0);
  border: 1px solid var(--panel-edge);
  box-shadow: 0 20px 40px oklch(0 0 0 / 0.5);
}

.playbook-title {
  margin-bottom: 0.75rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: oklch(0.95 0 0 / 0.72);
}

.plays {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.play {
  display: grid;
  grid-template-columns: 2.1rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: oklch(0.95 0 0 / 0.85);
}

.play svg {
  width: 2.1rem;
  height: 2.1rem;
  fill: none;
  stroke: oklch(0.97 0 0);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
}

.play b {
  margin-right: 0.35rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.play em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px dashed oklch(1 0 0 / 0.5);
  color: oklch(0.88 0 0);
}

.play.is-hot b { text-shadow: 0 0 12px var(--accent); }
.play.is-hot svg { animation: chalk 0.6s ease; }

@keyframes chalk {
  from { stroke-dashoffset: 60; }
  to { stroke-dashoffset: 0; }
}

.playbook-note {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

.playbook.is-nudged { animation: nudge 0.5s ease; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Dig: Work box score ---------- */

.sets {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.set {
  --i: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: clamp(1.1rem, 1.8vw, 1.75rem);
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.set:nth-child(2) { --i: 1; }
.set:nth-child(3) { --i: 2; }

.set--live {
  border-color: oklch(1 0 0 / 0.55);
  background: oklch(0.14 0 0);
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.25), 0 0 40px oklch(1 0 0 / 0.07), 0 20px 50px oklch(0.05 0 0 / 0.45);
}

.set.set--live h3 { font-size: clamp(1.9rem, 3vw, 2.9rem); }
.set.set--live .set-desc { font-size: 1.08rem; color: var(--text); }

.set-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px dashed oklch(1 0 0 / 0.16);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.set-no {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: oklch(0.06 0 0);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.set-years {
  margin-left: auto;
  color: var(--muted);
}

.set-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
}

.set-live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: live 1.4s ease-in-out infinite;
}

@keyframes live {
  50% { opacity: 0.3; }
}

.set h3 {
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-weight: 800;
  line-height: 1.1;
}

.set-role {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.set-desc {
  flex: 1;
  color: var(--muted);
  font-size: 1rem;
}

/* ---------- Set: Projects as the setter's options ---------- */

.hitters {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 1fr);
  grid-template-areas: "shot body";
  column-gap: clamp(1.5rem, 3vw, 3.5rem);
  row-gap: 1rem;
  align-items: center;
}

.hitter { display: contents; }
.hitter[hidden] { display: none; }

.hitter-shot {
  grid-area: shot;
  margin: 0;
  /* Fill the column, but never taller than the space above the ball. */
  width: min(100%, calc((100dvh - var(--header-h) - var(--court-h) - 13rem) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid oklch(1 0 0 / 0.14);
  box-shadow: 0 30px 70px oklch(0.05 0 0 / 0.55);
}

.hitter-shot img {
  width: 100%;
  height: 100%;
  padding: 3%;
  object-fit: contain;
}

.hitter-shot--full { background: oklch(0.12 0 0); }

.hitter-shot--full img {
  padding: 0;
  object-fit: cover;
  object-position: top;
}

.hitter-body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hitter-body h3 {
  font-size: clamp(1.9rem, 3vw, 3rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.01em;
}

.hitter-desc {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hitter-body .link-row { padding-top: 0.25rem; }

.option-pos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.option-pos span {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--night);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
}

.hitters.is-swapping .hitter-shot { animation: enter-set 0.45s var(--ease-out) both; }
.hitters.is-swapping .hitter-body { animation: enter-set 0.45s var(--ease-out) 60ms both; }

.scene[data-enter] .hitter-shot { animation: enter-set 0.6s var(--ease-out) 120ms both; }
.scene[data-enter] .hitter-body { animation: enter-set 0.6s var(--ease-out) 190ms both; }
/* ---------- Spike: Contact ---------- */

.kill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding-top: 2rem;
  text-align: center;
}

.kill-word {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  transform: translate(-50%, -58%);
  font-size: clamp(8rem, 30vw, 22rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 2px oklch(1 0 0 / 0.16);
  pointer-events: none;
}

.kill .scene-call { grid-row: auto; }

.kill h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 800;
}

.kill-lede {
  max-width: 30rem;
  color: var(--muted);
}

.kill-email {
  margin: 0.4rem 0 0.6rem;
  font-size: clamp(1.4rem, 3.6vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 4px no-repeat;
  padding-bottom: 0.15rem;
  transition: color 0.2s;
  overflow-wrap: anywhere;
}

.kill-email:hover { color: var(--accent); }

.kill .link-row { justify-content: center; }

@media (min-width: 861px) {
  .scene--spike .scene-inner {
    max-width: none;
    padding-left: calc(50% + 1rem);
  }

  .kill-word { font-size: clamp(8rem, 18vw, 16rem); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .hitters {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "shot"
      "body";
  }

  .hitter-shot { width: 100%; }

}

@media (max-width: 860px) {
  :root { --header-h: 58px; --ball: 64px; }

  .scoreboard {
    grid-template-columns: auto 1fr auto;
    gap: 0.6rem;
  }

  .brand-name,
  .header-links a:not(.timeout),
  .team-name { display: none; }

  .board { justify-self: center; }

  .board-mid { min-width: 6.5rem; }

  .home-grid {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 1.5rem;
  }

  .home-side { grid-template-columns: 1fr; }

  .player-card { display: none; }

  .sets { grid-template-columns: 1fr; }

  .scene-head { column-gap: 0.85rem; }

  .ball-hint span:last-child { display: none; }

  .attacker-name { display: none; }
}

@media (max-width: 560px) {
  .play {
    grid-template-columns: 1.6rem 1fr auto;
    gap: 0.6rem;
    font-size: 0.82rem;
  }

  .play svg { width: 1.6rem; height: 1.6rem; }
}

@media (max-height: 760px) and (min-width: 861px) {
  .home-intro h1 { font-size: clamp(3rem, 8vw, 6rem); }
  .set { padding: 1rem; }
  .set-desc { font-size: 0.86rem; }
}

/* ---------- First load: the gym powers on ---------- */
/* `backwards` fill only, so nothing stays pinned once the intro is over (the card still tilts on hover). */

.intro .gym { animation: lights-on 0.9s backwards; }

@keyframes lights-on {
  0% { opacity: 0; animation-timing-function: steps(1, end); }
  16% { opacity: 0.6; animation-timing-function: steps(1, end); }
  24% { opacity: 0.08; animation-timing-function: steps(1, end); }
  38% { opacity: 0.85; animation-timing-function: steps(1, end); }
  46% { opacity: 0.3; animation-timing-function: ease-out; }
  70%, 100% { opacity: 1; }
}

.intro .gym-lights { animation: lights-bar 0.8s var(--ease-out) 0.1s backwards; }

@keyframes lights-bar { from { transform: scaleX(0); opacity: 0; } }

.intro .court {
  transform-origin: 50% 100%;
  animation: court-rise 1.1s var(--ease-out) 0.3s backwards;
}

@keyframes court-rise {
  from { opacity: 0; transform: translateY(48px) scaleY(0.82); filter: brightness(2.4); }
  55% { opacity: 1; filter: brightness(1.7); }
}

.intro .scoreboard { animation: board-drop 0.7s var(--ease-out) 0.55s backwards; }

@keyframes board-drop { from { opacity: 0; transform: translateY(-100%); } }

.intro .scene--home .eyebrow { animation: intro-rise 0.7s var(--ease-out) 0.75s backwards; }
.intro .scene--home h1 { animation: name-reveal 0.95s var(--ease-out) 0.85s backwards; }
.intro .scene--home .lede { animation: intro-rise 0.7s var(--ease-out) 1.05s backwards; }
.intro .scene--home .link-row { animation: intro-rise 0.7s var(--ease-out) 1.15s backwards; }
.intro .scene--home .player-card { animation: card-deal 0.85s var(--ease-bounce) 1.05s backwards; }
.intro .scene--home .playbook { animation: board-slide 0.75s var(--ease-out) 1.25s backwards; }

@keyframes intro-rise { from { opacity: 0; transform: translateY(18px); } }

@keyframes name-reveal {
  from { opacity: 0; clip-path: inset(100% 0 -10% 0); transform: translateY(0.35em); }
  to { clip-path: inset(0 0 -10% 0); }
}

@keyframes card-deal {
  from { opacity: 0; transform: translate(60px, 40px) rotate(14deg) scale(0.9); }
  to { transform: rotate(-4deg); }
}

@keyframes board-slide { from { opacity: 0; transform: translateX(40px); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
