/* Product media only: never reset grid-tools, quick view or gallery wrappers. */
body.factory-catalog-layout .product-small.box > .box-image:has(> .factory-catalog-media) {
  padding-top: 0 !important;
  height: auto !important;
}
body.factory-catalog-layout .factory-catalog-media,
body.factory-catalog-layout [data-factory-product-media] {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto !important;
  padding-top: 0 !important;
  overflow: hidden;
}
body.factory-catalog-layout .factory-catalog-media > a {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
body.factory-catalog-layout .factory-catalog-media img,
body.factory-catalog-layout [data-factory-product-media] img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: none;
  object-fit: contain !important;
  object-position: center;
}
body.factory-catalog-layout ul.products li.product:not(.product-category) .woocommerce-loop-product__link > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
}
/* Preserve native hover opacity, tool positioning, badge colors and sale text. */
body.factory-catalog-layout .factory-sale-pill.badge {
  display: inline-flex !important;
  width: auto !important;
  height: 30px !important;
  min-width: 64px;
}
body.factory-catalog-layout .factory-sale-pill.badge .badge-inner.on-sale,
body.factory-catalog-layout .onsale.factory-sale-pill,
body.factory-catalog-layout [data-factory-sale-badge] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto !important;
  min-width: 64px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 4px 12px !important;
  border-radius: 30px !important;
  line-height: 1 !important;
  white-space: nowrap;
}
.factory-category-tree .factory-category-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.factory-category-tree .factory-category-row > a { flex: 1; min-width: 0; }
.factory-category-tree .factory-category-row > .count { flex: none; }
.factory-category-tree button[data-factory-category-toggle] {
  position: static !important;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  transform: none !important;
}
.factory-category-tree button[data-factory-category-toggle]:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.factory-category-tree ul.children[hidden],
.factory-category-tree ul.sub-menu[hidden] { display: none !important; }
.factory-category-tree ul.children:not([hidden]),
.factory-category-tree ul.sub-menu:not([hidden]) { display: block !important; }
