/**
 * Custom Product Cards — new.embroideres.com (Hummingbird)
 * Основано на реальной HTML-структуре страницы
 *
 * Реальная структура:
 * article.product-miniature.product-card
 *   .card.product-card__inner
 *     a.product-miniature__link.product-card__image-link
 *       .product-miniature__image-container.product-card__image-wrap
 *         img.product-miniature__image.product-card__img
 *       .product-card__overlay
 *     .product-miniature__infos.product-card__body.card-body
 *       .product-miniature__infos__top
 *         span.product-card__tag
 *         a > p.product-miniature__title.product-card__name
 *       .product-miniature__infos__bottom
 *         .product-miniature__prices.product-card__footer   ← КОНТЕЙНЕР СТРОКИ
 *           .product-card__price-wrap
 *             span.product-card__price
 *           form.product-card__cart-form
 *             button.product-card__btn-cart
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --pc-warm-white:   #FFFBF5;
  --pc-brown:        #8B5E3C;
  --pc-orange:       #E8703A;
  --pc-rose:         #F2A69E;
  --pc-mint:         #7EC8A4;
  --pc-ink:          #2D2013;
  --pc-muted:        #9C8572;
  --pc-shadow:       0 4px 20px rgba(139,94,60,.10), 0 1px 4px rgba(139,94,60,.06);
  --pc-shadow-hover: 0 16px 48px rgba(139,94,60,.18), 0 4px 12px rgba(139,94,60,.10);
  --pc-radius:       20px;
  --pc-radius-sm:    14px;
}

/* ============================================================
   ARTICLE + INNER .card
   ============================================================ */
.products.row {
  row-gap: 16px !important;
}

article.product-miniature {
  height: 100%;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

article.product-miniature .card {
  height: 100%;
  display: flex !important;
  flex-direction: column !important;
  border-radius: var(--pc-radius) !important;
  border: 1.5px solid rgba(139,94,60,.07) !important;
  box-shadow: var(--pc-shadow) !important;
  background: var(--pc-warm-white) !important;
  overflow: hidden;
  position: relative;
  transition: transform .35s cubic-bezier(.22,.68,0,1.2),
              box-shadow .35s ease,
              border-color .3s ease;
  opacity: 0;
  animation: pc-card-in .5s ease forwards;
}

article.product-miniature .card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: var(--pc-shadow-hover) !important;
  border-color: rgba(139,94,60,.14) !important;
}

/* Dashed stitch inner border */
article.product-miniature .card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--pc-radius) - 6px);
  border: 1.5px dashed rgba(139,94,60,.13);
  pointer-events: none;
  z-index: 0;
  transition: border-color .3s;
}
article.product-miniature .card:hover::before {
  border-color: rgba(232,112,58,.25);
}

/* ============================================================
   IMAGE AREA
   ============================================================ */
a.product-card__image-link,
a.product-miniature__link.product-card__image-link {
  display: block !important;
  position: relative !important;
  text-decoration: none !important;
  flex-shrink: 0;
}

.product-miniature__image-container,
.product-card__image-wrap {
  position: relative !important;
  height: 200px !important;
  overflow: hidden !important;
  background: linear-gradient(145deg, #FFF5E9, #FDEBD8) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.product-miniature__image,
.product-card__img {
  width: 100% !important;
  height: 200px !important;
  object-fit: contain !important;
  padding: 12px !important;
  transition: transform .5s cubic-bezier(.22,.68,0,1.2) !important;
  display: block !important;
}
article.product-miniature .card:hover .product-miniature__image {
  transform: scale(1.08) rotate(-1deg) !important;
}

/* Shimmer on hover */
.product-miniature__image-container::after,
.product-card__image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0) 40%,
    rgba(255,255,255,.5) 50%,
    rgba(255,255,255,0) 60%
  );
  background-size: 200% 200%;
  opacity: 0;
  pointer-events: none;
  animation: pc-shimmer 1.5s ease infinite;
  z-index: 1;
  transition: opacity .3s;
}
article.product-miniature .card:hover .product-miniature__image-container::after,
article.product-miniature .card:hover .product-card__image-wrap::after {
  opacity: 1;
}
@keyframes pc-shimmer {
  0%   { background-position: -100% -100%; }
  100% { background-position:  200%  200%; }
}

/* ============================================================
   QUICK VIEW OVERLAY
   ============================================================ */
.product-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(45,32,19,.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
  z-index: 2;
}
article.product-miniature .card:hover .product-card__overlay {
  opacity: 1;
}
.product-card__quickview-label {
  background: var(--pc-warm-white);
  color: var(--pc-brown);
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 9px 20px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translateY(8px);
  transition: transform .3s .05s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  pointer-events: none;
}
article.product-miniature .card:hover .product-card__quickview-label {
  transform: translateY(0);
}
.product-card__quickview-label svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 2;
}

/* Hide Hummingbird's built-in quickview button */
.product-miniature__quickview {
  display: none !important;
}

/* ============================================================
   CARD BODY
   ============================================================ */
.product-miniature__infos.card-body,
.product-card__body.card-body {
  padding: 14px 16px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  position: relative;
  z-index: 1;
  background: transparent !important;
}

