/* ==========================================================================
   Kipod — cart page
   Replaces the "Cart Style" Elementor snippet. Selectors are prefixed with
   body.woocommerce-cart so they beat Storefront and the old snippet (which sets
   .woocommerce { display: flex } and fixed widths) while it is still active.
   ========================================================================== */

body.woocommerce-cart .woocommerce {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
	grid-template-areas:
		"notices notices"
		"items   summary"
		"recs    summary";
	grid-template-rows: auto auto 1fr;
	gap: 28px 36px;
	align-items: start;
	width: 100%;
	font-family: var(--kipod-font);
	color: var(--kipod-text);
	text-align: start;
}

/* Storefront clearfix pseudo-elements would become phantom grid cells. */
body.woocommerce-cart .woocommerce::before,
body.woocommerce-cart .woocommerce::after,
body.woocommerce-cart table.shop_table.cart tr::before,
body.woocommerce-cart table.shop_table.cart tr::after,
body.woocommerce-cart .cart_totals table.shop_table tr::before,
body.woocommerce-cart .cart_totals table.shop_table tr::after { content: none; display: none; }

body.woocommerce-cart .woocommerce > .woocommerce-notices-wrapper {
	grid-area: notices;
	position: static;
	width: auto;
}

body.woocommerce-cart .woocommerce > .woocommerce-notices-wrapper:empty { display: none; }

body.woocommerce-cart .woocommerce-cart-form {
	grid-area: items;
	width: auto;
	margin: 0;
	font-size: 15px;
}

body.woocommerce-cart .cart-collaterals {
	grid-area: summary;
	align-self: start;
	width: auto;
	margin: 0;
}

/* Summary spans the items + recommendations rows, so it can follow the scroll
   (below the sticky site header) without ever covering the recommendations. */
@media (min-width: 768px) {
	body.woocommerce-cart .cart-collaterals { position: sticky; top: 110px; }
	body.admin-bar.woocommerce-cart .cart-collaterals { top: 142px; }
}

body.woocommerce-cart .kipod-recs-slot { grid-area: recs; }
body.woocommerce-cart .kipod-recs-slot:empty { display: none; }

/* Items --------------------------------------------------------------------- */

body.woocommerce-cart table.shop_table.cart {
	display: block;
	margin: 0;
	border: 0;
	background: none;
}

body.woocommerce-cart table.shop_table.cart thead { display: none; }

body.woocommerce-cart table.shop_table.cart tbody {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

body.woocommerce-cart table.shop_table.cart tr.cart_item {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr) auto 110px 32px;
	grid-template-areas:
		"thumb name  qty sub remove"
		"thumb price qty sub remove";
	column-gap: 20px;
	align-items: center;
	padding: 16px 20px;
	border: 1px solid var(--kipod-line);
	border-radius: var(--kipod-radius);
	background: #fff;
	transition: border-color .2s var(--kipod-ease);
}

body.woocommerce-cart table.shop_table.cart tr.cart_item:hover { border-color: var(--kipod-ink); }

body.woocommerce-cart table.shop_table.cart td {
	display: block;
	padding: 0;
	border: 0;
	background: none !important;
	text-align: start;
}

body.woocommerce-cart table.shop_table.cart td::before { display: none !important; content: none !important; }

body.woocommerce-cart td.product-thumbnail {
	grid-area: thumb;
	display: block !important;
}

/* Product image in the same 1px black frame as the product grids. */
body.woocommerce-cart td.product-thumbnail a,
body.woocommerce-cart td.product-thumbnail img {
	display: block;
	width: 96px !important;
	max-width: none !important;
	height: 96px;
	margin: 0;
}

body.woocommerce-cart td.product-thumbnail a {
	overflow: hidden;
	border: 1px solid var(--kipod-ink);
	background: #fff;
}

body.woocommerce-cart td.product-thumbnail img {
	width: 100% !important;
	height: 100%;
	border-radius: 0;
	object-fit: cover;
}

