/* The bracket always fits the frame; on small screens people zoom in.
Everything inside scales with the bracket width (cqi), so it stays one picture. */
.bracket-page {
    position: relative;
    width: min(calc(100% - 64px), 1200px);
    margin: calc(5rem + 64px) auto 0;
    /* The logo is sized from the page width, like the bracket */
    container-type: inline-size;
}

/* B Games logo in the empty space at the top centre of the bracket.
It is also the link back to the year page. */
.bracket-brand-halo {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 50%;
    width: 12cqi;
    transform: translateX(-50%);
    border-radius: 50%;
}

.bracket-brand-halo:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
}

.bracket-brand {
    display: block;
    width: 100%;
    height: auto;
}

/* The bracket starts a little below the top of the page, so the logo sits
high in the gap above the lines and keeps the usual distance to the header */
.bracket-scroll {
    margin-top: 5cqi;
}

.bracket-graphic {
    position: relative;
    width: 100%;
    aspect-ratio: 1040 / 600;
    container-type: inline-size;
}

.bracket-lines {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.bracket-trophy {
    filter: drop-shadow(0 .25cqi 0 black);
}

.bracket-game {
    position: absolute;
    box-sizing: border-box;
    width: 6.73%;
    height: auto;
    border: max(1px, .21cqi) solid white;
    border-radius: 50%;
    background: white;
    /* 3D edge like the logo on the rules pages (grey band, black band, soft shadow), in the same proportions to the logo */
    box-shadow: 0 .26cqi 0 #ddd, 0 .53cqi 0 black, 0 .84cqi 1.26cqi #0006;
    transform: translate(-50%, -50%);
}

.bracket-team {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 7.8%;
    max-width: none;
    height: 3.2cqi;
    margin: 0;
    padding: .21em .36em;
    border-width: max(1px, .17cqi);
    border-color: black;
    background: white;
    color: black;
    font-size: .933cqi;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: normal;
    transform: translate(-50%, -50%) rotate(-1.5deg);
}

.bracket-team[data-eliminated="true"] {
    background: #c9c9c9;
    color: #242424;
    border-color: #242424;
    box-shadow: .23em .23em 0 #242424;
    font-weight: 600;
}

/* Hint to turn the phone: only on phones held upright, shown over the
bracket for a few seconds, then it fades out. It shows again each time the
phone is turned back upright. */
.bracket-rotate-hint {
    display: none;
}

@media (max-width: 600px) {
    .bracket-page {
        margin-top: calc(5rem + 48px);
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    /* Icon only: a phone turning sideways, on a dark see-through circle, in the middle of the screen
       and half the screen wide. It sits outside <main>, so "fixed" refers to the screen, not the bracket. */
    .bracket-rotate-hint {
        position: fixed;
        z-index: 3;
        top: 50%;
        left: 50%;
        display: grid;
        place-items: center;
        box-sizing: border-box;
        width: 50vw;
        height: 50vw;
        margin: 0;
        border: 2px solid white;
        border-radius: 50%;
        background: #000b;
        color: white;
        transform: translate(-50%, -50%);
        pointer-events: none;
        animation: rotate-hint-fade 6s ease forwards;
    }

    .bracket-rotate-hint svg {
        /* Same share of the circle as before (2.75rem in 4.5rem) */
        width: 61%;
        height: 61%;
        animation: rotate-hint-turn 2.2s ease-in-out .3s 2 both;
    }
}

@keyframes rotate-hint-fade {
    0%, 80% {
        opacity: 1;
        visibility: visible;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes rotate-hint-turn {
    0%, 20% {
        transform: rotate(0);
    }

    60%, 100% {
        transform: rotate(-90deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bracket-rotate-hint svg {
        animation: none;
        transform: rotate(-90deg);
    }
}

/* Positions of the individual items. They live here instead of in the page
so the content security policy can block all inline styles. */

.bracket-game.bracket-spot-1 {
    left: 12.69231%;
    top: 6.52167%;
}

.bracket-game.bracket-spot-2 {
    left: 90.26538%;
    top: 5.33333%;
}

.bracket-game.bracket-spot-3 {
    left: 55.41442%;
    top: 27.97333%;
}

.bracket-game.bracket-spot-4 {
    left: 31.48654%;
    top: 41.83333%;
}

.bracket-game.bracket-spot-5 {
    left: 97.59615%;
    top: 50%;
}

.bracket-game.bracket-spot-6 {
    left: 9.61538%;
    top: 80%;
}

.bracket-game.bracket-spot-7 {
    left: 74.33942%;
    top: 85.69333%;
}

.team-name.bracket-spot-8 {
    left: 22.02404%;
    top: 11.83333%;
}

.team-name.bracket-spot-9 {
    left: 11.51923%;
    top: 24.33333%;
}

.team-name.bracket-spot-10 {
    left: 11.51923%;
    top: 59%;
}

.team-name.bracket-spot-11 {
    left: 22.02404%;
    top: 51.83333%;
}

.team-name.bracket-spot-12 {
    left: 32.52885%;
    top: 61.83333%;
}

.team-name.bracket-spot-13 {
    left: 67.36058%;
    top: 21.83333%;
}

.team-name.bracket-spot-14 {
    left: 77.86538%;
    top: 31.83333%;
}

.team-name.bracket-spot-15 {
    left: 88.37019%;
    top: 24.33333%;
}

.team-name.bracket-spot-16 {
    left: 88.37019%;
    top: 57.33333%;
}

.team-name.bracket-spot-17 {
    left: 88.37019%;
    top: 66.33333%;
}

.team-name.bracket-spot-18 {
    left: 77.86538%;
    top: 50.83333%;
}

.team-name.bracket-spot-19 {
    left: 56.85577%;
    top: 41.83333%;
}

/* 2024 bracket: its own positions, the 2025 ones above stay as they are */

.bracket-game.bracket-2024-spot-1 {
    left: 32.50000%;
    top: 12.50000%;
}

.bracket-game.bracket-2024-spot-2 {
    left: 67.50000%;
    top: 17.50000%;
}

.bracket-game.bracket-2024-spot-3 {
    left: 50.00000%;
    top: 30.83333%;
}

.bracket-game.bracket-2024-spot-4 {
    left: 67.50000%;
    top: 54.16667%;
}

.bracket-game.bracket-2024-spot-5 {
    left: 2.88462%;
    top: 49.16667%;
}

.bracket-game.bracket-2024-spot-6 {
    left: 33.17308%;
    top: 90.00000%;
}

.bracket-game.bracket-2024-spot-7 {
    left: 96.92308%;
    top: 76.66667%;
}

.team-name.bracket-2024-spot-8 {
    left: 11.57452%;
    top: 22.50000%;
}

.team-name.bracket-2024-spot-9 {
    left: 11.57452%;
    top: 33.16667%;
}

.team-name.bracket-2024-spot-10 {
    left: 11.57452%;
    top: 54.50000%;
}

.team-name.bracket-2024-spot-11 {
    left: 11.57452%;
    top: 86.50000%;
}

.team-name.bracket-2024-spot-12 {
    left: 22.07933%;
    top: 38.50000%;
}

.team-name.bracket-2024-spot-13 {
    left: 22.07933%;
    top: 81.16667%;
}

.team-name.bracket-2024-spot-14 {
    left: 32.58413%;
    top: 70.50000%;
}

.team-name.bracket-2024-spot-15 {
    left: 88.42548%;
    top: 11.83333%;
}

.team-name.bracket-2024-spot-16 {
    left: 88.42548%;
    top: 33.16667%;
}

.team-name.bracket-2024-spot-17 {
    left: 88.42548%;
    top: 54.50000%;
}

.team-name.bracket-2024-spot-18 {
    left: 88.42548%;
    top: 86.50000%;
}

.team-name.bracket-2024-spot-19 {
    left: 77.92067%;
    top: 17.16667%;
}

.team-name.bracket-2024-spot-20 {
    left: 77.92067%;
    top: 81.16667%;
}

.team-name.bracket-2024-spot-21 {
    left: 67.41587%;
    top: 70.50000%;
}

.team-name.bracket-2024-spot-22 {
    left: 56.91106%;
    top: 49.16667%;
}
