/* 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);
}

/* Directly under the subtitle, which gives up its bottom margin to it. */
.standings-subtitle:has(+ .vtscores-credit) {
    margin-bottom: 0.6rem;
}

/* The credit for vtscores.com, whose standings these are: a label and his
   logo, the whole of it one link. */
.vtscores-credit {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    margin: 0 0 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
}

.vtscores-credit:hover .vtscores-credit-label,
.vtscores-credit:focus-visible .vtscores-credit-label {
    color: var(--color-primary);
    text-decoration: underline;
}

/* His logo is drawn white on his site's navy header, so it carries that
   header with it here as a badge: white type would vanish on our light
   page. These are his brand's colors, deliberately not our theme tokens,
   so the mark looks the way it does on his site. */
.vtscores-logo {
    display: block;
    height: 1.9rem;
    width: auto;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
    background: #093755;
}

.vtscores-logo-vt { fill: #ffffff; }
.vtscores-logo-scores { fill: #3d78a0; }
.vtscores-logo-bar { fill: #e1be19; }

/* His two bars pulse in turn, as on his site; slower here, since this is a
   credit in the corner of someone else's page, not the masthead. */
@keyframes vtscores-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

.vtscores-logo-bar-1 { animation: vtscores-pulse 8s ease-in-out infinite; }
.vtscores-logo-bar-2 { animation: vtscores-pulse 8s ease-in-out infinite 2s; }

@media (prefers-reduced-motion: reduce) {
    .vtscores-logo-bar { animation: none; opacity: 1; }
}

/* A division's heading when his table has more than one (Division I, Out
   of State). */
.standings-group-heading {
    margin: 1.5rem 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.standings-group-heading:first-child {
    margin-top: 0;
}

/* His playoff medal beside the team name (see outcomeBadge in standings.js):
   a trophy, silver or bronze, a little larger than the name, since an emoji
   draws smaller than its type size. Narrow enough to stay beside the name on
   a phone. */
.standings-medal {
    margin-left: 0.35rem;
    font-size: 1.15em;
    line-height: 1;
    cursor: help;
}

/* Any other playoff result he sends, as text: small, so the name still leads. */
.standings-badge {
    display: inline-block;
    margin-left: 0.45rem;
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: 0.1em;
    background: var(--color-surface-alt);
    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);
}

/* ---- Admin comparison with the results computed here ---- */

.standings-admin-note {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--color-warning-border);
    background: var(--color-warning-bg);
    font-size: 0.85rem;
}

.standings-row-mismatch {
    background: var(--color-warning-bg);
}

.standings-mismatch {
    font-weight: 800;
    color: var(--color-warning);
    text-decoration: underline dotted;
    cursor: help;
}

.standings-admin-badge {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

/* ---- 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;
}

/* A school we don't track (from vtscores.com's table) has no page to open. */
.standings-table tbody tr.standings-row-static {
    cursor: default;
}

.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.3rem;
    }

    /* Only when there's a short name to show instead: a school with no
       abbreviation on file, or one of vtscores.com's rows for a school we
       don't track, has the full name alone, and must keep it. */
    .standings-team-full:has(+ .standings-team-short) {
        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;
    }

    /* Ties, likewise: rare in tennis, already counted in Pct, and the column
       that tips a girls' table with one tie off a phone's screen. */
    .standings-ties {
        display: none;
    }

    /* A school we don't track has no short name ("Montpelier / U-32"), so
       it may wrap rather than widen the column for everyone. */
    .standings-table tr.standings-row-static td.standings-team {
        white-space: normal;
    }

    /* Two digits at most: the room goes to the team names instead. */
    .standings-rank {
        width: 1.6rem;
    }

    /* Closer in, so "Burr & Burton" and its medal fit beside the numbers. */
    .standings-medal {
        margin-left: 0.2rem;
        font-size: 1.05em;
    }

    /* Beside the name, a text badge widens the team column enough to push
       the numbers off a phone's screen; under it, it costs a little height
       instead. (A medal is narrow enough to stay put.) */
    .standings-badge {
        display: block;
        width: fit-content;
        margin: 0.15rem 0 0;
        font-size: 0.62rem;
    }
}

/* A fixture known only by its final score has no box score to open. */
.team-score-only {
    font-size: 0.8rem;
    color: var(--color-text-faint);
    white-space: nowrap;
}
