/* ATIIE — Full-width, responsive storefront layout (2026-11-16).
 * Keep one small, symmetrical outer gutter. Expand PAGE and WIDGET wrappers,
 * not individual product cards, Elementor columns, filter widths or drawers.
 *
 * IMPORTANT: the parent MarketKit storefront defines width + inline-size with
 * !important inside @layer marketkit-storefront. Unlayered !important overrides
 * do NOT win against important declarations in that layer. The finishing rules
 * are therefore in the SAME named layer, enqueued after the existing styles.
 */

body.mk-shell {
  --atiie-page-gutter: clamp(8px, 0.8vw, 14px);
}
@media (max-width: 767px) {
  body.mk-shell { --atiie-page-gutter: 8px; }
}
body.mk-shell #mk-main {
  --mk-content-width: 100%;
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: none;
  min-inline-size: 0;
}

@layer marketkit-storefront {
  /* Nested page-layout wrappers must not compound the left/right gutters.
   * This includes the category browser and storefront promotional shelves. */
  body.mk-shell #mk-main .mk-container {
    box-sizing: border-box !important;
    inline-size: 100% !important;
    width: 100% !important;
    max-inline-size: none !important;
    max-width: none !important;
    min-inline-size: 0 !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
  }

  /* One single gutter for the actual main page: home, shop, product,
   * generic content, Elementor-built landing pages and customer screens. */
  body.mk-shell #mk-main > :is(
    .mk-container, .mk-home, .mk-catalog-page, .mk-reference-page,
    .mk-pdp-page, .mk-builder-page-product, .mk-builder-page-catalog,
    .mk-commerce-content, .mk-section
  ) {
    box-sizing: border-box !important;
    inline-size: calc(100% - 2 * var(--atiie-page-gutter)) !important;
    width: calc(100% - 2 * var(--atiie-page-gutter)) !important;
    max-inline-size: none !important;
    max-width: none !important;
    min-inline-size: 0 !important;
    margin-inline: auto !important;
  }

  /* The main .mk-container is a layout frame, NOT an extra padded panel. */
  body.mk-shell #mk-main > .mk-container {
    padding-inline: 0 !important;
  }

  /* A widget uses all space in ITS OWN grid/column: do not change the number
   * of columns, the product-card widths, or the WooCommerce sidebar ratio. */
  body.mk-shell #mk-main :is(.mk-home, .mk-container.mk-home) > :is(
    .mk-module, .mk-section, .mk-widget, .widget, .mk16-panel,
    .mk156-shop-wrap, .mk37-category-browser
  ),
  body.mk-shell #mk-main .mk-module.mk-module-boxed,
  body.mk-shell #mk-main .mk-home > .elementor {
    box-sizing: border-box !important;
    inline-size: 100% !important;
    width: 100% !important;
    max-inline-size: none !important;
    max-width: none !important;
    min-inline-size: 0 !important;
    margin-inline: 0 !important;
  }

  /* Elementor boxed sections/containers may store a narrower global width.
   * Only widen the page-width frames, never a child column/flex item. */
  body.mk-shell #mk-main .elementor,
  body.mk-shell #mk-main .elementor-section-wrap,
  body.mk-shell #mk-main .elementor > .e-con,
  body.mk-shell #mk-main .elementor-section.elementor-section-boxed > .elementor-container,
  body.mk-shell #mk-main .elementor-section.elementor-section-full_width > .elementor-container,
  body.mk-shell #mk-main .e-con.e-con-boxed > .e-con-inner {
    box-sizing: border-box !important;
    inline-size: 100% !important;
    width: 100% !important;
    max-inline-size: none !important;
    max-width: none !important;
    min-inline-size: 0 !important;
    margin-inline: 0 !important;
  }
  body.mk-shell #mk-main .elementor-section.elementor-section-boxed,
  body.mk-shell #mk-main .e-con.e-con-boxed {
    --container-max-width: 100% !important;
    max-inline-size: none !important;
    max-width: none !important;
  }
  body.mk-shell #mk-main :is(.mk-widget, .mk156-shop-wrap, .mk37-category-browser.mk-container) {
    max-inline-size: 100% !important;
    max-width: 100% !important;
  }

  /* Keep widgets in aside/sidebar areas filling their allocated COLUMN only.
   * Do not turn sidebars, filters or add-to-cart panels into full-page rows. */
  body.mk-shell #mk-main :is(aside, .sidebar, .widget-area, #mk-catalog-sidebar) {
    box-sizing: border-box;
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  body.mk-shell #mk-main :is(.sidebar, .widget-area, #mk-catalog-sidebar) > :is(.widget, .mk-widget) {
    box-sizing: border-box;
    inline-size: 100%;
    max-inline-size: 100%;
  }

  /* Align header / footer containers with the extended storefront edges. */
  body.mk-shell.mk-storefront-32 :is(.mk-header, .mk-footer, .mk-secure-header) .mk-container {
    box-sizing: border-box !important;
    inline-size: calc(100% - 2 * var(--atiie-page-gutter)) !important;
    width: calc(100% - 2 * var(--atiie-page-gutter)) !important;
    max-inline-size: none !important;
    max-width: none !important;
    margin-inline: auto !important;
  }

  /* On smaller screens, retain comfortable touch-friendly breathing room. */
  @media (max-width: 767px) {
    body.mk-shell #mk-main :is(.elementor, .elementor-section-wrap, .e-con-inner) {
      min-inline-size: 0;
    }
  }
}

/* MK48 category rail is now handled by atiie-category-retail.css beside its track markup. */
