/* 240 px square source shown at 130%: 312 px listing thumbnails. */
#newCenterbox-card-body .card-deck {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(312px, 1fr)) !important;
  gap: 16px !important;
}
#newCenterbox-card-body .centerBoxContentsNew {
  flex: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#newCenterbox-card-body .centerBoxContentsNew img,
#whatsNew .centerBoxContentsNew img,
#featuredProducts .centerBoxContentsFeatured img,
#specialsDefault .centerBoxContentsSpecials img,
#alsoPurchased .centerBoxContentsAlsoPurchased img,
#productRelatedProducts .centerBoxContentsRelated img,
#productListing .productListingData img,
#productListingContainer .productListingData img,
.productListingData img,
.product-listing-item img,
.productListingItem img,
.product-card img,
.listingProductImage,
#indexProductList table[id$="Table"] td:first-child img,
#productListing table[id$="Table"] td:first-child img {
  display: block;
  width: 312px !important;
  height: 312px !important;
  max-width: 100% !important;
  object-fit: contain !important;
  margin: 0 auto;
}

#indexProductList table[id$="Table"] td:first-child,
#productListing table[id$="Table"] td:first-child {
  width: 340px !important;
  vertical-align: middle;
}

@media (max-width: 767px) {
  #newCenterbox-card-body .card-deck {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #newCenterbox-card-body .centerBoxContentsNew img,
  #whatsNew .centerBoxContentsNew img,
  #featuredProducts .centerBoxContentsFeatured img,
  #specialsDefault .centerBoxContentsSpecials img,
  #alsoPurchased .centerBoxContentsAlsoPurchased img,
  #productRelatedProducts .centerBoxContentsRelated img,
  #productListing .productListingData img,
  #productListingContainer .productListingData img,
  .productListingData img,
  .product-listing-item img,
  .productListingItem img,
  .product-card img,
  .listingProductImage,
  #indexProductList table[id$="Table"] td:first-child img,
  #productListing table[id$="Table"] td:first-child img {
    width: min(312px, 90vw) !important;
    height: min(312px, 90vw) !important;
  }
  #indexProductList table[id$="Table"] td:first-child,
  #productListing table[id$="Table"] td:first-child {
    width: auto !important;
  }
}

/* Three compact product cards per row on desktop, with responsive mobile sizing. */
@media (min-width: 992px) {
  #mainWrapper .row:has(#indexDefault) > #navColumnOne,
  #mainWrapper .row:has(#indexDefault) > #navColumnTwo,
  #mainWrapper .row:has(#indexProductList) > #navColumnOne,
  #mainWrapper .row:has(#indexProductList) > #navColumnTwo {
    display: none !important;
  }
  #mainWrapper .row:has(#indexDefault) > .col-lg-6:has(#indexDefault),
  #mainWrapper .row:has(#indexProductList) > .col-lg-6:has(#indexProductList) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

#newCenterbox-card-body .card-deck,
#whatsNew .card-deck,
#featuredProducts .card-deck,
#specialsDefault .card-deck,
#alsoPurchased .card-deck,
#productRelatedProducts .card-deck {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  justify-items: center !important;
  gap: 16px !important;
}
#newCenterbox-card-body .centerBoxContentsNew,
#whatsNew .centerBoxContentsNew,
#featuredProducts .centerBoxContentsFeatured,
#specialsDefault .centerBoxContentsSpecials,
#alsoPurchased .centerBoxContentsAlsoPurchased,
#productRelatedProducts .centerBoxContentsRelated {
  flex: none !important;
  width: 100% !important;
  max-width: 340px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
#newCenterbox-card-body .centerBoxContentsNew img,
#whatsNew .centerBoxContentsNew img,
#featuredProducts .centerBoxContentsFeatured img,
#specialsDefault .centerBoxContentsSpecials img,
#alsoPurchased .centerBoxContentsAlsoPurchased img,
#productRelatedProducts .centerBoxContentsRelated img {
  display: block !important;
  width: 312px !important;
  height: 312px !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}

#indexProductList table[id$="Table"],
#productListing table[id$="Table"],
#productListingContainer table[id$="Table"] {
  display: block !important;
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 0 !important;
}
#indexProductList table[id$="Table"] > tbody,
#productListing table[id$="Table"] > tbody,
#productListingContainer table[id$="Table"] > tbody {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  width: 100% !important;
}
#indexProductList table[id$="Table"] tr.productListing-rowheading,
#productListing table[id$="Table"] tr.productListing-rowheading,
#productListingContainer table[id$="Table"] tr.productListing-rowheading {
  display: none !important;
}
#indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading),
#productListing table[id$="Table"] tbody tr:not(.productListing-rowheading),
#productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 340px !important;
  margin: 0 auto !important;
  padding: 8px !important;
  border: 1px solid #dedede !important;
  border-radius: 8px !important;
  background: #fff !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading) > td,
