/* The stage sets the gallery height; the thumbnail rail never expands it. */
.product-page .product-gallery {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
    min-width: 0;
}
.product-page .product-gallery--single { grid-template-columns: minmax(0, 1fr); }
.product-page .product-gallery .product-stage {
    padding: 0 !important;
    overflow: hidden;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
    align-self: start;
    touch-action: pan-y;
}
.product-page .product-gallery .product-stage > img {
    inset: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}
.product-page .product-thumbs-rail { position: relative; min-height: 0; min-width: 0; }
.product-page .product-thumbs-rail .product-thumbs {
    position: absolute;
    inset: 34px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
    width: auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
}
.product-page .product-thumbs-rail .product-thumbs::-webkit-scrollbar { display: none; }
.product-page .product-thumbs-rail .product-thumbs > button {
    flex: 0 0 64px;
    width: 64px;
    height: 64px !important;
    min-width: 64px;
    max-width: 64px;
    max-height: 64px;
    aspect-ratio: 1;
    box-sizing: border-box;
    min-height: 64px;
    scroll-snap-align: start;
}
.product-page .product-thumbs-rail .product-thumbs img { width: 100%; height: 100%; object-fit: cover; transform: none; }
.product-page .product-thumbs-prev,
.product-page .product-thumbs-next {
    position: absolute;
    left: 20px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid #d7e1ee;
    border-radius: 50%;
    background: #fff;
    color: #0c2e6e;
    transform: rotate(90deg);
    cursor: pointer;
}
.product-page .product-thumbs-prev { top: 0; }
.product-page .product-thumbs-next { bottom: 0; }
.product-page .product-thumbs-rail > button:disabled { opacity: .3; cursor: default; }
.product-page .product-stage[aria-busy="true"]::after {
    content: "";
    position: absolute;
    left: calc(50% - 10px);
    bottom: 18px;
    width: 20px;
    height: 20px;
    border: 2px solid #d7e1ee;
    border-top-color: #0c2e6e;
    border-radius: 50%;
    animation: product-gallery-loading .7s linear infinite;
}
.product-gallery-status:not([hidden]) {
    position: absolute;
    bottom: 40px;
    left: 12px;
    right: 12px;
    padding: 10px;
    background: #fff;
    color: #842626;
    font-size: 13px;
    text-align: center;
}
@keyframes product-gallery-loading { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
    .product-page .product-gallery { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .product-page .product-gallery .product-stage { grid-row: 1; }
    .product-page .product-thumbs-rail { grid-row: 2; height: 74px; }
    .product-page .product-thumbs-rail .product-thumbs {
        inset: 0 34px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
    }
    .product-page .product-thumbs-prev,
    .product-page .product-thumbs-next { top: 18px; bottom: auto; transform: none; }
    .product-page .product-thumbs-prev { left: 0; }
    .product-page .product-thumbs-next { left: auto; right: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .product-page .product-stage[aria-busy="true"]::after { animation: none; }
}
