/* Copyright (c) 2026 Brownie, LLC. All rights reserved. */

/*
 * The Season view (views/season.ts): a team's or a school's season in
 * numbers, and the links to it from the team and school pages. Also a
 * tournament's page (views/tournaments.ts) and NASP's totals on cards.
 * Builds on the shared pieces in styles.css, team.css and team-roster.css.
 */

.season-links .button {
  text-decoration: none;
}

/* The projected team score, big, with "of 3,600" beside it. */
.season-total {
  color: var(--color-text-muted);
}

.season-total b {
  color: var(--color-text);
  font: 700 2.2rem/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* The bubble: ranks 11 to 14, highlighted in the table and named in the key. */
.season-table tr.is-bubble > * {
  background: var(--color-ten-soft);
}

.season-bubble-key {
  padding: 1px 6px;
  border-radius: var(--control-radius);
  background: var(--color-ten-soft);
  color: var(--color-text);
  font-weight: 600;
}

/* "Not counted": the line where the team score stops counting. */
.season-table tr.season-cut td {
  padding-block: 4px;
  border-top: 2px solid var(--color-text-muted);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.season-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* The leaderboard is the page's sortable table (components.ts dataTable).
   Its headings keep their small letters, so "10s" and "50s" never read
   "10S" and "50S"; numbers are in the display font, the average bold. */
.data-table.leaderboard-table thead th {
  letter-spacing: 0;
  text-transform: none;
}

.leaderboard-table td.is-numeric {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.leaderboard-table td.is-total {
  font-size: 1.25rem;
  font-weight: 700;
}

.leaderboard-table th[aria-sort] {
  color: var(--color-text);
}

/* The sections under the header, drawn again when a filter changes: cards on
   a grid, two to a row on a wide screen (the leaderboard beside most
   improved), the rest across the whole width. */
.season-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  align-items: start;
  gap: 16px;
  min-width: 0;
}

.season-sections > .is-wide {
  grid-column: 1 / -1;
}

.season-filter-slot:empty {
  display: none;
}

.progress-filters .season-filter-slot {
  flex: 0 1 auto;
  min-width: 0;
}

.season-filter-status {
  margin: 0;
}

/* The archer list with Open their page beside it, wrapping on a phone. */
.season-archer-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  max-width: 520px;
}

.season-archer-picker .form-field {
  flex: 1 1 160px;
}

/* A team score counts both genders: said once while Girls or Boys is chosen. */
.season-gender-note {
  font-style: italic;
}

.season-table-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

/* Practice attendance: each week's count shaded darker for more cards, like
   the design's heat map (season-tables.ts attendanceLevel). The number
   stays in the cell; the shade only helps the eye. Levels 1 to 3 keep the
   page's text color and the darkest takes the accent's own, so every level
   reads at 4.5:1 or better in light and dark mode (a test checks this from
   the colors in styles.css). */
.attendance-cell.is-level-1 {
  background: color-mix(in srgb, var(--color-accent) 15%, var(--color-surface));
  color: var(--color-text);
}

.attendance-cell.is-level-2 {
  background: color-mix(in srgb, var(--color-accent) 30%, var(--color-surface));
  color: var(--color-text);
}

.attendance-cell.is-level-3 {
  background: color-mix(in srgb, var(--color-accent) 50%, var(--color-surface));
  color: var(--color-text);
}

.attendance-cell.is-level-4 {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

/* An archer with no practice scorecards in the last 2 weeks. */
.season-flag {
  display: block;
  color: var(--color-review);
  font-size: 0.78rem;
  font-weight: 600;
}

/* A part of a section holding a table (Practice or Tournament under Most
   improved) may shrink to the screen, so its table scrolls in its own box. */
.season-part {
  min-width: 0;
}

/* ---------- Tournaments ---------- */

/* A small box for a total or 10s: three digits fit, two boxes fit a phone row. */
.tournament-box {
  width: 4.5em;
  min-height: 40px;
  padding-inline: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tournament-box[aria-invalid="true"] {
  border-color: var(--color-danger);
}

/* A row's problem goes under its boxes. */
.tournament-row-error {
  display: block;
  font-size: 0.85rem;
  white-space: normal;
  text-align: left;
}

.tournament-row-error:empty {
  display: none;
}

.tournament-grid td {
  vertical-align: top;
}

.tournament-nasp {
  flex-wrap: nowrap;
  align-items: center;
}

/* A scanned card whose NASP total differs from what it adds up to. */
.tournament-table tr.is-check > * {
  background: var(--color-review-soft);
}

.tournament-how {
  white-space: normal;
  min-width: 10em;
}

/* NASP's total next to a card: quiet when it agrees, flagged when it doesn't. */
.badge.is-nasp,
.badge.is-check {
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  white-space: nowrap;
}

.badge.is-check {
  background: var(--color-review-soft);
  color: var(--color-review);
}
