/*
 * Product grid (new-woocommerce.sketch, Shop Home V1 and V2): a section heading, then the store's product list with
 * one product-card per product in a 1140px wide grid, 360px cards 30px apart, 60px between rows.
 * heading-center: centered title (34/45) and text (18/26, 579 wide, 20 below), the cards 72 below the text.
 * heading-inline: title, text (at 400px, 460 wide) and a 60×11 arrow link at the end of one row, the cards 60 below;
 * a 443×55 outlined load more button 80 below the last row.
 * archive (Category-list-sidebar): the list fills its column (781 of 1140, beside the shop sidebar); the store's
 * result count and a 181×40 outlined sorting select in one row, the 246px cards 40 below it, 21 apart, 61 between rows,
 * and the numbered pagination 120 below the last row.
 * carousel (the store's carousel layout; the single product template's upsells and related products): the heading
 * and 44px outlined previous/next squares in one row, then three cards per view in a row that scrolls sideways (two on
 * tablets, one and a part on phones). The store's buttons scroll the row and hide when everything fits.
 * The column count follows the collection's setting (the store's columns-N class); narrow screens show two columns.
 */
.rt-product-grid {
	--rt-product-grid-columns: 3;
	display: grid;
	gap: 4.5rem;
	box-sizing: border-box;
	padding: 0 max(var(--rt-layout-root-padding-end, var(--rt-spacing-40)), (100% - var(--rt-product-grid-width, var(--rt-layout-content))) / 2 + var(--rt-bleed, 0px)) 0 max(var(--rt-layout-root-padding-start, var(--rt-spacing-40)), (100% - var(--rt-product-grid-width, var(--rt-layout-content))) / 2 + var(--rt-bleed, 0px));
}

.rt-product-grid--heading-inline {
	gap: 3.75rem;
}

.rt-product-grid .rt-section-heading {
	gap: 1.25rem;
}

.rt-product-grid .rt-section-heading__title {
	font-size: var(--rt-font-size-x-large);
	line-height: var(--rt-font-line-height-heading);
}

.rt-product-grid .rt-section-heading__text {
	color: var(--rt-color-body);
	font-size: var(--rt-font-size-base-plus);
	line-height: calc(26 / 18);
}

/* heading-center: the text keeps the design's width (by element: the original theme's section heading has no rt-* classes and
 * core has no width setting for a paragraph in a stack) */
.rt-product-grid--heading-center h2 + p {
	max-width: 36.25rem;
}

/* heading-inline: title and text side by side, the arrow at the row's end */
.rt-product-grid__header {
	display: flex;
	align-items: flex-start;
	gap: var(--rt-spacing-40);
}

.rt-product-grid__header .rt-section-heading {
	flex: 1;
	grid-template-columns: 25rem minmax(0, 28.75rem);
	align-items: start;
	gap: 1.25rem 0;
}

.rt-product-grid__more {
	flex: none;
	margin: 0;
}

/* The link's text stays for screen readers; a long thin arrow is drawn in its place. */
.rt-product-grid__more a {
	position: relative;
	display: block;
	width: 3.75rem;
	height: 2.75rem;
	color: var(--rt-color-contrast);
	font-size: 0;
	text-decoration: none;
}

.rt-product-grid__more a::after {
	content: "";
	position: absolute;
	inset: 0;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 11'%3E%3Cpath d='M0 5.5h56' stroke='%23000'/%3E%3Cpath d='M55 0l5 5.5-5 5.5z'/%3E%3C/svg%3E") 100% 50% / 3.75rem 0.6875rem no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 11'%3E%3Cpath d='M0 5.5h56' stroke='%23000'/%3E%3Cpath d='M55 0l5 5.5-5 5.5z'/%3E%3C/svg%3E") 100% 50% / 3.75rem 0.6875rem no-repeat;
	transition: transform 0.2s ease;
}

.rt-product-grid__more a:hover::after,
.rt-product-grid__more a:focus-visible::after {
	transform: translateX(0.25rem);
}

