/**
 * Wareoff Distribution Theme: cart, checkout and order pages (0.5.0).
 *
 * These pages keep the plugin's own forms and markup, so an order placed in
 * the website is the same as one placed in the plugin's app (Phase 0: "restyled
 * on the plugin's forms"). This file only adjusts how that markup sits in the
 * theme's frame. Loaded on portal pages the theme draws (surface
 * "portal-theme"), after the plugin's portal.css. Every rule is scoped to
 * .wot-portal, so the plugin's app layout (staff) is untouched.
 */

/* Page header with the Cart → Checkout → Confirmation bar ------------------- */
.wot-portal__header--steps {
	display: grid;
	gap: var(--wot-space-4);
}

.wot-portal__header--steps .wot-steps {
	max-width: 34rem;
}

@media (min-width: 1024px) {
	.wot-portal__header--steps {
		grid-template-columns: auto minmax(0, 34rem);
		justify-content: space-between;
		align-items: center;
	}
}

/* Back links sit close under the heading. */
.wot-portal .wot-portal__content > .wds-toolbar:first-child,
.wot-portal .wot-portal__content > p.wds-toolbar:first-child {
	margin-top: calc(-1 * var(--wot-space-3));
}

/* Order summaries stay in view below the website's sticky header. */
.wot-portal .wds-cart__summary,
.wot-portal .wds-checkout__summary {
	top: calc(var(--wot-header-height) + var(--wot-space-4));
}

/* The main action of each summary. */
.wot-portal .wds-cart__summary .wds-button--block,
.wot-portal .wds-checkout__summary .wds-button--block {
	min-height: 3rem;
	font-size: var(--wot-text-lg);
}

.wot-portal .wds-totals__total {
	font-size: var(--wot-text-lg);
}

/* Narrow screens: the cart, then its summary with the Checkout button, then
   Quick add; checkout keeps the address and payment choices before "Your
   order" and Place order. */
@media (max-width: 1024px) {
	.wot-portal .wds-cart {
		display: flex;
		flex-direction: column;
		gap: var(--wds-space-4);
	}

	.wot-portal .wds-cart > .wds-stack {
		display: contents;
	}

	.wot-portal .wds-cart [aria-labelledby="wds-cart-lines"] {
		order: 1;
	}

	/* Outranks the plugin's own narrow-screen rule for this column. */
	.wot-portal .wds-columns--wide.wds-cart > .wds-cart__summary:last-child {
		position: static;
		order: 2;
	}

	.wot-portal .wds-cart [aria-labelledby="wds-cart-pad"] {
		order: 3;
	}

	.wot-portal .wds-checkout > .wds-stack {
		order: 1;
	}

	.wot-portal .wds-columns--wide.wds-checkout > .wds-checkout__summary:last-child {
		position: static;
		order: 2;
	}
}

/* Choices (delivery address, way to pay) ------------------------------------ */
.wot-portal .wds-choice {
	padding: var(--wot-space-4);
	border-radius: var(--wot-radius-control);
	transition: border-color var(--wot-duration) var(--wot-ease), background-color var(--wot-duration) var(--wot-ease);
}

.wot-portal .wds-choice:hover {
	border-color: var(--wot-color-primary);
}

.wot-portal .wds-choice input[type="radio"] {
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.1rem;
	accent-color: var(--wot-color-primary);
}

.wot-portal .wds-choice:has(input:checked) {
	box-shadow: inset 0 0 0 1px var(--wot-color-primary);
}

.wot-portal input[type="checkbox"] {
	accent-color: var(--wot-color-primary);
}

/* A labelled tick box is at least 24px, the WCAG 2.2 target size (0.6.0). */
.wot-portal .wds-check input[type="checkbox"] {
	flex: none;
	width: 1.5rem;
	height: 1.5rem;
	margin: 0;
}

/* Cart lines --------------------------------------------------------------- */
.wot-portal .wds-cart__table .wds-row--warn td {
	background: var(--wot-warning-soft);
}

.wot-portal .wds-qty {
	display: flex;
	gap: var(--wot-space-2);
	align-items: center;
}
