/* Единый вид карточек WooCommerce вне главной страницы. */

body:not(.home) main ul.products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  margin: 0;
}

/* Сайдбар сужает рабочую область каталога: на десктопе оставляем три карточки. */
@media (min-width: 993px) {
  body.left-woocommerce-sidebar:not(.home) main ul.products,
  body.right-woocommerce-sidebar:not(.home) main ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Карточки подкатегорий: отдельная компактная сетка по три элемента. */
body.woocommerce.archive:not(.home) main ul.products:has(> li.product-category) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category {
  width: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #e3e6ea;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(25, 35, 50, .07);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category:hover {
  border-color: #d2d6dc;
  box-shadow: 0 10px 26px rgba(25, 35, 50, .12);
  transform: translateY(-2px);
}

body.woocommerce.archive:not(.home) main ul.products li.product-category > a {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 140px;
  padding: 15px;
  color: #20242a;
  text-decoration: none;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category .cat-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 108px;
  overflow: hidden;
  border-radius: 12px;
  background: #f7f8fa;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category img {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 8px;
  object-fit: contain;
  transition: transform .25s ease;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category:hover img {
  transform: scale(1.04);
}

body.woocommerce.archive:not(.home) main ul.products li.product-category .woocommerce-loop-category__title {
  min-width: 0;
  margin: 0;
  color: #20242a;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

body.woocommerce.archive:not(.home) main ul.products li.product-category .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 99px;
  background: #f5e9ea;
  color: #ad2a31;
  font-size: 12px;
  font-weight: 700;
}

body:not(.home) main ul.products::before,
body:not(.home) main ul.products::after {
  display: none;
}

body:not(.home) main ul.products li.product:not(.product-category) {
  display: flex;
  align-self: start;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #e3e6ea;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(25, 35, 50, .07);
  flex-direction: column;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

body:not(.home) main ul.products li.product:not(.product-category)::before,
body:not(.home) main ul.products li.product:not(.product-category)::after {
  display: none;
}

body:not(.home) main ul.products li.product:not(.product-category):hover {
  border-color: #d6d9de;
  box-shadow: 0 12px 30px rgba(25, 35, 50, .12);
  transform: translateY(-3px);
}

body:not(.home) main .woocommerce-image__wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
}

body:not(.home) main .woocommerce-image__wrapper > a,
body:not(.home) main .shoptimizer-plp-carousel-container,
body:not(.home) main .shoptimizer-plp-image-wrapper {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

body:not(.home) main .woocommerce-image__wrapper img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  padding: 12px;
  object-fit: contain;
  transition: transform .25s ease;
}

body:not(.home) main ul.products li.product:hover .woocommerce-image__wrapper img {
  transform: scale(1.025);
}

body:not(.home) main ul.products li.product .commercekit-wishlist.mini {
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  place-items: center;
}

body:not(.home) main ul.products li.product .woocommerce-card__header {
  display: grid !important;
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 2.8em auto auto;
  align-items: center;
  gap: 12px 8px;
  width: 100%;
  min-height: 126px;
  padding: 15px;
}

body:not(.home) main ul.products li.product .woocommerce-loop-product__title {
  display: -webkit-box;
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 2.8em;
  margin: 0;
  overflow: hidden;
  color: #20242a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body:not(.home) main ul.products li.product .woocommerce-card__header > .star-rating,
body:not(.home) main ul.products li.product .woocommerce-card__header > .shoptimizer_ratingContainer {
  display: none !important;
}

body:not(.home) main ul.products li.product .woocommerce-loop-product__title a {
  color: inherit;
  text-decoration: none;
}

body:not(.home) main ul.products li.product .price {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: center;
  margin: 0;
  color: #c52127;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

body:not(.home) main ul.products li.product .button,
body:not(.home) main ul.products li.product .added_to_cart {
  display: flex !important;
  grid-column: 1 / -1;
  grid-row: 3;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  width: min(100%, 240px) !important;
  min-width: 0;
  min-height: 36px;
  margin: 0 !important;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: #ad2a31;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  opacity: 1 !important;
  position: static !important;
  visibility: visible !important;
  transition: background .2s ease, transform .2s ease;
}

body:not(.home) main ul.products li.product .button:hover,
body:not(.home) main ul.products li.product .added_to_cart:hover {
  background: #8f2026;
  color: #fff;
  transform: translateY(-1px);
}

@media (max-width: 992px) {
  body:not(.home) main ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body.woocommerce.archive:not(.home) main ul.products:has(> li.product-category) {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  body.woocommerce.archive:not(.home) main ul.products li.product-category > a {
    grid-template-columns: 96px minmax(0, 1fr);
    min-height: 124px;
    gap: 14px;
    padding: 13px;
  }

  body.woocommerce.archive:not(.home) main ul.products li.product-category .cat-image-wrapper {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 380px) {
  body:not(.home) main ul.products {
    grid-template-columns: minmax(0, 1fr);
  }
}
