/*
 * The cart page header is the shared `.fcsu-page-header` primitive (app.css):
 * breadcrumb, ADR-010 H1, intro card, closing rule. It used to be redeclared
 * here — including a title clamp that made the cart the one page not on the
 * ADR-010 scale — and the checkout carried a second copy of the same ideas.
 * Both now read the primitive, so the two pages cannot drift apart again.
 */

.fcsu-cart-page .cart-collaterals .cart_totals,
.fcsu-cart-page .wc-block-components-sidebar {
	position: relative;
	overflow: hidden;
	border: 1px solid var(--fc-border);
	border-top: 0.25rem solid var(--fc-brand-primary);
	background: var(--fc-surface);
	box-shadow: 0 1.25rem 3rem color-mix(in srgb, var(--fc-brand-secondary) 10%, transparent);
}

.fcsu-cart-page .cart-collaterals .cart_totals::after,
.fcsu-cart-page .wc-block-components-sidebar::after {
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--fc-brand-primary) 4%, transparent),
		transparent 42%
	);
	content: "";
	pointer-events: none;
}

.fcsu-cart-page .cart-collaterals .cart_totals h2,
.fcsu-cart-page .wc-block-cart__totals-title {
	padding-bottom: var(--fc-space-2);
	border-bottom: 1px solid var(--fc-border);
	color: var(--fc-brand-primary);
	font-size: clamp(1.35rem, 2vw, 1.7rem);
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.15;
	text-transform: none;
}

.fcsu-cart-page .cart_totals table.shop_table,
.fcsu-cart-page .wc-block-components-totals-wrapper {
	border-radius: var(--fc-radius-md);
	background: color-mix(in srgb, var(--fc-background) 72%, var(--fc-surface));
}

.fcsu-cart-page .cart_totals table.shop_table th,
.fcsu-cart-page .cart_totals table.shop_table td {
	padding-inline: var(--fc-space-2);
}

.fcsu-cart-page .cart_totals .order-total th,
.fcsu-cart-page .cart_totals .order-total td,
.fcsu-cart-page .wc-block-components-totals-footer-item {
	color: var(--fc-brand-secondary);
	font-weight: 800;
}

.fcsu-cart-page .wc-proceed-to-checkout,
.fcsu-cart-page .wc-block-cart__submit-container {
	padding-top: var(--fc-space-3);
}

