/*
 * Page/component specific rules. Shared theme tokens and global look live in theme.css.
 */

/*== Anchor targets =======================================================*/
/* Keeps headings from being tucked under the sticky navbar when jumped to via a URL fragment. */
[id] {
    scroll-margin-top: 5rem;
}

/*== Record book view toggle ==============================================*/
.sc-view-toggle .btn {
    border: 1px solid var(--sc-navy);
    color: var(--sc-navy);
    background-color: transparent;
    font-weight: 600;
}

.sc-view-toggle .btn:hover {
    background-color: var(--sc-navy-soft);
    color: #fff;
}

.sc-view-toggle .btn.active {
    background-color: var(--sc-navy);
    color: #fff;
}

/*== Data tables (Teams / Standings) =====================================*/
.sc-table-scroll {
    background-color: var(--sc-surface);
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    max-height: 70vh;
    font-size: 0.85rem;
}

/* On touch devices, don't nest a second vertical scroll region inside the
   page for tall tables — iOS handles that combination unreliably (rows go
   missing, gestures fight the page scroll). Let the table flow with the
   page instead; only horizontal scrolling stays contained to the table. */
@media (hover: none) and (pointer: coarse) {
    .sc-table-scroll {
        max-height: none;
    }

    .sc-table-scroll th {
        position: static;
    }
}

.sc-table-scroll table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.sc-table-scroll td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--sc-border);
}

.sc-table-scroll th {
    cursor: pointer;
    padding: 0.6rem 0.75rem;
    text-align: left;
    position: sticky;
    top: 0;
    background: var(--sc-navy);
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
    z-index: 1;
}

.sc-table-scroll tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.sc-table-scroll tbody a {
    color: var(--sc-navy);
    font-weight: 600;
}

.sc-table-scroll tbody a:hover {
    color: var(--sc-gold-dark);
}

/*== Standings table ======================================================*/
/* Auto (not fixed) layout: each column sizes to its content, so a record
   like "13-4-1" or a header like "vs League" never gets squeezed into a
   column too narrow for it and wraps or bleeds into the next column. If the
   content genuinely needs more room than the screen, the .sc-table-scroll
   wrapper's overflow-x scrolls horizontally instead. */
.sc-table-scroll table.sc-standings-table {
    min-width: 0;
}

.sc-standings-table {
    font-size: 0.95rem;
}

.sc-standings-table th,
.sc-standings-table td {
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
}

.sc-standings-table td:first-child {
    white-space: normal;
}

.sc-standings-table th,
.sc-standings-table td {
    font-variant-numeric: tabular-nums;
    border-right: 1px solid var(--sc-border);
}

.sc-standings-table th:last-child,
.sc-standings-table td:last-child {
    border-right: none;
}

.sc-standings-table td:first-child {
    font-weight: 600;
}

.sc-matchup-table td.sc-pos {
    font-weight: 400;
}

.sc-matchup-table td:not(.sc-pos):not(.sc-num) {
    font-weight: 600;
}

.sc-standings-table .sc-num {
    text-align: right;
}

/* Matchup (Weekly Results) tables: Pos and Score only ever hold a couple of
   characters, so pin them to a tight content width and let Player fill the
   rest of the row — otherwise the browser's auto table layout hands them
   more room than they need and pushes the table into horizontal scroll. */
.sc-matchup-table {
    width: 100%;
    table-layout: fixed;
}

.sc-matchup-table .sc-pos {
    width: 3.5rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

.sc-matchup-table .sc-num {
    width: 4.5rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

.sc-matchup-table th:not(.sc-pos):not(.sc-num),
.sc-matchup-table td:not(.sc-pos):not(.sc-num) {
    white-space: normal;
}

/*== Bench toggle (Weekly Results) =========================================*/
.sc-bench-toggle {
    color: var(--sc-text);
    font-weight: 700;
    text-decoration: none;
}

.sc-bench-toggle:hover {
    color: var(--sc-navy);
}

.sc-bench-caret {
    display: inline-block;
    transition: transform 0.15s ease;
}

.sc-bench-toggle[aria-expanded="true"] .sc-bench-caret {
    transform: rotate(90deg);
}

/*== Head-to-Head stat tiles ================================================*/
.sc-h2h-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.75rem;
}

.sc-h2h-stat {
    background-color: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-top: 3px solid var(--sc-navy);
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 0.9rem 1rem;
    text-align: center;
}

.sc-h2h-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--sc-navy);
    font-variant-numeric: tabular-nums;
}

a.sc-h2h-stat-value {
    text-decoration: none;
}