/* Top: tag + name */
.product-miniature__infos__top {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Category tag */
.product-card__tag {
  display: inline-block;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--pc-muted);
  margin-bottom: 5px;
  position: relative;
  padding-left: 10px;
  line-height: 1.4;
}
.product-card__tag::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--pc-orange);
}

/* Product name */
.product-miniature__title,
.product-card__name {
  font-size: .9rem !important;
  font-weight: 700 !important;
  color: var(--pc-ink) !important;
  line-height: 1.4 !important;
  margin: 0 0 8px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}
.product-miniature__title a,
.product-card__name a {
  color: inherit !important;
  text-decoration: none !important;
}
.product-miniature__title a:hover,
.product-card__name a:hover {
  color: var(--pc-orange) !important;
}

/* ============================================================
   BOTTOM SECTION
   KEY INSIGHT: .product-miniature__prices (.product-card__footer)
   содержит ВНУТРИ себя и цену и форму с кнопкой.
   Это один flex-row контейнер!
   ============================================================ */

.product-miniature__infos__bottom {
  margin-top: auto;
}

/* Prices block = ROW с ценой слева и кнопкой справа */
/* Используем article для повышения специфичности — перебивает theme cache */
article.product-miniature .product-miniature__prices,
article.product-miniature .product-card__footer {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding-top: 10px !important;
  margin-top: 4px !important;
  width: 100% !important;
  border-top: 1px dashed rgba(139,94,60,.15) !important;
  flex-wrap: nowrap !important;
}

/* Price wrapper — LEFT */
.product-card__price-wrap {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 1px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

/* Current price */
.product-miniature__price,
.product-card__price {
  font-size: 1.2rem !important;
  font-weight: 900 !important;
  color: var(--pc-brown) !important;
  line-height: 1.1 !important;
  display: block !important;
  white-space: nowrap !important;
}

/* Old price */
.product-miniature__regular-price {
  font-size: .72rem !important;
  color: var(--pc-muted) !important;
  text-decoration: line-through !important;
  font-weight: 600 !important;
  display: block !important;
}

/* Cart form — RIGHT */
article.product-miniature form.product-card__cart-form {
  position: static !important;
  bottom: auto !important;
  right: auto !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
}

/* ============================================================
   ADD TO CART BUTTON
   Ограничено только карточками каталога (.product-miniature)
   Страница товара НЕ затрагивается
   ============================================================ */
article.product-miniature .product-card__btn-cart,
article.product-miniature button[data-button-action="add-to-cart"] {
  background: var(--pc-orange) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--pc-radius-sm) !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background .2s, transform .2s, box-shadow .2s !important;
  box-shadow: 0 4px 12px rgba(232,112,58,.30) !important;
  flex-shrink: 0 !important;
  font-size: 0 !important;
  line-height: 1 !important;
}
article.product-miniature .product-card__btn-cart:hover,
article.product-miniature button[data-button-action="add-to-cart"]:hover {
  background: var(--pc-brown) !important;
  transform: scale(1.1) rotate(-5deg) !important;
  box-shadow: 0 6px 18px rgba(139,94,60,.35) !important;
}

/* SVG cart icon внутри карточек */
article.product-miniature .product-card__btn-cart svg {
  width: 18px !important;
  height: 18px !important;
  stroke: #fff !important;
  fill: none !important;
  stroke-width: 2.2 !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* ============================================================
   PRODUCT FLAGS
   ============================================================ */
.product-miniature .product-flag {
  font-size: .68rem !important;
  font-weight: 800 !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  padding: 4px 10px !important;
  border-radius: 20px !important;
  z-index: 3 !important;
}
.product-miniature .product-flag.new,
.product-miniature .product-flag.new-product {
  background: var(--pc-mint) !important;
  color: #1a4a35 !important;
}
.product-miniature .product-flag.discount,
.product-miniature .product-flag.on-sale {
  background: var(--pc-rose) !important;
  color: #fff !important;
}

/* ============================================================
   ENTRANCE ANIMATION
   ============================================================ */
@keyframes pc-card-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.products .js-product-miniature:nth-child(1) .card { animation-delay: .05s; }
.products .js-product-miniature:nth-child(2) .card { animation-delay: .10s; }
.products .js-product-miniature:nth-child(3) .card { animation-delay: .15s; }
.products .js-product-miniature:nth-child(4) .card { animation-delay: .20s; }
.products .js-product-miniature:nth-child(5) .card { animation-delay: .25s; }
.products .js-product-miniature:nth-child(6) .card { animation-delay: .30s; }
.products .js-product-miniature:nth-child(7) .card { animation-delay: .35s; }
.products .js-product-miniature:nth-child(8) .card { animation-delay: .40s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 575px) {
  .product-miniature__image-container,
  .product-card__image-wrap,
  .product-miniature__image,
  .product-card__img {
    height: 160px !important;
  }
  .product-miniature__price,
  .product-card__price {
    font-size: 1rem !important;
  }
  article.product-miniature .product-card__btn-cart,
  article.product-miniature button[data-button-action="add-to-cart"] {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
  }
}
@media (min-width: 1200px) {
  .product-miniature__image-container,
  .product-card__image-wrap,
  .product-miniature__image,
  .product-card__img {
    height: 220px !important;
  }
}
