/**
 * Dimple Whisky — WooCommerce classic (legacy-template) chrome.
 *
 * The shop loop, the product card, the classic buttons, the archive header,
 * the breadcrumb, the classic notices and the Shop page's own description —
 * everything WooCommerce's classic templates print. Enqueued exactly where
 * dimple_whisky_needs_classic_woocommerce_assets() keeps WooCommerce's own
 * classic stylesheets: the front page (which on this site IS the Shop), any
 * WooCommerce-templated view, the cart, checkout and account pages, and any
 * page that embeds WooCommerce of its own. Nothing here matches on the FAQ,
 * Contact, About or legal pages.
 *
 * The loop rules are needed on the cart (cross-sells) and on a product page
 * (related products and up-sells) as well as on the shop itself, which is why
 * they are in this file rather than in woocommerce-single-product.css or a
 * shop-only one: those three views all satisfy the predicate above.
 */

/* -------------------------------------------------- product grid -------- */

/*
 * WooCommerce still lays the loop out with floats and percentage widths
 * (woocommerce-layout.css), which is what put three cramped columns on a
 * 390px screen. Replaced with a grid: one column on mobile, two from 600px,
 * three from 900px. The selectors mirror WooCommerce's own, including the
 * [class*="columns-"] and :nth-child(2n) variants, so each pair ties on
 * specificity and this file — loaded later — wins.
 */
.woocommerce ul.products,
.woocommerce-page ul.products {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	padding: 0;
	list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
	content: none;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce ul.products[class*="columns-"] li.product,
.woocommerce-page ul.products[class*="columns-"] li.product {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	float: none;
	clear: none;
	margin: 0;
	padding: 0;
	text-align: start;
}

.woocommerce ul.products[class*="columns-"] li.product:nth-child(2n),
.woocommerce-page ul.products[class*="columns-"] li.product:nth-child(2n) {
	float: none;
}

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

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

/* Cross-sells and up-sells follow the same grid. */
.woocommerce .cart-collaterals .cross-sells ul.products li.product,
.woocommerce-page .cart-collaterals .cross-sells ul.products li.product {
	width: 100%;
}

/* -------------------------------------------------- product card -------- */

.woocommerce ul.products li.product a img {
	margin: 0 0 var(--wp--preset--spacing--20);
	aspect-ratio: 1 / 1;
	object-fit: contain;
}

/*
 * One column on a phone means the square thumbnail would be as tall as the
 * screen is wide. Cap it: the bottle still reads at a glance and the grid
 * stays scrollable.
 */
@media (max-width: 599px) {
	.woocommerce ul.products li.product a img {
		aspect-ratio: auto;
		height: 260px;
	}
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	margin: 0 0 0.25em;
	padding: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	line-height: 1.25;
}

.woocommerce ul.products li.product .price {
	margin: 0 0 var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
}

.woocommerce ul.products li.product .price del {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
}

.woocommerce ul.products li.product .price ins {
	color: var(--wp--preset--color--brand);
	text-decoration: none;
}

.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
	margin-top: auto;
	align-self: start;
}

@media (max-width: 599px) {
	.woocommerce ul.products li.product .button {
		width: 100%;
		text-align: center;
	}
}

.woocommerce span.onsale {
	background-color: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--brand-contrast);
	border-radius: 0;
	min-height: 0;
	min-width: 0;
	padding: 0.35em 0.7em;
	line-height: 1.3;
	font-weight: 600;
}

/* ------------------------------------------------------- buttons -------- */

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt {
	background-color: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--brand-contrast);
	border: 0;
	border-radius: 0;
	padding: 0.75em 1.5em;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	text-shadow: none;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover,
.woocommerce #respond input#submit.alt:hover,
.woocommerce a.button:focus,
.woocommerce button.button:focus,
.woocommerce input.button:focus,
.woocommerce #respond input#submit:focus {
	background-color: var(--wp--preset--color--brand-dark);
	color: var(--wp--preset--color--brand-contrast);
}

