/* Cart Block presentation only. WooCommerce remains the data and transaction authority. */
body.woocommerce-cart main {
	max-width: 1280px;
	margin-inline: auto;
	padding: clamp(28px, 4vw, 52px) clamp(18px, 3vw, 44px) clamp(48px, 7vw, 96px);
}

body.woocommerce-cart main h1.entry-title,
body.woocommerce-cart main h1.wp-block-post-title,
body.woocommerce-cart main .page-title,
body.woocommerce-cart main > h1 {
	margin: 0 0 clamp(20px, 2.4vw, 32px);
	color: var(--marksake-text);
	font-family: var(--marksake-serif);
	font-size: clamp(2.35rem, 3.4vw, 3.2rem);
	font-weight: 400;
	letter-spacing: -0.04em;
	line-height: 1.02;
}

body.woocommerce-cart main .entry-header {
	min-height: 0;
	margin-bottom: clamp(20px, 3vw, 34px);
	padding-bottom: 0;
}

body.woocommerce-cart .wp-block-woocommerce-cart {
	width: 100%;
	max-width: none;
	margin: 0;
}

/* Woo Cart Blocks ships 65%/35% flex widths on its main/sidebar children.
 * Once the parent is intentionally converted to grid those legacy child widths
 * must be reset, otherwise each grid cell shrinks again inside its own track. */
body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart > .wc-block-components-main.wc-block-cart__main,
body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart > .wc-block-components-sidebar.wc-block-cart__sidebar {
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
	min-width: 0;
	margin: 0;
	flex-basis: auto !important;
}

/* Remove common theme/content-width constraints only on the real Cart page. */
body.woocommerce-cart main .entry-content,
body.woocommerce-cart main .wp-block-post-content,
body.woocommerce-cart main .woocommerce {
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
}

body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart {
	display: grid !important;
	width: 100%;
	max-width: none;
	grid-template-columns: minmax(0, 1.8fr) minmax(330px, 0.85fr);
	gap: clamp(32px, 5vw, 76px);
	align-items: start;
}

body.woocommerce-cart .wc-block-cart__main {
	min-width: 0;
}

body.woocommerce-cart .wc-block-cart-items {
	border-collapse: collapse;
	border-top: 1px solid var(--marksake-border);
}

body.woocommerce-cart .wc-block-cart-items__header {
	border-bottom: 1px solid var(--marksake-border);
}

body.woocommerce-cart .wc-block-cart-items__header th {
	padding: 13px 0;
	color: var(--marksake-muted);
	font-family: var(--marksake-sans);
	font-size: 0.67rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart-items__row {
	border-bottom: 1px solid var(--marksake-border);
}

body.woocommerce-cart .wc-block-cart-item__image,
body.woocommerce-cart .wc-block-cart-item__product,
body.woocommerce-cart .wc-block-cart-item__total {
	padding-top: 24px;
	padding-bottom: 24px;
	vertical-align: top;
}

body.woocommerce-cart .wc-block-cart-item__image {
	width: clamp(96px, 11vw, 130px);
	padding-right: clamp(16px, 2vw, 26px);
}

body.woocommerce-cart .wc-block-cart-item__image img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border: 1px solid var(--marksake-border);
}

body.woocommerce-cart .wc-block-components-product-name {
	color: var(--marksake-text);
	font-family: var(--marksake-serif);
	font-size: clamp(1.08rem, 1.5vw, 1.35rem);
	font-weight: 400;
	line-height: 1.25;
	text-decoration: none;
}

body.woocommerce-cart .wc-block-components-product-name:hover,
body.woocommerce-cart .wc-block-components-product-name:focus-visible {
	color: var(--marksake-accent);
	text-decoration: underline;
	text-underline-offset: 4px;
}

body.woocommerce-cart .wc-block-cart-item__prices,
body.woocommerce-cart .wc-block-cart-item__total {
	color: var(--marksake-text);
	font-family: var(--marksake-sans);
	font-size: 0.94rem;
	font-weight: 600;
}

