/**
 * Laatste-laag grid override (parent theme / plugin wint anders).
 * — Niet `[class*="loop"]`: dat matcht o.a. .woocommerce-loop-product__link en breekt kaarten.
 * — Gescoped op body.paperchase-shop-theme + Woo-archieven + /stores/.
 */

/* Voorkom dat een parent flex-column het raster op één kolom duwt */
body.paperchase-shop-theme.woocommerce-page:not(.single-product) .site-main .woocommerce,
body.paperchase-shop-theme.woocommerce-page:not(.single-product) #primary .woocommerce {
    display: block !important;
    flex-direction: unset !important;
}

/*
 * Live /shop/: lege strook links + kaarten rechts — WooCommerce layout.css (float/%breedte)
 * en sommige themes laten #primary of .woocommerce als smalle kolom. Alles op volle breedte.
 */
body.paperchase-shop-theme.woocommerce-page:not(.single-product) #primary.site-main,
body.paperchase-shop-theme.post-type-archive-product #primary.site-main,
body.paperchase-shop-theme.tax-product_cat #primary.site-main,
body.paperchase-shop-theme.tax-product_tag #primary.site-main {
    width: 100% !important;
    max-width: min(92rem, 100%) !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

body.paperchase-shop-theme.woocommerce-page:not(.single-product) .site-main .woocommerce,
body.paperchase-shop-theme.woocommerce-page:not(.single-product) .pcs-woo-wrap,
body.paperchase-shop-theme.woocommerce-page:not(.single-product) .pcs-shop-catalog {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    clear: both !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/*
 * Klassieke loop (ul.products): géén vast aantal kolommen — volgt Customizer via --woo-cols
 * (woocommerce.css zet .columns-2 / .columns-3 e.d.).
 */
body.paperchase-shop-theme.woocommerce-page:not(.single-product) ul.products,
body.paperchase-shop-theme.post-type-archive-product ul.products,
body.paperchase-shop-theme.tax-product_cat ul.products,
body.paperchase-shop-theme.tax-product_tag ul.products {
    display: grid !important;
    grid-template-columns: repeat(var(--woo-cols, 2), minmax(0, 1fr)) !important;
    gap: clamp(0.85rem, 2vw, 1.25rem) !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    align-content: start !important;
    justify-content: start !important;
    grid-auto-flow: row !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* Blokken / stores: aparte dichtheid (geen --woo-cols op zelfde manier) */
body.paperchase-shop-theme ul.wc-block-product-template,
body.paperchase-shop-theme .wc-block-grid .wc-block-grid__products,
body.pcs-stores-archive .artist-grid-container,
body.pcs-stores-archive .archive-artist-shops-grid {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    width: 100% !important;
    max-width: min(92rem, 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Smal scherm: 2 kolommen (ook als Customizer desktop 3+ heeft) */
@media (max-width: 768px) {
    body.paperchase-shop-theme.woocommerce-page:not(.single-product) ul.products,
    body.paperchase-shop-theme.post-type-archive-product ul.products,
    body.paperchase-shop-theme.tax-product_cat ul.products,
    body.paperchase-shop-theme.tax-product_tag ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.paperchase-shop-theme ul.wc-block-product-template,
    body.paperchase-shop-theme .wc-block-grid .wc-block-grid__products,
    body.pcs-stores-archive .artist-grid-container,
    body.pcs-stores-archive .archive-artist-shops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Kill all theme-based width restrictions on items */
body.paperchase-shop-theme.woocommerce-page:not(.single-product) ul.products li.product,
body.paperchase-shop-theme.woocommerce li.product,
body.paperchase-shop-theme li.product.type-product,
body.pcs-stores-archive a.artist-tile,
body.pcs-stores-archive .artist-tile {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

/*
 * WooCommerce layout.css: clearfix-pseudo’s op ul.products — bij CSS Grid worden ::before/::after
 * grid-items en breken kolommen / laten een «lege» strook zien. Uitschakelen op catalogus.
 */
body.paperchase-shop-theme.woocommerce-page:not(.single-product) ul.products::before,
body.paperchase-shop-theme.woocommerce-page:not(.single-product) ul.products::after,
body.paperchase-shop-theme.post-type-archive-product ul.products::before,
body.paperchase-shop-theme.post-type-archive-product ul.products::after,
body.paperchase-shop-theme.tax-product_cat ul.products::before,
body.paperchase-shop-theme.tax-product_cat ul.products::after,
body.paperchase-shop-theme.tax-product_tag ul.products::before,
body.paperchase-shop-theme.tax-product_tag ul.products::after {
    content: none !important;
    display: none !important;
}
