/* Product gallery: preserve the entire uploaded image inside a stable frame. */
.gallery .main-photo {
    display: block;
    width: 100%;
    height: 500px;
    object-fit: contain;
    object-position: center;
    padding: 12px;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, #edf1f6, #f9fafc);
}

.gallery .thumbs img {
    object-fit: cover;
}

.main-photo-stage {
    position: relative;
}

.gallery-content {
    width: 100%;
}

.gallery-video,
.gallery-video-poster {
    display: block;
    width: 100%;
    height: 500px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #071c35;
}

.gallery-video {
    border: 0;
}

.gallery-video-poster {
    position: relative;
    padding: 0;
    color: #fff;
    cursor: pointer;
}

.gallery-video-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .78;
}

.gallery-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 72px;
    height: 52px;
    padding-left: 4px;
    border-radius: 14px;
    background: #e62117;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    font-size: 25px;
    transform: translate(-50%, -50%);
}

.gallery-play-label {
    position: absolute;
    left: 50%;
    bottom: 34px;
    padding: 8px 13px;
    border-radius: 6px;
    background: rgba(7, 28, 53, .88);
    font-size: 13px;
    font-weight: 800;
    transform: translateX(-50%);
    white-space: nowrap;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    color: var(--gray);
    font-size: 12px;
    font-weight: 700;
}

.gallery .thumbs {
    overflow-x: auto;
    padding: 3px 2px 8px;
    scrollbar-width: thin;
}

.gallery-thumb {
    flex: 0 0 78px;
    width: 78px;
    height: 78px;
    padding: 3px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 5px;
}

.gallery-thumb--video {
    position: relative;
}

.gallery-thumb--video > span {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 31px;
    height: 23px;
    padding-left: 2px;
    border-radius: 6px;
    background: #e62117;
    color: #fff;
    font-size: 11px;
    transform: translate(-50%, -50%);
}

.gallery-thumb:hover {
    transform: translateY(-2px);
}

.gallery-thumb[aria-current='true'] {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 71, 171, .12);
}

.gallery-thumb:focus-visible,
.gallery-arrow:focus-visible {
    outline: 3px solid rgba(0, 71, 171, .35);
    outline-offset: 2px;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(7, 28, 53, .12);
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    color: var(--navy);
    box-shadow: 0 7px 20px rgba(7, 28, 53, .18);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.gallery-arrow--previous {
    left: 14px;
}

.gallery-arrow--next {
    right: 14px;
}

/* Product cards keep a stable frame while showing the entire uploaded image. */
.product-card .product-image {
    position: relative;
    display: block;
    height: 210px;
    min-height: 210px;
    overflow: hidden;
    background: linear-gradient(145deg, #edf1f6, #f9fafc);
}

.product-card .product-image img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    padding: 12px;
    object-fit: contain;
    object-position: center;
}

.product-card .product-code {
    display: block;
    margin-top: 7px;
}

.product-card .product-body {
    position: relative;
    z-index: 1;
    background: #fff;
}

@media (max-width: 900px) {
    .gallery .main-photo,
    .gallery-video,
    .gallery-video-poster {
        height: min(72vw, 380px);
    }
}

@media (max-width: 560px) {
    .gallery .main-photo,
    .gallery-video,
    .gallery-video-poster {
        height: min(72vw, 300px);
    }

    .gallery .main-photo {
        padding: 8px;
    }

    .gallery .thumbs {
        margin-top: 10px;
    }

    .gallery .gallery-thumb img {
        width: 100%;
        height: 100%;
    }

    .gallery-thumb {
        flex-basis: 68px;
        width: 68px;
        height: 68px;
    }

    .gallery-arrow {
        width: 38px;
        height: 38px;
    }

    .product-card .product-image {
        height: 140px;
        min-height: 140px;
    }

    .product-card .product-image img {
        padding: 8px;
    }
}
