/*
 * WooCommerce styling for Crystal Rose Publishing.
 *
 * Loaded only on WooCommerce pages (see crystal_rose_assets() in
 * functions.php). Covers the three surfaces theme.json cannot reach:
 *
 *   1. Woo's block cart/checkout, which ship their own component CSS.
 *   2. My Account, which has no block template — it renders through Woo's
 *      legacy templates, so it is styled by targeting that markup directly.
 *   3. Notices, forms, and the product gallery.
 *
 * All colour and spacing values come from theme.json custom properties, so
 * changing the brand in one place still changes it everywhere.
 */

/* -------------------------------------------------------------------------
   1. Shop archive — product cards
   ---------------------------------------------------------------------- */

.wc-block-product-template,
.products.columns-3,
.products.columns-4 {
	gap: var(--wp--preset--spacing--30);
}

.wc-block-product,
li.product {
	position: relative;
}

.wc-block-components-product-image img,
li.product img {
	border-radius: 3px 10px 10px 3px;
	box-shadow: var(--wp--preset--shadow--soft);
	transition: box-shadow var(--wp--custom--transition--base),
		transform var(--wp--custom--transition--base);
}

.wc-block-product:hover .wc-block-components-product-image img,
li.product:hover img {
	box-shadow: var(--wp--preset--shadow--book);
	transform: translateY(-4px);
}

.wc-block-components-product-title,
li.product .woocommerce-loop-product__title {
	font-family: var(--wp--preset--font-family--heading) !important;
	font-size: var(--wp--preset--font-size--large) !important;
	font-weight: 500 !important;
	line-height: 1.25 !important;
	color: var(--wp--preset--color--ink);
}

.wc-block-components-product-title a,
li.product a {
	text-decoration: none;
}

.wc-block-components-product-price,
li.product .price {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	color: var(--wp--preset--color--ink);
}

/* Archive cart control (crystal-rose/product-cart-control). Adding and
   viewing are separate actions, so the state is never ambiguous. */
.cr-pcc {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

.cr-pcc__primary {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--base);
	border-radius: 999px;
	padding: 0.8rem 1.7rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.03em;
	text-decoration: none;
	transition: background-color var(--wp--custom--transition--base),
		transform var(--wp--custom--transition--base);
}

.cr-pcc__primary:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
	transform: translateY(-1px);
}

.cr-pcc__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: 0 0.35rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.22);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

.cr-pcc__secondary {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--forest);
	text-decoration: none;
	border-bottom: 1px solid rgba(44, 97, 63, 0.35);
	padding-bottom: 1px;
}

.cr-pcc__secondary:hover {
	border-bottom-color: currentColor;
}

.cr-pcc--oos {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--gray);
	text-align: center;
}

/* Woo's default "sale" flash is a harsh circle; make it a quiet pill. */
.wc-block-components-product-sale-badge,
span.onsale {
	background: var(--wp--preset--color--forest) !important;
	color: var(--wp--preset--color--base) !important;
	border-radius: 999px !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: var(--wp--preset--font-size--x-small) !important;
	font-weight: 700 !important;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.3rem 0.75rem !important;
	min-height: 0 !important;
	min-width: 0 !important;
	line-height: 1.4 !important;
}

/* -------------------------------------------------------------------------
   2. Single product — the book page
   ---------------------------------------------------------------------- */

.woocommerce div.product .woocommerce-product-gallery__image img,
.wp-block-woocommerce-product-image-gallery img {
	border-radius: 3px 12px 12px 3px;
	box-shadow: var(--wp--preset--shadow--book);
}

.woocommerce div.product .woocommerce-product-gallery__wrapper {
	margin: 0;
}

/* Gallery thumbnails sit as a quiet row beneath the cover. */
.woocommerce div.product .flex-control-thumbs {
	display: flex;
	gap: 0.6rem;
	margin-top: 1rem;
	padding: 0;
	list-style: none;
}

.woocommerce div.product .flex-control-thumbs li {
	width: auto;
	flex: 0 0 auto;
	margin: 0;
}

.woocommerce div.product .flex-control-thumbs img {
	width: 68px;
	height: 68px;
	object-fit: cover;
	border-radius: 8px;
	box-shadow: none;
	opacity: 0.6;
	cursor: pointer;
	transition: opacity var(--wp--custom--transition--base);
}

