/* Dynamic product gallery layout guard — 2026-08-15.
 *
 * product-dynamic.blade.php renders the main image before the thumbnails.
 * The legacy grid declares a 90px column first, so auto-placement used to put
 * the main image into the thumbnail rail. Explicit grid areas keep the visual
 * roles stable regardless of DOM order.
 */

.page-product .product-gallery--compact {
    grid-template-columns: 90px minmax(0, 1fr);
    grid-template-areas: "thumbs main";
    align-items: start;
    max-width: 620px;
}

.page-product .product-gallery--compact .gallery-thumbs {
    grid-area: thumbs;
    min-width: 0;
}

.page-product .product-gallery--compact .gallery-main {
    grid-area: main;
    display: grid;
    min-width: 0;
    min-height: 610px;
    place-items: center;
    padding: 18px;
}

.page-product .product-gallery--compact .gallery-main img[data-gallery-main] {
    width: 100%;
    height: 100%;
    max-height: 574px;
    object-fit: contain;
    object-position: center;
}

.page-product .product-gallery--compact .gallery-thumbs button {
    width: 100%;
}

.page-product .product-gallery--compact .gallery-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 760px) {
    .page-product .product-gallery--compact {
        display: flex;
        flex-direction: column;
        max-width: none;
    }

    .page-product .product-gallery--compact .gallery-main {
        width: 100%;
        min-height: min(92vw, 440px);
    }

    .page-product .product-gallery--compact .gallery-main img[data-gallery-main] {
        max-height: min(84vw, 404px);
    }

    .page-product .product-gallery--compact .gallery-thumbs {
        display: flex;
        width: 100%;
        flex-direction: row;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .page-product .product-gallery--compact .gallery-thumbs button {
        width: 72px;
        height: 72px;
        flex: 0 0 72px;
    }
}
