/**
 * wwh/cart — SHOP.md S3.3.
 *
 * Colour is inherited throughout so the basket works on the cream page
 * background it ships on, and would survive being placed on a dark section.
 * Same reasoning as artwork-sale-status.
 */

.wwh-cart {
	max-width: 60rem;
	margin-inline: auto;
}

/* The site's standard 16px side gutter wherever the basket would otherwise
   touch the screen edge (TONITE decision 22, core 2.101.0): at 390px the
   line items, subtotal and the details form ran edge to edge. */
@media (max-width: 62rem) {
	.wwh-cart {
		box-sizing: border-box;
		padding-inline: 16px;
	}
}

.wwh-cart__heading {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-section);
	margin: 0 0 1.5rem;
}

.wwh-cart__notices {
	margin: 0 0 1.5rem;
	padding: 0.9rem 1.1rem;
	border-left: 3px solid var(--wp--preset--color--brand-text);
	background: var(--wp--preset--color--warm-cream-2);
}

.wwh-cart__notice {
	margin: 0;
	font-size: var(--wp--preset--font-size--caption, 0.9rem);
}

.wwh-cart__notice + .wwh-cart__notice {
	margin-top: 0.4rem;
}

/* --- Lines --- */

.wwh-cart__lines {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.wwh-cart__line {
	display: grid;
	grid-template-columns: 5rem 1fr auto auto auto;
	gap: 1rem;
	align-items: center;
	padding: 1.1rem 0;
	border-bottom: 1px solid color-mix(in srgb, currentColor 18%, transparent);
	transition: opacity 0.15s ease;
}

.wwh-cart__line.is-busy {
	opacity: 0.5;
	pointer-events: none;
}

.wwh-cart__media img {
	display: block;
	width: 5rem;
	height: 5rem;
	object-fit: cover;
}

.wwh-cart__title {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.15rem;
	color: inherit;
	text-decoration: none;
}

.wwh-cart__title:hover {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* How a sold artwork leaves (core 2.113.0). Full colour: it is information the
   buyer needs, not a label. */
.wwh-cart__leave {
	margin: 0.3rem 0 0;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.4;
	max-width: 42ch;
}

.wwh-cart__kind,
.wwh-cart__unit {
	margin: 0.15rem 0 0;
	font-size: var(--wp--preset--font-size--micro, 0.78rem);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.7;
}

.wwh-cart__unit {
	text-transform: none;
	letter-spacing: 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
}

.wwh-cart__qty-input {
	width: 4.5rem;
	padding: 0.5rem;
	font: inherit;
	text-align: center;
	color: inherit;
	background: transparent;
	border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
}

.wwh-cart__qty-fixed {
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	opacity: 0.7;
}

.wwh-cart__total {
	min-width: 5.5rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.wwh-cart__remove-btn {
	width: 2rem;
	height: 2rem;
	font-size: 1.3rem;
	line-height: 1;
	color: inherit;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 50%;
	cursor: pointer;
	/* 0.6 measured 4.35:1 on the cream panel — below the 4.5:1 AA floor, and
	   the × is small text, so the large-text allowance doesn't apply. 0.75
	   gives 6.94:1 and still reads as secondary to the item it removes. */
	opacity: 0.75;
}

.wwh-cart__remove-btn:hover,
.wwh-cart__remove-btn:focus-visible {
	opacity: 1;
	border-color: color-mix(in srgb, currentColor 35%, transparent);
}

/* A border colour alone is not a visible focus indicator — it is nearly
   invisible against the panel and disappears entirely in forced-colours mode.
   WCAG 2.4.7 wants focus to be unmistakable. */
.wwh-cart__remove-btn:focus-visible,
.wwh-cart__qty-input:focus-visible,
.wwh-cart__checkout:focus-visible,
.wwh-cart__empty-links a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* --- Foot --- */

.wwh-cart__foot {
	margin-top: 1.75rem;
	text-align: right;
}

.wwh-cart__subtotal {
	display: flex;
	justify-content: flex-end;
	align-items: baseline;
	gap: 1rem;
	margin: 0;
}

.wwh-cart__subtotal-lab {
	font-size: var(--wp--preset--font-size--micro, 0.78rem);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	opacity: 0.7;
}

.wwh-cart__subtotal-val {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--display-section);
	font-variant-numeric: tabular-nums;
}

.wwh-cart__gst,
.wwh-cart__secure {
	margin: 0.35rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	font-style: italic;
	opacity: 0.75;
}

.wwh-cart__checkout {
	margin-top: 1rem;
	padding: 0.95rem 2.4rem;
	font: 600 1rem/1 inherit;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--warm-cream);
	background: var(--wp--preset--color--ink-primary);
	border: 1px solid var(--wp--preset--color--ink-primary);
	border-radius: 999px;
	cursor: pointer;
}

.wwh-cart__checkout:hover:not(:disabled) {
	background: var(--wp--preset--color--brand-text);
	border-color: var(--wp--preset--color--brand-text);
}

.wwh-cart__checkout:disabled,
.wwh-cart__checkout.is-loading {
	opacity: 0.65;
	cursor: progress;
}

.wwh-cart__error {
	margin: 0.6rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	color: var(--wp--preset--color--event-soldout, #5e2a1f);
}

/* Ordering paused (Settings → Waterwheel Features → Shop ordering).
   Sits where the Checkout button would be, so it carries more weight than the
   caption-sized notices above — it is the answer to "why can't I buy this?",
   not a footnote. Uses the same warm tone as the admin screen's restricted-row
   highlight rather than an error red: nothing has gone wrong. */
.wwh-cart__paused {
	margin: 1rem 0 0;
	padding: 0.9rem 1rem;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	line-height: 1.5;
	color: var(--wp--preset--color--ink-primary, #1A1613);
	background: var(--wp--preset--color--warm-cream-2, #E9E4DB);
	border-left: 3px solid var(--wp--preset--color--brand-text, #8F632F);
	border-radius: 2px;
}

/* --- Empty --- */

.wwh-cart__empty {
	padding: 2.5rem 0;
	text-align: center;
}

.wwh-cart__empty-links a {
	color: inherit;
}

/* --- Narrow --- */

@media (max-width: 782px) {
	.wwh-cart__line {
		/* Media and remove stay on the outside edges; detail spans, with qty
		   and total tucked beneath it. Keeps the row scannable at 390px
		   without a horizontal scroll. */
		grid-template-columns: 4rem 1fr auto;
		grid-template-areas:
			"media detail remove"
			"media qty    total";
		gap: 0.5rem 0.9rem;
	}

	.wwh-cart__media  { grid-area: media; }
	.wwh-cart__detail { grid-area: detail; }
	.wwh-cart__qty    { grid-area: qty; }
	.wwh-cart__total  { grid-area: total; }
	.wwh-cart__remove { grid-area: remove; justify-self: end; }

	.wwh-cart__media img {
		width: 4rem;
		height: 4rem;
	}
}

/* --- Buyer identity (S3.11) ---
   The foot is text-align:right for the totals; a form of labelled fields has
   to opt back out or every label floats away from its input. */

.wwh-cart__identity {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--rule, rgba(36, 24, 35, 0.15));
	text-align: left;
}

.wwh-cart__identity-heading {
	margin: 0 0 0.35rem;
	font-size: var(--wp--preset--font-size--medium, 1.125rem);
}

.wwh-cart__identity-intro {
	margin: 0 0 1rem;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	opacity: 0.8;
}

.wwh-cart__field {
	margin: 0 0 0.9rem;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.wwh-cart__field label {
	font-weight: 600;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
}

.wwh-cart__field input[type="text"],
.wwh-cart__field input[type="email"],
.wwh-cart__field input[type="tel"] {
	padding: 0.7rem 0.85rem;
	font: inherit;
	color: inherit;
	background: var(--wp--preset--color--warm-cream, #fff);
	border: 1px solid var(--wp--preset--color--rule, rgba(36, 24, 35, 0.3));
	border-radius: 4px;
	/* 16px min stops iOS Safari zooming the viewport on focus, which on a
	   checkout form reads as the page jumping away mid-purchase. */
	font-size: max(1rem, 16px);
}

.wwh-cart__field input:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

/* Checkbox sits inline with its label rather than stacked. */
.wwh-cart__field--check {
	flex-direction: row;
	align-items: flex-start;
}

.wwh-cart__field--check label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	font-weight: 400;
}

.wwh-cart__req {
	color: var(--wp--preset--color--event-soldout, #5e2a1f);
}

.wwh-cart__hint {
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	opacity: 0.75;
}

.wwh-cart__verify {
	margin-top: 0.35rem;
	padding: 0.85rem 2rem;
	font: 600 1rem/1 inherit;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--warm-cream);
	background: var(--wp--preset--color--ink-primary);
	border: 1px solid var(--wp--preset--color--ink-primary);
	border-radius: 999px;
	cursor: pointer;
	/* Comfortably above the 44px WCAG 2.5.5 target on touch. */
	min-height: 44px;
}

.wwh-cart__verify:hover:not(:disabled) {
	background: var(--wp--preset--color--brand-text);
	border-color: var(--wp--preset--color--brand-text);
}

.wwh-cart__verify:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.wwh-cart__verify:disabled,
.wwh-cart__verify.is-loading {
	opacity: 0.65;
	cursor: progress;
}

.wwh-cart__verify-status {
	margin: 0.7rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
}

.wwh-cart__verify-status.is-error,
.wwh-cart__buyer-error {
	color: var(--wp--preset--color--event-soldout, #5e2a1f);
	font-weight: 600;
}

.wwh-cart__buyer-error {
	margin: 0.6rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
}

.wwh-cart__verified-note {
	margin: 0.6rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
	font-weight: 600;
}

.wwh-cart__buyer-known {
	margin: 1rem 0 0;
	font-size: var(--wp--preset--font-size--caption, 0.875rem);
}

/* A link-styled button: it is a real <button> because it changes state rather
   than navigating, but it should not compete with Checkout for attention. */
.wwh-cart__buyer-change {
	padding: 0;
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

.wwh-cart__buyer-change:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* The foot right-aligns totals; once the identity form is present the trailing
   reassurance line belongs with the form it reassures about, not floated off
   to the right away from the button. */
.wwh-cart__identity ~ .wwh-cart__secure {
	text-align: left;
}
