.product-gallery {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.product-gallery-slides,
.product-gallery-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.product-gallery-slide {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.product-gallery-slide.is-active {
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
}

.product-gallery .product-gallery-slide img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 14px;
    object-fit: contain;
    object-position: center;
    transform: none;
    transition: none;
}

.product-gallery-control {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(25, 25, 25, .6);
    color: #fff;
    cursor: pointer;
    transform: translateY(-50%);
}

.product-gallery-control:hover,
.product-gallery-control:focus-visible {
    background: rgba(25, 25, 25, .85);
}

.product-gallery-previous { left: 10px; }
.product-gallery-next { right: 10px; }

.home-product-gallery .product-gallery-control,
.home-raw-gallery .product-gallery-control,
.product-list-gallery .product-gallery-control,
.product-detail-gallery .product-gallery-control {
    display: none;
}

.product-img .product-gallery-control {
    width: 28px;
    height: 28px;
    background: rgba(25, 25, 25, .4);
    font-size: 11px;
    opacity: .68;
    transition: opacity .2s ease, background .2s ease;
}

.product-img .product-gallery-control:hover,
.product-img .product-gallery-control:focus-visible {
    background: rgba(25, 25, 25, .82);
    opacity: 1;
}

.product-img .product-gallery-control:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.product-gallery-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 3;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(25, 25, 25, .62);
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
}

.product-gallery-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transform: translateX(-50%);
}

.product-gallery-dot {
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.product-gallery-dot::before {
    width: 7px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .8);
    content: "";
    transition: width .2s ease, background .2s ease;
}

.product-gallery-dot.is-active::before {
    width: 15px;
    background: #fff;
}

.product-gallery-dot:focus-visible {
    border-radius: 50%;
    outline: 2px solid var(--primary, #7d1f39);
    outline-offset: -2px;
}

.product-gallery-empty {
    display: grid;
    place-items: center;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 30px;
}

.product-detail-gallery {
    position: relative;
    inset: auto;
    height: auto;
    aspect-ratio: 4 / 5;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
}

.product-detail-gallery .product-gallery-slide img {
    padding: 22px;
}

.home-product-gallery .product-gallery-slide img {
    padding: 18px;
}

#produk-jadi .product-card-img .product-gallery-slide img {
    padding: 18px;
    object-fit: contain;
}

.home-raw-gallery .product-gallery-slide img {
    padding: 0;
    object-fit: cover;
    transition: transform .5s ease;
}

.product-card-new:hover .product-card-img .product-gallery-slide img {
    transform: none;
}

.product-card:hover .product-img .product-gallery-slide img {
    transform: none;
}

.product-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
    margin-top: 12px;
}

.product-gallery-thumbnail {
    overflow: hidden;
    width: 72px;
    flex: 0 0 72px;
    padding: 0;
    aspect-ratio: 4 / 5;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #f3f4f6;
    cursor: pointer;
}

.product-gallery-thumbnail.is-active {
    border-color: var(--primary, #8b0000);
}

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

@media (min-width: 768px) {
    .product-detail-gallery {
        aspect-ratio: auto;
        height: clamp(380px, 45vw, 460px);
        max-width: 500px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-gallery-slide {
        transition: none;
    }
}
