/* Modern CSS that the bundler's minifier cannot parse.
 *
 * nopCommerce bundles CSS with BundlerMinifier 3.2.449, which uses NUglify 1.13.2.
 * That parser predates :has() and rejects it outright ("Expected identifier"), and a
 * single parse error makes it skip writing the .min.css for the whole bundle - which
 * silently breaks every stylesheet on the site, not just this rule.
 *
 * theme.custom-1.css cannot hold these rules: the SevenSpikes theme framework adds
 * theme.custom-{storeId}.css to the CSS parts by naming convention WITHOUT
 * excludeFromBundle, so its contents reach the minifier no matter what Head.cshtml says.
 * This file is referenced only from Head.cshtml with excludeFromBundle: true, so it is
 * served as its own <link> and never goes through the minifier.
 *
 * Put :has(), and anything else the minifier rejects, in here - not in theme.custom-1.css.
 * Loaded after theme.custom-1.css, so these rules win on equal specificity.
 */

@media screen and (min-width: 1025px) {

    /* Until the collection is configured to return six products, center five. */
    body.home-page-body .spc-categories[data-categorygroupid] .product-grid.active .item-grid:has(> .item-box:nth-child(5):last-child) {
        grid-template-columns: repeat(5, minmax(0, calc((100% - 45px) / 6))) !important;
        justify-content: center;
    }

    /* Dark overlay when mega menu is open */
    body:has(
        .mega-menu-pro > li.all-categories:hover
    )::before,
    body:has(
        .mega-menu-pro > li.all-categories:focus-within
    )::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.48);
        z-index: 1000;
        pointer-events: none;
    }

    /* Keep header and mega menu above overlay */
    body:has(
        .mega-menu-pro > li.all-categories:hover
    ) .master-header-wrapper-parent,
    body:has(
        .mega-menu-pro > li.all-categories:focus-within
    ) .master-header-wrapper-parent {
        position: relative;
        z-index: 1001;
    }

    /* Moved out of MegaMenuPro.css, which is bundled.
       A parent with no children should not reserve an empty block below it. */
    .mega-menu-pro .sub-category-group:has(> .sub-category-item:only-child) {
        margin-bottom: 0;
    }
}