a.sc-h2h-stat-value:hover {
    text-decoration: underline;
    color: inherit;
}

.sc-h2h-stat-label {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--sc-text-muted);
}

.sc-h2h-stat-good {
    border-top-color: #15803d;
}

.sc-h2h-stat-good .sc-h2h-stat-value {
    color: #15803d;
}

.sc-h2h-stat-bad {
    border-top-color: #b91c1c;
}

.sc-h2h-stat-bad .sc-h2h-stat-value {
    color: #b91c1c;
}

.sc-h2h-stat-even .sc-h2h-stat-value {
    color: var(--sc-text-muted);
}

/*== Team info / stat block ================================================*/
#teamInfo {
    background-color: var(--sc-surface);
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

#teamInfo table {
    width: 100%;
}

#teamInfo .category {
    font-weight: 700;
    padding-right: 1rem;
}

#teamInfo td {
    padding: 0.25rem 0;
}

#filter_form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

#teamTitle {
    font-weight: 800;
    color: var(--sc-navy);
    text-align: center;
}

/*== Championship banners (team page) ======================================*/
#banner {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/*== Runner-Up / Third Place banners (SVG/Alpine, teams page) ==============*/
.sc-place-banner-col {
    width: min(100%, 190px);
}

.sc-place-banner-col.sc-place-silver {
    order: 1;
}

.sc-place-banner-col.sc-place-bronze {
    order: 3;
}

.sc-place-banner-wrapper {
    width: 100%;
}

.sc-place-banner {
    width: 100%;
    display: block;
    overflow: visible;
}

.sc-place-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 1px;
    fill: #f1f5f9;
    text-transform: uppercase;
}

.sc-place-year-text {
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 0.5px;
    fill: #f8fafc;
}

@media (max-width: 576px) {
    #banner {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .sc-place-banner-col {
        width: min(100%, 160px);
    }
}

/*== Champion banner (SVG/Alpine, teams page) ==============================*/
.sc-champ-banner-col {
    order: 2;
    width: min(100%, 260px);
}

.sc-champ-banner-wrapper {
    width: 100%;
}

.sc-champ-banner {
    width: 100%;
    display: block;
    overflow: visible;
}

.sc-champ-banner-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 58px;
    font-weight: 900;
    letter-spacing: 3px;
    fill: url(#scChampGoldGradient);
    stroke: #080808;
    stroke-width: 5px;
    paint-order: stroke fill;
}

.sc-champ-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    font-weight: 900;
    letter-spacing: 2px;
    fill: #111;
}

.sc-champ-year-text {
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 1px;
    fill: url(#scChampGoldGradient);
    stroke: #050505;
    stroke-width: 1.5px;
    paint-order: stroke fill;
}

.sc-champ-year-plaque {
    filter: url(#scChampPlaqueShadow);
}

@media (max-width: 576px) {
    .sc-champ-banner-col {
        order: -1;
        width: min(100%, 300px);
    }
}

/* ==========================================================================
   Live scoring - Race for the Top 5
   ========================================================================== */
[x-cloak] {
    display: none !important;
}

.sc-live {
    --sc-live-green: #16a34a;
    --sc-live-green-bg: #ecfdf3;
    --sc-live-red: #dc2626;
    --sc-live-red-bg: #fef2f2;
    --sc-live-amber: #d97706;
    --sc-live-amber-bg: #fffbeb;
    --sc-live-playing: #fde68a;
}

.sc-live-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1rem;
}

.sc-live-status {
    padding-bottom: 1.5rem;
}

.sc-live-muted {
    color: var(--sc-text-muted);
    font-size: 0.85em;
}

.sc-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--sc-live-red);
    color: #fff;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.sc-live-pill::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #fff;
    animation: sc-live-pulse 1.4s ease-in-out infinite;
}

.sc-live-board {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sc-live-row {
    position: relative;
    background: var(--sc-surface);
    border: 1px solid var(--sc-border);
    border-left: 6px solid var(--sc-border);
    border-radius: var(--sc-radius-sm);
    box-shadow: var(--sc-shadow);
}

.sc-live-top {
    border-left-color: var(--sc-live-green);
    background: linear-gradient(90deg, var(--sc-live-green-bg), var(--sc-surface) 60%);
}

.sc-live-bottom {
    border-left-color: var(--sc-live-red);
    background: linear-gradient(90deg, var(--sc-live-red-bg), var(--sc-surface) 60%);
}

.sc-live-bubble {
    border-left-color: var(--sc-live-amber);
    background: linear-gradient(90deg, var(--sc-live-amber-bg), var(--sc-surface) 60%);
}

.sc-live-high {
    border-color: var(--sc-gold);
    border-left-color: var(--sc-gold);
    box-shadow: 0 0 0 2px var(--sc-gold), 0 6px 22px rgba(245, 183, 0, 0.35);
}

.sc-live-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: 0;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.sc-live-rank {
    flex: 0 0 2rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--sc-navy);
    text-align: center;
}

