/* Roster archives (players / coaches / medics / cheerleaders / organisation)
   Like for like with the live plugin `.players-container` styles, rem→px (×16).
   Group titles keep the live faded colour but sit above the grid instead of
   half behind it (review feedback on the matches page). Enqueued only on the
   five club archives. */

.roster_archive {
    background: var(--background);
}

.roster_groups {
    padding-top: 16px;
}

/* Group band ----------------------------------------------------------- */
.roster_group {
    max-width: 100%;
    margin-bottom: 32px;

    & > .container {
        width: 100%;
        padding: 32px;
    }

    &.is_navy {
        background: var(--primary);
    }
}

.roster_group_title {
    max-width: 100%;
    margin: 0 0 16px;
    padding: 0;
    overflow: hidden;
    color: rgba(8, 35, 60, .12);
    font-size: 64px;
    font-weight: 700;
    line-height: 1.1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;

    .is_navy & {
        color: rgba(255, 255, 255, .29);
    }

    @media (max-width: 768px) {
        font-size: 48px;
    }
}

.roster_empty {
    padding: 64px 0;
    text-align: center;
    color: var(--text-muted);
}

/* Grid ------------------------------------------------------------------- */
.roster_grid {
    /* flex + wrap + justify-content:center, not CSS grid - grid's justify-content only
       centres the whole (empty) track set, so a lone card in a 3-column grid still sits
       in column 1 with the gap trailing to its right. Flex actually centres a short row. */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
}

.roster_grid .roster_card {
    flex: 0 1 390px;
    max-width: 390px;

    @media (max-width: 1024px) { flex-basis: 420px; max-width: 420px; }
    @media (max-width: 746px)  { flex-basis: 100%;  max-width: 420px; }
}

/* Card ------------------------------------------------------------------- */
.roster_card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    overflow: hidden;
    outline: none;

    @media (max-width: 768px) {
        min-height: 400px;
    }

    &:focus-visible {
        outline: 3px solid var(--secondary);
        outline-offset: 2px;
    }
}

.roster_card_image {
    position: absolute;
    inset: 0;

    &::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(8, 35, 60, 0) 0%, rgba(8, 35, 60, .32) 50%, rgba(8, 35, 60, .49) 100%);
        z-index: 1;
    }

    &::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 5px;
        background: var(--secondary);
        z-index: 1;
    }

    & img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }

    & .is_placeholder {
        padding-top: 80px;
        object-fit: contain;
        background: var(--grey);
    }
}

.roster_card_content {
    position: relative;
    z-index: 10;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 0 16px;
}

/* Staff job pill (top right) */
.roster_card_job {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px;
    padding: 4.8px 11.2px;
    border-radius: var(--radius-sm);
    background: var(--secondary);

    & span {
        padding: 0;
        color: var(--white);
        font-family: var(--font-display);
        font-size: 16px;
        font-weight: 500;
        text-transform: uppercase;
    }
}

/* Number + name row (bottom left) */
.roster_card_name_row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 15px;
    padding: 0;
}

.roster_card_number {
    margin: 0;
    padding: 0;
    color: var(--white);
    font-family: var(--font-display);
    font-size: 73.6px;
    font-weight: 700;
    line-height: .8;

    @media (max-width: 1024px) { font-size: 80px; }
    @media (max-width: 768px)  { font-size: 72px; }
}

.roster_card_name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--white);
    font-size: 19.2px;
    font-weight: 600;
    line-height: .8;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;

    @media (max-width: 768px) {
        margin-bottom: 7px;
    }

    & .roster_card_first {
        display: block;
        color: var(--white);
        font-family: var(--font-display);
        font-size: 19.2px;
        font-weight: 600;
    }

    & .roster_card_last {
        display: block;
        max-width: 100%;
        overflow: hidden;
        color: var(--white);
        font-family: var(--font-display);
        font-size: 48px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;

        @media (max-width: 768px) { font-size: 32px; }
    }
}

/* Player detail panel (slides up on hover / focus) ---------------------- */
.roster_card_overlay {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: 35%;
    padding: 24px;
    background: var(--secondary);
    color: var(--white);
    transform: translateY(100%);
    transition: transform .4s ease-in-out;

    @media (max-width: 768px) {
        height: 50%;
    }
}

.roster_card:hover .roster_card_overlay,
.roster_card:focus-visible .roster_card_overlay,
.roster_card:focus-within .roster_card_overlay {
    transform: translateY(0);
}

.roster_card_overlay_content {
    width: 100%;
    max-width: 100%;
    text-align: left;

    & p {
        margin: 8px 0;
        color: var(--white);
        font-family: var(--font-body);
        font-size: 16px;
        line-height: 1.4;

        & strong {
            color: var(--white);
            font-weight: 700;
        }
    }
}

.roster_card_instagram {
    display: inline-block;
    margin-top: 16px;
    color: var(--white);

    & svg {
        width: 24px;
        height: 24px;
        fill: currentColor;
        transition: color .3s var(--ease);
    }

    &:hover,
    &:focus-visible {
        color: #E1306C; /* Instagram brand pink, as live */
    }
}

@media (prefers-reduced-motion: reduce) {
    .roster_card_overlay { transition: none; }
}
