/* Image gallery on the game and accessory detail pages: one big image,
   thumbnails below pick which, click the big one for full size (gallery.js). */

.gallery {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 220px;
    flex-shrink: 0;
}

.gallery-main-button {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    border-radius: 8px;
}

.gallery-main-button:focus-visible,
.gallery-thumb:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* --surface, not --cover-bg: product shots are often transparent PNGs, and a
   black controller would vanish on the dark theme's black cover background */
.gallery-main {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 8px;
    background: var(--surface);
}

/* game box art is opaque: keep the cover background it always had */
.gallery-covers .gallery-main,
.gallery-covers .gallery-thumb {
    background: var(--cover-bg);
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gallery-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
}

.gallery-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.gallery-thumb:hover {
    border-color: var(--border-strong);
}

.gallery-thumb[aria-current="true"] {
    border-color: var(--link);
}

/* previous / next in the full-size view: round buttons on the screen's
   edges (fixed, so they stay put whatever the image's size), dark and
   see-through so they work over any picture in both themes */
.gallery-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.75);
}

.gallery-nav:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.gallery-nav svg {
    width: 22px;
    height: 22px;
}

.gallery-prev {
    left: 12px;
}

.gallery-next {
    right: 12px;
}

@media (min-width: 900px) {
    .gallery {
        width: 440px;
    }

    .gallery-prev {
        left: 24px;
    }

    .gallery-next {
        right: 24px;
    }
}

@media (max-width: 600px) {
    .gallery {
        align-self: center;
        width: 100%;
        max-width: 340px;
    }
}