.woocommerce div.product .flex-control-thumbs img:hover,
.woocommerce div.product .flex-control-thumbs img.flex-active {
	opacity: 1;
}

/* Price.
   The product-price block renders an inner .wc-block-components-product-price
   that carries Woo's own font sizing, so the outer wrapper alone is not
   enough — both need the rule. */
.woocommerce div.product p.price,
.woocommerce div.product span.price,
.wp-block-woocommerce-product-price,
.wp-block-woocommerce-product-price .wc-block-components-product-price,
.wp-block-woocommerce-product-price .wc-block-components-product-price__value {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 500;
	line-height: 1.2;
	color: var(--wp--preset--color--ink);
}

/* Inside product cards and the cart the price must stay at body scale. */
.wc-block-product .wc-block-components-product-price,
.wc-block-cart-item__total .wc-block-components-product-price,
.wc-block-components-order-summary-item .wc-block-components-product-price {
	font-size: var(--wp--preset--font-size--medium);
}

.woocommerce div.product p.price del {
	color: var(--wp--preset--color--gray);
	font-size: 0.7em;
	opacity: 0.8;
}

/* Quantity + add to cart */
.woocommerce div.product form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin: var(--wp--preset--spacing--20) 0;
}

/* Quantity stepper — same pill as the block cart, shared by the single-product
   form and the buy controls on the editorial pages (.cr-buy--form), which use
   Woo's own .quantity > input.qty markup for exactly this reason.
   .cr-qty is added by assets/js/quantity.js, which also injects the buttons;
   the un-enhanced .quantity fallback is styled first. */
.woocommerce .quantity input.qty,
.cr-buy--form .quantity input.qty {
	width: 5.5rem;
	padding: 0.8rem 0.5rem;
	text-align: center;
	border: 1.5px solid rgba(74, 78, 82, 0.22);
	border-radius: 8px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
}

.woocommerce .quantity.cr-qty,
.cr-buy--form .quantity.cr-qty {
	display: grid;
	grid-template-columns: 2.25rem minmax(2.25rem, 1fr) 2.25rem;
	align-items: stretch;
	width: 7.75rem;
	margin: 0;
	background: var(--wp--preset--color--base);
	border: 1.5px solid rgba(74, 78, 82, 0.22);
	border-radius: 999px;
	overflow: hidden;
}

.woocommerce .quantity.cr-qty input.qty,
.cr-buy--form .quantity.cr-qty input.qty {
	grid-column: 2;
	width: 100% !important;
	min-width: 0;
	padding: 0.5rem 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	text-align: center;
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	line-height: 1.4;
	-moz-appearance: textfield;
	appearance: textfield;
}

.woocommerce .quantity.cr-qty input.qty:focus,
.cr-buy--form .quantity.cr-qty input.qty:focus {
	outline: 2px solid var(--wp--preset--color--forest);
	outline-offset: -2px;
}

.woocommerce .quantity.cr-qty input.qty::-webkit-outer-spin-button,
.woocommerce .quantity.cr-qty input.qty::-webkit-inner-spin-button,
.cr-buy--form .quantity.cr-qty input.qty::-webkit-outer-spin-button,
.cr-buy--form .quantity.cr-qty input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.cr-qty__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.15rem;
	line-height: 1;
	opacity: 0.65;
	cursor: pointer;
	transition: opacity var(--wp--custom--transition--base),
		background-color var(--wp--custom--transition--base);
}

.cr-qty__button--minus {
	grid-column: 1;
}

.cr-qty__button--plus {
	grid-column: 3;
}

.cr-qty__button:hover:not(:disabled) {
	opacity: 1;
	background: var(--wp--preset--color--shell);
	color: var(--wp--preset--color--forest);
}

.cr-qty__button:disabled {
	opacity: 0.28;
	cursor: not-allowed;
}

.woocommerce div.product form.cart .button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--base);
	border: 0;
	border-radius: 999px;
	padding: 0.9rem 1.9rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.03em;
	line-height: 1.2;
	text-transform: none;
	transition: background-color var(--wp--custom--transition--base),
		transform var(--wp--custom--transition--base);
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce div.product form.cart .button:hover,
.woocommerce #respond input#submit:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
	transform: translateY(-1px);
}

