/* v687 – stable detail gallery and category tiles, isolated from legacy experiments. */
@media (min-width: 992px) {
    html body:has(#product-offer) #image_wrapper,
    html body:has(#product-offer) #gallery_wrapper,
    html body:has(#product-offer) #gallery,
    html body:has(#product-offer) #gallery .slick-list,
    html body:has(#product-offer) #gallery .slick-track,
    html body:has(#product-offer) #gallery .slick-slide,
    html body:has(#product-offer) #gallery .square.square-image,
    html body:has(#product-offer) #gallery .square.square-image > .inner,
    html body:has(#product-offer) #gallery .square.square-image picture {
        height: 368px !important;
        min-height: 368px !important;
        max-height: 368px !important;
    }

    html body:has(#product-offer) #gallery_wrapper {
        display: block !important;
        overflow: hidden !important;
    }

    html body:has(#product-offer) #gallery .square.square-image > .inner,
    html body:has(#product-offer) #gallery .square.square-image picture {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        inset: auto !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #f7f4f1 !important;
    }

    /* JTL uses img-fluid/first for the real detail image on several article types. */
    html body:has(#product-offer) #gallery picture > img,
    html body:has(#product-offer) #gallery img.product-image,
    html body:has(#product-offer) #gallery img.img-fluid,
    html body:has(#product-offer) #gallery img.first {
        display: block !important;
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        object-fit: contain !important;
        object-position: center center !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
}

/* Parent category pages do not contain #product-list, so they need their own grid. */
@media (min-width: 768px) {
    body.luna-toys:not(:has(#product-list)) .luna-toys-tiles {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 16px !important;
        margin: 18px 0 24px !important;
    }

    body.luna-toys:not(:has(#product-list)) .luna-toys-tile,
    body.luna-toys:not(:has(#product-list)) .luna-toys-tile:nth-child(n) {
        grid-column: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
    }

    body.luna-toys:not(:has(#product-list)) .luna-toys-tile img,
    body.luna-toys:not(:has(#product-list)) .luna-toys-tile-placeholder {
        height: 168px !important;
        min-height: 168px !important;
        max-height: 168px !important;
        object-fit: contain !important;
        object-position: center !important;
    }
}

@media (max-width: 767px) {
    body.luna-toys:not(:has(#product-list)) .luna-toys-tiles {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
    body.luna-toys:not(:has(#product-list)) .luna-toys-tile img,
    body.luna-toys:not(:has(#product-list)) .luna-toys-tile-placeholder {
        height: 150px !important;
    }
}