.sc-live-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sc-bg);
}

.sc-live-team {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sc-live-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    font-weight: 700;
    color: var(--sc-navy);
}

.sc-live-h2h {
    font-size: 0.8rem;
    color: var(--sc-text-muted);
}

.sc-live-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}

.sc-live-badge-high {
    background: var(--sc-gold);
    color: var(--sc-navy);
}

.sc-live-badge-zone {
    background: var(--sc-bg);
    color: var(--sc-text-muted);
}

.sc-live-bubble .sc-live-badge-zone { background: var(--sc-live-amber); color: #fff; }

.sc-live-move {
    font-size: 0.75rem;
    font-weight: 800;
    animation: sc-live-pop 400ms ease-out;
}

.sc-live-move.up { color: var(--sc-live-green); }
.sc-live-move.down { color: var(--sc-live-red); }

.sc-live-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.sc-live-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--sc-bg);
    color: var(--sc-text);
}

.sc-live-chip-playing {
    background: var(--sc-live-playing);
    font-weight: 700;
}

.sc-live-chip-yet {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 700;
}

.sc-live-chip-playing.is-zero,
.sc-live-chip-yet.is-zero {
    color: var(--sc-text);
    background: var(--sc-bg);
    font-weight: 400;
}

.sc-live-chip-playing.is-zero .sc-live-dot {
    display: none;
}

.sc-live-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--sc-live-red);
    animation: sc-live-pulse 1.4s ease-in-out infinite;
}

.sc-live-score {
    flex: 0 0 auto;
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--sc-navy);
}

.sc-live-caret {
    flex: 0 0 auto;
    color: var(--sc-text-muted);
    transition: transform 200ms ease;
}

.sc-live-open .sc-live-caret {
    transform: rotate(180deg);
}

.sc-live-roster {
    padding: 0 1rem 0.75rem;
}

.sc-live-roster table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.sc-live-roster th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sc-text-muted);
    border-bottom: 1px solid var(--sc-border);
    padding: 0.3rem 0.4rem;
}

.sc-live-roster td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--sc-border);
}

.sc-live-roster td:first-child {
    width: 3rem;
    font-weight: 700;
    color: var(--sc-text-muted);
}

.sc-live-roster td:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.sc-live-roster tr.is-playing td {
    background: #fef9c3;
}

.sc-live-roster tr.is-yet td {
    color: var(--sc-text-muted);
}

.sc-live-teamlink {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.sc-live-cut {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.35rem 0;
    color: var(--sc-live-red);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

.sc-live-cut::before,
.sc-live-cut::after {
    content: "";
    flex: 1 1 auto;
    border-top: 2px dashed var(--sc-live-red);
}

.sc-live-cut small {
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--sc-text-muted);
}

.sc-live-flash-in {
    animation: sc-live-flash-in 2.5s ease-out;
}

.sc-live-flash-out {
    animation: sc-live-flash-out 2.5s ease-out;
}

@keyframes sc-live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes sc-live-pop {
    0% { transform: scale(0.4); }
    70% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

@keyframes sc-live-flash-in {
    0%, 30% { box-shadow: 0 0 0 4px var(--sc-live-green), 0 0 28px rgba(22, 163, 74, 0.6); }
    100% { box-shadow: var(--sc-shadow); }
}

@keyframes sc-live-flash-out {
    0%, 30% { box-shadow: 0 0 0 4px var(--sc-live-red), 0 0 28px rgba(220, 38, 38, 0.6); }
    100% { box-shadow: var(--sc-shadow); }
}

@media (max-width: 576px) {
    .sc-live-summary {
        gap: 0.5rem;
        padding: 0.6rem 0.6rem;
    }

    .sc-live-rank {
        flex-basis: 1.4rem;
        font-size: 1.1rem;
    }

    .sc-live-icon {
        display: none;
    }

    .sc-live-score {
        font-size: 1.25rem;
    }

    .sc-live-roster {
        padding: 0 0.6rem 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sc-live-dot,
    .sc-live-pill::before,
    .sc-live-move,
    .sc-live-flash-in,
    .sc-live-flash-out {
        animation: none;
    }
}