.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background: var(--wp--preset--color--forest);
}

/* Secondary/greyed buttons keep the shape but drop the fill. */
.woocommerce a.button.wc-backward {
	background: transparent;
	color: var(--wp--preset--color--forest);
	border: 1.5px solid var(--wp--preset--color--forest);
}

.woocommerce a.button.wc-backward:hover {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--base);
}

/* Product meta (SKU, category) reads as fine print, not body copy. */
.woocommerce div.product .product_meta {
	margin-top: var(--wp--preset--spacing--20);
	padding-top: var(--wp--preset--spacing--20);
	border-top: var(--wp--custom--rule--hairline);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wp--preset--color--gray);
}

.woocommerce div.product .product_meta > span {
	display: block;
	margin-bottom: 0.3rem;
}

/* Tabs */
.woocommerce div.product .woocommerce-tabs ul.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0;
	margin: 0 0 var(--wp--preset--spacing--30);
	border-bottom: var(--wp--custom--rule--hairline);
}

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

.woocommerce div.product .woocommerce-tabs ul.tabs li {
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a {
	display: block;
	padding: 0.7rem 1.1rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--gray);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a,
.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
	color: var(--wp--preset--color--forest);
	border-bottom-color: var(--wp--preset--color--forest);
}

.woocommerce div.product .woocommerce-tabs .panel > h2:first-child {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

/* -------------------------------------------------------------------------
   3. Notices
   ---------------------------------------------------------------------- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
	border-radius: 10px !important;
	border: 0 !important;
	border-left: 3px solid var(--wp--preset--color--forest) !important;
	background: var(--wp--preset--color--shell) !important;
	color: var(--wp--preset--color--ink) !important;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	padding: 1rem 1.25rem !important;
	box-shadow: none !important;
}

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

.woocommerce-error,
.wc-block-components-notice-banner.is-error {
	border-left-color: #a4341f !important;
	background: #fdf3f1 !important;
}

.woocommerce-error::before {
	color: #a4341f;
}

.wc-block-components-notice-banner > svg {
	fill: var(--wp--preset--color--forest);
}

.wc-block-components-notice-banner.is-error > svg {
	fill: #a4341f;
}

/* -------------------------------------------------------------------------
   4. Block cart and checkout
   ---------------------------------------------------------------------- */

.wc-block-components-title,
.wc-block-cart__totals-title,
.wc-block-components-order-summary__title {
	font-family: var(--wp--preset--font-family--heading) !important;
	font-weight: 500 !important;
	color: var(--wp--preset--color--ink) !important;
}

/* -----------------------------------------------------------------
   The subtotal, said twice

   Once under the product table, where someone has just finished
   changing quantities and wants to know what that came to, and once
   beside "Cart totals", where the eye lands next. Both are written
   by assets/js/cart-subtotal.js off Woo's own data store, because
   the block cart re-renders on every quantity change without a page
   load. Neither exists without JavaScript, and the order summary's
   own subtotal row is untouched, so nothing is lost if it fails.
   ----------------------------------------------------------------- */

.cr-cart-subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
	margin-top: var(--wp--preset--spacing--20);
	padding-top: var(--wp--preset--spacing--20);
	border-top: 2px solid var(--wp--preset--color--cream);
}

.cr-cart-subtotal__label {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--gray);
}

.cr-cart-subtotal__amount {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	color: var(--wp--preset--color--ink);
}

/* The heading is a plain <h2>; the amount is pushed to its far edge. */
.wc-block-cart__totals-title.has-cr-subtotal {
	display: flex !important;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
}

.cr-totals-subtotal {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none;
	color: var(--wp--preset--color--ink);
}

.wc-block-cart-item__product-name a,
.wc-block-components-product-name {
	font-family: var(--wp--preset--font-family--heading) !important;
	font-size: var(--wp--preset--font-size--large) !important;
	font-weight: 500 !important;
	color: var(--wp--preset--color--ink) !important;
	text-decoration: none;
}

.wc-block-cart-item__image img,
.wc-block-components-order-summary-item__image img {
	border-radius: 2px 6px 6px 2px;
	box-shadow: var(--wp--preset--shadow--soft);
}

