/* Keep the gallery controls separate from the thumbnail rail. */
body[data-view="product"] .product-detail.style-a-product .gallery {
    position: relative;
}

body[data-view="product"] .style-a-product .product-main-media {
    display: grid;
    justify-items: center;
    min-width: 0;
}

body[data-view="product"] .style-a-product .main-photo {
    width: fit-content;
    max-width: 100%;
    border-radius: 12px;
}

body[data-view="product"] .style-a-product .main-photo img {
    width: auto;
    max-width: 100%;
    margin-inline: auto;
}

body[data-view="product"] .style-a-product .main-photo:has(img[hidden]) {
    width: 100%;
}

body[data-view="product"] .style-a-product .product-zoom-cue {
    inset-inline-end: 8px;
    inset-block-end: 8px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
}

body[data-view="product"] .style-a-product .product-zoom-cue[hidden] {
    display: none;
}

body[data-view="product"] .style-a-product .product-zoom-cue .icon {
    width: 17px;
    height: 17px;
}

body[data-view="product"] .style-a-product .product-gallery-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    margin-top: 8px;
}

body[data-view="product"] .style-a-product .product-gallery-tools .thumbnails {
    justify-content: safe center;
    gap: 6px;
    padding: 2px 2px 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

body[data-view="product"] .style-a-product .thumbnails::-webkit-scrollbar {
    display: none;
}

body[data-view="product"] .style-a-product .product-gallery-tools .thumbnails button {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    padding: 2px;
    scroll-snap-align: start;
}

body[data-view="product"] .style-a-product .product-gallery-navigation:not([hidden]) {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0;
}

body[data-view="product"] .style-a-product .product-gallery-navigation > div {
    display: contents;
}

body[data-view="product"] .style-a-product .product-gallery-navigation [data-gallery-step="-1"] {
    order: 0;
}

body[data-view="product"] .style-a-product .product-gallery-navigation #product-photo-count {
    min-width: 30px;
    order: 1;
    color: var(--muted);
    text-align: center;
}

body[data-view="product"] .style-a-product .product-gallery-navigation [data-gallery-step="1"] {
    order: 2;
}

body[data-view="product"] .style-a-product .product-gallery-navigation button {
    width: 40px;
    height: 40px;
}

body[data-view="product"] .style-a-product .product-purchase-panel h1 {
    margin: 2px 0 2px;
}

body[data-view="product"] .style-a-product .product-context-row {
    min-height: 0;
}

body[data-view="product"] .style-a-product .product-context-row button {
    border: 0;
    background: transparent;
}

body[data-view="product"] .style-a-product .product-price-row {
    margin: 4px 0 8px;
}

body[data-view="product"] .style-a-product .product-current-price {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}

body[data-view="product"] .style-a-product .product-current-price #product-price-prefix:not([hidden]) {
    display: inline;
}

body[data-view="product"] .style-a-product .product-order-controls {
    gap: 5px;
    padding: 10px 12px;
}

body[data-view="product"] .style-a-product .option-group {
    margin-block: 4px 7px;
}

@media (max-width: 639px) {
    body[data-view="product"] .breadcrumbs {
        margin-block: 0 8px;
    }

    body[data-view="product"] .style-a-product {
        row-gap: 9px;
    }

    body[data-view="product"] .style-a-product .product-gallery-tools {
        gap: 2px;
        margin-top: 5px;
    }

    body[data-view="product"] .style-a-product .product-gallery-tools .thumbnails button {
        width: clamp(44px, 12vw, 48px);
        height: clamp(44px, 12vw, 48px);
    }

    body[data-view="product"] .product-detail.style-a-product .main-photo img {
        max-height: min(36svh, 300px);
    }

    body[data-view="product"] .style-a-product .product-gallery-navigation:not([hidden]) {
        position: absolute;
        inset-inline: 0;
        inset-block-end: calc(clamp(44px, 12vw, 48px) + 15px);
        pointer-events: none;
    }

    body[data-view="product"] .style-a-product .product-gallery-navigation button {
        width: 44px;
        height: 44px;
        pointer-events: auto;
    }

    body[data-view="product"] .style-a-product .product-gallery-navigation #product-photo-count {
        padding: 3px 7px;
        border-radius: 20px;
        background: var(--surface);
        color: var(--ink);
    }

    body[data-view="product"] .style-a-product .product-purchase-panel h1 {
        font-size: 20px;
    }
}
