/**
 * V3.6.46 — header icon + catalogue density only.
 * Keep the established single-product, checkout and quick-order layouts intact.
 * Scope every rule; do not resize all SVGs, all images, all forms or all .price.
 */

/* A small glyph inside the existing 44px touch target — not a tiny button. */
@media (max-width: 1120px) {
  body.stoneman-site .sm-header .sm-header-search {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
  }
  body.stoneman-site .sm-header .sm-header-search .dgwt-wcas-search-wrapp:not(.dgwt-wcas-search-wrapp-mobile) {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    margin: 0 !important;
  }
  body.stoneman-site .sm-header .sm-header-search :is(.dgwt-wcas-search-icon, .dgwt-wcas-icon-handler, .sm-search-fallback) {
    box-sizing: border-box;
    display: grid !important;
    place-items: center;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    flex: 0 0 44px;
  }
  body.stoneman-site .sm-header .sm-header-search .dgwt-wcas-ico-magnifier-handler,
  body.stoneman-site .sm-header .sm-header-search .dgwt-wcas-icon-handler > .dgwt-wcas-ico-magnifier,
  body.stoneman-site .sm-header .sm-header-search .dgwt-wcas-search-icon > svg,
  body.stoneman-site .sm-header .sm-header-search .sm-search-fallback > svg {
    display: block !important;
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 22px;
    vertical-align: middle;
  }
}

/* Catalogue-only scope excludes single-product recommendations and payment pages. */
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(ul.products, .sm-product-grid) {
  align-items: stretch !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product,
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-grid > .sm-product-card {
  --sm-catalog-inset: 12px;
  --sm-catalog-title-size: 15px;
  --sm-catalog-price-size: 18px;
  --product-element-spacing: 0px;
  --theme-product-element-spacing: 0px;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  align-self: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
}

/* WooCommerce / Blocksy: remove stacked outer wrapper spacing, not image ratios. */
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product > :is(figure, .ct-woo-card-media, .sm-loop-image-link, .sm-loop-title-link, .woocommerce-loop-product__link, .ct-woo-card-content) {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product > :is(.sm-loop-image-link, .sm-loop-title-link):empty {
  display: none !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product :is(figure, .sm-loop-image-link) img,
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product > a > img,
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product > img {
  display: block;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product :is(.woocommerce-loop-product__title, .entry-title) {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 10px var(--sm-catalog-inset) 5px !important;
  padding: 0 !important;
  font-size: var(--sm-catalog-title-size) !important;
  line-height: 1.4 !important;
  -webkit-line-clamp: unset !important;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product .price {
  display: flex !important;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 var(--sm-catalog-inset) 4px !important;
  padding: 0 !important;
  font-size: var(--sm-catalog-price-size) !important;
  line-height: 1.35 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product .entry-meta {
  min-height: 0 !important;
  margin: 0 var(--sm-catalog-inset) !important;
  padding: 0 !important;
  font-size: 11px;
  line-height: 1.4;
}

/* Theme homepage cards: same reading order, without changing stored content. */
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-grid > .sm-product-card > .sm-product-body {
  flex: 1 1 auto !important;
  min-width: 0;
  gap: 0 !important;
  padding: 10px var(--sm-catalog-inset) 12px !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-body > h3 {
  order: 1;
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 5px !important;
  padding: 0 !important;
  font-size: var(--sm-catalog-title-size) !important;
  line-height: 1.4 !important;
  -webkit-line-clamp: unset !important;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-body > .sm-price {
  order: 2;
  align-items: baseline;
  min-height: 0 !important;
  margin: 0 0 4px !important;
  gap: 2px 6px !important;
  font-size: var(--sm-catalog-price-size) !important;
  line-height: 1.35 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-body > .sm-product-category {
  order: 3;
  min-height: 0 !important;
  margin: 0 !important;
  font-size: 11px;
  line-height: 1.4;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-body > :is(.sm-buy-row, .sm-view-product) { order: 4; }
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-body > .sm-add-feedback { order: 5; }

/* Keep live prices, sale prices and member labels; allow each to wrap safely. */
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product .price, .sm-product-card .sm-price) > .sm-b2b-price-label {
  flex-basis: 100%;
  max-width: 100%;
  margin-top: 2px !important;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Controls align to the card bottom; extra title lines never push over another card. */
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product .sm-buy-row,
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-card .sm-buy-row {
  display: grid !important;
  grid-template-columns: 48px minmax(0, 1fr) !important;
  gap: 6px !important;
  min-width: 0;
  min-height: 0 !important;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  padding: 8px 0 0 !important;
  border: 0;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product :is(.sm-buy-row, .sm-view-product, .sm-add-feedback) {
  margin-left: var(--sm-catalog-inset) !important;
  margin-right: var(--sm-catalog-inset) !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-card .sm-buy-row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row > label {
  display: block;
  min-width: 0;
  margin: 0 !important;
  padding: 0;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row input[type="number"],
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: none;
  margin: 0 !important;
  padding: 6px !important;
  border-radius: 4px;
  font-size: 13px !important;
  line-height: 1.25 !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row input[type="number"] {
  font-size: 16px !important;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row button {
  white-space: normal;
  overflow-wrap: anywhere;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-view-product {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto !important;
  min-height: 44px !important;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  padding: 10px 8px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-add-feedback:not([hidden]) {
  margin-top: 6px !important;
  margin-bottom: 0 !important;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product,
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-grid > .sm-product-card {
    --sm-catalog-inset: 9px;
    --sm-catalog-title-size: 14px;
    --sm-catalog-price-size: 16px;
  }
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main ul.products > li.product :is(.woocommerce-loop-product__title, .entry-title) {
    margin-top: 8px !important;
    margin-bottom: 4px !important;
  }
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main .sm-product-grid > .sm-product-card > .sm-product-body {
    padding-top: 8px !important;
    padding-bottom: 10px !important;
  }
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row {
    grid-template-columns: 44px minmax(0, 1fr) !important;
    gap: 5px !important;
  }
  body.stoneman-site:not(.single-product):not(.woocommerce-cart):not(.woocommerce-checkout) .sm-main :is(li.product, .sm-product-card) .sm-buy-row button {
    font-size: 12px !important;
  }
}
