/* ──────────────────────────────────────────────────────────────
   SACFD — Greatest Goalkickers
   Builds on the theme's sacfd.css (.sacfd-table, .sacfd-group-nav,
   .sacfd-group-anchor, .sacfd-record-status) and only adds what the
   ranked list needs.
   ────────────────────────────────────────────────────────────── */

.sacfd-gk {
    --sacfd-gk-ink: #000;
    --sacfd-gk-navy: #1a1a2e;
    --sacfd-gk-red: #cc0000;
    --sacfd-gk-yellow: #f5c518;
    --sacfd-gk-link: #1a3a6b;
    --sacfd-gk-rule: #e8e8e8;
    --sacfd-gk-scroll-height: 70vh;
    margin-bottom: 32px;
}

/* ── Group navigation ───────────────────────────────────────── */

.sacfd-gk-nav {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 10px 0;
    margin-bottom: 0;
    background: #f5f0e1;
    border-bottom: 2px solid var(--sacfd-gk-red);
}

.sacfd-gk-nav .sacfd-group-nav__link[aria-current="true"] {
    background: var(--sacfd-gk-red);
    color: #fff;
}

.sacfd-gk-nav .sacfd-group-nav__link:focus-visible {
    outline: 3px solid var(--sacfd-gk-yellow);
    outline-offset: 2px;
}

/* ── Scroll region ──────────────────────────────────────────── */

.sacfd-gk-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sacfd-gk-scroll.is-scrollable {
    max-height: var(--sacfd-gk-scroll-height);
    overflow-y: auto;
    border: 1px solid var(--sacfd-gk-rule);
    border-top: 0;
    scroll-padding-top: 2.6em;
}

.sacfd-gk-scroll:focus-visible {
    outline: 3px solid var(--sacfd-gk-yellow);
    outline-offset: -3px;
}

/* ── Table ──────────────────────────────────────────────────── */

.sacfd-gk-table {
    margin-bottom: 0;
}

.sacfd-gk-caption {
    caption-side: top;
    text-align: left;
    font-size: 15px;
    line-height: 1.5;
    color: #444;
    padding: 0 0 10px;
}

.sacfd-gk-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Group heading rows. The theme paints all th cells navy, so the
   lighter anchor row needs to win on specificity as well as on
   the theme's !important background. */
.sacfd-gk-table th.sacfd-gk-group-anchor {
    position: sticky;
    top: 2.5em;
    z-index: 1;
    color: #1a1a2e;
    background: #e8e8e8;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
    font-size: 15px;
    border-top: 2px solid var(--sacfd-gk-red);
    scroll-margin-top: 0;
}

/* Rank cells are row headers, not column headers: undo the navy. */
.sacfd-gk-table tbody th.sacfd-gk-rank {
    background: transparent;
    color: var(--sacfd-gk-ink);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    font-size: 16px;
    padding: 6px 12px;
    text-align: right;
    white-space: nowrap;
    width: 4.5em;
    border-bottom: 1px solid var(--sacfd-gk-rule);
}

.sacfd-gk-table .sacfd-gk-goals {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sacfd-gk-table .sacfd-gk-status {
    text-align: center;
    white-space: nowrap;
}

.sacfd-gk-table .sacfd-gk-clubs {
    color: #333;
}

.sacfd-gk-unknown {
    color: #999;
}

/* Active players */
.sacfd-gk-row--active .sacfd-gk-player a {
    font-weight: 700;
}

.sacfd-gk-active {
    display: inline-block;
    margin-left: 4px;
    color: var(--sacfd-gk-red);
    font-size: 11px;
    vertical-align: middle;
}

.sacfd-gk-row--active {
    box-shadow: inset 3px 0 0 var(--sacfd-gk-yellow);
}

.sacfd-gk-sr,
.sacfd-gk-caption.sacfd-gk-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Legend ─────────────────────────────────────────────────── */

.sacfd-gk-legend {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff;
    border-left: 4px solid var(--sacfd-gk-navy);
}

.sacfd-gk-legend__heading {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.sacfd-gk-legend__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 4px 20px;
    margin: 0;
}

.sacfd-gk-legend__item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 15px;
}