/* -------------------------------------------------------------------------
   4a. Cart line item — quantity stepper and remove control

   Woo's DOM order is input, minus, plus, then a separate remove button. The
   theme's global number-input rule (width:100%, padding, border) breaks the
   stepper's layout, so the whole group is rebuilt here as an explicit grid
   with the trash control set apart from it.
   ---------------------------------------------------------------------- */

.wc-block-cart-item__quantity {
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

.wc-block-components-quantity-selector {
	display: grid;
	grid-template-columns: 2.25rem minmax(2.25rem, 1fr) 2.25rem;
	align-items: stretch;
	width: 7.75rem;
	min-width: 0;
	margin: 0;
	background: var(--wp--preset--color--base);
	border: 1.5px solid rgba(74, 78, 82, 0.22);
	border-radius: 999px;
	overflow: hidden;
}

/* Woo places the input first in the DOM; put it back in the middle. */
.wc-block-components-quantity-selector__input {
	grid-column: 2;
	grid-row: 1;
	width: 100% !important;
	min-width: 0;
	padding: 0.5rem 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	text-align: center;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	line-height: 1.4;
	-moz-appearance: textfield;
	appearance: textfield;
}

.wc-block-components-quantity-selector__input:focus {
	box-shadow: none !important;
	outline: 2px solid var(--wp--preset--color--forest);
	outline-offset: -2px;
}

/* Hide the native spinners; the −/+ buttons are the control. */
.wc-block-components-quantity-selector__input::-webkit-outer-spin-button,
.wc-block-components-quantity-selector__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.wc-block-components-quantity-selector__button {
	grid-row: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.15rem;
	line-height: 1;
	opacity: 0.65;
	cursor: pointer;
	transition: opacity var(--wp--custom--transition--base),
		background-color var(--wp--custom--transition--base);
}

.wc-block-components-quantity-selector__button--minus {
	grid-column: 1;
}

.wc-block-components-quantity-selector__button--plus {
	grid-column: 3;
}

.wc-block-components-quantity-selector__button:hover:not(:disabled) {
	opacity: 1;
	background: var(--wp--preset--color--shell);
	color: var(--wp--preset--color--forest);
}

.wc-block-components-quantity-selector__button:disabled {
	opacity: 0.28;
	cursor: not-allowed;
}

/* Remove control: a quiet icon button, clearly separate from the stepper. */
.wc-block-cart-item__remove-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	flex: 0 0 auto;
	padding: 0;
	margin: 0 !important;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--gray);
	text-decoration: none !important;
	font-size: 0 !important;
	cursor: pointer;
	transition: color var(--wp--custom--transition--base),
		background-color var(--wp--custom--transition--base);
}

.wc-block-cart-item__remove-link svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
	display: block;
}

.wc-block-cart-item__remove-link:hover {
	background: #fdf3f1;
	color: #a4341f;
}

/* -------------------------------------------------------------------------
   4b. Order summary line (cart sidebar and checkout)

   Requested layout: image · title + unit price · quantity · line total.
   The quantity lives inside the image wrapper in Woo's markup, so the
   wrapper is set to `display: contents` to hoist both children into the
   flex row, where they can be ordered freely.
   ---------------------------------------------------------------------- */

/* An explicit three-column grid. Woo's own layout here is a grid, so `order`
   on flex children had no effect, and `display: contents` on the image wrapper
   was overridden — so rather than hoisting the quantity out, it stays in the
   first column and is stacked directly beneath the cover, which reads clearly:

     [cover ]  [title + unit price]  [line total]
     [  x2  ]
*/
.wc-block-components-order-summary-item {
	display: grid !important;
	grid-template-columns: 56px minmax(0, 1fr) auto;
	column-gap: 0.85rem;
	align-items: start;
	padding-block: 1rem;
}

.wc-block-components-order-summary-item::after {
	display: none;
}

/* Column 1: cover with the quantity beneath it, both centred. */
.wc-block-components-order-summary-item__image {
	grid-column: 1;
	grid-row: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	position: static;
	width: 56px;
	margin: 0;
}

