/* Shop/category only. Existing WowStore markup, controls and visibility stay native. */
body.sp-catalog #page { max-width:1080px; width:calc(100% - 48px); margin-inline:auto; }
body.sp-catalog #content { display:block; padding:32px 0 56px; }
body.sp-catalog #content .wopb-builder-container { width:100%; min-width:0; }
body.sp-catalog #wc-column-container { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; align-items:start; }
body.sp-catalog #wc-column-container > * { grid-column:1 / -1; min-width:0; }
body.sp-catalog #wc-column-container > .woocommerce-notices-wrapper { order:-2; }
body.sp-catalog #wc-column-container > .woocommerce-notices-wrapper:empty { display:none; }
body.sp-catalog #wc-column-container > :is(.sp-catalog-heading, .wp-block-product-blocks-archive-title) { grid-column:1; order:-1; }
body.sp-catalog #wc-column-container > .woocommerce-ordering { grid-column:2; order:-1; float:none; margin:0; }
body.sp-catalog #content .woocommerce-ordering select { max-width:100%; min-height:42px; border:1px solid var(--sp-line); border-radius:4px; background-color:white; color:var(--sp-ink); font:13px Arial,sans-serif; padding:10px 30px 10px 12px; }
/* Native WowStore sorting stays inside the existing filter and mobile filter modal. */
body.sp-catalog.sp-wowstore-sorting #wc-column-container > form.woocommerce-ordering { display:none; }
body.sp-catalog :is(.wopb-block-6e481f, .wopb-block-da32d7) .wopb-filter-sort_by .wopb-filter-toggle { display:none; }
body.sp-catalog :is(.wopb-block-6e481f, .wopb-block-da32d7) .wopb-filter-sort_by .wopb-filter-body { display:block !important; }
body.sp-catalog :is(.wopb-block-6e481f, .wopb-block-da32d7) .wopb-filter-sorting-input { box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:42px; border:1px solid var(--sp-line); border-radius:4px; background-color:white; color:var(--sp-ink); font:13px Arial,sans-serif; padding:10px 24px 10px 10px; }
body.sp-catalog #content .wopb-block-archive-title { margin:0; padding:0; text-align:left; }
/* Saved builder typography has !important line heights. */
body.sp-catalog #content :is(.sp-catalog-heading h1, .wopb-archive-name) { font:700 34px/1.18 var(--sp-heading); line-height:1.18 !important; letter-spacing:0; color:var(--sp-ink); text-transform:uppercase; padding:0; margin:0 0 10px; }
body.sp-catalog #content .wopb-archive-desc { color:var(--sp-muted); font:14px/1.6 Arial,sans-serif; line-height:1.6 !important; margin:0; }
body.sp-catalog #content .wopb-archive-desc p:last-child { margin-bottom:0; }
/* Inspected GenerateBlocks layout IDs; these are not menu or product IDs. */
body.sp-catalog #content :is(.gb-element-b6cc611b, .gb-element-0a416527, .gb-element-94929c5e, .gb-element-96c5b06b) { width:100%; max-width:none; margin:0; padding:0; min-width:0; }
body.sp-catalog #content :is(.gb-element-b25d523a, .gb-element-91f95629) { display:grid; grid-template-columns:230px minmax(0,1fr); gap:24px; width:100%; max-width:none; margin:0; padding:0; align-items:start; }
body.sp-catalog #content :is(.gb-element-b25d523a, .gb-element-91f95629) > div { min-width:0; width:auto; }
body.sp-catalog #content .wopb-block-items-wrap { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; }
body.sp-catalog #content .wopb-block-item { min-width:0; display:flex; padding:0; }
body.sp-catalog #content .wopb-block-content-wrap { width:100%; min-width:0; box-sizing:border-box; display:flex; flex-direction:column; border:1px solid #eceeef; border-radius:4px; padding:15px 15px 14px; background:white; box-shadow:0 3px 16px #17202306; position:relative; transition:box-shadow .2s,transform .2s; }
body.sp-catalog #content .wopb-block-content-wrap:hover { box-shadow:0 7px 24px #17202312; transform:translateY(-3px); }
body.sp-catalog #content .wopb-block-image { position:relative; height:190px; margin:0 0 13px; padding:0; overflow:hidden; border-radius:0; }
body.sp-catalog #content .wopb-block-image > a,
body.sp-catalog #content .wopb-block-image .empty-image,
body.sp-catalog #content .wopb-block-image .empty-image > a { display:flex; align-items:center; justify-content:center; height:100%; width:100%; }
body.sp-catalog #content .wopb-block-image img { width:100%; height:95%; max-height:100%; object-fit:contain; border-radius:0; }
body.sp-catalog #content .wopb-block-title { font:600 18px/1.18 var(--sp-heading); line-height:1.18 !important; text-align:center; text-transform:uppercase; min-height:43px; padding:0; margin:0 0 9px; overflow-wrap:anywhere; }
body.sp-catalog #content .wopb-block-title a { color:var(--sp-ink); font:inherit; line-height:1.18 !important; }
body.sp-catalog #content .wopb-block-title a:hover { color:var(--sp-red); }
body.sp-catalog #content .wopb-star-rating { margin:0 auto 9px; flex-shrink:0; }
body.sp-catalog #content .wopb-product-price { font:14px/1.5 Arial,sans-serif; line-height:1.5 !important; color:var(--sp-ink); text-align:center; margin:auto 0 14px; padding:0; }
body.sp-catalog #content .wopb-product-price ins { color:#9e131c; font-weight:700; background:none; text-decoration:none; }
body.sp-catalog #content .wopb-product-price del { color:#80868a; font-size:12px; margin-right:5px; }
body.sp-catalog #content .woocommerce-price-suffix { display:block; font-size:11px; color:var(--sp-muted); }
body.sp-catalog #content .wopb-product-btn { margin:0; padding:0; }
/* Never override display here: the plugin switches normal/active cart links. */
body.sp-catalog #content .wopb-product-btn a { box-sizing:border-box; width:100%; min-height:42px; margin:0; padding:11px 8px; border:1px solid var(--sp-red); border-color:var(--sp-red) !important; border-radius:3px; background:var(--sp-red); color:white; font:700 13px/1.4 Arial,sans-serif; line-height:1.4 !important; text-align:center; text-decoration:none; text-transform:none; white-space:normal; }
body.sp-catalog #content .wopb-product-btn a:hover { background:#a71820; border-color:#a71820 !important; color:white; }
body.sp-catalog #content .sp-catalog-sale { position:absolute; top:0; right:0; z-index:4; display:flex; align-items:center; justify-content:center; flex-direction:column; width:49px; height:49px; border-radius:50%; background:var(--sp-red); color:white; font:12px/1.15 var(--sp-heading); text-transform:uppercase; transform:rotate(-7deg); box-shadow:0 2px 4px #0002; pointer-events:none; }
body.sp-catalog #content .sp-catalog-sale strong { font-size:18px; }
body.sp-catalog #content .wopb-block-image:has(.sp-catalog-sale) .wopb-onsale { display:none; }
body.sp-catalog #content .wopb-product-outofstock { z-index:5; }
body.sp-catalog #content .wopb-filter-block { box-sizing:border-box; padding:20px 16px; border:1px solid var(--sp-line); border-radius:4px; background:#f6f7f7; color:var(--sp-ink); }
body.sp-catalog #content .wopb-filter-title-section { margin-bottom:20px; padding-bottom:14px; border-bottom:1px solid var(--sp-line); }
body.sp-catalog #content .wopb-filter-title { font:600 22px/1.2 var(--sp-heading); line-height:1.2 !important; text-transform:uppercase; }
body.sp-catalog #content .wopb-filter-section { margin-bottom:22px; }
body.sp-catalog #content .wopb-filter-header { margin-bottom:12px; }
body.sp-catalog #content .wopb-filter-label { font:600 16px/1.3 var(--sp-heading); line-height:1.3 !important; text-transform:uppercase; }
body.sp-catalog #content .wopb-filter-item { margin-bottom:8px; }
body.sp-catalog #content .wopb-item-content label { font:13px/1.5 Arial,sans-serif; color:var(--sp-ink); overflow-wrap:anywhere; }
body.sp-catalog #content .wopb-filter-block input[type=checkbox] { accent-color:var(--sp-red); }
body.sp-catalog #content .wopb-filter-block input[type=checkbox]:checked { background-color:var(--sp-red); border-color:var(--sp-red) !important; }
body.sp-catalog #content :is(.wopb-filter-price-input, .wopb-filter-search-input) { box-sizing:border-box; min-width:0; max-width:100%; background:white; color:var(--sp-ink); border-radius:3px; font:13px/1.4 Arial,sans-serif; }
body.sp-catalog #content .wopb-price-range-bar { background:var(--sp-red); }
body.sp-catalog #content .wopb-price-range-input::-webkit-slider-thumb { background:var(--sp-red); }
body.sp-catalog #content .wopb-price-range-input::-moz-range-thumb { background:var(--sp-red); }
body.sp-catalog #content :is(.wopb-filter-show-more, .wopb-filter-show-less, .wopb-filter-remove-all) { color:var(--sp-red); }
body.sp-catalog #content .wopb-pagination-wrap { margin-top:28px; }
body.sp-catalog #content :is(a, button, input, select):focus-visible { outline:2px solid var(--sp-red); outline-offset:3px; }
@media (max-width:1050px) {
    body.sp-catalog #content :is(.gb-element-b25d523a, .gb-element-91f95629) { grid-template-columns:210px minmax(0,1fr); gap:20px; }
    body.sp-catalog #content .wopb-block-items-wrap { grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
    body.sp-catalog #content .wopb-block-image { height:170px; }
}
@media (max-width:760px) {
    body.sp-catalog #page { width:calc(100% - 32px); }
    body.sp-catalog #content { padding:24px 0 40px; }
    body.sp-catalog #wc-column-container { grid-template-columns:minmax(0,1fr); gap:18px; }
    body.sp-catalog #wc-column-container > .woocommerce-ordering { grid-column:1; }
    body.sp-catalog #content :is(.sp-catalog-heading h1, .wopb-archive-name) { font-size:28px; }
    body.sp-catalog #content :is(.gb-element-b25d523a, .gb-element-91f95629) { grid-template-columns:minmax(0,1fr); gap:24px; }
    body.sp-catalog #content .wopb-filter-block { padding:16px; }
    body.sp-catalog #content .wopb-block-items-wrap { gap:12px; }
    body.sp-catalog #content .wopb-block-content-wrap { padding:10px; }
    body.sp-catalog #content .wopb-block-image { height:155px; }
    body.sp-catalog #content .wopb-block-title { font-size:16px; min-height:38px; }
    body.sp-catalog #content .wopb-product-price { font-size:13px; }
    body.sp-catalog #content .wopb-product-price del { font-size:11px; }
    body.sp-catalog #content .wopb-product-btn a { font-size:12px; }
    body.sp-catalog #content .sp-catalog-sale { width:40px; height:40px; font-size:10px; }
    body.sp-catalog #content .sp-catalog-sale strong { font-size:15px; }
}
@media (prefers-reduced-motion:reduce) { body.sp-catalog #content .wopb-block-content-wrap { transition:none; } }

/* Shared mobile cards for the inspected WowStore archive/recommendation grids.
 * Extra grid ancestry wins over the single-product desktop rule loaded later.
 * Homepage cards, search suggestions, cart and other block layouts are excluded.
 */
@media (max-width:768px) {
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap.wopb-block-row {
        display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;
        align-items:stretch; min-width:0;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap > .wopb-block-item {
        /* WowStore's height:fit-content prevents grid-row stretching. */
        display:flex; flex-direction:row; align-items:stretch; align-self:stretch; height:auto; width:auto; min-width:0; margin:0; padding:0;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap > .wopb-block-item > .wopb-block-content-wrap {
        display:grid; grid-template-columns:minmax(0,1fr);
        /* Reserve a rating line even when the product has no rating markup.
         * The flexible fourth row absorbs differences in natural title height. */
        grid-template-rows:clamp(120px,38vw,155px) 16px auto minmax(0,1fr) auto auto;
        gap:8px; align-content:stretch; width:100%; min-width:0; box-sizing:border-box; padding:10px;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-category-grid { display:none; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-image {
        grid-row:1; height:100%; min-height:0; min-width:0; margin:0; padding:0;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-image img {
        width:100%; height:100%; max-width:100%; max-height:100%; object-fit:contain;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-star-rating {
        grid-row:2; align-self:center; justify-self:center; margin:0; float:none;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-title {
        grid-row:3; min-height:0; margin:0; padding:0; font-size:15px; line-height:1.25 !important;
        white-space:normal; overflow-wrap:anywhere;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-title a { line-height:1.25 !important; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-product-price {
        grid-row:5; margin:0; padding:0; font-size:13px; line-height:1.4 !important;
        /* Up to three text lines: regular price, sale price and VAT suffix. */
        min-height:4.2em; overflow-wrap:anywhere;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-product-price del { font-size:11px; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .woocommerce-price-suffix { display:block; font-size:11px; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-content-wrap > .wopb-product-btn {
        grid-row:6; align-self:end; min-width:0; margin:0; padding:0;
    }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-cart-action { width:100%; min-width:0; white-space:normal; text-wrap:wrap; }
    /* Keep the plugin's display rules for normal/active cart links intact. */
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-product-btn a {
        width:100%; min-width:0; min-height:48px; box-sizing:border-box; padding:7px 6px;
        font-size:12px; line-height:1.4 !important; white-space:normal; overflow-wrap:anywhere; justify-content:center;
    }
}
@media (max-width:374px) {
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap.wopb-block-row { gap:8px; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap > .wopb-block-item > .wopb-block-content-wrap { padding:8px; }
    body:is(.sp-catalog,.single-product) #content .wp-block-product-blocks-product-grid-1 .wopb-block-items-wrap .wopb-block-title { font-size:14px; }
}
