/*
 * Product card. Shared by the Home carousel and the Produtos grid, which is why it is
 * its own stylesheet instead of living inside sections/products.css.
 */

.product-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	width: 100%;
	padding: 0;
	text-align: center;
}

/*
 * Ratio instead of a fixed height so the card works at any column width. 289x400 is the
 * Figma box, and the two rules it replaces were the same ratio written twice: 400px at
 * the 289px desktop item, and min(108vw, 400px) at the min(78vw, 289px) mobile item,
 * where 78vw x 400/289 = 108vw.
 */
.product-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 289 / 400;
	border-radius: var(--radius-media);
	background-color: var(--color-surface-muted);
	overflow: hidden;
}

/*
 * The packshot is contained with a margin inside the gray box, not full bleed: the
 * prototype puts a 200x290 image box at (45, 62) inside the 289x400 card, which is
 * 69.2% by 72.5% centred. The hover grows that box to 240x331, so the photo zooms
 * inside a card that does not move. SMART_ANIMATE EASE_OUT 1000ms.
 *
 * The eight exports are all 450x530, so contain always paints 200x235 and the height of
 * the box is never reached. In the node each product has its own size inside the box, from
 * 200x58 for the mussarela to 94x256 for the bisnaga, and that framing is lost here. The
 * deviation is uniform, so a single factor closes it: see BACKLOG 33.
 */
.product-card__image {
	width: 69.2%;
	height: 72.5%;
	object-fit: contain;
	/* The default box sits at (45, 62) in 606:14526, 7px under the centre; the hover box is centred. */
	translate: 0 7px;
	transition: width var(--duration-card-hover) var(--ease-out),
		height var(--duration-card-hover) var(--ease-out),
		translate var(--duration-card-hover) var(--ease-out);
}

.product-card:hover .product-card__image,
.product-card:focus-visible .product-card__image {
	width: 83%;
	height: 82.8%;
	translate: 0 0;
}

@media (prefers-reduced-motion: reduce) {
	.product-card__image {
		transition: none;
	}
}

.product-card__name {
	display: block;
	color: var(--color-title-card);
	font-family: var(--font-heading);
	font-size: var(--font-h5);
	font-weight: var(--weight-heading);
	line-height: var(--lh-heading);
	letter-spacing: var(--ls-heading);
	overflow-wrap: anywhere;
}
