/* NCS 2.0.19 — consistent desktop scale and content alignment.
 * Scope: public storefront only. Preserve original theme typography, hero
 * artwork, card styling, header, buttons and mobile breakpoints. */
@media screen and (min-width: 1024px) {
    @supports (zoom: 0.9) {
        html { zoom: 0.9 !important; }
    }
    body.ncs219-storefront {
        --ncs219-content-width: min(88%, 1320px);
    }
    /* Match the approved home category section's centered content rail. */
    body.ncs219-home :is(.ncs-hero-content, .ncs-section > .ncs-container, .ncs-trust-grid),
    body.ncs219-storefront:not(.ncs219-home,.ncs219-commerce) .ncs-page-main > .ncs-container {
        width: var(--ncs219-content-width) !important;
        max-width: 1320px !important;
        margin-inline: auto !important;
        box-sizing: border-box;
    }
    /* The original theme commerce wrapper, or a standard WooCommerce main.
       Do not constrain nested wrappers a second time. */
    body.ncs219-commerce .ncs-container:has(> main, > .ncs-commerce-main):not(main *, .ncs-commerce-main *),
    body.ncs219-commerce .ncs-commerce-main:not(main *, .ncs-container *),
    body.ncs219-commerce main:not(.ncs-commerce-main *, .ncs-container *) {
        width: var(--ncs219-content-width) !important;
        max-width: 1320px !important;
        margin-inline: auto !important;
        box-sizing: border-box;
        min-width: 0;
    }
    body.ncs219-commerce .ncs-container > :is(main,.ncs-commerce-main),
    body.ncs219-commerce main .ncs-commerce-main,
    body.ncs219-commerce .ncs-commerce-main main,
    body.ncs219-commerce :is(main,.ncs-commerce-main) > .ncs-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: auto !important;
        box-sizing: border-box;
    }
    /* Fallback for themes that emit the loop without either main wrapper.
       Apply to individual loop elements only when outside both wrappers. */
    body.ncs219-archive :is(.woocommerce-products-header,.ncs-shop-intro,.woocommerce-breadcrumb,.woocommerce-result-count,.ncs-state-filter,.woocommerce-ordering,ul.products,.woocommerce-pagination,.woocommerce-notices-wrapper,.woocommerce-info):not(main *):not(.ncs-commerce-main *):not(header *):not(footer *) {
        width: var(--ncs219-content-width) !important;
        max-width: 1320px !important;
        margin-inline: auto !important;
        box-sizing: border-box;
        float: none !important;
    }
    body.ncs219-archive :is(main,.ncs-commerce-main) :is(.woocommerce-result-count,.woocommerce-ordering,.ncs-state-filter) {
        float: none !important;
        max-width: 100%;
        box-sizing: border-box;
    }
    body.ncs219-archive .woocommerce-result-count { margin-block: 8px 12px !important; }
    body.ncs219-archive .ncs-state-filter { margin-block: 0 12px !important; gap: 7px; flex-wrap: wrap; }
    body.ncs219-archive .woocommerce-ordering { margin-block: 0 18px !important; }
    body.ncs219-archive .woocommerce-ordering select { max-width: 100%; }
    body.ncs219-archive ul.products { min-width: 0; box-sizing: border-box; }
    body.ncs219-archive ul.products li.product { min-width: 0; overflow-wrap: anywhere; }
    body.ncs219-archive ul.products li.product img { max-width: 100%; box-sizing: border-box; }
}
/* At smaller widths, leave scale and grid columns to the native responsive
   theme; add only a safe gutter to an unwrapped product archive. */
@media screen and (max-width: 1023px) {
    body.ncs219-archive :is(.woocommerce-products-header,.ncs-shop-intro,.woocommerce-breadcrumb,.woocommerce-result-count,.ncs-state-filter,.woocommerce-ordering,ul.products,.woocommerce-pagination,.woocommerce-notices-wrapper,.woocommerce-info):not(main *):not(.ncs-commerce-main *):not(header *):not(footer *) {
        width: calc(100% - 24px) !important;
        margin-inline: auto !important;
        box-sizing: border-box;
        float: none !important;
    }
    body.ncs219-archive .ncs-state-filter { flex-wrap: wrap; }
    body.ncs219-archive .woocommerce-ordering select { max-width: 100%; }
}