#productListing table[id$="Table"] tbody tr:not(.productListing-rowheading) > td,
#productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) > td {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  padding: 6px !important;
  border: 0 !important;
  text-align: center !important;
  box-sizing: border-box !important;
}
#indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a,
#productListing table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a,
#productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a {
  display: block !important;
  width: 100% !important;
  max-width: 312px !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto !important;
}
#indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child img,
#productListing table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child img,
#productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}
#indexProductList .listingDescription,
#productListing .listingDescription,
#productListingContainer .listingDescription {
  display: none !important;
}
#indexProductList .itemTitle,
#productListing .itemTitle,
#productListingContainer .itemTitle {
  margin: 4px 0 8px !important;
}

@media (min-width: 768px) and (max-width: 991px) {
  #newCenterbox-card-body .card-deck,
  #whatsNew .card-deck,
  #featuredProducts .card-deck,
  #specialsDefault .card-deck,
  #alsoPurchased .card-deck,
  #productRelatedProducts .card-deck,
  #indexProductList table[id$="Table"] > tbody,
  #productListing table[id$="Table"] > tbody,
  #productListingContainer table[id$="Table"] > tbody {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 767px) {
  #newCenterbox-card-body .card-deck,
  #whatsNew .card-deck,
  #featuredProducts .card-deck,
  #specialsDefault .card-deck,
  #alsoPurchased .card-deck,
  #productRelatedProducts .card-deck,
  #indexProductList table[id$="Table"] > tbody,
  #productListing table[id$="Table"] > tbody,
  #productListingContainer table[id$="Table"] > tbody {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #newCenterbox-card-body .centerBoxContentsNew img,
  #whatsNew .centerBoxContentsNew img,
  #featuredProducts .centerBoxContentsFeatured img,
  #specialsDefault .centerBoxContentsSpecials img,
  #alsoPurchased .centerBoxContentsAlsoPurchased img,
  #productRelatedProducts .centerBoxContentsRelated img {
    width: min(312px, calc(100vw - 32px)) !important;
    height: min(312px, calc(100vw - 32px)) !important;
  }
  #indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a,
  #productListing table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a,
  #productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) > td:first-child a {
    width: min(312px, calc(100vw - 48px)) !important;
  }
}

/* Remove the dividing frames around product cards in catalog listings. */
#indexProductList table[id$="Table"] tbody tr:not(.productListing-rowheading),
#productListing table[id$="Table"] tbody tr:not(.productListing-rowheading),
#productListingContainer table[id$="Table"] tbody tr:not(.productListing-rowheading) {
      border: 0 !important;
        border-radius: 0 !important;
          background: transparent !important;
            box-shadow: none !important;
}

}

/* One-of-a-kind products: hide quantity selectors and stock counts. */
#productsListing table[id$="Table"] .input-group.my-2,
#productsListing-btn-toolbarTop,
#productsListing-btn-toolbarBottom,
#cartAdd input[name="cart_quantity"],
#productInfo-productDetailsList li:nth-child(2) {
  display: none !important;
}
#cartAdd .input-group {
  justify-content: center;
}


/* Mobile New Products and All Products: large square photos with titles underneath. */
@media screen and (max-width: 767px) {
  #productsListing table#catTable { display: block !important; width: 100% !important; border: 0 !important; }
  #productsListing table#catTable > tbody { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 18px !important; width: 100% !important; }
  #productsListing table#catTable > tbody > tr.productListing-rowheading { display: none !important; }
  #productsListing table#catTable > tbody > tr:not(.productListing-rowheading) { display: flex !important; flex-direction: column !important; width: 100% !important; max-width: 360px !important; margin: 0 auto !important; border: 0 !important; box-sizing: border-box !important; }
  #productsListing table#catTable > tbody > tr:not(.productListing-rowheading) > td { display: block !important; width: 100% !important; max-width: none !important; padding: 6px 0 !important; border: 0 !important; text-align: center !important; box-sizing: border-box !important; }
  #productsListing table#catTable > tbody > tr:not(.productListing-rowheading) > td:first-child a { display: flex !important; align-items: center !important; justify-content: center !important; width: min(312px, calc(100vw - 32px)) !important; height: min(312px, calc(100vw - 32px)) !important; margin: 0 auto !important; }
  #productsListing table#catTable img.listingProductImage { display: block !important; width: min(312px, calc(100vw - 32px)) !important; height: min(312px, calc(100vw - 32px)) !important; max-width: 100% !important; max-height: 100% !important; aspect-ratio: 1 / 1 !important; object-fit: contain !important; margin: 0 auto !important; }
  #productsListing .itemTitle { margin: 8px 0 !important; text-align: center !important; }
  #productsListing .listingDescription { display: none !important; }
  #productsListing table#catTable .input-group.my-2, #productsListing-btn-toolbarTop, #productsListing-btn-toolbarBottom { display: none !important; }
  #productsListing table#catTable td:nth-child(3) { text-align: center !important; }
}


/* Remove outlines around product cards and separators in product listings */
.centerBoxContents.card {
  border: 0 !important;
  box-shadow: none !important;
}

#productsListing table,
#productsListing table th,
#productsListing table td,
#indexProductList table,
#indexProductList table th,
#indexProductList table td {
  border: 0 !important;
  box-shadow: none !important;
}


/* Match the primary product photo to the gallery image */
#productMainImage img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 70vh !important;
  object-fit: contain !important;
  margin: 0 auto !important;
}
