/*
 * Product cards (u17_sv2_card() markup) — shared by the product archives
 * (template-parts/shop) and the product page rows (template-parts/product).
 * Wrap the grid in `.u17-cards`. Grid list view stays in u17-archive.css.
 */

.u17-plp__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--u17-space-4) var(--u17-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}


.u17-cards .u17-plp__grid li.u17-pcard {
	display: flex;
	flex-direction: column;
	width: auto;
	margin: 0;
	padding: 0;
	float: none;
	border: 1px solid var(--u17-line);
	background: var(--u17-white);
	text-align: left;
	transition: border-color var(--u17-fast);
}

.u17-cards .u17-plp__grid li.u17-pcard:hover {
	border-color: var(--u17-ink);
}

.u17-pcard__media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--u17-white);
	overflow: hidden;
}

.u17-pcard__imglink {
	position: absolute;
	inset: 0;
	display: block;
}

.u17-cards .u17-pcard__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover; /* every photo fills the square (owner's choice, 2026-09-27): wide/tall shots lose their edges */
	transition: opacity var(--u17-fast) var(--u17-ease);
}

.u17-cards .u17-pcard__img--alt {
	opacity: 0;
}

/* No mouse = the second photo can never show: don't render it, so lazy
   loading never fetches or decodes it (iPhone memory). Exact opposite of the
   hover rule below. The <img> stays in the HTML for image search. */
@media not all and (hover: hover) and (pointer: fine) {
	.u17-cards .u17-pcard__img--alt {
		display: none;
	}
}

@media (hover: hover) and (pointer: fine) {
	.u17-pcard:hover .u17-pcard__img--alt {
		opacity: 1;
	}

	.u17-pcard:hover .u17-pcard__media:has(.u17-pcard__img--alt) .u17-pcard__img:not(.u17-pcard__img--alt) {
		opacity: 0;
	}
}

.u17-pcard__badges {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
	pointer-events: none;
}

.u17-pcard__badge {
	padding: 5px 8px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 1px;
	text-transform: uppercase;
	background: var(--u17-white);
	color: var(--u17-ink);
	border: 1px solid var(--u17-ink);
}

.u17-pcard__badge--sale {
	background: var(--u17-ink);
	color: var(--u17-white);
}

.u17-pcard__badge--new {
	background: var(--u17-teal);
	border-color: var(--u17-teal);
	color: var(--u17-black);
}

.u17-pcard__badge--soon {
	border-color: var(--u17-muted);
	color: var(--u17-muted);
}

.u17-pcard__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 14px 0;
	flex: 1 1 auto;
}

.u17-cards .u17-pcard__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3; /* the full name of most parts; the car it fits is in the name */
	overflow: hidden;
	margin: 0;
	padding: 0;
	font-family: var(--u17-font);
	font-size: var(--u17-fs-small);
	font-weight: 400;
	line-height: 1.35;
	letter-spacing: 0;
	text-transform: none;
	color: var(--u17-ink);
}

.u17-pcard__title a {
	color: inherit;
	text-decoration: none;
}

/* the whole card is clickable through the title link */
.u17-pcard__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.u17-cards .u17-grid li.u17-pcard,
.u17-cards .u17-plp__grid li.u17-pcard {
	position: relative;
}

.u17-pcard__title a:focus-visible {
	outline: none;
}

.u17-pcard:has(.u17-pcard__title a:focus-visible) {
	outline: 2px solid var(--u17-teal-text);
	outline-offset: 2px;
}

/* the short description: list view only (u17-archive.css) */
.u17-pcard__excerpt {
	display: none;
}

.u17-pcard__buy {
	position: relative;
	z-index: 1;               /* above the card-wide title link */
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px 14px 14px;
}

.u17-pcard__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
}

.u17-cards .u17-pcard__price .price {
	margin: 0;
	font-size: var(--u17-fs-h3);
	font-weight: 600;
	line-height: 1.2;
	color: var(--u17-ink);
}

.u17-cards .u17-pcard__price .price del {
	margin-right: 6px;
	font-size: var(--u17-fs-small);
	font-weight: 300;
	color: var(--u17-muted);
	opacity: 1;
}

.u17-cards .u17-pcard__price .price ins {
	text-decoration: none;
	font-weight: 600;
}

.u17-pcard__save {
	font-size: var(--u17-fs-label);
	font-weight: 500;
	color: var(--u17-teal-text);
}

.u17-cards :is(a, button).u17-btn.u17-pcard__cta {
	width: 100%;
	min-height: 44px;
	padding: 0 12px;
	font-size: var(--u17-fs-label);
	letter-spacing: 1.5px;
}

.u17-cards .u17-pcard__cta.loading {
	opacity: 0.6;
	pointer-events: none;
}

.u17-cards .u17-pcard__cta.loading::after,
.u17-cards .u17-pcard__cta.added::after {
	content: none;
}

.u17-cards .u17-pcard__buy .added_to_cart {
	display: inline-block;
	font-size: var(--u17-fs-small);
	font-weight: 500;
	color: var(--u17-teal-text);
	text-align: center;
	text-decoration: underline;
}


@media (max-width: 1279px) {
	.u17-plp__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.u17-plp__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--u17-space-3) 10px;
	}

	.u17-pcard__body {
		padding: 10px 10px 0;
	}

	.u17-pcard__buy {
		padding: 10px;
	}

	.u17-cards .u17-pcard__price .price {
		font-size: var(--u17-fs-body);
	}

	.u17-pcard__badges {
		top: 6px;
		left: 6px;
	}

	.u17-pcard__badge {
		padding: 4px 6px;
		font-size: 11px;
	}
}

/* One row of cards (`.u17-cards.u17-cards--row`, the homepage): four cards on
   desktop, a swipe row below 1280px — as the product page's rows. */
@media (min-width: 1280px) {
	.u17-cards--row .u17-plp__grid li.u17-pcard:nth-child(n + 5) {
		display: none;
	}
}

@media (max-width: 1279px) {
	.u17-cards--row {
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: thin;
		padding-bottom: 6px;
	}

	.u17-cards--row .u17-plp__grid {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 31%;
	}

	.u17-cards--row .u17-pcard {
		scroll-snap-align: start;
	}
}

@media (max-width: 1023px) {
	.u17-cards--row .u17-plp__grid {
		grid-auto-columns: 42%;
	}
}

@media (max-width: 767px) {
	.u17-cards--row .u17-plp__grid {
		grid-auto-columns: 72%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.u17-cards .u17-pcard__img {
		transition: none;
	}
}
