/* ============================================================
   Schedule board — the upper panel.
   Mirrors NBA Jam's team-select grid: gold HOME block on the left,
   magenta AWAY block on the right, vertical edge labels, and a cyan
   selection box on the next game (where "DENVER" was selected).
   ============================================================ */

.board {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: clamp(3px, 0.6cqw, 9px);
  min-height: 0;
  padding: clamp(4px, 0.7cqw, 10px);
  background:
    radial-gradient(ellipse at 50% 0%, #16162a 0%, #08080f 70%),
    var(--jam-black);
  border: clamp(4px, 0.75cqw, 10px) solid transparent;
  border-image: var(--wood-v) 1 / clamp(4px, 0.75cqw, 10px) / 0 stretch;
  border-radius: 4px;
}

/* ── Vertical HOME / AWAY edge labels ─────────────────────── */
.board__edge {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 clamp(1px, 0.2cqw, 3px);
}
.board__edge span {
  font-family: var(--font-display);
  font-size: clamp(9px, 2.1cqw, 27px);
  line-height: 1;
  letter-spacing: .16em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  text-shadow: var(--outline);
}
.board__edge--home span { color: var(--jam-gold); }
.board__edge--away span { color: var(--jam-magenta); }

/* ── The feed ─────────────────────────────────────────────
   One chronological list of every upcoming game. Colour carries home vs away
   (gold / magenta), and the vertical edge labels either side act as the legend
   for that coding. */
.board__grid {
  display: grid;
  min-height: 0;
  min-width: 0;
  /* Fade the list out at the top and bottom edges instead of letting rows be
     cut hard by the frame while scrolling. */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
}

.games {
  display: flex;
  flex-direction: column;
  gap: clamp(1px, 0.25cqw, 4px);
  margin: 0;
  padding: clamp(3px, 0.5cqw, 7px) 0;
  list-style: none;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.games::-webkit-scrollbar { display: none; }
.games:focus-visible { outline: 2px solid var(--jam-cyan); outline-offset: -2px; }

/* Home/away filter, driven by data-filter on the list (set by the chips). */
.games[data-filter="home"] .game--away,
.games[data-filter="away"] .game--home { display: none; }

/* Games already played, marked by app.js. Kept on the board as a record of
   the season, but drained of colour so the live fixtures read first. */
.game--played {
  opacity: .45;
  filter: saturate(.35);
}
.game--played .game__opp { color: #9a9ab0; }

/* ── A game row ──────────────────────────────────────────── */
.game {
  position: relative;
  display: grid;
  /* badge · when · opponent · venue */
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(4px, 0.8cqw, 12px);
  padding: clamp(2px, 0.42cqw, 6px) clamp(4px, 0.8cqw, 12px);
  font-size: clamp(8px, 1.2cqw, 16px);
  line-height: 1.25;
  white-space: nowrap;
  border: 2px solid transparent;
  border-radius: 2px;
  transition: background-color .09s steps(3), transform .09s steps(3);
}

/* Side is carried on the row itself, not the column, because below 900px the
   two columns merge into one date-ordered list and the rows keep their colour. */
.game--home { color: var(--jam-gold); }
.game--away { color: var(--jam-magenta); }

/* H / A badge. Redundant with the colour coding by design — colour alone must
   never be the only signal for home vs away. */
.game__badge {
  display: grid;
  place-items: center;
  min-width: 1.7em;
  font-family: var(--font-display);
  font-size: .78em;
  padding: .2em .3em;
  color: var(--jam-black);
  border: 1px solid #000;
}
.game--home .game__badge { background: var(--jam-gold); }
.game--away .game__badge { background: var(--jam-magenta); }

.game__when {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.game__opp {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--jam-cream);
}
.game__side {
  color: inherit;
  opacity: .85;
}

/* Venue: a real button, so keyboard and screen-reader support is free. */
.game__venue {
  font: inherit;
  color: var(--jam-cyan);
  background: none;
  border: 0;
  padding: 0 clamp(2px, 0.3cqw, 4px);
  cursor: pointer;
  text-shadow: var(--outline-thin);
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}
.game__venue::before {
  content: '\25B8';           /* ▸ */
  display: inline-block;
  margin-right: .35em;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .1s steps(2), transform .1s steps(2);
}
.game__venue:hover,
.game__venue:focus-visible { color: #ccf7ff; text-decoration: underline dotted; }
.game__venue:hover::before,
.game__venue:focus-visible::before,
.game__venue[aria-pressed="true"]::before { opacity: 1; transform: translateX(0); }

.game__venue[aria-pressed="true"] {
  color: var(--jam-green);
  text-decoration: underline;
}

/* ── Hover: pop, glow, and a spinning ball on the left ─────
   The ball hangs outside the row, so it is attached to the badge's pseudo-
   element (positioned against the row) — .game__opp clips its overflow and
   .game's own ::before/::after are already spoken for. */
.game:hover {
  background-color: rgba(34, 231, 255, .1);
  transform: translateX(clamp(1px, 0.3cqw, 4px));
  border-color: rgba(34, 231, 255, .35);
}
.game:hover .game__opp { color: #fff; }

.game__badge::before {
  content: '';
  position: absolute;
  top: 50%;
  left: clamp(-14px, -1.1cqw, -8px);
  width: 1em;
  height: 1em;
  margin-top: -.5em;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 45%, rgba(0,0,0,.75) 45% 55%, transparent 55%),
    radial-gradient(circle at 34% 30%, #ffb45c 0%, #e2701a 55%, #a8410a 100%);
  opacity: 0;
  transition: opacity .1s steps(2);
}
.game:hover .game__badge::before {
  opacity: 1;
  animation: ball-spin .7s linear infinite;
}
@keyframes ball-spin { to { transform: rotate(360deg); } }

/* Score flash on hover — varied by row position so it is not always "+2". */
.game:hover::after {
  content: '+2';
  position: absolute;
  right: clamp(3px, 0.6cqw, 9px);
  bottom: 55%;
  font-family: var(--font-display);
  font-size: .72em;
  color: var(--jam-green);
  text-shadow: var(--outline-thin);
  pointer-events: none;
  animation: swish .55s steps(5) forwards;
}
.game:nth-child(3n):hover::after { content: '+3'; }
.game:nth-child(4n):hover::after { content: 'SWISH'; }
.game:nth-child(7n):hover::after { content: 'BOOMSHAKALAKA'; }

@keyframes swish {
  0%   { opacity: 1; transform: translateY(4px) scale(.7); }
  100% { opacity: 0; transform: translateY(-14px) scale(1.25); }
}

/* ── The next game: cyan selection box ──────────────────────
   This is "DENVER" in the reference — filled blue, bright cyan keyline,
   bloom, and a stepped blink (arcade hardware didn't ease). */
.game--next {
  color: #d8fbff;
  background: linear-gradient(180deg, #1b53f0, #0a2a9c);
  border-color: var(--jam-cyan);
  box-shadow:
    0 0 0 2px #000,
    0 0 clamp(6px, 1.3cqw, 18px) rgba(34, 231, 255, .7);
  animation: next-pulse 1.1s steps(2, jump-none) infinite;
}
.game--next .game__opp,
.game--next .game__side { color: #fff; }
.game--next .game__venue { color: #b9f6ff; }
@keyframes next-pulse {
  to { border-color: #d8fbff; box-shadow: 0 0 0 2px #000, 0 0 clamp(10px, 2cqw, 26px) rgba(34,231,255,.95); }
}

/* Player-cursor badge on the next game, like the "2" and "3" markers in the
   original. */
.game--next::before {
  content: '1';
  position: absolute;
  top: -0.55em;
  left: -0.3em;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  font-family: var(--font-display);
  font-size: .7em;
  color: #fff;
  background: var(--jam-red);
  border: 2px solid #000;
  border-radius: 3px;
  animation: cursor-bob .8s steps(2, jump-none) infinite alternate;
}
@keyframes cursor-bob { to { transform: translateY(-2px); } }

/* ── Season-over notice ─────────────────────────────────────── */
.board__status {
  grid-column: 1 / -1;
  place-self: center;
  margin: auto;
  padding: clamp(8px, 1.4cqw, 18px) clamp(12px, 2cqw, 26px);
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.5cqw, 19px);
  line-height: 1.8;
  color: var(--jam-gold);
  background: #0c0c16;
  border: 3px solid var(--jam-gold);
  text-shadow: var(--outline-thin);
}
.board__status b { display: block; color: var(--jam-magenta); }

/* ── Mobile filter chips ───────────────────────────────────
   Hidden on desktop, where the gold/magenta columns already do this job. */
.board__filter { display: none; }

.chip {
  font-family: var(--font-display);
  font-size: 10px;
  padding: 6px 9px;
  color: var(--jam-cream);
  background: #14141f;
  border: 2px solid #3f3f52;
  border-radius: 2px;
  cursor: pointer;
}
.chip.is-active {
  color: var(--jam-black);
  background: var(--jam-gold);
  border-color: #000;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet / small laptop: the feed is already a single column, so the vertical
   edge labels give way to the filter chips and the rows just breathe more. */
@media (max-width: 900px) {
  .board {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  .board__edge { display: none; }
  .board__filter {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 4px;
  }
  .games {
    max-height: 58vh;
    font-size: clamp(11px, 2.5vw, 15px);
  }
  .game { font-size: clamp(11px, 2.5vw, 15px); }
}

/* Phone: the row becomes three lines — badge + when, opponent, venue —
   because 50-odd characters of pixel type will not sit on one 360px line. */
@media (max-width: 620px) {
  .game {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: 'badge when' 'opp opp' 'venue venue';
    row-gap: 3px;
    column-gap: 8px;
    font-size: 12px;
    padding: 7px 8px;
    white-space: normal;
  }
  .game__badge { grid-area: badge; }
  .game__when  { grid-area: when; }
  .game__opp   { grid-area: opp; white-space: normal; }
  .game__venue {
    grid-area: venue;
    justify-self: start;
    text-align: left;
    padding-left: 0;
  }
  .game__badge::before { display: none; }
  .game:hover::after { display: none; }
  .games { max-height: none; }
  .chip { font-size: 9px; padding: 7px 8px; }
}
