/**
 * Product cards — mobile-first, equal heights, theme-aware.
 * Loaded only on home/shop product surfaces.
 */

.product-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 900px) {
  .product-grid,
  .product-grid.product-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

.product-card.product-card--sale,
.product-grid .product-card.product-card--sale {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 100% !important;
  background: var(--color-card-bg, rgba(58, 46, 36, 0.96)) !important;
  border: 1px solid var(--color-card-border, rgba(var(--color-primary-rgb, 212, 175, 55), 0.28)) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-card, 0 10px 24px rgba(40, 28, 16, 0.18)) !important;
  padding: 0.65rem !important;
  color: var(--color-text, #f7efe3) !important;
  gap: 0.55rem !important;
}

.product-card--sale .product-media,
.product-grid .product-card--sale .product-media {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0.55rem !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  border: 1px solid var(--color-card-media-border, rgba(var(--color-primary-rgb, 212, 175, 55), 0.2)) !important;
  background: var(--color-card-media-bg, radial-gradient(circle at 30% 0, rgba(245, 232, 210, 0.22), rgba(58, 46, 36, 0.98))) !important;
  flex: 0 0 auto !important;
}

.product-card--sale .product-media-img,
.product-grid .product-card--sale .product-media-img {
  position: absolute !important;
  inset: 0.55rem !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(100% - 1.1rem) !important;
  max-height: calc(100% - 1.1rem) !important;
  margin: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  transform: none !important;
  transition: transform 0.35s ease !important;
  background: transparent !important;
}

.product-card--sale:hover .product-media-img {
  transform: scale(1.03) !important;
}

.product-card--sale .product-hair-shape {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.product-card--sale .product-card-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.35rem !important;
  flex: 1 1 auto !important;
  min-height: 5.5rem !important;
  color: var(--color-text, #f7efe3) !important;
}

.product-card--sale .product-name {
  color: var(--color-heading, #fff6e8) !important;
  font-size: 0.92rem !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  min-height: 2.4em !important;
}

.product-card--sale .product-price {
  color: var(--color-primary, #d4af37) !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

.product-card--sale .product-rating-row {
  margin-top: auto !important;
}

.product-card--sale .product-rating-text,
.product-grid .product-card--sale .product-rating-text {
  color: var(--color-subtle-text, rgba(247, 239, 227, 0.88)) !important;
  font-size: 0.72rem !important;
  line-height: 1.35 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

.product-card--sale .product-rating-star {
  color: var(--color-primary, #d4af37) !important;
}

.product-card--sale .product-ribbon {
  z-index: 2;
  background: color-mix(in srgb, var(--color-deep, #2a221c) 82%, transparent) !important;
  color: var(--color-accent, #f1d17a) !important;
  border: 1px solid rgba(var(--color-primary-rgb, 212, 175, 55), 0.4) !important;
}

.product-card--sale .product-footer {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.4rem !important;
  margin-top: auto !important;
  padding-top: 0.55rem !important;
  border-top: 1px solid rgba(var(--color-primary-rgb, 212, 175, 55), 0.18) !important;
  align-items: stretch !important;
}

.product-card--sale .product-footer .btn,
.product-card--sale .product-footer .btn-small {
  width: 100% !important;
  min-height: 40px !important;
  justify-content: center !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.04em !important;
  padding: 0.4rem 0.35rem !important;
}

.product-card--sale .product-footer .btn.btn-ghost,
.product-card--sale .product-footer .btn-small.btn-ghost {
  background: rgba(var(--color-primary-rgb, 212, 175, 55), 0.1) !important;
  color: var(--color-accent, #f1d17a) !important;
  border: 1px solid rgba(var(--color-primary-rgb, 212, 175, 55), 0.4) !important;
}

.product-card--sale .product-footer .btn:not(.btn-ghost),
.product-card--sale .product-footer .btn-small:not(.btn-ghost) {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent)) !important;
  color: var(--color-on-primary, #1a140c) !important;
  border: 1px solid rgba(var(--color-primary-rgb, 212, 175, 55), 0.35) !important;
}

/* Instant add → qty stepper */
.product-card--sale .product-bag-slot {
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.product-card--sale .product-qty-stepper {
  display: none;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: 1px solid rgba(var(--color-primary-rgb, 212, 175, 55), 0.35);
  color: var(--color-on-primary, #1a140c);
}

.product-card--sale .product-bag-slot.is-in-bag [data-add-to-bag] {
  display: none !important;
}

.product-card--sale .product-bag-slot.is-in-bag .product-qty-stepper {
  display: flex !important;
}

.product-card--sale .product-qty-stepper button {
  width: 2rem;
  min-height: 2rem;
  border: 0;
  border-radius: 6px;
  background: rgba(16, 11, 4, 0.12);
  color: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.product-card--sale .product-qty-stepper button:hover {
  background: rgba(16, 11, 4, 0.2);
}

.product-card--sale .product-qty-stepper [data-qty-value] {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@media (min-width: 900px) {
  .product-card.product-card--sale {
    padding: 0.8rem !important;
  }

  .product-card--sale .product-name {
    font-size: 0.98rem !important;
  }

  .product-card--sale .product-footer .btn,
  .product-card--sale .product-footer .btn-small {
    min-height: 42px !important;
    font-size: 0.7rem !important;
  }
}