body.woocommerce-cart .wc-block-components-product-metadata {
	margin-top: 12px;
}

body.woocommerce-cart .wc-block-components-product-details {
	margin: 5px 0;
	color: var(--marksake-muted);
	font-family: var(--marksake-sans);
	font-size: 0.8rem;
	line-height: 1.45;
}

body.woocommerce-cart .wc-block-components-product-details__name {
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart-item__quantity {
	gap: 13px;
	margin-top: 19px;
}

body.woocommerce-cart .wc-block-components-quantity-selector {
	min-height: 44px;
	border-color: var(--marksake-border);
	border-radius: 0;
	background: var(--marksake-surface);
}

body.woocommerce-cart .wc-block-components-quantity-selector__button {
	min-width: 42px;
	color: var(--marksake-text);
}

body.woocommerce-cart .wc-block-components-quantity-selector__input {
	min-width: 38px;
	color: var(--marksake-text);
	font-family: var(--marksake-sans);
	font-weight: 700;
}

body.woocommerce-cart .wc-block-cart-item__remove-link {
	min-height: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--marksake-muted);
	font-family: var(--marksake-sans);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-decoration: underline;
	text-underline-offset: 4px;
	text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart__sidebar {
	position: sticky;
	top: 30px;
	padding: clamp(22px, 3vw, 32px);
	border: 1px solid var(--marksake-border);
	background: var(--marksake-surface);
}

body.woocommerce-cart .wc-block-cart__totals-title {
	margin: 0 0 20px;
	color: var(--marksake-text);
	font-family: var(--marksake-serif);
	font-size: 1.55rem;
	font-weight: 400;
}

body.woocommerce-cart .wc-block-components-totals-wrapper {
	border-top-color: var(--marksake-border);
}

body.woocommerce-cart .wc-block-components-totals-item {
	padding-block: 13px;
	color: var(--marksake-text);
	font-family: var(--marksake-sans);
	font-size: 0.88rem;
}

body.woocommerce-cart .wc-block-components-totals-footer-item {
	padding-top: 19px;
	font-size: 1rem;
}

body.woocommerce-cart .wc-block-cart__payment-options {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--marksake-border);
}

body.woocommerce-cart .wc-block-cart__submit-container {
	margin-top: 20px;
	background: transparent;
}