.wc-block-components-order-summary-item__image img {
	width: 56px !important;
	height: auto !important;
	max-width: 56px;
	margin: 0;
	border-radius: 2px 6px 6px 2px;
	box-shadow: var(--wp--preset--shadow--soft);
	order: 1;
}

.wc-block-components-order-summary-item__description {
	grid-column: 2;
	grid-row: 1;
	min-width: 0;
}

/* Quantity: taken out of its absolute overlay and set below the cover. */
.wc-block-components-order-summary-item__quantity {
	order: 2;
	position: static !important;
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	width: auto !important;
	height: auto !important;
	min-width: 0;
	margin: 0 !important;
	padding: 0.2rem 0.6rem;
	border: 0 !important;
	border-radius: 999px;
	background: var(--wp--preset--color--shell);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	line-height: 1.5;
	box-shadow: none;
	white-space: nowrap;
}

/* "Qty 2" reads unambiguously; a bare "× 2" was easy to miss. */
.wc-block-components-order-summary-item__quantity::before {
	content: "Qty ";
	margin-right: 0.1rem;
	font-weight: 600;
	opacity: 0.65;
}

.wc-block-components-order-summary-item__total-price {
	grid-column: 3;
	grid-row: 1;
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	color: var(--wp--preset--color--ink);
	white-space: nowrap;
}

/* The product blurb is redundant at the point of payment. */
.wc-block-components-order-summary-item .wc-block-components-product-metadata__description,
.wc-block-components-order-summary-item .wc-block-components-product-details {
	display: none !important;
}

/* Title needs to read as a label here, not a heading. */
.wc-block-components-order-summary-item .wc-block-components-product-name {
	display: block;
	margin: 0 0 0.15rem;
	font-family: var(--wp--preset--font-family--heading) !important;
	font-size: var(--wp--preset--font-size--medium) !important;
	font-weight: 500 !important;
	line-height: 1.25 !important;
	color: var(--wp--preset--color--ink) !important;
}

/* Per-unit price, quieter than the line total. */
.wc-block-components-order-summary-item__individual-prices,
.wc-block-components-order-summary-item .wc-block-cart-item__prices {
	display: block;
	margin: 0;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 400 !important;
	color: var(--wp--preset--color--gray) !important;
}

/* Title reads as a compact label in the sidebar; at heading scale the long
   book name wraps to five lines. */
.wc-block-components-order-summary-item .wc-block-components-product-name {
	font-size: var(--wp--preset--font-size--small) !important;
	line-height: 1.35 !important;
}

@media (max-width: 480px) {
	.wc-block-components-order-summary-item {
		grid-template-columns: 48px minmax(0, 1fr) auto;
		column-gap: 0.7rem;
	}

	.wc-block-components-order-summary-item__image img {
		width: 48px !important;
		max-width: 48px;
	}
}

/* The totals panel becomes a card so it reads as a distinct summary.
   Padding is modest here: Woo adds its own 16px inside
   .wc-block-components-order-summary, and stacking both left a wide dead
   margin to the left of the cover thumbnail. */
.wp-block-woocommerce-cart-order-summary-block,
.wc-block-components-sidebar .wc-block-components-totals-wrapper:first-child {
	background: var(--wp--preset--color--shell);
	border-radius: 16px;
	padding: var(--wp--preset--spacing--20);
}

