.gallery {
    max-height: 428px;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);
    background: var(--belyy);
    position: relative;
}

.gallery__thumbs {
    order: 2;
    width: 100%;
    max-height: none;
    overflow: hidden;
}

.gallery__thumbs .swiper-slide {
    width: auto;
    height: auto;
}

.gallery__thumb {
    cursor: pointer;
    padding: 12px;
    aspect-ratio: 1/1;
    width: 100%;
    box-shadow: inset 0 0 30px 0 rgba(224, 224, 224, 0.7);
    background: var(--belyy);
    border: 0;
    display: block;
}

.gallery__thumb img {
    max-width: 30px;
    width: 100%;
    aspect-ratio: 1/1;
    margin: 0 auto;
    display: block;
    object-fit: contain;
}

.gallery-thumbs-swiper .swiper-slide-thumb-active .gallery__thumb,
.gallery__thumb--active {
    outline: 1.5px solid var(--chernyy);
}

.gallery__main {
    order: 1;
    min-height: 280px;
    box-shadow: inset 0 0 83px 0 rgba(224, 224, 224, 0.7);
    background: var(--belyy);
    width: 100%;
    overflow: hidden;
}

.gallery__main-view {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: 10px;
}

.gallery__main img {
    max-height: 216px;
    max-width: 100%;
    object-fit: contain;
}

.gallery__pagination {
    bottom: 8px !important;
}

.gallery__fav-icon {
    display: block;
    position: absolute;
    top: 30px;
    right: 30px;
    background: transparent;
    cursor: pointer;
    z-index: 2;
    min-width: 20px;
    height: auto;
}

@media (min-width: 768px) {
    .gallery {
        grid-template-columns: 90px 1fr;
        grid-template-rows: 1fr;
        max-height: max-content;
        gap: 10px;
    }

    .gallery__thumbs {
        order: 0;
        height: 100%;
        max-height: 400px;
    }

    .gallery__main {
        order: 0;
        min-height: 400px;
        padding-inline: 0;
    }

    .gallery__main-view {
        min-height: 400px;
        padding-inline: 60px;
    }

    .gallery__main img {
        max-height: 300px;
    }

    .gallery__pagination {
        display: none;
    }
}

@media (min-width: 950px) {
    .gallery {
        gap: 10px;
        height: 100%;
    }

    .gallery__main-view {
        padding: 40px 60px;
    }

    .gallery__fav-icon {
        max-width: 30px;
    }
}

@media (min-width: 1500px) {
    .gallery {
        max-height: 620px;
        max-width: 568px;
        gap: 10px;
        height: 100%;
    }

    .gallery__thumbs {
        gap: 12px;
        max-height: 580px;
    }

    .gallery__main-view {
        min-height: 560px;
    }

    .gallery__main img {
        max-height: 420px;
    }
}

/* Phones (Figma "М. Устройство"): thumbs column on the left, photo on the right, no dots */
@media (max-width: 767px) {
    .gallery {
        grid-template-columns: 50px minmax(0, 1fr);
        grid-template-rows: 1fr;
        max-height: none;
    }

    .gallery__thumbs {
        order: 0;
        height: 100%;
        max-height: 280px;
    }

    .gallery__thumb {
        padding: 8px;
    }

    .gallery__main {
        order: 0;
    }

    .gallery__main img {
        max-height: 260px;
    }

    .gallery__pagination {
        display: none;
    }
}