.woocommerce a.button.disabled,
.woocommerce button.button.disabled,
.woocommerce input.button.disabled,
.woocommerce a.button:disabled,
.woocommerce button.button:disabled,
.woocommerce input.button:disabled,
.woocommerce button.button[disabled]:disabled {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

/* ------------------------------------------------ shop / archive -------- */

.woocommerce-products-header {
	margin: 0 0 var(--wp--preset--spacing--40);
}

/*
 * On the front page the store heading comes from the template (the WooCommerce
 * archive title is filtered off), so this header is left holding nothing but
 * whitespace. Hide it only in that case — if the Shop page ever gets a
 * description, WooCommerce prints it in here as an element and it shows.
 */
.dw-shop--front .woocommerce-products-header:not(:has(> *)) {
	display: none;
}

/*
 * :has() support fails unsafely: a browser that doesn't know it drops the
 * whole selector above, so the empty header keeps its default bottom
 * margin sitting on top of the grid. This unconditional fallback costs
 * nothing when :has() IS supported — the header is display:none by then,
 * so its margin is moot — and removes the margin either way when it isn't.
 */
.dw-shop--front .woocommerce-products-header {
	margin: 0;
}

.woocommerce-products-header__title {
	font-size: var(--wp--preset--font-size--xxx-large);
	line-height: 1.2;
}

.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin-bottom: var(--wp--preset--spacing--30);
}

.woocommerce .woocommerce-ordering select {
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.5em;
	max-width: 100%;
}

.woocommerce nav.woocommerce-pagination ul {
	border: 0;
	gap: 4px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.woocommerce nav.woocommerce-pagination ul li {
	border: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--wp--preset--color--border);
	padding: 0 0.5em;
}

.woocommerce nav.woocommerce-pagination ul li span.current,
.woocommerce nav.woocommerce-pagination ul li a:hover {
	background-color: var(--wp--preset--color--brand);
	color: var(--wp--preset--color--brand-contrast);
	border-color: var(--wp--preset--color--brand);
}

/* ---------------------------------------------------- breadcrumb -------- */

/*
 * WooCommerce prints the breadcrumb on woocommerce_before_main_content, so it
 * is on the product archive as well as on a single product — hence this file
 * and not woocommerce-single-product.css.
 */

.dw-breadcrumb {
	margin: 0 0 var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.dw-breadcrumb a {
	color: var(--wp--preset--color--muted);
	text-decoration: underline;
}

@media (max-width: 767px) {
	.dw-breadcrumb a {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

.dw-breadcrumb a:hover,
.dw-breadcrumb a:focus {
	color: var(--wp--preset--color--brand);
}

.dw-breadcrumb__sep {
	margin: 0 0.45em;
}

/* The headings above related products, up-sells and cross-sells. */

.woocommerce div.product .related > h2,
.woocommerce div.product .upsells > h2,
.woocommerce .cart-collaterals .cross-sells > h2 {
	font-size: var(--wp--preset--font-size--xx-large);
	margin: var(--wp--preset--spacing--50) 0 var(--wp--preset--spacing--30);
}

/* ------------------------------------------------------- notices -------- */

/* The classic notices, printed by wc_print_notices() on classic views. The
   block notice banners are in woocommerce.css: those show up site-wide. */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	border-top-color: var(--wp--preset--color--brand);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
}

.woocommerce-message::before,
.woocommerce-info::before {
	color: var(--wp--preset--color--brand);
}

/*
 * The Shop page's own content, which on this site is the front page copy
 * ("About Dimple Whisky" / "Why Shop With Us"). WooCommerce prints it in a
 * plain <div class="page-description">, and functions.php re-hooks it to
 * woocommerce_after_main_content so it lands below the product grid.
 *
 * Because it is not inside a block-layout container, the gap between its
 * paragraphs and the width it reads at are set here rather than by the block
 * layout engine — that keeps the content itself free of layout attributes and
 * free of styles that would only arrive in the footer.
 */
.page-description {
	max-width: 780px;
	margin-inline: auto;
	margin-block-start: var(--wp--preset--spacing--60);
}

.page-description > * {
	margin-block: 0;
}

.page-description > * + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.page-description > h2 + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

.page-description > * + h2 {
	margin-block-start: var(--wp--preset--spacing--60);
}