/* Woo's inner side padding is redundant once the panel has its own. */
.wc-block-components-order-summary,
.wc-block-components-order-summary__content {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.wc-block-components-totals-item__label {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
.wc-block-components-totals-footer-item .wc-block-formatted-money-amount {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	color: var(--wp--preset--color--ink);
}

/* Inputs inside the checkout inherit the site's field styling. */
.wc-block-components-text-input input[type="text"],
.wc-block-components-text-input input[type="email"],
.wc-block-components-text-input input[type="tel"],
.wc-block-components-text-input input[type="number"],
.wc-block-components-textarea,
.wc-blocks-components-select__select {
	border: 1.5px solid rgba(74, 78, 82, 0.22) !important;
	border-radius: 8px !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: var(--wp--preset--font-size--medium) !important;
	color: var(--wp--preset--color--ink) !important;
	background: var(--wp--preset--color--base) !important;
}

.wc-block-components-text-input.is-active label,
.wc-block-components-text-input label {
	font-family: var(--wp--preset--font-family--body) !important;
	color: var(--wp--preset--color--gray) !important;
}

.wc-block-components-text-input input:focus,
.wc-blocks-components-select__select:focus {
	border-color: var(--wp--preset--color--forest) !important;
	box-shadow: 0 0 0 3px rgba(44, 97, 63, 0.14) !important;
	outline: none !important;
}

/* Woo's own buttons inside blocks. */
.wc-block-components-button:not(.is-link) {
	background: var(--wp--preset--color--forest) !important;
	color: var(--wp--preset--color--base) !important;
	border-radius: 999px !important;
	border: 0 !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 600 !important;
	letter-spacing: 0.03em;
	padding: 0.95rem 2rem !important;
	transition: background-color var(--wp--custom--transition--base);
}

.wc-block-components-button:not(.is-link):hover {
	background: var(--wp--preset--color--ink) !important;
}

.wc-block-components-button.is-link {
	color: var(--wp--preset--color--forest) !important;
}

/* The Stripe card form copies its background colour from the first element on
   the page that has one, working down a list that runs from the payment box to
   `.wp-block-group`. Every earlier candidate is transparent, so it landed on
   the first group in the document — the green promo bar — and painted the
   whole card form green. The checkout sits on a white page, so saying so here
   gives it the right answer and changes nothing you can see. */
.wc-block-checkout {
	background-color: var(--wp--preset--color--base);
}

/* Radio/payment option cards. */
.wc-block-components-radio-control-accordion-option,
.wc-block-components-radio-control__option {
	border-radius: 10px;
}

.wc-block-components-radio-control__option--checked-option-highlighted {
	border-color: var(--wp--preset--color--forest) !important;
}

/* Empty cart */
.wp-block-woocommerce-empty-cart-block {
	text-align: center;
	padding-block: var(--wp--preset--spacing--40);
}

/* -------------------------------------------------------------------------
   5. Order confirmation
   ---------------------------------------------------------------------- */

.woocommerce-order .woocommerce-thankyou-order-received,
.wc-block-order-confirmation-status {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 500;
	color: var(--wp--preset--color--ink);
}

.woocommerce ul.order_details,
.wc-block-order-confirmation-summary {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin: var(--wp--preset--spacing--30) 0;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--shell);
	border-radius: 16px;
	list-style: none;
}

.woocommerce ul.order_details li {
	border: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--gray);
}

.woocommerce ul.order_details li strong {
	display: block;
	margin-top: 0.3rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
	color: var(--wp--preset--color--ink);
}

/* -------------------------------------------------------------------------
   6. My Account
      No block template exists for this screen, so it is styled against
      Woo's legacy markup. Visually it matches the rest of the site.
   ---------------------------------------------------------------------- */

.woocommerce-account .woocommerce {
	display: grid;
	grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
	gap: var(--wp--preset--spacing--40);
	align-items: start;
}

@media (max-width: 782px) {
	.woocommerce-account .woocommerce {
		grid-template-columns: 1fr;
		gap: var(--wp--preset--spacing--30);
	}
}

.woocommerce-account .woocommerce-MyAccount-navigation {
	width: auto;
	float: none;
	background: var(--wp--preset--color--shell);
	border-radius: 16px;
	padding: 0.5rem;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation li {
	margin: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 0.7rem 0.9rem;
	border-radius: 9px;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	transition: background-color var(--wp--custom--transition--base),
		color var(--wp--custom--transition--base);
}

.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
	background: rgba(255, 255, 255, 0.75);
	color: var(--wp--preset--color--forest);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a {
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--base);
}

.woocommerce-account .woocommerce-MyAccount-content {
	width: auto;
	float: none;
}

.woocommerce-account .woocommerce-MyAccount-content > p:first-child {
	font-size: var(--wp--preset--font-size--large);
	font-family: var(--wp--preset--font-family--heading);
	color: var(--wp--preset--color--ink);
}

/* Login / register forms sit as centred cards. */
.woocommerce-account:not(.logged-in) .woocommerce {
	display: block;
	max-width: 34rem;
	margin-inline: auto;
}

