/* WoodMart category cards (/katalog/) - fix horizontal overflow of long titles/submenu items */
.wd-cat,
.wd-cat-wrap,
.wd-cat-inner,
.wd-cat-content,
.wd-cat-header,
.wd-cat-footer,
.wd-cat-footer .wd-sub-menu,
.wd-cat-footer .wd-sub-menu ul {
  max-width: 100% !important;
  min-width: 0 !important;
}

h3.wd-entities-title {
  max-height: 105px !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Limit title link to card width and allow wrapping without breaking layout */
h3.wd-entities-title a {
  display: block !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/*
 * Submenu links (wd-cat-footer) can contain very long phrases.
 * Force them to stay within card width and not expand tile horizontally.
 */
.wd-cat .wd-cat-footer {
  max-width: 100% !important;
  overflow: hidden !important;
  min-width: 0 !important;
}

.wd-cat .wd-cat-footer .wd-sub-menu a,
.wd-cat .wd-cat-footer .wd-sub-menu li {
  max-width: 100% !important;
  min-width: 0 !important;
}

.wd-cat .wd-cat-footer .wd-sub-menu a {
  display: block !important;
  white-space: normal !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  text-overflow: ellipsis !important;
}

/* Ensure card content can't visually spill outside the tile */
.wd-cat .wd-cat-content {
  overflow: hidden !important;
  min-width: 0 !important;
}

/* Keep product cards visually consistent when source images have extreme proportions */
.woocommerce .products .wd-product .product-image-link,
.woocommerce .products .wd-product .hover-img a {
  display: block !important;
  width: 100% !important;
  aspect-ratio: 212 / 242 !important;
  overflow: hidden !important;
}

.woocommerce .products .wd-product .product-image-link img,
.woocommerce .products .wd-product .hover-img img {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  object-fit: cover !important;
  object-position: center center !important;
}

/* Hard reset for the broken tall product image so it matches the grid */
.woocommerce .products .wd-product.post-15602 .product-image-link,
.woocommerce .products .wd-product.post-15602 .hover-img a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  aspect-ratio: 212 / 242 !important;
  height: auto !important;
}

.woocommerce .products .wd-product.post-15602 .product-image-link img,
.woocommerce .products .wd-product.post-15602 .hover-img img {
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}
