/*
 * Card row (ul.cw-card-row): a row of small product cards (woocommerce/loop/loop-start.php prints it for the loops
 * related, up-sells, cw-category-row, cw-category-new, cw-home-row and cw-home-new). A grid on desktop (columns
 * --cw-card-row-columns, default 5) and, up to 899px, a horizontal carousel with scroll-snap that bleeds to the screen
 * edges (columns of 168px). The modifier --stack turns the carousel into a 2-column grid that shows the first four cards.
 * Only design tokens. Breakpoint of the mobile layout: 899px (same as the header and the mobile navigation).
 */
ul.cw-card-row {
	display: grid;
	grid-template-columns: repeat(var(--cw-card-row-columns, 5), minmax(0, 1fr));
	gap: var(--cw-card-row-gap, var(--cw-gap));
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 899px) {
	ul.cw-card-row {
		grid-template-columns: none;
		grid-auto-columns: 168px;
		grid-auto-flow: column;
		gap: 10px;
		margin-inline: calc(var(--cw-gutter) * -1);
		padding-inline: var(--cw-gutter);
		overflow-x: auto;
		scroll-padding-inline: var(--cw-gutter);
		scroll-snap-type: x proximity;
		scrollbar-width: none;
	}

	.cw-card-row > li {
		scroll-snap-align: start;
	}

	ul.cw-card-row--stack {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-columns: auto;
		grid-auto-flow: row;
		margin-inline: 0;
		padding-inline: 0;
		overflow-x: visible;
		scroll-snap-type: none;
	}

	.cw-card-row--stack > li:nth-child(n + 5) {
		display: none;
	}
}