.woocommerce form.login,
.woocommerce form.register,
.woocommerce form.lost_reset_password,
.woocommerce-EditAccountForm,
.woocommerce-address-fields {
	border: 0;
	border-radius: 16px;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--shell);
	margin: 0;
}

.woocommerce form .form-row {
	padding: 0;
	margin-bottom: 1.1rem;
}

.woocommerce form .form-row label {
	margin-bottom: 0.4rem;
}

/* Order tables */
.woocommerce table.shop_table,
.woocommerce table.woocommerce-orders-table {
	border: 0;
	border-collapse: collapse;
	border-radius: 12px;
	overflow: hidden;
	font-size: var(--wp--preset--font-size--small);
}

.woocommerce table.shop_table thead th {
	background: var(--wp--preset--color--shell);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--gray);
	border: 0;
	padding: 0.9rem 1rem;
}

.woocommerce table.shop_table td,
.woocommerce table.shop_table th {
	border: 0;
	border-bottom: var(--wp--custom--rule--hairline);
	padding: 0.9rem 1rem;
}

.woocommerce table.shop_table tbody tr:last-child td {
	border-bottom: 0;
}

.woocommerce mark.order-status,
.woocommerce .woocommerce-orders-table__cell-order-status {
	background: transparent;
	color: var(--wp--preset--color--forest);
	font-weight: 600;
}

/* -------------------------------------------------------------------------
   7. Reviews
   ---------------------------------------------------------------------- */

.woocommerce #reviews #comments ol.commentlist li .comment-text {
	border: 0;
	border-radius: 14px;
	background: var(--wp--preset--color--shell);
	padding: var(--wp--preset--spacing--20);
	margin-left: 4.5rem;
}

.woocommerce #reviews #comments ol.commentlist li img.avatar {
	width: 3.4rem;
	border: 0;
	border-radius: 999px;
	padding: 0;
	background: transparent;
}

.woocommerce .star-rating span,
.woocommerce p.stars a {
	color: var(--wp--preset--color--forest);
}

/* -------------------------------------------------------------------------
   7b. Order summary — specificity overrides

   WooCommerce styles the quantity badge and cover thumbnail with descendant
   selectors, which outrank the single-class rules further up this file. These
   repeat the intent at matching specificity so the badge actually leaves its
   absolute overlay and sits beneath the cover.
   ---------------------------------------------------------------------- */

.wc-block-components-order-summary-item .wc-block-components-order-summary-item__image img {
	width: 56px !important;
	max-width: 56px !important;
	height: auto !important;
}

.wc-block-components-order-summary-item
	.wc-block-components-order-summary-item__image
	.wc-block-components-order-summary-item__quantity {
	position: static !important;
	top: auto !important;
	right: auto !important;
	left: auto !important;
	bottom: auto !important;
	transform: none !important;
	width: auto !important;
	min-width: 0 !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.15rem 0.55rem !important;
	border: 0 !important;
	border-radius: 999px !important;
	/* White chip with a hairline, so it reads as a distinct label against the
	   cream summary panel rather than dissolving into it. */
	background: var(--wp--preset--color--base) !important;
	background-color: var(--wp--preset--color--base) !important;
	border: 1px solid rgba(74, 78, 82, 0.18) !important;
	color: var(--wp--preset--color--ink) !important;
	box-shadow: none !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: 0.78rem !important;
	font-weight: 700 !important;
	line-height: 1.45 !important;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

/* The number lives in a child span that Woo colours white for its dark badge.
   Recolouring only the chip left white-on-white, so the child needs it too. */
.wc-block-components-order-summary-item
	.wc-block-components-order-summary-item__quantity > span {
	color: var(--wp--preset--color--ink) !important;
	font: inherit !important;
	background: none !important;
}

/* -------------------------------------------------------------------------
   8. Breadcrumb
   ---------------------------------------------------------------------- */

.woocommerce .woocommerce-breadcrumb {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--gray);
	margin-bottom: var(--wp--preset--spacing--20);
}

.woocommerce .woocommerce-breadcrumb a {
	color: var(--wp--preset--color--gray);
	text-decoration: none;
}

.woocommerce .woocommerce-breadcrumb a:hover {
	color: var(--wp--preset--color--forest);
}