.rt-product-grid__more a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Product list: the store's responsive grid with the design's gaps. A column is never narrower than 150px. */
.rt-product-grid__items.columns-2 {
	--rt-product-grid-columns: 2;
}

.rt-product-grid__items.columns-4 {
	--rt-product-grid-columns: 4;
}

.rt-product-grid__items.columns-5 {
	--rt-product-grid-columns: 5;
}

.rt-product-grid__items.columns-6 {
	--rt-product-grid-columns: 6;
}

.rt-product-grid .rt-product-grid__collection .rt-product-grid__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(9.375rem, (100% - (var(--rt-product-grid-columns) - 1) * var(--rt-product-grid-column-gap)) / var(--rt-product-grid-columns)), 1fr));
	gap: var(--rt-product-grid-row-gap) var(--rt-product-grid-column-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.rt-product-grid__items > li {
	margin: 0;
}

.rt-product-grid .rt-pagination {
	--rt-pagination-offset: 5rem;
}

.rt-product-grid__empty {
	padding-block: var(--rt-spacing-50);
	color: var(--rt-color-body);
}

.rt-product-grid--heading-center .rt-product-grid__empty {
	text-align: center;
}

.rt-product-grid__empty p {
	margin: 0;
}

/* archive: no section edges, the column sets the width. */
.rt-product-grid.rt-product-grid--archive {
	padding: 0;
}

.rt-product-grid--archive .rt-product-grid__collection .rt-product-grid__items {
	/* The store's product template: 30px between the columns, the fluid Large preset between the rows */
	--rt-product-grid-column-gap: 1.875rem;
	--rt-product-grid-row-gap: var(--rt-spacing-60-fluid, 3.8125rem);
}

/* The archive keeps that row gap at every width (the narrow-screen rules below set the other grids') */
.rt-product-grid.rt-product-grid--archive .rt-product-grid__collection .rt-product-grid__items {
	row-gap: var(--rt-product-grid-row-gap);
}

/* The original theme prints the (empty) pagination row after the products even on a single page: its fluid X-Large top margin
   stays under the last row */
.rt-product-grid--archive .rt-product-grid__collection:not(:has(.rt-pagination)) {
	margin-block-end: var(--rt-spacing-70-fluid, 6rem);
}

.rt-product-grid--archive .rt-pagination {
	--rt-pagination-offset: 7.5rem;
}

.rt-product-grid__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--rt-spacing-20) var(--rt-spacing-40);
	padding-block-end: var(--rt-spacing-50-fluid, var(--rt-spacing-50));
}

.rt-product-grid__count p {
	margin: 0;
	color: var(--rt-color-contrast);
	font-size: var(--rt-font-size-medium);
	font-weight: var(--rt-font-weight-bold);
	line-height: var(--rt-font-line-height-heading);
}

/* The store's sorting select: a 181×40 outlined box with the design's small chevron. */
.rt-product-grid__sorting form {
	margin: 0;
}

.rt-product-grid .rt-product-grid__sorting select {
	box-sizing: border-box;
	width: 11.3125rem;
	height: 2.5rem;
	margin: 0;
	padding: 0 var(--rt-spacing-50) 0 0.9375rem;
	border: 1px solid var(--rt-color-contrast);
	border-radius: 0;
	background: var(--rt-color-base) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 5'%3E%3Cpath d='M.5.5 4 4 7.5.5' fill='none' stroke='%23000' stroke-width='1.2'/%3E%3C/svg%3E") right 0.9375rem center / 0.5rem 0.3125rem no-repeat;
	color: var(--rt-color-contrast);
	font-family: var(--rt-font-family-body);
	font-size: var(--rt-font-size-x-small);
	font-weight: var(--rt-font-weight-regular, 400);
	line-height: 1;
	cursor: pointer;
	appearance: none;
}

