/* Groups page (tournament/<year>/groups). The overview pages share this file
for .tournament-year-cover; their frame comes from gallery-years.css. */

.tournament-page {
    width: min(calc(100% - 64px), 1200px);
    margin: calc(5rem + 64px) auto 0;
}

.tournament-heading {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

/* One dot per group; the open group's dot is filled */
.group-dots {
    display: flex;
    justify-content: center;
    gap: .25rem;
    margin-bottom: 1.75rem;
}

.group-dot {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.group-dot::before {
    content: "";
    box-sizing: border-box;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    background: #0005;
    transition: background-color .2s;
}

.group-dot[aria-current="true"]::before {
    background: white;
}

.group-dot:focus-visible {
    outline: 2px solid white;
    outline-offset: 0;
    border-radius: 50%;
}

/* Group title sticker: padding, corners and shadow in em, so it keeps its
proportions at every text size */
.current-group {
    margin: 0;
    padding: .33em .56em;
    border: 2px solid black;
    border-radius: .14em;
    background: white;
    color: black;
    box-shadow: .15em .15em 0 black;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    text-align: center;
    transform: rotate(1.5deg);
}

/* Fixed width, so the sticker doesn't change size between letters */
#group-heading {
    box-sizing: content-box;
    width: 6em;
}

/* The group title is also the link back to the year page */
#group-heading .title-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25em;
    white-space: nowrap;
}

.group-letter {
    display: flex;
    justify-content: center;
    flex: 0 0 1em;
}

.tournament-year-cover {
    background: #666 url('/assets/images/background/background-image.webp') center / cover;
}

/* Arrows left and right of the cards. The card area is capped, so a whole
group fits on a laptop screen. */
.group-stage {
    display: grid;
    grid-template-columns: 56px minmax(0, 640px) 56px;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.group-stage:focus-visible {
    outline: 2px solid white;
    outline-offset: 6px;
    border-radius: .3rem;
}

.group-panels {
    position: relative;
    overflow: hidden;
    min-width: 0;
    /* Vertical scrolling and zoom stay with the browser; sideways swipes change the group */
    touch-action: pan-y pinch-zoom;
}

.group-panel {
    box-sizing: border-box;
    width: 100%;
    /* Room for the card shadows inside the clipped area */
    padding: 0 8px 8px 0;
}

.group-panel[hidden] {
    display: none;
}

.group-panel.is-leaving {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.team-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 2.5rem 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.team-card {
    box-sizing: border-box;
    min-width: 0;
    text-align: center;
    /* Photo frame border, corners and shadow are sized from the card width */
    container-type: inline-size;
}

.team-photo-area {
    position: relative;
    overflow: hidden;
    /* Same frame as the year cards: 3px border, 6px shadow */
    border: 3px solid black;
    border-radius: .4rem;
    box-shadow: 6px 6px 0 black;
}

.team-photo {
    display: block;
    width: 100%;
    height: auto;
    /* Every team photo gets the same 4:3 frame, whatever its own shape (2024 photos are 16:9).
       Like the gallery, the photo fills the frame and the edges are cut. Name positions in
       people-YEAR.json are measured in this frame. */
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: black;
}

/* A drawing instead of a photo: shown whole on white, so nothing is cut */
.team-photo.is-drawing {
    object-fit: contain;
    background: white;
}

.team-photo-area.is-locked .team-photo {
    filter: blur(10px);
    transform: scale(1.06);
}

.team-photo-lock {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #0003;
    color: #000b;
    pointer-events: none;
}

.team-photo-lock svg {
    width: 64px;
    height: auto;
    filter: drop-shadow(0 1px 1px #fff4);
}

.team-photo-area:not(.is-locked) .team-photo-lock {
    display: none;
}

.person-hotspot {
    position: absolute;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: default;
    touch-action: manipulation;
}

.person-hotspot:focus-visible {
    outline: 2px solid white;
    outline-offset: -3px;
    box-shadow: inset 0 0 0 1px black;
}

.person-label {
    position: absolute;
    z-index: 1;
    top: var(--person-y, 55%);
    left: clamp(2rem, var(--person-x, 50%), calc(100% - 2rem));
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    max-width: calc(100% - .75rem);
    padding: .18em .32em;
    border: 2px solid white;
    border-radius: .21em;
    background: black;
    color: white;
    font-size: .875rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

.person-label[hidden] {
    display: none;
}

/* Team name sticker: same style as the /games name stickers */
.team-name {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    width: fit-content;
    max-width: calc(100% - 1rem);
    margin: -.6em auto 0;
    padding: .37em .57em;
    border: 2px solid black;
    border-radius: .17em;
    background: white;
    color: black;
    box-shadow: .23em .23em 0 black;
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
    transform: rotate(-1.5deg);
}

.group-arrow {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid white;
    border-radius: 50%;
    background: #0005;
    color: white;
    cursor: pointer;
    transition: background-color .2s, color .2s, transform .2s;
}

.group-arrow svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
    .group-arrow:hover {
        background: white;
        color: black;
        transform: scale(1.08);
    }
}

.group-arrow:disabled {
    opacity: .4;
    cursor: default;
}

.group-arrow:focus-visible {
    outline: 2px solid white;
    outline-offset: 6px;
}

/* Tablet */
@media (max-width: 950px) {
    .current-group {
        font-size: 2rem;
    }

    .team-name {
        font-size: 1rem;
    }

    .team-photo-lock svg {
        width: 56px;
    }

    .person-label {
        font-size: .75rem;
    }
}

/* Phone: one card per row, no arrows: swipe sideways to change the group */
@media (max-width: 600px) {
    .tournament-page {
        margin-top: calc(5rem + 48px);
    }

    .tournament-heading {
        margin-bottom: 1rem;
    }

    .group-dots {
        margin-bottom: 1.5rem;
    }

    .current-group {
        font-size: 1.75rem;
    }

    .group-stage {
        grid-template-columns: minmax(0, 400px);
    }

    .group-arrow {
        display: none;
    }

    .team-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.75rem;
    }

    .team-name {
        font-size: .875rem;
    }

    .team-photo-lock svg {
        width: 48px;
    }

    .person-label {
        left: clamp(2.2rem, var(--person-x, 50%), calc(100% - 2.2rem));
        font-size: .6875rem;
    }
}

@media (hover: hover) and (pointer: fine) {
    .group-dot:hover::before {
        background: #fffa;
    }
}

@media (prefers-reduced-motion: reduce) {
    .group-arrow, .group-dot::before {
        transition: none;
    }
}
