/*
 * Novus DNA – basket, checkout and account pages (template-parts/checkout/page.php).
 *
 * WooCommerce's Cart and Checkout blocks keep their own layout and behaviour;
 * this sets the Novus type, colours, fields and buttons, and the progress steps.
 */

.nv-commerce {
	--nv-field: #fff;
	padding-block: clamp(1.5rem, 1rem + 2vw, 2.75rem) var(--nv-section);
	background: #fff;
}

.nv-commerce .nv-container {
	max-inline-size: calc(76rem + var(--nv-gutter) * 2);
}

/* ---------------------------------------------------------------
 * Heading and steps
 * ------------------------------------------------------------- */
.nv-commerce__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	margin-block-end: clamp(1.5rem, 1rem + 2vw, 2.5rem);
	padding-block-end: 1.25rem;
	border-block-end: 1px solid var(--nv-line);
}

.nv-commerce__title {
	margin: 0;
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.1;
}

.nv-steps__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.nv-steps__item {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--nv-muted);
	font-size: 0.875rem;
	font-weight: 500;
}

/* Thin rule between steps. */
.nv-steps__item + .nv-steps__item::before {
	content: "";
	inline-size: clamp(1rem, 0.5rem + 2vw, 2.5rem);
	block-size: 1px;
	margin-inline-end: 0.25rem;
	background: var(--nv-line);
}

.nv-steps__dot {
	display: inline-grid;
	place-items: center;
	inline-size: 1.75rem;
	block-size: 1.75rem;
	border: 1px solid var(--nv-line);
	border-radius: 50%;
	font-family: var(--nv-heading);
	font-size: 0.8125rem;
	font-weight: 600;
}

.nv-steps__dot .icon {
	inline-size: 1rem;
	block-size: 1rem;
}

.nv-steps__item.is-current {
	color: var(--nv-ink);
	font-weight: 600;
}

.nv-steps__item.is-current .nv-steps__dot {
	border-color: var(--nv-ink);
	background: var(--nv-ink);
	color: #fff;
}

.nv-steps__item.is-done {
	color: var(--nv-ink);
}

.nv-steps__item.is-done .nv-steps__dot {
	border-color: #1f7a3a;
	color: #1f7a3a;
}

.nv .nv-steps__label {
	color: inherit;
	text-decoration: none;
}

