/**
 * Basket - the Factory Fresh cart page.
 *
 * Same token system as the shop grid and the PDP (aliased from cw-tokens.css
 * with literal fallbacks, the established convention) - the basket must read
 * as the step between those two surfaces, not a third interpretation.
 *
 * Scoped under .cwct throughout: this renders inside the real chrome, which
 * carries Bricks' @layer sheet and WooCommerce's stylesheet, so bare class
 * names would collide in both directions.
 */

.cwct {
	--ct-lime: var(--cw-lime, #80bc00);
	--ct-lime-deep: var(--cw-lime-deep, #5f8c00);
	--ct-lime-dark: var(--cw-lime-dark, #4c7000);
	--ct-lime-wash: var(--cw-lime-wash, #f3f9e4);
	--ct-lime-row: var(--cw-lime-row, #f9fcf0);
	--ct-olive: var(--cw-olive, #16210a);
	--ct-ink: var(--cw-ink, #263238);
	--ct-ink-2: var(--cw-ink-2, #52575a);
	--ct-grey: var(--cw-grey, #6b6b6b);
	--ct-faint: var(--cw-faint, #9a9a94);
	--ct-ground: var(--cw-ground, #f7f7f5);
	--ct-card: var(--cw-card, #fff);
	--ct-line: var(--cw-line, #e7e5df);
	--ct-line-2: var(--cw-line-2, #d6d3ca);
	--ct-amber: var(--cw-amber, #9a6414);
	--ct-amber-tint: var(--cw-amber-tint, #fdf4e6);
	--ct-brick: var(--cw-brick, #a3372c);
	--ct-brick-tint: var(--cw-brick-tint, #fbeeec);

	background: var(--ct-ground);
	color: var(--ct-ink);
	font-family: system-ui, -apple-system, "Segoe UI", roboto, sans-serif;
	font-size: 14.5px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.cwct *,
.cwct *::before,
.cwct *::after {
	box-sizing: border-box;
}

/*
 * The hidden attribute must ALWAYS win (same bug-class as the shop grid: any
 * component display rule outranks the UA stylesheet's display:none).
 */
.cwct [hidden] {
	display: none !important;
}

.cwct a {
	color: inherit;
	text-decoration: none;
}

.cwct button {
	font-family: inherit;
	cursor: pointer;
}

.cwct :focus-visible {
	outline: 3px solid rgba(128, 188, 0, 0.55);
	outline-offset: 2px;
	border-radius: 4px;
}

.cwct-num,
.cwct .woocommerce-Price-amount {
	font-variant-numeric: tabular-nums;
}

.cwct-wrap {
	max-width: 1160px;
	margin: 0 auto;
	padding: 0 20px;
}

.cwct-main {
	padding-top: 26px;
	padding-bottom: 60px;
}

/*
 * The `body.cwpr-page-cart` prefix is load-bearing, not decoration - the same
 * trap the store locator hit: our own child theme carries a deliberate
 * `body.page h1 { display: none }` (suppressing Bricks' automatic page
 * titles), and a code-built page is body.page too. WooCommerce's own
 * `body.woocommerce-page h1 { display: block }` exception in the same sheet
 * would ALSO re-show it here, but relying on WC body classes surviving every
 * plugin/theme change is exactly the kind of quiet dependency that breaks -
 * so the opt-out is owned explicitly at (0,2,1), which beats both (0,1,1)
 * rules regardless.
 */
body.cwpr-page-cart .cwct-title {
	display: block;
	margin: 0;
	font-size: 26px;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.01em;
	color: var(--cw-ink, #263238);
}

@media (min-width: 700px) {
	body.cwpr-page-cart .cwct-title {
		font-size: 30px;
	}
}

/*
 * The site stylesheet sets body { overflow-x: hidden }, which turns body into
 * a scroll container and silently kills position: sticky on the summary rail.
 * Same scoped re-enable as Support Schools - it cannot affect any other page.
 */
body.cwpr-page-cart {
	overflow-x: visible !important;
}

/* --- page head --- */
.cwct-head {
	display: flex;
	align-items: baseline;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.cwct-count {
	color: var(--ct-grey);
	font-size: 14px;
}

.cwct-continue {
	margin-left: auto;
	color: var(--ct-lime-dark);
	font-weight: 700;
	font-size: 13.5px;
	border-bottom: 1px solid rgba(128, 188, 0, 0.35);
}

.cwct-continue:hover {
	color: var(--ct-lime-deep);
}

/* --- layout --- */
.cwct-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 350px;
	gap: 26px;
	align-items: start;
}

@media (max-width: 939px) {
	.cwct-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- the lines card --- */
.cwct-lines-card {
	background: var(--ct-card);
	border: 1px solid var(--ct-line);
	border-radius: 12px;
	overflow: hidden;
}

.cwct-lines {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cwct-line {
	display: grid;
	grid-template-columns: 84px minmax(0, 1fr) auto;
	gap: 16px;
	align-items: center;
	padding: 16px 18px;
	border-bottom: 1px solid var(--ct-line);
	transition: opacity 0.15s ease;
}

.cwct-line:last-child {
	border-bottom: 0;
}

.cwct-line.is-busy {
	opacity: 0.55;
	pointer-events: none;
}

.cwct-thumb {
	display: block;
	width: 84px;
	height: 84px;
	background: #fff;
	border: 1px solid var(--ct-line);
	border-radius: 10px;
	padding: 6px;
}

.cwct-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cwct-info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	min-width: 0;
}

.cwct-name {
	font-weight: 700;
	font-size: 14.5px;
	line-height: 1.3;
	color: var(--ct-ink);
}

a.cwct-name:hover {
	color: var(--ct-lime-dark);
}

.cwct-meta {
	color: var(--ct-grey);
	font-size: 12.5px;
}

.cwct-unit {
	color: var(--ct-grey);
	font-size: 13px;
}

.cwct-unit .woocommerce-Price-amount {
	color: var(--ct-ink-2);
	font-weight: 600;
}

.cwct-remove {
	color: var(--ct-faint);
	font-size: 12.5px;
	border-bottom: 1px solid transparent;
	margin-top: 2px;
}

.cwct-remove:hover {
	color: var(--ct-brick);
	border-bottom-color: currentcolor;
}

/* --- quantity + line total --- */
.cwct-buy {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}

.cwct-stepper {
	display: flex;
	align-items: stretch;
	border: 1.5px solid var(--ct-line-2);
	border-radius: 999px;
	background: #fff;
	overflow: hidden;
}

.cwct-step {
	width: 34px;
	border: 0;
	background: none;
	font-size: 17px;
	font-weight: 700;
	color: var(--ct-ink-2);
	line-height: 1;
	padding: 7px 0;
	/*
	 * Explicit centering, not relied-on browser default button text-align -
	 * with zero horizontal padding (the shorthand above) and no display
	 * override, the glyph rendered off-centre (user-reported, 2026-08-25).
	 * grid/place-items is the exact technique .cwsg-step already uses in
	 * shop-simple-grid.css for the same "-"/"+" pair, kept here for
	 * consistency rather than inventing a second way to centre a button.
	 */
	display: grid;
	place-items: center;
}

.cwct-step:hover {
	background: var(--ct-lime-wash);
	color: var(--ct-lime-dark);
}

.cwct-qty {
	width: 46px;
	border: 0;
	text-align: center;
	font-weight: 800;
	font-size: 14.5px;
	color: var(--ct-ink);
	background: none;
	-moz-appearance: textfield;
	appearance: textfield;
}

.cwct-qty::-webkit-outer-spin-button,
.cwct-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.cwct-linetotal {
	font-weight: 800;
	font-size: 15.5px;
	color: var(--ct-ink);
}

/* --- the summary rail --- */
.cwct-aside {
	position: sticky;
	top: 92px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

@media (max-width: 939px) {
	.cwct-aside {
		position: static;
	}
}

.cwct-card {
	background: var(--ct-card);
	border: 1px solid var(--ct-line);
	border-radius: 12px;
	padding: 18px 20px;
}

.cwct-card-title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 800;
	color: var(--ct-ink);
}

.cwct-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding: 5px 0;
	font-size: 14px;
}

.cwct-row--muted {
	color: var(--ct-grey);
	font-size: 13px;
}

.cwct-saving {
	color: var(--ct-lime-dark);
	font-weight: 700;
}

.cwct-row--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--ct-line);
	font-size: 17px;
	font-weight: 800;
}

.cwct-vatnote {
	margin: 2px 0 14px;
	color: var(--ct-faint);
	font-size: 12px;
}

/* --- coupon --- */
.cwct-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.cwct-chips:not(:empty) {
	padding: 4px 0 6px;
}

.cwct-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: var(--ct-lime-wash);
	border: 1px solid var(--cw-lime-line, #dcecb8);
	border-radius: 999px;
	padding: 3px 6px 3px 11px;
	font-size: 12px;
}

.cwct-chip-code {
	font-weight: 800;
	letter-spacing: 0.04em;
	color: var(--ct-lime-dark);
}

.cwct-chip-amount {
	color: var(--ct-ink-2);
}

.cwct-chip-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	font-size: 13px;
	line-height: 1;
	color: var(--ct-grey);
	background: rgba(255, 255, 255, 0.7);
}

.cwct-chip-remove:hover {
	color: #fff;
	background: var(--ct-brick);
}

.cwct-coupon {
	display: flex;
	gap: 8px;
	margin: 6px 0 10px;
}

.cwct-coupon-input {
	flex: 1;
	min-width: 0;
	border: 1.5px solid var(--ct-line-2);
	border-radius: 8px;
	padding: 8px 12px;
	font: inherit;
	font-size: 13.5px;
	color: var(--ct-ink);
	background: #fff;
}

.cwct-coupon-input:focus {
	outline: none;
	border-color: var(--ct-lime);
	box-shadow: 0 0 0 3px rgba(128, 188, 0, 0.18);
}

/* --- buttons --- */
.cwct-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid transparent;
	border-radius: 10px;
	font-weight: 800;
	font-size: 14px;
	line-height: 1.2;
	padding: 10px 18px;
	text-align: center;
}

.cwct-btn-lime {
	background: var(--ct-lime);
	color: var(--ct-olive);
}

.cwct-btn-lime:hover {
	background: var(--ct-lime-deep);
	color: #fff;
}

.cwct-btn-ghost {
	background: #fff;
	border-color: var(--ct-line-2);
	color: var(--ct-ink-2);
	font-size: 13px;
	padding: 8px 14px;
}

.cwct-btn-ghost:hover {
	border-color: var(--ct-lime);
	color: var(--ct-lime-dark);
}

.cwct-checkout {
	width: 100%;
	padding: 14px 20px;
	font-size: 15px;
	margin-top: 2px;
}

/* --- delivery-promise progress --- */
.cwct-promise {
	background: var(--ct-lime-row);
	border-color: var(--cw-lime-line, #dcecb8);
}

.cwct-bar {
	height: 8px;
	border-radius: 999px;
	background: var(--ct-line);
	overflow: hidden;
	margin-bottom: 10px;
}

.cwct-bar-fill {
	height: 100%;
	border-radius: inherit;
	background: var(--ct-lime);
	transition: width 0.25s ease;
}

.cwct-progress-label {
	margin: 0;
	font-size: 12.5px;
	color: var(--ct-ink-2);
}

.cwct-progress-label strong {
	color: var(--ct-lime-dark);
}

/* --- empty state --- */
.cwct-empty {
	background: var(--ct-card);
	border: 1px solid var(--ct-line);
	border-radius: 12px;
	padding: 54px 24px;
	text-align: center;
	max-width: 560px;
	margin: 10px auto 0;
}

.cwct-empty-lead {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 800;
	color: var(--ct-ink);
}

.cwct-empty-sub {
	margin: 0 0 20px;
	color: var(--ct-grey);
}

.cwct-empty-note {
	padding: 40px 0;
	color: var(--ct-grey);
}

/* --- WooCommerce notices (coupon feedback, no-JS fallbacks) --- */
.cwct-notices:not(:empty) {
	margin-bottom: 16px;
}

.cwct .woocommerce-error,
.cwct .woocommerce-message,
.cwct .woocommerce-info {
	list-style: none;
	margin: 0 0 8px;
	padding: 11px 14px;
	border-radius: 10px;
	font-size: 13.5px;
}

.cwct .woocommerce-error {
	background: var(--ct-brick-tint);
	border: 1px solid var(--cw-brick-line, #eed3ce);
	color: var(--ct-brick);
}

.cwct .woocommerce-message,
.cwct .woocommerce-info {
	background: var(--ct-lime-wash);
	border: 1px solid var(--cw-lime-line, #dcecb8);
	color: var(--ct-ink-2);
}

/* --- toast (AJAX errors / stock clamps) --- */
.cwct-toast {
	position: fixed;
	left: 50%;
	bottom: 84px; /* clear of the mobile bottom nav */
	transform: translateX(-50%);
	background: var(--cw-olive, #16210a);
	color: #fff;
	font-size: 13.5px;
	padding: 11px 18px;
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
	z-index: 999997; /* below the mobile nav (999999) and PDP sticky (999998) */
	max-width: min(92vw, 480px);
	text-align: center;
}

/* --- mobile --- */
@media (max-width: 599px) {
	.cwct-line {
		grid-template-columns: 64px minmax(0, 1fr);
		gap: 12px;
		padding: 14px;
	}

	.cwct-thumb {
		width: 64px;
		height: 64px;
		align-self: start;
	}

	.cwct-buy {
		grid-column: 2;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.cwct-continue {
		margin-left: 0;
		flex-basis: 100%;
	}
}
