/* Product card and product grid (shop, category, home, related products). */

ul.products {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	ul.products.columns-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	ul.products.columns-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
	background: none;
}

.product-card__media {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--grey-100);
}

.product-card__media > a {
	display: block;
}

.product-card__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
	mix-blend-mode: multiply;
	transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-card__media img,
.product-card:focus-within .product-card__media img {
	transform: scale(1.04);
}

.product-card__media img.product-image--placeholder,
.quickview__media img.product-image--placeholder {
	mix-blend-mode: normal;
}

.product-card__qv {
	position: absolute;
	right: var(--space-1);
	bottom: var(--space-1);
	display: inline-flex;
	align-items: center;
	gap: var(--space-half);
	min-height: 44px;
	padding: 0 var(--space-2);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: #fff;
	color: var(--color-primary);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.product-card:hover .product-card__qv,
.product-card:focus-within .product-card__qv,
.product-card__qv:focus-visible {
	opacity: 1;
	transform: none;
}

/* Touch screens have no hover, so the button stays visible and icon-only. */
@media (hover: none) {
	.product-card__qv {
		opacity: 1;
		transform: none;
		padding: 0 var(--space-1);
	}

	.product-card__qv-text {
		display: none;
	}
}

.product-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: var(--space-half);
	padding: var(--space-2) 0 var(--space-1);
}

.product-card__brand {
	margin: 0;
	color: var(--color-muted);
	font-size: 0.8125rem;
	font-weight: 500;
}

.product-card__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.012em;
}

.product-card__title a {
	color: var(--color-primary);
	text-decoration: none;
}

.product-card__title a:hover {
	text-decoration: underline;
}

.product-card__title a::after {
	/* Whole card is clickable; the quick view and cart buttons sit above it. */
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.product-card__qv {
	z-index: 2;
}

.product-card__buy {
	position: relative;
	z-index: 2;
}

.product-card__pn {
	margin: 0;
	color: var(--color-muted);
	font-size: 0.875rem;
}

.product-card__pn span {
	color: var(--color-text);
	font-family: var(--font-mono);
	font-size: 0.8125rem;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

.stock-label {
	display: inline-flex;
	align-items: center;
	gap: var(--space-half);
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
}

.stock-label--in {
	/* The brand green is 4.2:1 on white; a darker shade of it reads at 5.6:1 for this small text. */
	color: color-mix(in srgb, var(--color-success) 80%, #000);
}

.stock-label--out {
	color: var(--color-error);
}

.stock-label--backorder {
	color: var(--grey-700);
}

.product-card__buy {
	display: grid;
	gap: var(--space-1);
	padding: var(--space-1) 0 0;
}

.product-card__price {
	margin: 0;
	color: var(--color-primary);
	font-size: 1.1875rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.product-card__price del {
	color: var(--color-muted);
	font-size: 0.875rem;
	font-weight: 400;
}

.product-card__price ins {
	text-decoration: none;
}

.product-card .added_to_cart {
	display: block;
	margin-top: var(--space-1);
	font-size: 0.875rem;
	font-weight: 600;
}

.product-card .button.loading {
	opacity: 0.7;
}
