/*
 * Product, Cart, Checkout and My Account — what block and Customizer
 * settings can't reach. Card styling lives in product-card.css.
 */

:root {
	--wpr-store-ink: var(--global-palette3);
	--wpr-store-muted: var(--wpr-muted);
	--wpr-store-line: rgba(13, 13, 13, 0.1);
	--wpr-store-gold: var(--global-palette2);
	--wpr-store-gold-text: var(--wpr-gold-text);
}

/* Cart and Checkout stay inside the page; alignwide would overhang it. */
.entry-content .wp-block-woocommerce-cart.alignwide,
.entry-content .wp-block-woocommerce-checkout.alignwide {
	width: auto;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

.wc-block-cart .wc-block-cart-items {
	width: 100%;
}

/* Filled cart: the cross-sells take a full row under the items and totals. */
.wc-block-cart .wp-block-woocommerce-product-collection {
	flex: 0 0 100%;
	width: 100%;
	margin-top: 48px;
}

.wc-block-cart .wp-block-woocommerce-product-collection .wp-block-heading {
	margin-top: 0;
}

/* Stacked, WooCommerce's own totals margins already leave about 50px above the suggestions. */
@media (max-width: 1024px) {
	.wc-block-cart .wp-block-woocommerce-product-collection {
		margin-top: 0;
	}
}

/* An <a>, so Kadence's button radius doesn't reach it. */
.wc-block-cart .wc-block-cart__submit-button {
	border-radius: var(--wpr-btn-radius);
}

/*
 * Kadence's button styles also list this wrapper, which drew a padded box
 * with a hover shadow around the real button. The wrapper is layout only.
 */
.wc-block-cart .wc-block-cart__submit,
.wc-block-cart .wc-block-cart__submit:hover {
	padding: 0;
	box-shadow: none;
}

/* Empty cart */
.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title {
	margin-bottom: 24px;
}

.entry-content .wp-block-woocommerce-empty-cart-block .wp-block-buttons {
	margin-bottom: 64px;
}

/* Checkout error rows */
.wc-block-components-validation-error {
	margin-bottom: 8px;
}

/* Product page: gallery thumbnails sit under the main image. */
.single-product.woocommerce div.product div.images .flex-control-thumbs {
	position: static;
	display: flex;
	justify-content: flex-start;
	gap: 8px;
	width: 100%;
	max-width: 100%;
	margin: 12px 0 0;
	padding: 0;
	background: transparent;
	transform: none;
}

.single-product.woocommerce div.product div.images .flex-control-thumbs li,
.single-product.woocommerce div.product div.images .flex-control-thumbs li:nth-child(n) {
	flex: 0 0 72px;
	width: 72px;
	height: auto;
	padding: 0;
	background: transparent;
}

.single-product.woocommerce div.product div.images .flex-control-thumbs li img {
	display: block;
	width: 100%;
	height: auto; /* The gallery script sets a pixel width on load; this keeps every thumbnail square. */
	aspect-ratio: 1;
	object-fit: cover;
	border: 0;
	border-radius: 6px;
}

.single-product.woocommerce div.product div.images .flex-control-thumbs li img:focus-visible {
	outline: 2px solid var(--wpr-store-ink);
	outline-offset: 2px;
}

/* Product tabs: the same underline as the shop's collection links. */
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 32px;
	margin: 0 0 32px;
	padding: 0;
	border-bottom: 1px solid var(--wpr-store-line);
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li,
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li.active {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li::after {
	display: none;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li a {
	display: block;
	padding: 8px 0;
	border-bottom: 1.5px solid transparent;
	background: transparent;
	color: var(--wpr-store-muted);
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 500;
	opacity: 1;
	text-decoration: none;
	transition: color 200ms ease, border-color 200ms ease;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover,
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
	border-bottom-color: var(--wpr-store-gold);
	background: transparent;
	color: var(--wpr-store-ink);
}

/* Kadence boxes the tabs on small screens; the underline tabs don't need it. */
.single-product.woocommerce div.product .woocommerce-tabs {
	border: 0;
}

.single-product.woocommerce div.product .woocommerce-tabs .panel {
	margin: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
}

/* Same badge wording as the product cards. */
.single-product.woocommerce div.product > .onsale {
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* Four related cards can't leave an orphan row: two, then four. */
@media (min-width: 576px) and (max-width: 767px) {
	.single-product.woocommerce .related.products ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.single-product.woocommerce .related.products ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Reassurance line under Add to cart */
.wpr-reassurance {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
	margin: 0 0 24px;
	padding: 0;
	font-size: 13px;
	list-style: none;
}

.wpr-reassurance a {
	display: inline-block;
	padding: 4px 0;
	color: var(--wpr-store-gold-text);
	text-underline-offset: 2px;
}

.wpr-reassurance a:hover {
	color: var(--wpr-store-ink);
}

/* My Account: login and register forms */
.woocommerce-account .woocommerce form.login,
.woocommerce-account .woocommerce form.register,
.woocommerce-account .woocommerce form.lost_reset_password {
	margin-bottom: 0;
	padding: 24px;
	border: 1px solid var(--wpr-store-line);
	border-radius: 10px;
}

.woocommerce-account .woocommerce form.lost_reset_password {
	max-width: 600px;
}

.woocommerce-account form.register .woocommerce-privacy-policy-text {
	margin-bottom: 20px;
}

.woocommerce-account .woocommerce-form-row {
	margin-bottom: 16px;
}

.woocommerce-account .woocommerce-form-row label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--wpr-store-ink);
}

/*
 * Page ends: the gap above the footer comes from Customize > General >
 * Layout > Content Spacing, so the last block on these pages adds none.
 */
.entry-content .wp-block-woocommerce-cart,
.entry-content .wp-block-woocommerce-checkout,
.entry-content .wc-block-components-sidebar-layout,
.wc-block-cart .wp-block-woocommerce-product-collection,
.wc-block-checkout__actions,
.entry-content .wp-block-woocommerce-empty-cart-block .wc-block-grid.wc-block-grid,
.woocommerce-account form .form-row:last-child,
.single-product.woocommerce .related.products ul.products,
.single-product.woocommerce .upsells.products ul.products,
.single-product.woocommerce div.product .woocommerce-tabs .panel > :last-child {
	margin-bottom: 0;
}

/* Checkout fields 16px apart. WooCommerce's own first-row rules still win. */
.wc-block-components-form .wc-block-components-text-input {
	margin-top: 16px;
}

/* Product summary: one 24px step between its parts. */
.woocommerce div.product .summary .woocommerce-product-details__short-description,
.woocommerce div.product .summary .wpr-fragrance-notes,
.woocommerce div.product .summary form.cart {
	margin-bottom: 24px;
}

.woocommerce div.product .summary .wpr-fragrance-notes p:last-child {
	margin-bottom: 0;
}

.woocommerce div.product .summary .product_meta {
	margin-top: 24px;
}

/* Kadence lifts the breadcrumb 16px into the page's top gap; keep the gap the same as other pages. */
.single-product .product-title.product-above .kadence-breadcrumbs {
	margin-top: 0;
}

/* Product tabs: clear space above, readable line length, headings off their content. */
.single-product.woocommerce div.product .woocommerce-tabs {
	margin-top: 48px;
}

.single-product.woocommerce div.product .woocommerce-tabs .panel > * {
	max-width: 70ch;
}

.single-product.woocommerce div.product .woocommerce-tabs .panel > h2,
.single-product.woocommerce .related.products > h2,
.single-product.woocommerce .upsells.products > h2 {
	margin-bottom: 24px;
}

.single-product #review_form .comment-reply-title {
	display: block;
	margin-bottom: 16px;
}

/* Related and upsell rows: a full section gap below the tabs, and the shop grid's card gap. */
.single-product.woocommerce .related.products,
.single-product.woocommerce .upsells.products {
	margin-top: 80px;
}

.single-product.woocommerce .related.products ul.products,
.single-product.woocommerce .upsells.products ul.products {
	gap: var(--wpr-grid-gap);
}

@media (max-width: 1024px) {
	.single-product.woocommerce .related.products,
	.single-product.woocommerce .upsells.products {
		margin-top: 64px;
	}
}

@media (max-width: 767px) {
	.single-product.woocommerce div.product .woocommerce-tabs {
		margin-top: 32px;
	}

	.single-product.woocommerce .related.products,
	.single-product.woocommerce .upsells.products {
		margin-top: 48px;
	}

	/* Login and Register stack with a section gap between them. */
	.woocommerce-account .u-columns.col2-set .u-column2 {
		margin-top: 48px;
	}
}
