/* Standings card: tabs, own team, playoff cut line */
.standings-tabs-container {
    margin-bottom: 8px;
}

.standings-table tr.own-team td {
    background-color: var(--standings-highlight, #e8e8e8);
}

.standings-table tr.own-team td:first-child {
    box-shadow: inset 4px 0 0 var(--standings-accent, #555);
}

.standings-table tr.cut-line td {
    border-bottom: 2px dashed #888;
}

/* Playoff card: current round as bracket slots */
.playoff-subtitle {
    margin: 0 0 8px 0;
    color: #666;
    text-align: center;
}

/* Widest layout (3 columns): the playoff card spans the whole row, the two brackets flank
   the middle. media_scaling.css.jinja undoes this for 2 and 1 columns. */
.card_display.playoff-card {
    grid-column: 1 / -1;
    max-width: none;
}

.card_display.playoff-card .playoff-conferences {
    grid-template-columns: repeat(2, minmax(0, 300px));
    justify-content: center;
    column-gap: 64px;
}

/* West and East side by side (like on a map), stacked when the card is too narrow */
.playoff-conferences {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    width: 100%;
    container-type: inline-size;
}

/* Conference label written vertically on the outer side: West on the left (read bottom to top),
   East on the right (top to bottom) */
.playoff-conference {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.playoff-conference.east {
    flex-direction: row-reverse;
}

.playoff-conference .bracket {
    flex: 1;
    min-width: 0;
}

.playoff-conference-title {
    margin: 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #666;
}

.playoff-conference.east .playoff-conference-title {
    transform: none;
}

/* Stacked (phones): both labels on the left, so the two brackets line up */
@container (max-width: 407px) {
    .playoff-conference.east {
        flex-direction: row;
    }

    .playoff-conference.east .playoff-conference-title {
        transform: rotate(180deg);
    }
}

.bracket {
    --line: #bdbdbd;
    --pair-gap: 6px;
    --connector: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px 4px 4px;
}

/* Two series whose winners meet next round, joined by a bracket line on the right */
.bracket-pair {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--pair-gap);
    padding-right: calc(2 * var(--connector));
}

.bracket-pair:not(.single)::before {
    /* vertical line between the two series' midpoints */
    content: "";
    position: absolute;
    right: var(--connector);
    top: calc(25% - var(--pair-gap) / 4);
    bottom: calc(25% - var(--pair-gap) / 4);
    border-right: 2px solid var(--line);
    border-radius: 0 4px 4px 0;
}

.bracket-pair:not(.single)::after {
    /* line out towards the next round */
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: var(--connector);
    border-top: 2px solid var(--line);
}

/* Side by side, the East bracket is mirrored so both open towards the middle */
@container (min-width: 408px) {
    .bracket.mirrored .bracket-pair {
        padding-right: 0;
        padding-left: calc(2 * var(--connector));
    }

    .bracket.mirrored .bracket-pair:not(.single)::before {
        right: auto;
        left: var(--connector);
        border-right: none;
        border-left: 2px solid var(--line);
        border-radius: 4px 0 0 4px;
    }

    .bracket.mirrored .bracket-pair:not(.single)::after {
        right: auto;
        left: 0;
    }

    .bracket.mirrored .bracket-pair:not(.single) .bracket-series::after {
        right: auto;
        left: calc(-1 * var(--connector) - 1px);
    }
}

.bracket-series {
    position: relative;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bracket-pair:not(.single) .bracket-series::after {
    /* stub from each series to the vertical line */
    content: "";
    position: absolute;
    right: calc(-1 * var(--connector) - 1px);
    top: 50%;
    width: var(--connector);
    border-top: 2px solid var(--line);
}

.bracket-team {
    display: grid;
    grid-template-columns: 2.4em 24px 1fr auto;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
}

.bracket-team + .bracket-team {
    border-top: 1px solid #eee;
}

.bracket-team:first-child {
    border-radius: 8px 8px 0 0;
}

.bracket-team:last-child {
    border-radius: 0 0 8px 8px;
}

.bracket-team.own-team {
    background-color: var(--standings-highlight, #e8e8e8);
    box-shadow: inset 4px 0 0 var(--standings-accent, #555);
}

.bracket-team img {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.bracket-seed {
    font-size: 0.75rem;
    color: #777;
}

.bracket-abbrev {
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: left;
}

.bracket-value {
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.bracket-value small {
    font-size: 0.7em;
    font-weight: normal;
    color: #777;
}

.bracket-team.won .bracket-abbrev,
.bracket-team.won .bracket-value {
    color: var(--standings-accent, #555);
}

.bracket-status {
    padding: 3px 10px 5px;
    border-top: 1px solid #eee;
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}