/* Keep the summary card visibly white and prevent nested total rows from clipping. */
.fcsu-cart-page .cart-collaterals,
.fcsu-cart-page .cart-collaterals .cart_totals,
.fcsu-cart-page .wc-block-components-sidebar {
	background-color: var(--fc-surface, #fff) !important;
	background-image: none !important;
	isolation: isolate;
}

.fcsu-cart-page .cart-collaterals .cart_totals::after,
.fcsu-cart-page .wc-block-components-sidebar::after {
	display: none;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-wrapper {
	margin: 0;
	padding: 0;
	overflow: visible !important;
	border: 0;
	border-radius: 0;
	background: transparent !important;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-coupon,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-shipping,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-footer-item {
	min-height: 0 !important;
	margin: 0 0 0.75rem;
	padding: 1rem !important;
	overflow: visible !important;
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-md);
	background: color-mix(in srgb, var(--fc-background) 78%, var(--fc-surface)) !important;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-item {
	min-height: 0 !important;
	align-items: flex-start;
	overflow: visible !important;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-item__label,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-item__value,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-item__description {
	position: static !important;
	min-height: 0 !important;
	margin: 0;
	overflow: visible !important;
	line-height: 1.45;
	white-space: normal;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-item__description {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.875rem;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-panel,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-panel__button,
.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-panel__content {
	height: auto !important;
	min-height: 0 !important;
	overflow: visible !important;
}

.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-panel__button {
	padding: 0 !important;
}

.fcsu-cart-page .cart_totals table.shop_table {
	border-radius: 0;
	background: transparent;
}

.fcsu-cart-page .cart_totals table.shop_table tr th,
.fcsu-cart-page .cart_totals table.shop_table tr td {
	background: color-mix(in srgb, var(--fc-background) 78%, var(--fc-surface));
}

.fcsu-cart-page .cart_totals table.shop_table tr th:first-child {
	border-radius: var(--fc-radius-md) 0 0 var(--fc-radius-md);
}

.fcsu-cart-page .cart_totals table.shop_table tr td:last-child {
	border-radius: 0 var(--fc-radius-md) var(--fc-radius-md) 0;
}

@media (max-width: 700px) {
	.fcsu-cart-page .cart-collaterals .cart_totals,
	.fcsu-cart-page .wc-block-components-sidebar {
		position: static;
		overflow: visible;
		border-top-width: 0.2rem;
		box-shadow: none;
	}

	.fcsu-cart-page .cart-collaterals .cart_totals h2,
	.fcsu-cart-page .wc-block-cart__totals-title {
		display: block !important;
		visibility: visible !important;
		margin: 0 0 var(--fc-space-2) !important;
	}

	/* WooCommerce or third-party mobile styles must not detach the CTA. */
	.fcsu-cart-page .wc-proceed-to-checkout,
	.fcsu-cart-page .wc-proceed-to-checkout .checkout-button,
	.fcsu-cart-page .cart_totals .checkout-button,
	.fcsu-cart-page .wc-block-cart__submit-container,
	.fcsu-cart-page .wc-block-cart__submit-button {
		position: static !important;
		inset: auto !important;
		top: auto !important;
		right: auto !important;
		bottom: auto !important;
		left: auto !important;
		z-index: auto !important;
		width: 100% !important;
		max-width: none !important;
		transform: none !important;
		box-shadow: none !important;
	}

	.fcsu-cart-page .wc-proceed-to-checkout {
		display: block !important;
		margin: 0 !important;
		padding: var(--fc-space-3) 0 0 !important;
	}

	.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-coupon,
	.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-shipping,
	.fcsu-cart-page .wc-block-components-sidebar .wc-block-components-totals-footer-item {
		padding: 0.9rem !important;
	}

	.fcsu-cart-page table.shop_table tr.cart_item {
		grid-template-columns: 4.5rem minmax(0, 1fr) 2.75rem;
		grid-template-areas:
			"thumb name subtotal"
			"thumb price subtotal"
			". quantity remove";
		gap: 0.5rem 0.75rem;
		align-items: start;
		padding: 1rem 0.25rem;
	}

	.fcsu-cart-page td.product-thumbnail img {
		width: 4.5rem;
	}

	.fcsu-cart-page td.product-name {
		min-width: 0;
	}

	.fcsu-cart-page td.product-name a {
		display: block;
		overflow-wrap: anywhere;
	}

	.fcsu-cart-page .variation {
		gap: 0.15rem;
		margin-top: 0.35rem;
		line-height: 1.45;
	}

	.fcsu-cart-page td.product-price {
		align-self: start;
	}

	.fcsu-cart-page td.product-subtotal {
		align-self: start;
		white-space: nowrap;
	}

	.fcsu-cart-page td.product-quantity {
		display: flex !important;
		align-items: center;
		min-width: 0;
	}

	.fcsu-cart-page td.product-remove {
		align-self: center;
		justify-self: start;
	}

	.fcsu-cart-page .product-remove a.remove {
		min-width: 2.5rem;
		min-height: 2.5rem;
	}
}

@media (max-width: 420px) {
	.fcsu-cart-page table.shop_table tr.cart_item {
		grid-template-columns: 4rem minmax(0, 1fr) 2.5rem;
		gap: 0.45rem 0.65rem;
	}

	.fcsu-cart-page td.product-thumbnail img {
		width: 4rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fcsu-cart-page .cart-collaterals .cart_totals,
	.fcsu-cart-page .wc-block-components-sidebar {
		box-shadow: none;
	}
}
