/* MasterPalm Patch 238 — homepage product grid guard
   Purpose: keep the homepage featured/product grid at 4 columns on desktop/tablet
   and 1 column on mobile, regardless of earlier MasterPalm CSS media queries.
   This file is intentionally loaded after Patch 237 and after masterpalm-industrial.css. */

/* Homepage product section grid only; do not alter category page product results. */
body.site-masterpalm #site-main .mp-home-products .mp-home-product-list,
body.site-masterpalm #site-main section.mp-home-products .mp-category-products-grid,
body.site-masterpalm #site-main .mp-home-products .mp-category-products-grid.mp-home-product-list,
body.masterpalm-theme #site-main .mp-home-products .mp-home-product-list,
body.masterpalm-theme #site-main section.mp-home-products .mp-category-products-grid,
body.masterpalm-theme #site-main .mp-home-products .mp-category-products-grid.mp-home-product-list,
#site-main .mp-home-products .mp-home-product-list,
#site-main section.mp-home-products .mp-category-products-grid,
#site-main .mp-home-products .mp-category-products-grid.mp-home-product-list{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:16px !important;
  align-items:stretch !important;
  width:100% !important;
  max-width:100% !important;
}

body.site-masterpalm #site-main .mp-home-products .mp-product-list-card,
body.masterpalm-theme #site-main .mp-home-products .mp-product-list-card,
#site-main .mp-home-products .mp-product-list-card{
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
  display:flex !important;
  flex-direction:column !important;
}

body.site-masterpalm #site-main .mp-home-products .mp-product-list-media,
body.masterpalm-theme #site-main .mp-home-products .mp-product-list-media,
#site-main .mp-home-products .mp-product-list-media{
  width:100% !important;
  height:auto !important;
  min-height:0 !important;
  aspect-ratio:16 / 9 !important;
  display:grid !important;
  place-items:center !important;
  background-image:var(--mp-product-list-bg, var(--list-bg, none)) !important;
  background-size:contain !important;
  background-position:center center !important;
  background-repeat:no-repeat !important;
}

body.site-masterpalm #site-main .mp-home-products .mp-product-list-media img,
body.masterpalm-theme #site-main .mp-home-products .mp-product-list-media img,
#site-main .mp-home-products .mp-product-list-media img{
  display:none !important;
}

/* Mobile must be 1 card per row. */
@media (max-width:767.98px){
  body.site-masterpalm #site-main .mp-home-products .mp-home-product-list,
  body.site-masterpalm #site-main section.mp-home-products .mp-category-products-grid,
  body.site-masterpalm #site-main .mp-home-products .mp-category-products-grid.mp-home-product-list,
  body.masterpalm-theme #site-main .mp-home-products .mp-home-product-list,
  body.masterpalm-theme #site-main section.mp-home-products .mp-category-products-grid,
  body.masterpalm-theme #site-main .mp-home-products .mp-category-products-grid.mp-home-product-list,
  #site-main .mp-home-products .mp-home-product-list,
  #site-main section.mp-home-products .mp-category-products-grid,
  #site-main .mp-home-products .mp-category-products-grid.mp-home-product-list{
    grid-template-columns:1fr !important;
    gap:14px !important;
  }
}
