/* ==========================================================================
   Youth Team – Training mode selector
   ========================================================================== */

.youth-mode-btn {
    text-align: center;
    padding: 0.75rem;
}

.youth-mode-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* The header doubles as the fold toggle (see `_renderModeCard`), so it is a
   button — stripped back to the card header it looks like. */
.youth-mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.youth-mode-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

/* The mode's own icon — not the chevron, which keeps its body-text size. */
.youth-mode-title .fa {
    font-size: 1.25rem;
    margin-right: 0.25rem;
}

.youth-mode-header strong {
    font-size: 1rem;
}

/* Effects + slots: the folding part. A column so `.youth-slot-list`'s
   `margin-top: auto` still pushes the selects to the bottom of the card now
   that they no longer sit in the flex `.card-body` directly. */
.youth-mode-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

/* Folded there is no body left to separate the header from. */
.youth-mode-card .collapsible-card.is-collapsed > .youth-mode-header {
    margin-bottom: 0;
}

.youth-slot-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

.youth-slot-select {
    font-size: 0.85rem;
}

.youth-mode-inline-select {
    font-size: 0.85rem;
    width: auto;
    min-width: 9rem;
    display: inline-block;
}

/* In the compact youth table on a phone the mode is one of six columns; the
   select shows as much of the mode as fits and opens to the full list. */
@media screen and (max-width: 768px) {
    .table-container.is-compact .youth-mode-inline-select {
        min-width: 0;
        width: 5.5rem;
    }
}

.youth-mode-effects {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.5rem;
}

.youth-mode-effect {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.youth-effect-label {
    font-size: 0.85rem;
}

/* Effect icons – default (inactive button) */
.youth-effect-positive {
    color: var(--app-positive);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.youth-effect-negative {
    color: var(--bs-danger);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Effect icons – active (primary button) — lighter tones for contrast */
.youth-effect-positive-active {
    color: var(--app-effect-positive);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.youth-effect-negative-active {
    color: var(--app-effect-negative);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
}

/* ==========================================================================
   Youth Team – squad photo (#563)

   The squad lines up on the pitch in front of the youth academy. The backdrop
   is a still of the club's own academy cropped out of the 3D scene, painted
   onto the element by `_applyAcademyBackdrop` (a data URL cannot live in a
   stylesheet). Until it arrives the frame is plain light grey on purpose: a
   painted stand-in would show for a moment and then be swapped out, which read
   as a glitch.

   Both rows share one slot grid: a member is exactly one slot wide, so two
   centred rows whose counts differ by one land in each other's gaps, and the
   `--offset` modifier nudges the back row by half a slot when they don't. The
   rows also overlap vertically — the back row is pushed down into the front
   one, which paints over it, the way a real team photo stacks.
   ========================================================================== */

.youth-squad-photo {
    /* Slot = one member's width plus the gap to the next. Everything about the
       staggering is derived from these two, so they only exist here. */
    --youth-slot-width: 5.5rem;
    --youth-slot-gap: 0.35rem;
    /* How far the back row drops into the front one. Pushing the back row down
       rather than lifting the front one up keeps the block's bottom edge where
       the layout put it, so no empty strip opens below the squad. */
    --youth-row-overlap: 1.6rem;
    --youth-row-shift-x: 0rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* A header image, not the content: tall enough to show the academy behind
       the squad, no taller — the roster below it is what the page is for and
       has to be reachable without scrolling past a wall of trees.

       Why the height follows the width: the still is 2.4:1 and `cover` crops
       whatever the frame does not match. On a phone the frame is narrower than
       that, so a short frame only loses sky at the top (it is anchored to its
       bottom edge) — 13rem is plenty. On a desktop the frame is nearly three
       times as wide, `cover` scales by width, and the same 13rem would cut the
       roof off the academy. 24vw keeps roughly the old 20rem there.

       A squad of six or more outgrows all of this on its own; the minimum only
       matters while the academy is still small. */
    min-height: clamp(13rem, 24vw, 20rem);
    padding: 1rem 0 0.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: var(--app-youth-photo-bg);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: bottom center;
    box-shadow: inset 0 0 3rem rgba(var(--app-black-rgb), 0.35);
}

/* The grey only shows until the backdrop still has loaded. */
[data-bs-theme=dark] .youth-squad-photo {
    background-color: var(--app-surface-muted);
}

/* On a phone the frame runs edge to edge: the page's 2rem gutter is pulled back
   so no white strip is left beside the photo, and the corners square off with
   it. Same trick as `.horizontal-scrollable-table` / the tab bar in layout.css. */
@media screen and (max-width: 768px) {
    .youth-squad-photo {
        margin-inline: -2rem;
        border-radius: 0;
    }
}

/* A big squad is wider than the frame — it scrolls sideways instead of wrapping
   into a third row, and both rows scroll together. */
.youth-squad-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 0 0.75rem;
}

/* `max-content` + auto margins rather than `justify-content` on the scroller:
   a centred flex child cannot be scrolled back to its start. */
.youth-squad-rows {
    display: flex;
    flex-direction: column;
    /* No gap — the rows are meant to touch, and `--youth-row-overlap` then
       pushes them into each other. */
    gap: 0;
    width: max-content;
    margin-inline: auto;
}

.youth-squad-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-end;
    gap: var(--youth-slot-gap);
}

/* One transform for both shifts: a second `transform` declaration would
   replace the first rather than add to it. */
.youth-squad-row--back {
    transform: translate(var(--youth-row-shift-x), var(--youth-row-overlap));
}

.youth-squad-row--offset {
    --youth-row-shift-x: calc((var(--youth-slot-width) + var(--youth-slot-gap)) / 2);
}

.youth-squad-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    /* Fixed, not fit-content: the stagger only works on an even slot grid. */
    width: var(--youth-slot-width);
    flex: 0 0 auto;
}

.youth-squad-portrait {
    /* Reserve the portrait box so the rows don't jump when the SVGs arrive. */
    min-height: 88px;
    display: flex;
    align-items: flex-end;
}

.youth-squad-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    max-width: 100%;
    margin: 0;
}

.youth-squad-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.05rem 0.4rem;
    border-radius: 0.4rem;
    /* The backdrop runs from bright sky to dark asphalt, so the nameplate
       carries its own contrast instead of relying on a text shadow alone. */
    background-color: rgba(var(--app-black-rgb), 0.5);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-ink-on-accent);
}

/* The canvas the academy still is rendered on: it needs a real size for WebGL,
   but must never be seen or take up room. Removed again after the capture. */
.youth-academy-still {
    position: fixed;
    top: 0;
    left: 0;
    width: 960px;
    height: 400px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Folding is a phone affordance: side by side the three cards cost one screen
   between them, so above 768px they are always open and the chevron goes away
   — the header then just reads as a header. Overrides the generic
   `.collapsible-card.is-collapsed > .collapsible-card-content` fold. */
@media screen and (min-width: 768px) {
    .youth-mode-card .collapsible-card.is-collapsed > .youth-mode-content {
        display: flex;
    }

    .youth-mode-card .collapsible-card.is-collapsed > .youth-mode-header {
        margin-bottom: 0.75rem;
    }

    .youth-mode-card .collapsible-card-chevron {
        display: none;
    }

    .youth-mode-header {
        cursor: default;
    }
}