.nv a.nv-steps__label:hover {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* Phones: numbers for every step, the label only for the current one. */
@media (max-width: 39.99em) {
	.nv-steps {
		inline-size: 100%;
	}

	.nv-steps__list {
		flex-wrap: nowrap;
	}

	.nv-steps__item {
		flex: 0 0 auto;
		font-size: 0.8125rem;
		white-space: nowrap;
	}

	.nv-steps__item.is-current {
		flex: 1 1 auto;
	}

	.nv-steps__item:not(.is-current) .nv-steps__label {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.nv-steps__item + .nv-steps__item::before {
		inline-size: 1rem;
	}
}

/* ---------------------------------------------------------------
 * WooCommerce blocks: type, fields, buttons
 * ------------------------------------------------------------- */
.nv-commerce .wc-block-cart,
.nv-commerce .wc-block-checkout,
.nv-commerce .woocommerce {
	color: var(--nv-text);
	font-family: var(--nv-body);
}

.nv-commerce .wp-block-woocommerce-cart.alignwide,
.nv-commerce .wp-block-woocommerce-checkout.alignwide {
	margin-inline: 0;
	max-inline-size: none;
}

.nv-commerce .wc-block-components-title,
.nv-commerce .wc-block-components-checkout-step__title,
.nv-commerce .wc-block-cart__totals-title,
.nv-commerce h2,
.nv-commerce h3 {
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-weight: 600;
	letter-spacing: -0.01em;
}

.nv-commerce .wc-block-components-checkout-step__title {
	font-size: 1.25rem;
}

.nv-commerce .wc-block-components-product-name {
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-weight: 600;
	text-decoration: none;
}

.nv-commerce .wc-block-components-product-name:hover {
	text-decoration: underline;
}

.nv-commerce .wc-block-components-product-metadata__description {
	display: none; /* The short description repeats the product page; the offer line stays. */
}

/* Fields */
.nv-commerce .wc-block-components-text-input input,
.nv-commerce .wc-block-components-text-input textarea,
.nv-commerce .wc-blocks-components-select .wc-blocks-components-select__select,
.nv-commerce .wc-block-components-combobox .wc-block-components-combobox-control input,
.nv-commerce .wc-block-components-textarea {
	border: 1px solid rgba(43, 37, 94, 0.25) !important;
	border-radius: var(--nv-radius-s) !important;
	background-color: var(--nv-field) !important;
	color: var(--nv-text) !important;
}

.nv-commerce .wc-block-components-text-input input:focus,
.nv-commerce .wc-block-components-textarea:focus,
.nv-commerce .wc-blocks-components-select .wc-blocks-components-select__select:focus {
	border-color: var(--nv-ink) !important;
	box-shadow: 0 0 0 1px var(--nv-ink) !important;
}

.nv-commerce .wc-block-components-text-input.has-error input,
.nv-commerce .wc-blocks-components-select.has-error .wc-blocks-components-select__select {
	border-color: #c4122f !important;
}

/* Choices (delivery, payment) */
.nv-commerce .wc-block-components-radio-control--highlight-checked,
.nv-commerce .wc-block-components-radio-control-accordion-option {
	border-radius: var(--nv-radius-s);
}

.nv-commerce .wc-block-components-radio-control--highlight-checked::after {
	border-radius: var(--nv-radius-s);
}

.nv-commerce .wc-block-components-radio-control__input:checked {
	border-color: var(--nv-ink);
}

.nv-commerce .wc-block-components-radio-control__input:checked::before {
	background: var(--nv-ink);
}

.nv-commerce .wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"] {
	border-radius: 0.3rem;
}

.nv-commerce .wc-block-components-checkbox .wc-block-components-checkbox__input[type="checkbox"]:checked {
	border-color: var(--nv-ink);
	background: var(--nv-ink);
}

.nv-commerce .wc-block-components-checkbox .wc-block-components-checkbox__mark {
	fill: #fff;
}

/* Buttons */
.nv-commerce .wc-block-components-button:not(.is-link),
.nv-commerce .woocommerce a.button,
.nv-commerce .woocommerce button.button,
.nv-commerce .woocommerce input.button {
	min-block-size: 3.25rem;
	border: 1.5px solid var(--nv-ink);
	border-radius: 999px;
	background: var(--nv-ink);
	color: #fff;
	font-family: var(--nv-heading);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.nv-commerce .wc-block-components-button:not(.is-link):hover,
.nv-commerce .woocommerce a.button:hover,
.nv-commerce .woocommerce button.button:hover,
.nv-commerce .woocommerce input.button:hover {
	border-color: var(--nv-ink-deep);
	background: var(--nv-ink-deep);
	color: #fff;
}

.nv-commerce .wc-block-components-button:not(.is-link):focus-visible {
	outline: 2px solid #00b5cb;
	outline-offset: 3px;
	box-shadow: none;
}

.nv-commerce .wc-block-components-button.is-link,
.nv-commerce .wc-block-components-checkout-return-to-cart-button {
	color: var(--nv-ink);
}

/* Order summary and basket totals as a panel */
.nv-commerce .wc-block-components-sidebar .wp-block-woocommerce-checkout-order-summary-block,
.nv-commerce .wc-block-cart .wc-block-components-sidebar {
	padding: 1.25rem 1.25rem 0.5rem;
	border: 0;
	border-radius: var(--nv-radius);
	background: var(--nv-paper);
}

.nv-commerce .wc-block-components-totals-wrapper {
	border-color: var(--nv-line);
}

.nv-commerce .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
.nv-commerce .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-weight: 600;
}

.nv-commerce .wc-block-components-order-summary-item__quantity {
	border-color: var(--nv-ink);
	background: var(--nv-ink);
	color: #fff;
}

/* ---------------------------------------------------------------
 * Product lines: order summary, and the basket on phones and tablets
 *
 * One grid per line: picture | name, price, saving, quantity | line total.
 * The name column takes all the room the total leaves (minmax(0, 1fr)), so
 * names wrap at spaces; the saving sits under the price instead of beside the
 * total, where it squeezed the name. display: contents lifts WooCommerce's
 * wrappers so their parts can sit in this grid.
 * ------------------------------------------------------------- */
.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row {
	display: grid;
	grid-template-columns: 3rem minmax(0, 1fr) auto;
	align-items: start;
	gap: 0 1rem;
	word-break: normal;
}

.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item {
	padding-block: 0.5rem 1rem;
}

.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row {
	grid-template-columns: 4.5rem minmax(0, 1fr) auto;
	padding-block: 1.25rem;
}

/* Picture: first column, every row. */
.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__image,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__image {
	grid-column: 1;
	grid-row: 1 / span 6;
	inline-size: auto;
	margin: 0;
	padding: 0;
}

/* Wrappers whose parts join the grid. */
.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item :is(.wc-block-components-order-summary-item__description, .wc-block-components-order-summary-item__total-price, .wc-block-cart-item__total-price-and-sale-badge-wrapper),
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row :is(.wc-block-cart-item__product, .wc-block-cart-item__wrap, .wc-block-cart-item__total, .wc-block-cart-item__total-price-and-sale-badge-wrapper) {
	display: contents;
}

/* Name, price, saving, details and quantity: second column, in that order. */
.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item :is(.wc-block-components-order-summary-item__description > *, .wc-block-components-sale-badge),
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row :is(.wc-block-cart-item__wrap > *, .wc-block-components-sale-badge) {
	grid-column: 2;
	grid-row: auto;
	min-inline-size: 0;
	margin: 0;
	padding: 0;
	order: 4;
}

.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__description > .wc-block-components-product-name,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__wrap > .wc-block-components-product-name {
	order: 1;
	padding-block-start: 0.1rem;
	font-size: 1rem;
	line-height: 1.35;
	overflow-wrap: normal;
	text-wrap: pretty;
}

.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__description > .wc-block-cart-item__prices,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__wrap > .wc-block-cart-item__prices {
	order: 2;
	margin-block-start: 0.3rem;
	font-size: 0.875rem;
	line-height: 1.45;
}

.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__total-price .wc-block-components-sale-badge,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__total .wc-block-components-sale-badge {
	order: 3;
	grid-column: 2 / -1; /* may run under the line total, so it stays on one line */
	justify-self: start;
	margin-block-start: 0.45rem;
	padding: 0.2rem 0.6rem;
}

.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__description > .wc-block-components-product-metadata,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__wrap > .wc-block-components-product-metadata {
	margin-block-start: 0.3rem;
}

/* The quantity and bin may run under the line total: at 320px the second column alone is
 * narrower than both, and the bin was squeezed to a sliver. */
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__wrap > .wc-block-cart-item__quantity {
	order: 5;
	grid-column: 2 / -1;
	flex-wrap: wrap;
	margin-block-start: 0.75rem;
}

.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-item__quantity > * {
	flex-shrink: 0;
}

/* Line total: third column, top row, never wrapped. */
.nv-commerce .wc-block-components-order-summary .wc-block-components-order-summary-item .wc-block-components-order-summary-item__total-price .wc-block-components-product-price,
.nv-commerce :is(.is-mobile, .is-small, .is-medium) table.wc-block-cart-items .wc-block-cart-items__row .wc-block-cart-item__total .wc-block-components-product-price {
	grid-column: 3;
	grid-row: 1;
	justify-self: end;
	padding-block-start: 0.15rem;
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	white-space: nowrap;
}

/* Savings ("Save £2.00 per delivery") wrap inside their own column if they must. */
.nv-commerce .wc-block-components-sale-badge {
	max-inline-size: 100%;
	padding: 0.2rem 0.55rem;
	border: 0;
	border-radius: 999px;
	background: rgba(31, 122, 58, 0.1);
	color: #1a6a32;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.35;
	text-align: start;
	text-transform: none;
	white-space: normal;
}

/* The unit price reads as one line of text ("£19.99 £17.99 every 2 months") that wraps at spaces. */
.nv-commerce .wc-block-cart-item__prices .wc-block-components-product-price {
	display: block;
}

.nv-commerce .wc-block-cart-item__prices .wc-block-components-product-price__regular {
	margin-inline-end: 0.35em;
	color: var(--nv-muted);
}

/* Wide basket (a table): the saving fits on one line under the line total. */
.nv-commerce .is-large .wc-block-cart-item__total .wc-block-components-sale-badge {
	white-space: nowrap;
}

.nv-commerce .wc-block-components-quantity-selector {
	border-radius: 999px;
}

.nv-commerce .wc-block-components-quantity-selector::after {
	border-radius: 999px;
}

/* The reassurance strip sits under the blocks. */
.nv-commerce .nv-cart-trust {
	margin-block-start: 1.5rem;
}

/* Empty basket */
.nv-commerce .wp-block-woocommerce-empty-cart-block {
	text-align: center;
}

.nv-commerce .wc-block-cart__empty-cart__title {
	color: var(--nv-ink);
	font-family: var(--nv-heading);
}

/* ---------------------------------------------------------------
 * Account (WooCommerce's classic account templates)
 * ------------------------------------------------------------- */
.nv-commerce--account .woocommerce {
	display: grid;
	gap: 2rem;
}

/* WooCommerce's clearfix pseudo-elements would take grid cells and push the menu and
 * the page apart (menu in the wide column, page squeezed into the narrow one). */
.nv-commerce--account .woocommerce::before,
.nv-commerce--account .woocommerce::after {
	content: none;
}

.nv-commerce--account .woocommerce > * {
	min-inline-size: 0;
}

@media (min-width: 60em) {
	.nv-commerce--account .woocommerce:has(.woocommerce-MyAccount-navigation) {
		grid-template-columns: 15rem minmax(0, 1fr);
		align-items: start;
	}

	.nv-commerce--account .woocommerce-MyAccount-navigation {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.nv-commerce--account .woocommerce-MyAccount-content {
		grid-column: 2;
	}
}

.nv-commerce .woocommerce-MyAccount-navigation,
.nv-commerce .woocommerce-MyAccount-content {
	float: none;
	inline-size: auto;
}

/* Section headings in account and order pages ("Subscription totals", "Billing address")
 * at the checkout's heading size rather than full page-heading size. */
.nv-commerce .woocommerce-MyAccount-content h2,
.nv-commerce .woocommerce-order h2,
.nv-commerce .woocommerce-customer-details h2 {
	margin-block: 2rem 0.75rem;
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
	line-height: 1.25;
}

/* Subscriptions: what Pause / Resume / Cancel do to the next payment (inc/subscriptions.php). */
.nv-subs-explain td {
	padding-block-start: 0;
}

.nv-subs-explain__text {
	margin: 0;
	padding: 0.75rem 0.9rem;
	border-radius: var(--nv-radius-s);
	background: var(--nv-paper);
	color: var(--nv-ink);
	font-size: 0.875rem;
	line-height: 1.5;
}

.nv-commerce .woocommerce-MyAccount-navigation ul {
	display: grid;
	gap: 0.25rem;
	margin: 0;
	padding: 0.5rem;
	border-radius: var(--nv-radius);
	background: var(--nv-paper);
	list-style: none;
}

.nv-commerce .woocommerce-MyAccount-navigation a {
	display: block;
	padding: 0.65rem 0.9rem;
	border-radius: var(--nv-radius-s);
	color: var(--nv-ink);
	font-weight: 500;
	text-decoration: none;
}

.nv-commerce .woocommerce-MyAccount-navigation .is-active a,
.nv-commerce .woocommerce-MyAccount-navigation a:hover {
	background: #fff;
}

.nv-commerce .woocommerce-MyAccount-navigation .is-active a {
	font-weight: 600;
}

/* Two-column sets (log in and register; billing and shipping addresses) as a grid
 * instead of WooCommerce's floats, so they never squeeze or overlap what follows. */
.nv-commerce .col2-set {
	display: grid;
	gap: 1.5rem 2rem;
}

@media (min-width: 48em) {
	.nv-commerce .col2-set {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.nv-commerce .col2-set::before,
.nv-commerce .col2-set::after {
	content: none; /* the clearfix would take a grid cell */
}

.nv-commerce .col2-set > .col-1,
.nv-commerce .col2-set > .col-2 {
	float: none;
	inline-size: auto;
	max-inline-size: none;
	margin: 0;
}

.nv-commerce .u-columns .u-column1,
.nv-commerce .u-columns .u-column2 {
	float: none;
	inline-size: auto;
}

.nv-commerce .woocommerce form.login,
.nv-commerce .woocommerce form.register,
.nv-commerce .woocommerce form.lost_reset_password {
	margin: 0;
	padding: clamp(1.25rem, 1rem + 1vw, 2rem);
	border: 1px solid var(--nv-line);
	border-radius: var(--nv-radius);
	background: #fff;
}

.nv-commerce .woocommerce form .input-text {
	min-block-size: 3rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid rgba(43, 37, 94, 0.25);
	border-radius: var(--nv-radius-s);
	background: #fff;
}

.nv-commerce .woocommerce form .input-text:focus {
	border-color: var(--nv-ink);
	outline: 1px solid var(--nv-ink);
}

.nv-commerce .woocommerce table.shop_table {
	border-color: var(--nv-line);
	border-radius: var(--nv-radius-s);
}

/* Order received */
.nv-commerce .woocommerce-order-overview {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
	margin: 1.5rem 0;
	padding: 1.25rem;
	border-radius: var(--nv-radius);
	background: var(--nv-paper);
	list-style: none;
}

/* WooCommerce floats these with dashed dividers and a clearfix; here they are a tidy grid. */
.nv-commerce .woocommerce ul.woocommerce-order-overview {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}

.nv-commerce .woocommerce ul.woocommerce-order-overview::before,
.nv-commerce .woocommerce ul.woocommerce-order-overview::after {
	content: none;
}

.nv-commerce .woocommerce ul.woocommerce-order-overview li {
	float: none;
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--nv-muted);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.nv-commerce .woocommerce ul.woocommerce-order-overview li strong {
	display: block;
	margin-block-start: 0.2rem;
	color: var(--nv-ink);
	font-size: 1rem;
	letter-spacing: 0;
	text-transform: none;
	overflow-wrap: anywhere; /* long email addresses */
}

.nv-commerce .woocommerce-notice--success {
	color: var(--nv-ink);
	font-family: var(--nv-heading);
	font-size: 1.125rem;
	font-weight: 600;
}

/* Order received: next steps */
.nv-next {
	margin-block-start: 2.5rem;
	padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
	border: 1px solid var(--nv-line);
	border-radius: var(--nv-radius);
}

.nv-commerce .nv-next__title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}

.nv-next__list {
	display: grid;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nv-next__list li {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
}

.nv-next__list .icon {
	flex: 0 0 auto;
	inline-size: 1.15rem;
	block-size: 1.15rem;
	margin-block-start: 0.15rem;
	color: #4e2583;
}

.nv-next__list a {
	color: var(--nv-ink);
	font-weight: 600;
}

.nv .nv-next__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-block-start: 1.5rem;
}

/* Empty basket: suggested products use the Novus buttons too. */
.nv-commerce .wp-block-button__link,
.nv-commerce .wc-block-components-product-button__button {
	border: 1.5px solid var(--nv-ink);
	border-radius: 999px;
	background: var(--nv-ink);
	color: #fff;
	font-family: var(--nv-heading);
	font-weight: 600;
}

.nv-commerce .wp-block-button__link:hover,
.nv-commerce .wc-block-components-product-button__button:hover {
	background: var(--nv-ink-deep);
	color: #fff;
}

/* Show-password button: at least a 24px target (WCAG 2.2). */
.nv-commerce .woocommerce form .show-password-input {
	min-inline-size: 2rem;
	min-block-size: 2rem;
}