body.woocommerce-cart td.product-name {
	grid-area: name;
	align-self: end;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .03em;
	line-height: 1.3;
	text-transform: uppercase;
}

body.woocommerce-cart td.product-name a,
body.woocommerce-cart td.product-name a:visited {
	color: var(--kipod-ink);
	text-decoration: none;
}

body.woocommerce-cart td.product-name a:hover { text-decoration: underline; text-underline-offset: 3px; }

body.woocommerce-cart td.product-name dl.variation {
	margin: 4px 0 0;
	color: var(--kipod-muted);
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

body.woocommerce-cart td.product-price {
	grid-area: price;
	align-self: start;
	margin-top: 4px;
	color: var(--kipod-muted);
	font-size: 14px;
	white-space: nowrap;
}

body.woocommerce-cart td.product-quantity { grid-area: qty; }

body.woocommerce-cart td.product-subtotal {
	grid-area: sub;
	color: var(--kipod-ink);
	font-size: 16px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: end;
	white-space: nowrap;
}

body.woocommerce-cart td.product-remove {
	grid-area: remove;
	justify-self: end;
}

body.woocommerce-cart table.cart td.product-remove a.remove {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin: 0;
	border-radius: var(--kipod-radius);
	background: transparent;
	color: var(--kipod-muted) !important;
	font-size: 22px;
	font-weight: 400;
	line-height: 1;
	text-decoration: none;
	text-indent: 0; /* Storefront hides the "×" and draws an icon-font glyph instead */
	opacity: 1;
	transition: background-color .15s, color .15s;
}

body.woocommerce-cart table.cart td.product-remove a.remove:hover {
	background: var(--kipod-ink);
	color: #fff !important;
}

body.woocommerce-cart table.cart td.product-remove a.remove:focus-visible { outline: 2px solid var(--kipod-accent); outline-offset: 2px; }
body.woocommerce-cart table.cart td.product-remove a.remove::before { display: none; }

/* Quantity stepper wrapping WooCommerce's input */
body.woocommerce-cart .kipod-qty--cart .quantity { display: inline-flex; margin: 0; }

body.woocommerce-cart .kipod-qty--cart input.qty {
	width: 40px;
	height: 34px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--kipod-ink);
	font-family: var(--kipod-font);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

body.woocommerce-cart .kipod-qty--cart input.qty::-webkit-outer-spin-button,
body.woocommerce-cart .kipod-qty--cart input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

body.woocommerce-cart .kipod-qty--cart input.qty:focus { outline: none; }

/* Coupon / actions row */
body.woocommerce-cart table.shop_table.cart tr:not(.cart_item) { display: block; }

body.woocommerce-cart table.shop_table.cart td.actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 4px 0 0;
}

body.woocommerce-cart td.actions .coupon {
	display: flex;
	flex: 1;
	max-width: 420px;
	gap: 8px;
	float: none;
}

body.woocommerce-cart td.actions .coupon .input-text,
body.woocommerce-cart td.actions .coupon #coupon_code {
	flex: 1;
	width: auto;
	min-width: 0;
	height: 46px;
	margin: 0 !important;
	padding: 0 16px;
	border: 1px solid var(--kipod-line);
	border-radius: var(--kipod-radius);
	background: #fff;
	box-shadow: none;
	color: var(--kipod-ink);
	font-family: var(--kipod-font);
	font-size: 15px;
}

body.woocommerce-cart td.actions .coupon .input-text:focus {
	border-color: var(--kipod-ink);
	background: #fff;
	outline: 2px solid var(--kipod-accent);
	outline-offset: 0;
}

body.woocommerce-cart td.actions .coupon .button,
body.woocommerce-cart td.actions .coupon button {
	width: auto;
	height: 46px;
	padding: 0 22px !important;
	border: 0;
	border-radius: var(--kipod-radius);
	background: #000;
	color: #fff;
	font-family: var(--kipod-font);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	white-space: nowrap;
}

