/*
 * The cart page — Sprint 3 phase D.
 * Specification: docs/18-cart-checkout-design.md §4.2. Decisions: D-155, D-156.
 *
 * WHAT THIS FILE IS ALLOWED TO DO: presentation only. It changes no price, no wording of the
 * shop's own copy, and no behaviour. Every rule is scoped under `.woocommerce-cart`, so nothing
 * here can leak onto another page.
 *
 * ⚠️ TWO RULES THAT ARE NOT COSMETIC, BOTH LEARNED THE HARD WAY ON THIS PROJECT:
 *   1. The theme sets `letter-spacing: 1px` and it INHERITS, and it sets the font directly on
 *      h1-h6. Neutralising it on a wrapper does nothing (D-095) — it has to be neutralised in
 *      the component's own type rules, which is what the block at the end does.
 *   2. The 2026-10-05 baseline measured ~3px of horizontal overflow at 360px on this page. It
 *      must be 0. `overflow-x: hidden` is NOT a fix — it hides the symptom (D-110).
 */

/* ------------------------------------------------------------------ tokens */

.woocommerce-cart .irkn-cart__back {
	margin: 18px 0 0;
}

.woocommerce-cart .irkn-cart__back-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 2px;
	font-size: 16px;
	font-weight: 600;
	color: var(--irkn-blue, #203ba6);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.woocommerce-cart .irkn-cart__back-link:hover,
.woocommerce-cart .irkn-cart__back-link:focus-visible {
	border-bottom-color: currentColor;
}

/* ------------------------------------------------------------- the page frame */

/*
 * ⚠️ THE CONTENT EDGE, AND WHY THIS RULE EXISTS.
 *
 * OceanWP wraps a page in `#content-wrap`, capped at 90% of the theme's container. The header,
 * the hero and the landing sections do NOT use that wrapper — they use the shop's own 1320px
 * container with `clamp(16px, 4.5vw, 40px)` of padding. So a cart left inside the theme wrapper is
 * narrower than everything above it and its left edge does not line up with theirs.
 *
 * The owner reported exactly that on 2026-10-12: "everything got decentralised, moved to the left
 * side, size seems not like on all other pages". This releases the wrapper on the cart and the
 * checkout only, and re-applies the shop's own arithmetic below. Nothing else changes.
 */
.woocommerce-cart #content-wrap,
.woocommerce-checkout #content-wrap {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
	padding-left: 0;
	padding-right: 0;
}

.woocommerce-cart .woocommerce {
	max-width: 1320px;
	width: 100%;
	margin: 0 auto;
	padding: 0 clamp(16px, 4.5vw, 40px);
	box-sizing: border-box;
	font-size: 16px;   /* the page must carry the same base size as the rest of the shop */
}

.woocommerce-cart .woocommerce-cart-form,
.woocommerce-cart .cart_totals {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	padding: 20px;
}

.woocommerce-cart .woocommerce-cart-form {
	margin-bottom: 24px;
}

.woocommerce-cart table.shop_table {
	border: 0;
	border-collapse: collapse;
	margin: 0;
}

.woocommerce-cart table.shop_table th {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #6b7280;
	border-bottom: 1px solid #e5e7eb;
	padding: 10px 8px;
}

.woocommerce-cart table.shop_table td {
	border-bottom: 1px solid #f1f2f4;
	padding: 14px 8px;
	vertical-align: middle;
}

.woocommerce-cart table.shop_table .product-thumbnail img {
	width: 72px;
	height: auto;
	border-radius: 10px;
}

/* Remove ("x") control: a real tap target, not a 14px glyph. */
.woocommerce-cart table.shop_table .product-remove a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 999px;
	background: #f7f8fa;
	color: #6b7280;
	font-size: 18px;
	line-height: 1;
	text-decoration: none;
}

.woocommerce-cart table.shop_table .product-remove a:hover,
.woocommerce-cart table.shop_table .product-remove a:focus-visible {
	background: #eef1fb;
	color: #203ba6;
}

/* ---------------------------------------------------------------- controls */