.sacfd-gk-legend__item dt {
    flex: 0 0 auto;
}

.sacfd-gk-legend__item dd {
    margin: 0;
    color: #333;
}

/* ── Empty state ────────────────────────────────────────────── */

.sacfd-gk-empty {
    padding: 20px 0;
}

.sacfd-gk-empty p {
    margin-bottom: 8px;
}

.sacfd-gk-empty__admin {
    font-size: 15px;
    font-style: normal;
    color: #666;
}

/* ── Compact top-N widget ───────────────────────────────────── */

.sacfd-gk-top {
    margin-bottom: 32px;
}

.sacfd-gk-top__heading {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--sacfd-gk-red, #cc0000);
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.sacfd-gk-top__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}

.sacfd-gk-top__item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #e8e8e8;
}

.sacfd-gk-top__rank {
    flex: 0 0 3em;
    text-align: right;
    font-weight: 700;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
}

.sacfd-gk-top__name {
    flex: 1 1 auto;
}

.sacfd-gk-top__goals {
    flex: 0 0 auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sacfd-gk-top__more {
    margin-top: 10px;
    font-size: 15px;
}

/* ── Rank badge helper ──────────────────────────────────────── */

.sacfd-gk-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    background: #1a1a2e;
    color: #f5c518;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3px;
}

a.sacfd-gk-badge-link {
    text-decoration: none;
}

a.sacfd-gk-badge-link:hover .sacfd-gk-badge {
    background: #cc0000;
    color: #fff;
}

.sacfd-gk-rank-label__goals {
    font-size: 15px;
    color: #333;
}

/* ── Mobile ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .sacfd-gk-scroll.is-scrollable {
        max-height: 60vh;
    }

    .sacfd-gk-table {
        font-size: 15px;
    }

    .sacfd-gk-table thead th,
    .sacfd-gk-table tbody th.sacfd-gk-rank,
    .sacfd-gk-table td {
        padding-left: 8px;
        padding-right: 8px;
    }

    .sacfd-gk-table tbody th.sacfd-gk-rank {
        width: 3.4em;
        font-size: 15px;
    }

    /* Clubs is the first thing to give way on a narrow screen. */
    .sacfd-gk-table .sacfd-gk-col-clubs,
    .sacfd-gk-table .sacfd-gk-clubs {
        display: none;
    }

    .sacfd-gk-legend__list {
        grid-template-columns: 1fr;
    }

    .sacfd-gk-nav {
        gap: 6px;
    }

    .sacfd-gk-nav .sacfd-group-nav__link {
        padding: 5px 10px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sacfd-gk-scroll.is-scrollable {
        scroll-behavior: auto;
    }
}

/* ── Print ──────────────────────────────────────────────────── */

@media print {
    .sacfd-gk-nav,
    .sacfd-gk-top__more {
        display: none !important;
    }

    .sacfd-gk-scroll,
    .sacfd-gk-scroll.is-scrollable {
        max-height: none !important;
        overflow: visible !important;
        border: 0 !important;
    }

    .sacfd-gk-table thead th,
    .sacfd-gk-table th.sacfd-gk-group-anchor {
        position: static !important;
    }

    .sacfd-gk-table thead th {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 2px solid #000;
    }

    .sacfd-gk-table th.sacfd-gk-group-anchor {
        background: #fff !important;
        border-top: 2px solid #000;
    }

    .sacfd-gk-row--active {
        box-shadow: none;
    }

    .sacfd-gk-table tr {
        page-break-inside: avoid;
    }

    .sacfd-gk-table thead {
        display: table-header-group;
    }

    .sacfd-gk-player a {
        color: #000;
        text-decoration: none;
    }

    .sacfd-record-status {
        border: 1px solid #666;
    }
}
