/* Public team standings: one division of one season at a time
   (Pages/Standings). Read far more often than it's interacted with, so the
   table is the page: the two controls sit above it and everything else is
   given over to making a column of records scannable. */

.standings-page {
    max-width: 780px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.standings-header h1 {
    margin: 0 0 0.25rem;
}

.standings-subtitle {
    margin: 0 0 1.25rem;
    color: var(--color-text-muted);
}

/* ---- Controls ---- */

.standings-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.standings-season {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
}

.standings-season select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
}

.standings-status-message {
    color: var(--color-text-muted);
    padding: 1rem 0;
}

/* ---- Table ---- */

.standings-table-wrap {
    overflow-x: auto;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.standings-table th,
.standings-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    text-align: right;
    white-space: nowrap;
}

.standings-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border-strong);
}

/* Rank and team read as a pair on the left; every other column is a number
   set right so the digits line up down the table. Qualified by element to
   outweigh the blanket right-align above, which is equally specific. */
.standings-table th.standings-rank,
.standings-table td.standings-rank,
.standings-table th.standings-team,
.standings-table td.standings-team {
    text-align: left;
}

.standings-rank {
    width: 2.5rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.standings-table td.standings-team {
    font-weight: 600;
    white-space: normal;
}

.standings-table td:not(.standings-team) {
    font-variant-numeric: tabular-nums;
}

.standings-diff-positive { color: var(--color-success); }
.standings-diff-negative { color: var(--color-text-muted); }

.standings-table tbody tr:hover {
    background: var(--color-surface-alt);
}

/* A team with nothing decided yet is in the division but not in the race;
   dimming it keeps a run of zeroes from reading like a losing streak. */
.standings-unplayed td {
    color: var(--color-text-muted);
}

.standings-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ---- Drilling into a team ---- */

/* The team cell is the way in to that team's season, and the whole row is
   clickable for it (see standings.js): a name-width target is a fussy tap on
   a phone. The link keeps the row's own colour rather than announcing itself
   in link blue, since every row is one. */
.standings-team-link {
    color: inherit;
    text-decoration: none;
}

.standings-table tbody tr {
    cursor: pointer;
}

.standings-table tbody tr:hover .standings-team-link,
.standings-team-link:focus-visible {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ---- One team's season (Pages/StandingsTeam) ---- */

.team-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.team-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.team-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.team-stat-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.team-stat-note {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.team-stat-none {
    color: var(--color-text-faint);
    font-weight: 600;
}

.team-section {
    margin-bottom: 2rem;
}

.team-section h2 {
    font-size: 1.05rem;
    margin: 0 0 0.6rem;
}

/* These rows aren't a way in to anything further, unlike the standings rows
   this stylesheet's table styles are shared with. */
.team-table tbody tr {
    cursor: default;
}

.standings-table td.team-date,
.standings-table th.team-date,
.standings-table td.team-opponent,
.standings-table th.team-opponent,
.standings-table td.team-player,
.standings-table th.team-player {
    text-align: left;
}

.team-date {
    color: var(--color-text-muted);
    width: 7.5rem;
}

.standings-table td.team-opponent,
.standings-table td.team-player {
    font-weight: 600;
}

/* Set in the muted colour and a size down so the opponent's name is what the
   eye lands on, not the preposition in front of it. */
.team-where {
    display: inline-block;
    width: 1.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.team-outcome {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
}

.team-outcome-win {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.team-outcome-loss {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

.team-outcome-pending {
    color: var(--color-text-faint);
}

.standings-table td.team-link,
.standings-table th.team-link {
    text-align: right;
    width: 6rem;
}

.team-link a {
    font-size: 0.85rem;
    font-weight: 600;
}

@media (max-width: 34rem) {
    .team-stat-value {
        font-size: 1.2rem;
    }

    .team-date {
        width: auto;
        font-size: 0.8rem;
    }

    /* The box-score link goes: every row is already a tap target on the
       scoreboard, and the column costs width the opponent's name needs. */
    .team-link {
        display: none;
    }

    /* Five columns of player stats don't fit a phone, and the grade is the
       one that isn't a result. */
    .team-grade {
        display: none;
    }
}

/* One of the two names in a team cell is always hidden; see teamName() in
   standings.js for why both are rendered. */
.standings-team-short {
    display: none;
}

@media (max-width: 34rem) {
    .standings-table {
        font-size: 0.88rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.5rem 0.4rem;
    }

    .standings-team-full {
        display: none;
    }

    .standings-team-short {
        display: inline;
    }

    .standings-table td.standings-team {
        white-space: nowrap;
    }

    /* Seven columns don't fit a phone, and the differential is the one that
       says nothing the Courts column doesn't: 89-16 is +73. */
    .standings-diff {
        display: none;
    }
}
