/* Shop archive presentation; other WooCommerce areas and theme pages are unaffected. */
body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) main {
	box-sizing: border-box;
}

@media (min-width: 769px) {
	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) main {
		width: min(calc(100% - 2 * var(--mc-gutter)), var(--mc-wide-max));
		max-width: none;
		margin-inline: auto;
	}
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-products-header {
	max-width: var(--mc-content-max);
	margin: 0 auto clamp(2.5rem, 6vw, 4.5rem);
	text-align: center;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-products-header__title {
	margin-bottom: 1.25rem;
	color: var(--mc-ink);
	font-size: clamp(2rem, 4vw, 3rem);
	line-height: 1.12;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) :where(.term-description, .woocommerce-products-header__description) {
	color: var(--mc-body);
	font-size: clamp(1rem, 1.5vw, 1.125rem);
	line-height: 1.65;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) :where(.woocommerce-result-count, .woocommerce-ordering) {
	margin-bottom: 2rem;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-ordering select {
	min-height: 2.75rem;
	padding: 0.5rem 2.5rem 0.5rem 0.875rem;
	border: 1px solid var(--mc-border);
	border-radius: var(--mc-radius-sm);
	background-color: var(--mc-latte-soft);
	color: var(--mc-body);
	font: inherit;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
	gap: clamp(2rem, 5vw, 4rem);
	clear: both;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products::before,
body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products::after {
	display: none;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product {
	float: none;
	width: auto;
	margin: 0;
	color: var(--mc-body);
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product img {
	width: 100%;
	margin: 0 0 1.5rem;
	background: var(--mc-latte-soft);
	object-fit: contain;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product :where(.woocommerce-loop-product__title, h2, h3) {
	margin: 0 0 0.25rem;
	padding: 0;
	color: var(--mc-ink);
	font-size: clamp(1.25rem, 2vw, 1.5rem);
	line-height: 1.25;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .mc-catalog-title > a {
	position: relative;
	display: inline-block;
	border-bottom: 0;
	text-decoration: none;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .mc-catalog-title > a::after {
	position: absolute;
	bottom: -0.25rem;
	left: 50%;
	width: calc(100% + 1.5rem);
	height: 1px;
	background: currentColor;
	content: "";
	opacity: 0;
	transform: translateX(-50%);
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .mc-catalog-title > a:is(:hover, :focus-visible) {
	text-decoration: none;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .mc-catalog-title > a:is(:hover, :focus-visible)::after {
	opacity: 1;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product :where(.price, .mc-catalog-subtitle, .mc-catalog-meta, .mc-packsize) {
	color: var(--mc-subtle);
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product .button {
	margin-top: 1.25rem;
}

/* A single-product catalogue becomes an editorial feature without affecting future grids. */
body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce:has(ul.products > li.product:only-child) :where(.woocommerce-result-count, .woocommerce-ordering) {
	display: none;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products:has(> li.product:only-child) {
	display: block;
	max-width: var(--mc-wide-max);
	margin: 0 auto;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(17rem, 0.92fr);
	gap: clamp(2.5rem, 7vw, 6rem);
	align-items: center;
	max-width: none;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child .woocommerce-loop-product__link {
	display: contents;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child img {
	grid-column: 1;
	grid-row: 1 / span 8;
	margin: 0;
}

body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child > :not(.woocommerce-loop-product__link),
body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child .woocommerce-loop-product__link > :not(img) {
	grid-column: 2;
}

@media (max-width: 768px) {
	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) main {
		padding-inline: var(--mc-gutter);
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-products-header {
		margin-bottom: 2.5rem;
		text-align: left;
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-products-header__title {
		font-size: clamp(1.75rem, 8vw, 2.25rem);
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) :where(.woocommerce-result-count, .woocommerce-ordering) {
		float: none;
		width: 100%;
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) .woocommerce-ordering select {
		width: 100%;
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child {
		display: flex;
		flex-direction: column;
		gap: 0;
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products > li.product:only-child .woocommerce-loop-product__link {
		display: block;
	}

	body:is(.post-type-archive-product, .tax-product_cat, .tax-product_tag) ul.products li.product .button {
		width: 100%;
	}
}