body.woocommerce-cart .wc-block-cart__submit-button {
	min-height: 52px;
	border-radius: 0;
	background: var(--marksake-text);
	color: var(--marksake-surface);
	font-family: var(--marksake-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart .wc-block-cart__submit-button:focus-visible {
	background: var(--marksake-accent);
}

body.woocommerce-cart .ms-commerce-ux__continue-shopping {
	margin: 28px 0 0;
	font-family: var(--marksake-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

body.woocommerce-cart .ms-commerce-ux__continue-shopping a {
	color: var(--marksake-text);
	text-decoration: underline;
	text-underline-offset: 4px;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block {
	max-width: 620px;
	margin: 0;
	padding: clamp(32px, 5vw, 64px);
	border: 1px solid var(--marksake-border);
	background: var(--marksake-surface);
	text-align: left;
}

body.woocommerce-cart .wc-block-cart__empty-cart__title {
	color: var(--marksake-text);
	font-family: var(--marksake-serif);
	font-size: clamp(1.7rem, 3vw, 2.5rem);
	font-weight: 400;
}

body.woocommerce-cart .wc-block-cart__empty-cart__description {
	color: var(--marksake-muted);
	font-family: var(--marksake-sans);
}

body.woocommerce-cart .wc-block-cart__empty-cart__shopping-button {
	min-height: 50px;
	border-radius: 0;
	background: var(--marksake-text);
	color: var(--marksake-surface);
	font-family: var(--marksake-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:focus-visible,
body.woocommerce-cart .wc-block-cart-item__remove-link:focus-visible,
body.woocommerce-cart .wc-block-cart__submit-button:focus-visible,
body.woocommerce-cart .ms-commerce-ux__continue-shopping a:focus-visible,
body.woocommerce-cart .wc-block-cart__empty-cart__shopping-button:focus-visible {
	outline: 2px solid var(--marksake-accent);
	outline-offset: 3px;
}

@media (max-width: 900px) {
	body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart {
		grid-template-columns: 1fr;
		gap: 30px;
	}

	body.woocommerce-cart .wc-block-cart__sidebar {
		position: static;
	}
}

@media (max-width: 600px) {
	body.woocommerce-cart main {
		padding-inline: 16px;
	}

	body.woocommerce-cart .wc-block-cart-items__header {
		display: none;
	}

	body.woocommerce-cart .wc-block-cart-items,
	body.woocommerce-cart .wc-block-cart-items tbody,
	body.woocommerce-cart .wc-block-cart-items__row,
	body.woocommerce-cart .wc-block-cart-item__image,
	body.woocommerce-cart .wc-block-cart-item__product,
	body.woocommerce-cart .wc-block-cart-item__total {
		display: block;
		width: 100%;
	}

	body.woocommerce-cart .wc-block-cart-items__row {
		position: relative;
		min-height: 128px;
		padding: 20px 0 20px 112px;
	}

	body.woocommerce-cart .wc-block-cart-item__image {
		position: absolute;
		left: 0;
		top: 20px;
		width: 92px;
		padding: 0;
	}

	body.woocommerce-cart .wc-block-cart-item__product,
	body.woocommerce-cart .wc-block-cart-item__total {
		padding: 0;
	}

	body.woocommerce-cart .wc-block-cart-item__total {
		margin-top: 16px;
		text-align: left;
	}

	body.woocommerce-cart .wc-block-cart__sidebar {
		padding: 22px 18px;
	}

	body.woocommerce-cart .wc-block-cart__submit-button {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.woocommerce-cart * {
		scroll-behavior: auto;
	}
}

/* Phase B r3 layout guard: never allow the Woo flex-era width rules to re-collapse grid tracks. */
@media (min-width: 901px) {
	body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart > .wc-block-cart__main,
	body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart > .wc-block-cart__sidebar {
		width: 100% !important;
		max-width: none !important;
	}
}


/* Phase B r4 visual correction: widen the real Cart Block and remove the remaining
 * theme-constrained editorial column without touching WooCommerce transaction state. */
body.woocommerce-cart main {
	width: 100%;
	max-width: none;
	padding-top: clamp(30px, 3vw, 46px);
	padding-bottom: clamp(56px, 7vw, 96px);
}

body.woocommerce-cart main .entry-header,
body.woocommerce-cart main .wp-block-post-title,
body.woocommerce-cart main h1.entry-title,
body.woocommerce-cart main > h1 {
	position: relative;
	left: 50%;
	width: min(1120px, calc(100vw - 48px));
	max-width: none;
	transform: translateX(-50%);
}

body.woocommerce-cart main .entry-header {
	margin-top: 0;
	margin-bottom: clamp(18px, 2vw, 28px) !important;
}

body.woocommerce-cart main h1.entry-title,
body.woocommerce-cart main h1.wp-block-post-title,
body.woocommerce-cart main .page-title,
body.woocommerce-cart main > h1 {
	margin-bottom: 0;
	font-size: clamp(2.35rem, 3.4vw, 3.2rem);
	line-height: 1.02;
}

body.woocommerce-cart .wp-block-woocommerce-cart {
	position: relative;
	left: 50%;
	width: min(1120px, calc(100vw - 48px)) !important;
	max-width: none !important;
	margin: 0 !important;
	transform: translateX(-50%);
}

body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart {
	grid-template-columns: minmax(0, 1fr) minmax(330px, 360px);
	gap: clamp(42px, 5vw, 68px);
}

body.woocommerce-cart .wc-block-cart-items {
	width: 100%;
	table-layout: auto;
}

body.woocommerce-cart .wc-block-cart-item__image {
	width: 126px;
	min-width: 126px;
	padding-right: 22px;
}

body.woocommerce-cart .wc-block-cart-item__image img {
	width: 110px !important;
	height: 110px !important;
	max-width: 110px !important;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

body.woocommerce-cart .wc-block-cart-item__product {
	width: auto;
	padding-right: 24px;
}

body.woocommerce-cart .wc-block-cart-item__total {
	width: 96px;
	min-width: 96px;
	text-align: right;
}

body.woocommerce-cart .wc-block-components-product-name {
	font-size: clamp(1rem, 1.25vw, 1.2rem);
	line-height: 1.3;
}

body.woocommerce-cart .wc-block-cart-item__prices {
	margin-top: 6px;
	font-size: 0.84rem;
}

body.woocommerce-cart .wc-block-components-product-metadata {
	margin-top: 14px;
}

body.woocommerce-cart .wc-block-components-product-details {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	align-items: baseline;
	margin: 6px 0;
}

body.woocommerce-cart .wc-block-components-product-details__name {
	flex: 0 0 auto;
}

body.woocommerce-cart .wc-block-cart__sidebar {
	width: 100% !important;
	padding: 30px 30px 28px;
}

body.woocommerce-cart .wc-block-cart__totals-title {
	font-size: 1.7rem;
	line-height: 1.1;
}

body.woocommerce-cart .wc-block-cart__payment-options,
body.woocommerce-cart .wc-block-cart__submit-container,
body.woocommerce-cart .wc-block-cart__submit-button {
	width: 100%;
	max-width: none;
}

body.woocommerce-cart .ms-commerce-ux__continue-shopping {
	margin-top: 34px;
}

@media (max-width: 900px) {
	body.woocommerce-cart main .entry-header,
	body.woocommerce-cart main .wp-block-post-title,
	body.woocommerce-cart main h1.entry-title,
	body.woocommerce-cart main > h1,
	body.woocommerce-cart .wp-block-woocommerce-cart {
		width: min(760px, calc(100vw - 36px)) !important;
	}

	body.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart {
		grid-template-columns: 1fr;
		gap: 32px;
	}
}

@media (max-width: 600px) {
	body.woocommerce-cart main .entry-header,
	body.woocommerce-cart main .wp-block-post-title,
	body.woocommerce-cart main h1.entry-title,
	body.woocommerce-cart main > h1,
	body.woocommerce-cart .wp-block-woocommerce-cart {
		width: calc(100vw - 32px) !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image {
		width: 92px;
		min-width: 92px;
	}

	body.woocommerce-cart .wc-block-cart-item__image img {
		width: 92px !important;
		height: 92px !important;
		max-width: 92px !important;
	}

	body.woocommerce-cart .wc-block-cart__sidebar {
		padding: 22px 18px;
	}
}

/* Phase B r7 deterministic Cart heading correction.
 * Previous revisions scoped the title under `main`, but the active MARKSAKE
 * theme can render/style the page heading outside that assumed container.
 * This rule deliberately targets the Cart page's H1 regardless of theme
 * wrapper and uses !important only for this isolated presentation override. */
body.woocommerce-cart h1,
body.woocommerce-cart h1.entry-title,
body.woocommerce-cart h1.wp-block-post-title,
body.woocommerce-cart .page-title {
	font-size: clamp(2.25rem, 2.75vw, 2.8rem) !important;
	line-height: 1.04 !important;
	letter-spacing: -0.035em !important;
}

@media (max-width: 600px) {
	body.woocommerce-cart h1,
	body.woocommerce-cart h1.entry-title,
	body.woocommerce-cart h1.wp-block-post-title,
	body.woocommerce-cart .page-title {
		font-size: clamp(2rem, 10vw, 2.55rem) !important;
	}
}


/* Phase B r8 compact Cart masthead.
 * The MARKSAKE theme renders the Cart title inside a tall editorial masthead
 * whose class is theme-owned. JS marks the actual title branch at runtime so
 * this spacing correction does not depend on guessed theme selectors. Only
 * vertical presentation is changed; Cart Block layout/transaction UI is not. */
body.woocommerce-cart .ms-commerce-ux__cart-masthead {
	box-sizing: border-box;
	min-height: 0 !important;
	height: auto !important;
	padding-top: clamp(48px, 4vw, 64px) !important;
	padding-bottom: clamp(38px, 3.25vw, 50px) !important;
	margin-top: 0 !important;
	margin-bottom: clamp(40px, 4vw, 56px) !important;
}

body.woocommerce-cart .ms-commerce-ux__cart-masthead-layer {
	min-height: 0 !important;
	height: auto !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

body.woocommerce-cart .ms-commerce-ux__cart-title {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

body.woocommerce-cart .ms-commerce-ux__cart-eyebrow {
	margin-top: 0 !important;
	margin-bottom: 12px !important;
}

@media (max-width: 600px) {
	body.woocommerce-cart .ms-commerce-ux__cart-masthead {
		padding-top: 34px !important;
		padding-bottom: 30px !important;
		margin-bottom: 34px !important;
	}
}


/* Phase B r9: tighten the Cart masthead after real staging review.
 * This intentionally reduces only vertical page-title spacing; Cart Block,
 * totals, checkout/payment controls and Phase A behaviors are untouched. */
@media (min-width: 901px) {
	body.woocommerce-cart main {
		padding-top: 14px !important;
	}

	body.woocommerce-cart .ms-commerce-ux__cart-masthead {
		padding-top: 26px !important;
		padding-bottom: 20px !important;
		margin-bottom: 24px !important;
	}

	body.woocommerce-cart .ms-commerce-ux__cart-eyebrow {
		margin-bottom: 8px !important;
	}
}

@media (min-width: 601px) and (max-width: 900px) {
	body.woocommerce-cart main {
		padding-top: 12px !important;
	}

	body.woocommerce-cart .ms-commerce-ux__cart-masthead {
		padding-top: 24px !important;
		padding-bottom: 18px !important;
		margin-bottom: 22px !important;
	}
}

@media (max-width: 600px) {
	body.woocommerce-cart main {
		padding-top: 10px !important;
	}

	body.woocommerce-cart .ms-commerce-ux__cart-masthead {
		padding-top: 20px !important;
		padding-bottom: 16px !important;
		margin-bottom: 20px !important;
	}

	body.woocommerce-cart .ms-commerce-ux__cart-eyebrow {
		margin-bottom: 7px !important;
	}
}

/* Phase E r1 — deterministic filled-cart item layout on phones.
 * Woo's table row becomes a simple two-column card: thumbnail + information.
 * Unit price remains inside the product block; the redundant line-total cell is
 * hidden at phone width to avoid the price-before-title collision seen in QA. */
@media (max-width: 600px) {
	body.woocommerce-cart .wc-block-cart-items__row {
		display: grid !important;
		grid-template-columns: 88px minmax(0, 1fr) !important;
		grid-template-rows: auto !important;
		column-gap: 14px;
		min-height: 0;
		padding: 18px 0 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image {
		position: static !important;
		grid-column: 1 !important;
		grid-row: 1 !important;
		width: 88px !important;
		min-width: 88px !important;
		padding: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__image img {
		width: 88px !important;
		height: 88px !important;
		max-width: 88px !important;
	}

	body.woocommerce-cart .wc-block-cart-item__product {
		grid-column: 2 !important;
		grid-row: 1 !important;
		width: auto !important;
		min-width: 0 !important;
		padding: 0 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__total {
		display: none !important;
	}

	body.woocommerce-cart .wc-block-components-product-name {
		display: block;
		font-size: 1rem !important;
		line-height: 1.25 !important;
	}

	body.woocommerce-cart .wc-block-cart-item__prices {
		margin-top: 5px;
		font-size: 0.84rem;
	}

	body.woocommerce-cart .wc-block-components-product-metadata {
		margin-top: 10px;
	}

	body.woocommerce-cart .wc-block-components-product-details {
		display: block;
		margin: 5px 0;
		font-size: 0.76rem;
	}

	body.woocommerce-cart .wc-block-cart-item__quantity {
		margin-top: 14px;
	}
}