.rt-product-grid .rt-product-grid__sorting select:focus-visible {
	outline: 2px solid var(--rt-color-contrast);
	outline-offset: 2px;
}

/* carousel: the heading row sits in the collection, above the list */
.rt-product-grid--carousel .rt-product-grid__collection {
	display: grid;
	gap: 3.75rem;
}

.rt-product-grid--carousel .rt-product-grid__collection > :not(:has(*)) {
	display: none;
}

.rt-product-grid--carousel .rt-product-grid__header {
	align-items: center;
	justify-content: space-between;
}

.rt-product-grid--carousel .rt-product-grid__header .rt-section-heading {
	flex: 1;
}

.rt-product-grid--carousel .rt-product-grid__header > :last-child {
	display: flex;
	flex: none;
	gap: 0.625rem;
}

.rt-product-grid--carousel .rt-product-grid__header > [hidden] {
	display: none;
}

.rt-product-grid .rt-product-grid__arrows {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	padding: 0;
	border: 1px solid var(--rt-color-line);
	border-radius: 0;
	background: none;
	color: var(--rt-color-contrast);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.rt-product-grid .rt-product-grid__arrows:hover {
	border-color: var(--rt-color-contrast);
	background-color: var(--rt-color-contrast);
	color: var(--rt-color-base);
}

.rt-product-grid .rt-product-grid__arrows:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.rt-product-grid .rt-product-grid__arrows[aria-disabled="true"] {
	border-color: var(--rt-color-line);
	background: none;
	color: var(--rt-color-contrast);
	cursor: not-allowed;
	opacity: 0.3;
}

/* The original theme: the section is align wide (core sizes it), so it has no padding of its own */
.rt-product-grid.rt-product-grid--carousel {
	--rt-product-grid-per-view: 3;
	padding: 0;
}

.rt-product-grid.rt-product-grid--carousel .rt-product-grid__collection .rt-product-grid__items {
	display: flex;
	gap: var(--rt-product-grid-column-gap);
	padding: 0;
	overflow-x: auto;
	scroll-padding: 0;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.rt-product-grid--carousel .rt-product-grid__items > li {
	flex: 0 0 calc((100% - (var(--rt-product-grid-per-view) - 1) * var(--rt-product-grid-column-gap)) / var(--rt-product-grid-per-view));
	box-sizing: border-box;
	min-width: 0;
	max-width: none;
	/* The store's carousel keeps 4px around each card (room for the focus ring inside the scroller) */
	padding: 0.25rem;
	scroll-snap-align: start;
}

@media (max-width: 64rem) {
	.rt-product-grid {
		gap: 3rem;
	}

	.rt-product-grid.rt-product-grid--carousel {
		--rt-product-grid-per-view: 2;
	}

	.rt-product-grid--carousel .rt-product-grid__collection {
		gap: 3rem;
	}

	.rt-product-grid__header {
		align-items: flex-end;
	}

	.rt-product-grid__header .rt-section-heading {
		grid-template-columns: minmax(0, 1fr);
	}

	.rt-product-grid .rt-product-grid__collection .rt-product-grid__items {
		row-gap: 3rem;
	}

	.rt-product-grid .rt-pagination {
		--rt-pagination-offset: 3.5rem;
	}
}

@media (max-width: 37.5rem) {
	.rt-product-grid {
		gap: var(--rt-spacing-50);
	}

	.rt-product-grid.rt-product-grid--carousel {
		--rt-product-grid-per-view: 1.4;
	}

	.rt-product-grid--carousel .rt-product-grid__collection {
		gap: var(--rt-spacing-50);
	}

	.rt-product-grid .rt-product-grid__collection .rt-product-grid__items {
		--rt-product-grid-column-gap: 0.9375rem;
		row-gap: var(--rt-spacing-50);
	}

	.rt-product-grid .rt-pagination {
		--rt-pagination-offset: 2.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rt-product-grid__more a::after,
	.rt-product-grid .rt-product-grid__arrows {
		transition: none;
	}
}
