/* =========================
   Gallery
========================= */

.gallery,
.gallery * {
    box-sizing: border-box;
}

.gallery {
    width: min(1000px, 100%);
}

/* =========================
   Main image
========================= */

.main-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 5px;
    background-color: #ddd;
    aspect-ratio: 16 / 10;
}

.main-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.04);
    transition:
        opacity 0.65s ease,
        transform 0.9s ease;
}

.main-image.active {
    opacity: 1;
    transform: scale(1);
}

/* =========================
   Previous and next buttons
========================= */

.gallery-button {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    width: 45px;
    height: 45px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgb(0 0 0 / 60%);
    color: #fff;
    font: inherit;
    cursor: pointer;
    place-items: center;
    transform: translateY(-50%);
}

.gallery-button:hover,
.gallery-button:focus-visible {
    background-color: #000;
}

.gallery-button.previous {
    left: 15px;
}

.gallery-button.next {
    right: 15px;
}

/* =========================
   Thumbnails
========================= */

.thumbnails {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 120px;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
}

.thumbnail {
    padding: 0;
    overflow: hidden;
    border: 3px solid transparent;
    border-radius: 5px;
    background: none;
    cursor: pointer;
    opacity: 0.6;
    aspect-ratio: 4 / 3;
}

.thumbnail:hover,
.thumbnail:focus-visible,
.thumbnail.active {
    opacity: 1;
}

.thumbnail.active {
    border-color: #333;
}

.thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================
   Mobile
========================= */

@media (max-width: 600px) {

    .gallery {
        padding: 10px;
    }

    .main-image-container {
        aspect-ratio: 4 / 5;
    }

    .gallery-button {
        width: 40px;
        height: 40px;
    }

    .gallery-button.previous {
        left: 10px;
    }

    .gallery-button.next {
        right: 10px;
    }

    .thumbnails {
        grid-auto-columns: 85px;
    }

}