body.woocommerce-cart td.actions .coupon .button:hover { background: var(--kipod-ink); color: var(--kipod-accent); }

/* Auto-update handles quantities, the manual button is not needed */
body.woocommerce-cart .woocommerce button[name="update_cart"],
body.woocommerce-cart .woocommerce input[name="update_cart"] { display: none; }

/* Summary ------------------------------------------------------------------- */

body.woocommerce-cart .cart-collaterals .cart_totals {
	float: none;
	width: auto;
	padding: 24px;
	border: 1px solid var(--kipod-ink);
	border-radius: var(--kipod-radius);
	background: #fff;
	font-size: 15px;
}

body.woocommerce-cart .cart-collaterals .cart_totals h2 {
	display: block;
	margin: 0 0 14px;
	padding: 0;
	color: var(--kipod-ink);
	font-family: var(--kipod-font);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
}

/* Progress is printed before the heading (woocommerce_before_cart_totals); show the heading first. */
body.woocommerce-cart .cart-collaterals .cart_totals { display: flex; flex-direction: column; }
body.woocommerce-cart .cart-collaterals .cart_totals h2 { order: -1; }
body.woocommerce-cart .cart_totals .kipod-progress { margin: 0 0 8px; }

body.woocommerce-cart .cart_totals table.shop_table {
	display: block;
	margin: 0;
	border: 0;
}

body.woocommerce-cart .cart_totals table.shop_table tbody { display: block; }

body.woocommerce-cart .cart_totals table.shop_table tr {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 16px;
	padding: 6px 0;
	border: 0;
}

body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td {
	display: block !important;
	padding: 0;
	border: 0;
	background: none !important;
	color: var(--kipod-ink);
	font-weight: 500;
}

body.woocommerce-cart .cart_totals table.shop_table td::before { display: none !important; }

body.woocommerce-cart .cart_totals table.shop_table td {
	flex: 1;
	text-align: end;
	font-variant-numeric: tabular-nums;
}

body.woocommerce-cart .cart_totals .woocommerce-shipping-totals td {
	color: var(--kipod-muted);
	font-size: 14px;
	font-weight: 400;
}

body.woocommerce-cart .cart_totals .cart-discount a { color: var(--kipod-muted); font-size: 13px; }

body.woocommerce-cart .cart_totals table.shop_table tr.order-total {
	margin-top: 10px;
	padding-top: 14px;
	border-top: 1px solid var(--kipod-ink);
}

