/* Product card. The title link stretches over the whole card; buttons sit above it. */
.card {
  position: relative;
  display: flex; flex-direction: column;
  animation: rise-in .45s var(--ease) both;
}
.card__media { aspect-ratio: 1 / 1; border-radius: var(--radius); }
.card__media > img { transition: transform .6s var(--ease); }
.card:hover .card__media > img { transform: scale(1.04); }

/* right: 56px keeps the badges clear of the wishlist heart (12px inset + 38px button + gap) */
.card__badges { position: absolute; top: 12px; left: 12px; right: 56px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.card__badges .badge { white-space: nowrap; }

.card__body { display: flex; flex-direction: column; flex: 1; padding-top: 14px; }
.card__meta { font-size: 13px; color: var(--color-muted); }
.card__title { margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
.card__title a {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.card:hover .card__title a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.card__swatches { display: flex; gap: 6px; margin-top: 10px; }
.card__swatches span { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }

/* Footer: price on one line, then a full-width button. margin-top:auto pins it to
   the bottom, so prices and buttons line up across a row whatever the title length. */
.card__foot { display: grid; gap: 12px; margin-top: auto; padding-top: 14px; }
.card__foot .price { flex-wrap: nowrap; white-space: nowrap; }
.card__add { position: relative; z-index: 2; width: 100%; }

/* Narrow cards (two-up on phones, three-up just above 600px): the old price drops under the new one. */
@media (max-width: 660px) {
  .card__foot .price { flex-wrap: wrap; white-space: normal; row-gap: 0; }
}
@media (max-width: 600px) {
  /* two-up cards are too narrow to share the top edge with the heart: badges move to the photo's bottom edge */
  .card__badges { top: auto; bottom: 8px; left: 8px; right: 8px; gap: 4px; }
  .card__badges .badge { height: 22px; padding: 0 7px; font-size: 11px; }
  .card__foot { gap: 10px; }
  .card__foot .price { flex-wrap: wrap; white-space: normal; row-gap: 0; }
}
