/* =========================================================
   STADIUM DAYLIGHT — Leaderboard (/leaderboard)
   The competition surface — sortable family standings.
   Tokens: tokens.css. Conventions: BEM, mobile-first.
   ========================================================= */

.leaderboard {
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.leaderboard__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.leaderboard__heading {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  font-variation-settings: "SOFT" 100, "opsz" 96;
}

.leaderboard__empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--slate);
  font-size: 14px;
}

/* Horizontal scroll wrapper — 9 columns won't fit on phone screens. */
.leaderboard__scroll {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.leaderboard__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--ink);
}

.leaderboard__table thead {
  background: var(--border-soft);
}

.leaderboard__col,
.leaderboard__cell {
  padding: 12px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}
.leaderboard__col {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}

.leaderboard__col--position,
.leaderboard__col--name,
.leaderboard__cell--position,
.leaderboard__cell--name {
  text-align: left;
}
.leaderboard__col--position,
.leaderboard__cell--position {
  width: 44px;
  color: var(--slate-soft);
}

.leaderboard__col-link {
  color: inherit;
  text-decoration: none;
}
.leaderboard__col-link:hover { color: var(--ink); }

/* Active-column arrow — ▲ for asc, ▼ for desc. */
.leaderboard__col[data-sort-active]::after {
  content: " ▼";
  font-size: 10px;
  color: var(--ink);
}
.leaderboard__col[data-sort-active="asc"]::after { content: " ▲"; }

.leaderboard__row:hover { background: var(--border-soft); }

.leaderboard__cell--name {
  font-weight: 600;
  color: var(--ink);
}
/* Stack the name above the form-dots row. An inner span carries the
   bold weight so the dots can sit beneath without inheriting it. Flex
   on the cell would risk breaking native <td> layout on some browsers;
   the children are block-level by default, which keeps the row valid. */
.leaderboard__name {
  display: block;
  margin-bottom: 4px;
}

/* ----- Form dots ------------------------------------------------------
   Five-dot recent-form indicator under each player's name. The colour
   map mirrors the badge palette (DESIGN.md §"Badges and Chips"):
     --exact   (5 pts) → --pitch       full hit
     --good    (3 pts) → --pitch-soft  correct goal diff
     --outcome (1 pt ) → --sky         correct outcome
     --miss    (0 pts) → --error-soft  wrong outcome
     --empty   (none ) → border-only   no prediction / future slot
   Each dot carries a 1.5px border in the deeper shade for crispness on
   the chalk surface; the empty slot is transparent-fill + border-only.
*/
.form-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.form-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  flex-shrink: 0;
}
.form-dot--exact   { background: var(--pitch);      border-color: var(--pitch-deep); }
.form-dot--good    { background: var(--pitch-soft); border-color: var(--pitch-deep); }
.form-dot--outcome { background: var(--sky);        border-color: var(--sky-deep); }
.form-dot--miss    { background: var(--error-soft); border-color: var(--error-deep); }
.form-dot--empty   { background: transparent;       border-color: var(--border); }

/* The dots themselves carry a native `title` tooltip in addition to
   aria-label, so the `help` cursor advertises that hovering reveals
   info. Unaffected by sortable column links above (those use the
   default link cursor) because cursor inherits from the closest
   declaration. */
.form-dot { cursor: help; }

/* ----- Form-dots legend -----------------------------------------------
   A single compact strip rendered above the leaderboard table that maps
   each dot colour to a one-word Dutch label. Mono labels in slate so the
   legend reads as a hint, not another table.

   Wraps to multiple rows on narrow screens by default — items stay as
   inline-flex chips so the row reflow is graceful.
*/
.form-dots-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
}
.form-dots-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.form-dots-legend__dot {
  display: inline-flex;
  margin: 0;
}
.form-dots-legend__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--slate);
}
.leaderboard__cell--num,
.leaderboard__cell--money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.leaderboard__cell--money { color: var(--ink-soft); }
.leaderboard__cell--negative { color: var(--error-deep); }

/* ----- Wider screens ---------------------------------------- */

@media (min-width: 481px) {
  .leaderboard { padding: var(--space-lg) var(--space-md); }
}