body.woocommerce-cart .cart_totals tr.order-total th { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

body.woocommerce-cart .cart_totals tr.order-total td,
body.woocommerce-cart .cart_totals tr.order-total td strong {
	color: var(--kipod-ink);
	font-size: 24px;
	font-weight: 700;
}

body.woocommerce-cart .cart_totals tr.order-total small.includes_tax { display: none !important; }

body.woocommerce-cart .wc-proceed-to-checkout { padding: 8px 0 0; }

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 56px;
	margin: 0;
	padding: 14px 20px;
	border-radius: var(--kipod-radius);
	background-color: var(--kipod-accent);
	color: #000;
	font-family: var(--kipod-font);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	transition: background-color .2s var(--kipod-ease);
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover { background-color: var(--kipod-accent-hover); color: #000; }
body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:focus-visible { outline: 2px solid var(--kipod-ink); outline-offset: 2px; }
body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button::after { display: none; }

/* Notices ------------------------------------------------------------------- */

body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart .woocommerce-error {
	margin: 0 0 8px;
	padding: 14px 18px;
	border: 0;
	border-inline-start: 4px solid var(--kipod-accent);
	border-radius: var(--kipod-radius);
	background: var(--kipod-tint);
	color: var(--kipod-ink);
	font-size: 15px;
}

body.woocommerce-cart .woocommerce-error { border-inline-start-color: var(--kipod-error); }
body.woocommerce-cart .woocommerce-message::before,
body.woocommerce-cart .woocommerce-info::before,
body.woocommerce-cart .woocommerce-error::before { display: none; }
body.woocommerce-cart .woocommerce-error li { margin: 0; }
body.woocommerce-cart .woocommerce-message a,
body.woocommerce-cart .woocommerce-info a { color: var(--kipod-ink); font-weight: 600; text-decoration: underline; }

/* Empty cart (the old snippet hid the "Return to shop" button). */
body.woocommerce-cart .wc-empty-cart-message { grid-column: 1 / -1; }
body.woocommerce-cart .woocommerce:has(.wc-empty-cart-message) { display: block; text-align: center; }
body.woocommerce-cart p.return-to-shop { display: block; }
body.woocommerce-cart .return-to-shop .button {
	padding: 14px 28px;
	border-radius: var(--kipod-radius);
	background: var(--kipod-accent);
	color: #000;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
}

/* Recommendations ----------------------------------------------------------- */

body.woocommerce-cart .kipod-recs {
	padding-top: 24px;
	border-top: 1px solid var(--kipod-line);
}

body.woocommerce-cart .kipod-recs__header { margin-bottom: 20px; }
body.woocommerce-cart .kipod-recs__title { font-size: 20px; line-height: 1.2; }

body.woocommerce-cart .kipod-recs__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 20px 16px;
}

body.woocommerce-cart .kipod-card__title { font-size: 14px; }
body.woocommerce-cart .kipod-card__price { font-size: 14px; }

/* Responsive ---------------------------------------------------------------- */

@media (max-width: 1024px) {
	body.woocommerce-cart .woocommerce { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
	body.woocommerce-cart table.shop_table.cart tr.cart_item {
		grid-template-columns: 80px minmax(0, 1fr) auto 32px;
		grid-template-areas:
			"thumb name  name remove"
			"thumb price price ."
			"thumb qty   sub  sub";
		row-gap: 6px;
	}
	body.woocommerce-cart td.product-thumbnail a { width: 80px !important; height: 80px; }
	body.woocommerce-cart td.product-quantity { margin-top: 6px; }
	body.woocommerce-cart td.product-subtotal { align-self: center; margin-top: 6px; }
}

@media (max-width: 767px) {
	body.woocommerce-cart .woocommerce {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"notices"
			"items"
			"summary"
			"recs";
		grid-template-rows: auto;
		gap: 20px;
	}

	body.woocommerce-cart table.shop_table.cart tr.cart_item {
		grid-template-columns: 72px minmax(0, 1fr) auto 28px;
		padding: 14px;
		column-gap: 12px;
	}

	body.woocommerce-cart td.product-thumbnail a { width: 72px !important; height: 72px; }
	body.woocommerce-cart td.product-name { font-size: 14px; }
	body.woocommerce-cart td.product-subtotal { font-size: 15px; }
	body.woocommerce-cart table.cart td.product-remove a.remove { width: 28px; height: 28px; }

	body.woocommerce-cart table.shop_table.cart td.actions { flex-direction: column; align-items: stretch; }
	body.woocommerce-cart td.actions .coupon { max-width: none; padding-bottom: 0; border-bottom: 0; } /* Storefront's mobile divider */

	body.woocommerce-cart .cart-collaterals .cart_totals { padding: 18px; }

	body.woocommerce-cart .kipod-recs__title { font-size: 18px; }

	/* One row that scrolls sideways (data-lenis-prevent in the markup). */
	body.woocommerce-cart .kipod-recs__list {
		grid-auto-flow: column;
		grid-auto-columns: 46%;
		grid-template-columns: none;
		gap: 12px;
		margin-inline: -20px;
		padding: 2px 20px 8px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: 20px;
		scrollbar-width: none;
	}
	body.woocommerce-cart .kipod-recs__list::-webkit-scrollbar { display: none; }
	body.woocommerce-cart .kipod-recs__item { scroll-snap-align: start; }
	body.woocommerce-cart .kipod-card__title { font-size: 13px; }
}