.woocommerce-cart input[type="number"],
.woocommerce-cart input[type="text"],
.woocommerce-cart input[type="email"],
.woocommerce-cart select,
.woocommerce-cart textarea {
	font-size: 16px;   /* below 16px iPhone Safari auto-zooms on tap */
	min-height: 44px;
	border-radius: 10px;
	border: 1px solid #d7dae0;
	padding: 8px 12px;
	letter-spacing: 0;
	text-transform: none;
}

.woocommerce-cart .qty {
	width: 84px;
	min-height: 44px;
	text-align: center;
}

.woocommerce-cart button,
.woocommerce-cart .button,
.woocommerce-cart input[type="submit"] {
	min-height: 44px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	border-radius: 10px;
	padding: 10px 22px;
}

.woocommerce-cart .actions .coupon {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

/*
 * ⚠️ THE SELECTOR CARRIES `table.cart td.actions` ON PURPOSE — THE SHORT FORM LOSES.
 *
 * WooCommerce's own cart stylesheet styles this ONE field more specifically than the controls block
 * above styles anything else:
 *   `.woocommerce-cart table.cart td.actions .coupon .input-text` (5 classes + 2 elements) sets
 *   `min-height: 32px; padding: 0 .8em; border-color: #ddd; width: auto`, and
 *   `.woocommerce-cart table.cart td.actions input` (3 classes + 3 elements) adds `height: 32px`.
 * Our `.woocommerce-cart input[type="text"]` is 2 classes + 1 element, so it lost on every one of
 * those properties. Measured on the clone 2026-10-15: the coupon field rendered **32px tall**, with
 * 0.8em of side padding and a #ddd border, while the button beside it and every other control on the
 * page was 44px. The rules were present, correct, and overridden — the same lesson as the checkout's
 * coupon form in assets/checkout.css.
 *
 * So this field repeats the page's own control values at a longer selector rather than inheriting
 * them. No `!important`.
 *
 * ⚠️⚠️ THE SELECTOR IS `input.input-text` AND NOT `.input-text`, AND THAT ONE ELEMENT IS THE WHOLE
 * DIFFERENCE. WooCommerce's own rule uses the selector written above — five classes and two elements,
 * exactly the same weight as `.input-text` here — and **that stylesheet is printed AFTER this one**
 * (measured 2026-10-15: cart.css appears before woocommerce.min.css in the document). At equal weight
 * the later rule wins, so the plain form changed NOTHING: the field stayed 32px tall with 0.8em of
 * padding and a #ddd border. Adding the `input` element makes this rule 5 classes + 3 elements and it
 * wins on weight instead of on luck of the load order. Do not shorten it.
 */
.woocommerce-cart table.cart td.actions .coupon input.input-text {
	min-width: 180px;
	min-height: 44px;
	padding: 8px 12px;
	border-color: #d7dae0;
	flex: 1 1 180px;   /* ⚠️ a ROW-layout value — see the 600px block below before reusing it */
}

/* ------------------------------------------------------------- cart totals */

.woocommerce-cart .cart_totals h2 {
	font-size: 18px;
	letter-spacing: 0;
	text-transform: none;
	margin: 0 0 12px;
}

.woocommerce-cart .cart_totals table.shop_table td,
.woocommerce-cart .cart_totals table.shop_table th {
	padding: 10px 0;
}

.woocommerce-cart .cart_totals .order-total .amount {
	font-size: 20px;
	font-weight: 700;
	color: #111827;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
	display: block;
	width: 100%;
	text-align: center;
	min-height: 48px;
	line-height: 28px;
	background: #203ba6;
	color: #fff;
	border-radius: 10px;
	font-size: 17px;
	font-weight: 700;
}

.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:focus-visible {
	background: #16286f;
	color: #fff;
}

/* --------------------------------------------------- shipping calculator */

.woocommerce-cart .shipping-calculator-button {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-size: 16px;
}

.woocommerce-cart .shipping-calculator-form p {
	margin: 8px 0;
}

/* ------------------------------------------------------------- empty cart */

.woocommerce-cart .cart-empty {
	font-size: 18px;
	margin: 0 0 8px;
}

.woocommerce-cart .return-to-shop .button {
	background: #203ba6;
	color: #fff;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 600px) {

	.woocommerce-cart .woocommerce-cart-form,
	.woocommerce-cart .cart_totals {
		padding: 14px;
		border-radius: 12px;
	}

	/*
	 * The cart table becomes stacked rows. A 4-column table cannot fit 360px, and forcing it to
	 * scroll sideways is the defect the baseline measured — not a solution to it.
	 */
	.woocommerce-cart table.shop_table_responsive thead {
		display: none;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item {
		display: block;
		position: relative;
		padding: 12px 0 12px 0;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item td {
		display: block;
		width: 100%;
		padding: 4px 0;
		border: 0;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item td::before {
		content: attr(data-title) ": ";
		font-size: 13px;
		font-weight: 700;
		color: #6b7280;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item td.product-remove,
	.woocommerce-cart table.shop_table_responsive tr.cart_item td.product-thumbnail {
		display: inline-block;
		width: auto;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item td.product-remove::before,
	.woocommerce-cart table.shop_table_responsive tr.cart_item td.product-thumbnail::before {
		content: none;
	}

	.woocommerce-cart table.shop_table_responsive tr.cart_item td.product-thumbnail img {
		width: 96px;
	}

	.woocommerce-cart .actions .coupon {
		flex-direction: column;
		align-items: stretch;
	}

	/*
	 * ⚠️⚠️ THIS FIELD RENDERED 180 × 180 px ON A PHONE — the defect the owner reported on 2026-10-15
	 * ("the promo code enter field looks excessive large on mobile view").
	 *
	 * THE CAUSE IS NOT A HEIGHT ANYWHERE IN THIS FILE. The block above sets `flex: 1 1 180px` for the
	 * ROW layout; this block turns the very same container into a COLUMN, and in a column flex
	 * container the flex-basis is the HEIGHT. So `180px` stopped being a width and became a height.
	 * Measured on the clone at 360px: the field 180 × 180, the "Pritaikyti" button beside it 44px.
	 *
	 * THE FIX IS TO DROP THE BASIS, NOT TO NAME A HEIGHT: `flex: 0 0 auto` hands the field's height
	 * back to its own `min-height` and padding, which is where every other field on this page gets it.
	 *
	 * ⚠️ The selector is the LONG form on purpose and it is NOT decoration: it has to out-rank BOTH the
	 * base rule in this file (1 class shorter) and WooCommerce's
	 * `.woocommerce-cart table.cart td.actions .coupon .input-text`, which sets `min-height: 32px` and
	 * `width: auto`. The short form loses silently — measured with it, the field came back **180px wide
	 * and 32px tall** instead of filling the column at 44px, which looks like a fix and is not one.
	 * `input.input-text` is what gives the rule one more element of weight than WooCommerce's.
	 *
	 * ⚠️ `min-width: 0` AND `max-width: 100%` ARE PART OF THE FIX, NOT TIDYING. WooCommerce caps this
	 * field at `max-width: 150px` between 581px and 767px; the base rule's `min-width: 180px` then
	 * floors it back to 180 — so in a 188px column the field stopped 8px short of the column it is in
	 * (measured at 600px). And on a 320px screen a 180px minimum is wider than the column, which is the
	 * one width this project has always said must never scroll sideways. Both are released here; on
	 * this layout `width` governs and a floor is not wanted.
	 */
	.woocommerce-cart table.cart td.actions .coupon input.input-text {
		flex: 0 0 auto;
		min-width: 0;
		width: 100%;
		max-width: 100%;
	}

	.woocommerce-cart .actions .coupon .button,
	.woocommerce-cart .actions .button {
		width: 100%;
	}
}

/* ------------------------------------------- type: neutralise inherited theme rules */

/*
 * The theme sets `letter-spacing: 1px` (and 1.5px + uppercase on buttons) and both INHERIT.
 * Declaring the stack on a wrapper does nothing, because the theme also sets the font directly
 * on headings. These are declared on the elements themselves, on purpose (D-095).
 */
.woocommerce-cart h1,
.woocommerce-cart h2,
.woocommerce-cart h3,
.woocommerce-cart th,
.woocommerce-cart td,
.woocommerce-cart .button,
.woocommerce-cart button,
.woocommerce-cart label {
	letter-spacing: 0;
	text-transform: none;
}
