/* Hide WooCommerce default catalog loop on the main Shop page only */
body.post-type-archive-product:not(.tax-product_cat) .woo-listing-top,
body.post-type-archive-product:not(.tax-product_cat) ul.products {
    display: none !important;
}
/* Hide the duplicated blocks injected by WooCommerce */
body.post-type-archive-product:not(.tax-product_cat) .woocommerce-products-header .page-description {
    display: none !important;
}


/* /magazines/ overview page: 4 columns on tablet */
@media (max-width: 1200px) and (min-width: 769px) {
    body.page-id-123949 .thepast-mag-covers ul.wp-block-post-template.is-layout-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 20px 15px !important;
    }
}

/* /magazines/ overview page: 1 scrollable row of 6 (3.5 covers visible) on mobile */
@media (max-width: 768px) {
    body.page-id-123949 .thepast-mag-covers ul.wp-block-post-template.is-layout-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        scroll-snap-type: x proximity;
        scrollbar-width: none !important;
        padding-bottom: 6px !important;
    }

    body.page-id-123949 .thepast-mag-covers ul.wp-block-post-template.is-layout-grid::-webkit-scrollbar {
        display: none !important;
    }

    /* 3 gaps (36px) subtracted so exactly 3.5 covers fit across any phone width */
    body.page-id-123949 .thepast-mag-covers ul.wp-block-post-template.is-layout-grid > li {
        flex: 0 0 calc((100% - 36px) / 3.5) !important;
        min-width: 0 !important;
        scroll-snap-align: start;
    }

    body.page-id-123949 .mag-grid-card,
    body.page-id-123949 .mag-grid-thumb img {
        width: 100% !important;
        height: auto !important;
    }

    body.page-id-123949 .mag-grid-divider {
        flex-wrap: wrap !important;
        gap: 4px 12px !important;
    }

    body.page-id-123949 .mag-grid-title {
        font-size: 12.5px !important;
        line-height: 1.25 !important;
    }
}


/* Homepage "Latest Issues" row: 1 scrollable row of 5 (3.5 covers visible) on mobile */
@media (max-width: 768px) {
    body.home .thepast-4col-image ul.columns-5.wp-block-post-template.is-layout-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        scroll-snap-type: x proximity;
        scrollbar-width: none !important;
        padding: 4px 4px 8px 4px !important;
    }

    body.home .thepast-4col-image ul.columns-5.wp-block-post-template.is-layout-grid::-webkit-scrollbar {
        display: none !important;
    }

    body.home .thepast-4col-image ul.columns-5.wp-block-post-template.is-layout-grid > li {
        flex: 0 0 calc((100% - 36px) / 3.5) !important;
        min-width: 0 !important;
        scroll-snap-align: start;
    }

    body.home .thepast-4col-image ul.columns-5 .wp-block-post-featured-image {
        margin-bottom: 10px !important;
    }

    body.home .thepast-4col-image ul.columns-5 .wp-block-post-title {
        font-size: 13px !important;
        line-height: 1.25 !important;
    }
}