/* Anahata v2 — product-card. Figma: "Product Card" set. */

.product-card {
  display: flex;
  flex-direction: column;
  /* Every card is the same size whatever its title (designer review
     2026-09-28, replacing the 09-24/09-26 "wrap in full" rule): the title
     is clamped to --pc-title-lines with "…" and that height is always
     reserved, so a one-word title and a long one give the same card. */
  --pc-title-lines: 2;
  --pc-title-lh: var(--a-lh-heading);
  --pc-price-lh: calc(var(--a-fs-body-l) * 1.25);
  --pc-info-gap: var(--a-space-2);
  background: var(--a-surface);
  border: 1px solid var(--a-tan);
  border-radius: var(--a-radius);
  overflow: hidden;
  box-shadow: var(--a-shadow-card);
}

.product-card__media {
  display: block;
  aspect-ratio: var(--pc-image-ratio, 1 / 1);
  background: var(--a-photo-ground);
  overflow: hidden;
}

/* Photos fill the frame (owner 2026-09-29: no empty space round them). */
.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Packshots — a piece on a plain backdrop — are shown whole instead, never
   cropped (the Ocean Necklace lost its top, 2026-09-28), and the frame takes
   the backdrop's own colour so the photo still reads edge to edge.
   assets/product-card-fit.js finds them and sets --pc-backdrop. */
.product-card__media.is-packshot {
  background: var(--pc-backdrop, var(--a-photo-ground));
}

.product-card__media.is-packshot .product-card__image {
  object-fit: contain;
}

/* the photo's sides fade into the frame, so a backdrop that shades a little
   toward its edge leaves no seam: a tall photo along left / right, a wide
   one along top / bottom. The mask is sized to the drawn photo, not the box. */
.product-card__media.is-tall .product-card__image {
  -webkit-mask: var(--a-mask-feather-x) center / var(--pc-drawn-w, 100%) 100% no-repeat;
  mask: var(--a-mask-feather-x) center / var(--pc-drawn-w, 100%) 100% no-repeat;
}

.product-card__media.is-wide .product-card__image {
  -webkit-mask: var(--a-mask-feather-y) center / 100% var(--pc-drawn-h, 100%) no-repeat;
  mask: var(--a-mask-feather-y) center / 100% var(--pc-drawn-h, 100%) no-repeat;
}

.product-card__image--placeholder {
  object-fit: contain;
  opacity: 0.4;
}

.product-card__footer {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--a-space-3);
  min-height: 65px;
  padding: var(--a-space-3) var(--a-space-4);
  background: var(--a-surface);
}

.product-card__info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* title on top, price on the bottom line of every card. Titles of two or
     more words always fill both lines (snippets/ui-product-card breaks them
     evenly), so the price sits right under them (owner 2026-09-29) */
  justify-content: space-between;
  gap: var(--pc-info-gap);
  min-height: calc(var(--pc-title-lh) * var(--pc-title-lines) + var(--pc-info-gap) + var(--pc-price-lh));
  min-width: 0;
}

/* Clamped to --pc-title-lines with "…" (see .product-card); --pc-title-lh
   follows each variant's line-height.
   Slightly larger than the price, with the hairline stroke that gives
   single-weight Aboreto a little more body. */
.product-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--pc-title-lines);
  line-clamp: var(--pc-title-lines);
  overflow: hidden;
  font-family: var(--a-font-display);
  font-size: var(--a-fs-heading);
  line-height: var(--pc-title-lh);
  color: var(--a-ink);
  text-decoration: none;
  overflow-wrap: break-word;
  -webkit-text-stroke: var(--a-stroke-hair) currentColor;
}

/* Smaller than the title but heavier, so it still reads first */
.product-card__price {
  font-family: var(--a-font-body);
  font-weight: 700;
  font-size: var(--a-fs-body-l);
  line-height: var(--pc-price-lh);
  color: var(--a-ink);
  white-space: nowrap;
}

.product-card__add-form {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
}

.product-card__add {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--a-radius-8);
  background: var(--a-ink-pure);
  color: var(--a-on-dark);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.product-card__add:hover {
  opacity: 0.82;
}

.product-card__add:focus-visible {
  outline: 2px solid var(--a-ink-pure);
  outline-offset: 2px;
}

/* "You May Also Like" (cart page): brown "+" beside the title/price */
.product-card__add--tan {
  background: var(--a-tan);
  color: var(--a-on-dark);
}

/* Compact card — Figma 1473:915 "In the same set" (1502:3520): the standard card
   placed at 0.822 scale (236 -> 194px). Every size multiplies the base, which
   is why the numbers land on the design's odd values (65 -> 53.43, 17 -> 13.97). */
.product-card--compact {
  --pc-s: var(--a-scale-card-compact);
  border-width: calc(1px * var(--pc-s));
  border-radius: calc(var(--a-radius) * var(--pc-s));
  box-shadow: var(--a-shadow-card-sm);
}

.product-card--compact .product-card__footer {
  gap: calc(var(--a-space-3) * var(--pc-s));
  min-height: calc(65px * var(--pc-s));
  padding: calc(var(--a-space-3) * var(--pc-s)) calc(var(--a-space-4) * var(--pc-s));
  border-top: 0;
}

.product-card--compact {
  --pc-title-lh: calc(var(--a-lh-display-s) * var(--pc-s));
  --pc-price-lh: calc(var(--a-fs-heading) * var(--pc-s) * 1.25);
  --pc-info-gap: calc(var(--a-space-2) * var(--pc-s));
}

/* secondary label colour per the design; clamps like every other card */
.product-card--compact .product-card__title {
  font-size: calc(var(--a-fs-display-s) * var(--pc-s));
  color: var(--a-text-muted);
}

.product-card--compact .product-card__price {
  font-size: calc(var(--a-fs-heading) * var(--pc-s));
}

.product-card--compact .product-card__add {
  width: calc(36px * var(--pc-s));
  height: calc(36px * var(--pc-s));
  border-radius: calc(var(--a-radius-8) * var(--pc-s));
}

/* Large tile — the one-column phone grid (Explore All, search results): the
   design sets the title at 27.19px there. Once the grid has room for several
   columns (750px+) the tile is rail-sized again and keeps the defaults above. */
@media screen and (max-width: 749px) {
  .product-card--large {
    --pc-title-lh: var(--a-lh-display-xl);
    --pc-price-lh: calc(var(--a-fs-price) * 1.25);
  }

  .product-card--large .product-card__title {
    font-size: var(--a-fs-display-xl);
  }

  .product-card--large .product-card__price {
    font-size: var(--a-fs-price);
  }
}

/* quick-add in flight (assets/product-card-add.js) */
.product-card__add[aria-busy='true'] {
  opacity: 0.5;
  pointer-events: none;
}
