/* ==========================================================================
   ICRUSH — product card
   Reference measurements:
   - image 3:4, object-fit contain, natural aspect
   - card gap 1.25rem between figure and info
   - info centered, gap .75rem; title/price gap .25rem
   - title one line (line-clamp 1), 14px Jost 400
   - swatches: 22px dots, gap 4px, 6 dots + “+N”
   - sale price: discounted current + struck regular
   ========================================================================== */

.product-card {
  --product-card-gap: 1.25rem;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--product-card-gap);
  scroll-snap-align: start;
}

.product-card__figure {
  position: relative;
}

.product-card__media {
  display: block;
  position: relative;
  isolation: isolate;
  background: #f4f3f1;
}

.product-card__image {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity .1s ease-in-out;
}

.product-card__image--secondary {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  display: none;
}

@media (pointer: fine) {
  .product-card__image--secondary {
    display: block;
  }

  .product-card__figure:has(.product-card__image--secondary):hover .product-card__image--primary {
    opacity: 0;
  }

  .product-card__figure:has(.product-card__image--secondary):hover .product-card__image--secondary {
    opacity: 1;
  }
}

.product-card__badges {
  position: absolute;
  inset-block-start: .5rem;
  inset-inline-start: .5rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  align-items: flex-start;
}

.product-card .badge {
  padding: .25rem .5rem;
  font-size: var(--ic-text-xs);
  letter-spacing: .02em;
}

.product-card__wishlist {
  position: absolute;
  inset-block-start: .75rem;
  inset-inline-end: .75rem;
  z-index: 2;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: rgb(var(--ic-text));
  opacity: 1;
  transition: color .2s ease;
}

.product-card__wishlist:hover,
.product-card__wishlist.is-active {
  color: rgb(var(--ic-sale));
}

.product-card__wishlist svg {
  width: 20px;
  height: 20px;
}

.product-card__wishlist.is-active svg {
  fill: currentColor;
}

@media not screen and (pointer: fine) {
  .product-card__wishlist {
    display: grid;
    opacity: 1;
  }
}

.product-card__quick-add-button {
  position: absolute;
  inset-block-end: .75rem;
  inset-inline-end: .75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgb(var(--ic-bg));
  color: rgb(var(--ic-text));
  box-shadow: 0 1px 6px rgb(var(--ic-text) / .18);
  opacity: 1;
  transform: none;
  transition: background-color .2s ease-in-out;
}

.product-card__quick-add-button svg {
  width: 12px;
  height: 12px;
  transition: transform .2s ease-in-out;
}

.product-card__quick-add-button:hover svg {
  transform: rotate(90deg);
}

.product-card__quick-add-button:hover {
  background: #f4f4f4;
}

@media not screen and (pointer: fine) {
  .product-card__quick-add-button {
    display: none;
  }
}

.product-card__info {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: .75rem;
  text-align: center;
}

.product-card__title-price {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  width: 100%;
  min-width: 0;
}

.product-title {
  font-size: var(--ic-text-base);
  line-height: 1.65;
  letter-spacing: var(--ic-body-letter-spacing);
  color: rgb(var(--ic-text));
  max-width: 100%;
}

.product-subtitle {
  font-size: var(--ic-text-sm);
  line-height: 1.5;
  color: rgb(var(--ic-text) / .55);
  margin: 0;
}

.line-clamp {
  -webkit-line-clamp: var(--line-clamp-count, 2);
  -webkit-box-orient: vertical;
  display: -webkit-box;
  overflow: hidden;
}

.product-card .price-list {
  justify-content: center;
  font-size: var(--ic-text-base);
  column-gap: .5rem;
}

.product-card .price-list s {
  font-size: var(--ic-text-base);
  color: rgb(var(--ic-text) / .65);
}

.product-card .price-sale {
  color: rgb(var(--ic-sale));
  text-decoration: none;
}

.product-card .price-current {
  color: rgb(var(--ic-text) / .65);
}

/* Swatches */
.product-card__swatches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .25rem;
  border: 0;
  margin: 0;
  padding: 0;
  min-height: 22px;
}

.color-swatch {
  --swatch-size: 1.375rem;
  --swatch-offset: 2px;
  width: var(--swatch-size);
  height: var(--swatch-size);
  padding: var(--swatch-offset);
  border: 1px solid transparent;
  border-radius: var(--ic-radius-full);
  background: content-box var(--swatch-background, #ddd) no-repeat center / cover;
  display: block;
  flex: 0 0 auto;
}

.color-swatch.is-selected {
  border-color: rgb(var(--ic-text));
}

.color-swatch[style*="background-color"] {
  background: var(--swatch-background, #ddd);
  padding: 0;
  border-color: rgb(var(--ic-border));
}

.product-card__swatch-extra {
  font-size: var(--ic-text-xs);
  line-height: 1;
  color: rgb(var(--ic-text) / .65);
  padding-inline: .125rem;
}

.product-card__rating {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem;
  font-size: var(--ic-text-base);
  color: rgb(var(--ic-text));
  line-height: 1.4;
}

.product-card__rating .stars {
  color: #ffdc0f;
}

.product-card__reviews {
  font-size: var(--ic-text-base);
  white-space: nowrap;
}

.product-card__rating .stars {
  font-size: 12px;
  gap: .05rem;
}

.product-card__rating .stars svg {
  width: 12px;
  height: 12px;
}

/* Placeholder image (no S3 media yet) */
.product-card__media img[src$="placeholder-card.svg"] {
  background: linear-gradient(135deg, #f2f2f2 0%, #e9e9e9 100%);
}
