/**
 * The cart page (board 15, ledger 5c): the journey and heading, the booking cards (photo, mode and city,
 * name, price, the rows with icons, additions and their entry row, quantity with "Remove booking", line
 * subtotal), "Families also added", the booking summary beside (1fr | 400px, sticky from 1024px), the
 * pinned bar below 1024px, and the empty booking card. Mobile first; tokens only. Markup:
 * woocommerce/cart-page.php, woocommerce/cart/*.php, parts/sticky-bar.php (the bar). The journey, toast,
 * text field and Need-help line are components.css; the additions sheet is addons.css.
 */

/* ---------- Page ---------- */
.ms-cartpage {
	padding-block: var(--space-24) var(--section-y);
}

.ms-cartpage > .ms-journey {
	margin-bottom: var(--space-24);
}

/* A removal's toast opens the page (board: 16px under the header, 24px over the journey). */
.ms-cartpage:has(> .ms-toast) {
	padding-top: var(--space-16);
}

.ms-cartpage > .ms-toast {
	margin-bottom: var(--space-24);
}

.ms-cart__title {
	margin: 0 0 var(--space-24);
	font-family: var(--font-display);
	font-size: var(--type-h2-size);
	font-weight: 400;
	line-height: var(--type-h2-lh);
	color: var(--text-primary);
}

/* WooCommerce's notices over the cart. */
.ms-cartpage .ms-wc-notice {
	margin: 0 0 var(--space-16);
}

.ms-wc-notice__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-cart__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-24);
	align-items: start;
}

.ms-cart__main {
	display: flex;
	flex-direction: column;
	gap: var(--space-32);
	min-width: 0;
}

.ms-cart__aside,
.ms-cart__more {
	min-width: 0;
}

/* Phones and tablets: the poojas, the summary, then "Families also added" (board). From 1024px the
   summary is a column of its own and "Families also added" sits under the poojas. */
@media (min-width: 1024px) {
	.ms-cart__layout {
		grid-template-columns: minmax(0, 1fr) 400px;
		grid-template-rows: auto 1fr;
		gap: var(--space-32) var(--space-48);
	}

	.ms-cart__main {
		grid-column: 1;
		grid-row: 1;
	}

	.ms-cart__aside {
		grid-column: 2;
		grid-row: 1 / span 2;
	}

	.ms-cart__more {
		grid-column: 1;
		grid-row: 2;
	}

	/* The summary stays in view beside a long cart, under the header bar. */
	.ms-cart__aside {
		position: sticky;
		top: calc(var(--sticky-top) + var(--space-16));
		transition: top var(--duration-md) var(--easing-out);
	}
}

.ms-cart__form {
	margin: 0;
}

.ms-cart__items {
	display: flex;
	flex-direction: column;
	gap: var(--space-16);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* "Update booking" sends the quantities without JavaScript; cart.js sends them at once and hides it. */
.ms-cart__update {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-12);
}

/* ---------- One booking card ---------- */
/* Phones: photo beside mode, name and price; the rows, additions, entry row, quantity and subtotal under
   them. From 640px the 200px photo keeps the left column and the quantity and subtotal share the foot. */
.ms-cart-item {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	grid-template-areas:
		"photo info"
		"facts facts"
		"adds adds"
		"acts acts"
		"qty qty"
		"sub sub";
	gap: var(--space-16);
	padding: var(--space-16);
	border-radius: var(--radius-lg);
	background-color: var(--surface-raised);
	box-shadow: var(--shadow-card);
}

@media (min-width: 640px) {
	.ms-cart-item {
		grid-template-columns: 200px minmax(0, 1fr) auto;
		grid-template-areas:
			"photo info info"
			"photo facts facts"
			"photo adds adds"
			"photo acts acts"
			"qty qty sub";
		column-gap: var(--space-24);
		padding: var(--space-24);
	}
}

.ms-cart-item > * {
	margin: 0;
}

.ms-cart-item__head {
	display: contents;
}

.ms-cart-item__photo {
	grid-area: photo;
	align-self: start;
	display: block;
	overflow: hidden;
	aspect-ratio: 1;
	border-radius: var(--radius-md);
	background-color: var(--surface-soft);
}

/* Two classes: WooCommerce's ".woocommerce img { height: auto }" must not win. */
.ms-cartpage .ms-cart-item__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ms-cart-item__photo--none {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-8);
	font-family: var(--font-display);
	font-size: var(--type-meta-size);
	line-height: var(--type-meta-lh);
	text-align: center;
	color: var(--text-secondary);
	overflow-wrap: anywhere;
}

.ms-cart-item__info {
	grid-area: info;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-4);
	min-width: 0;
}

.ms-cart-item__info > * {
	margin: 0;
}

.ms-cart-item__where {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	font-size: var(--type-meta-size);
	font-weight: 500;
	line-height: var(--type-meta-lh);
	color: var(--text-secondary);
}

.ms-cart-item__where .ms-icon {
	flex-shrink: 0;
	color: var(--icon-ritual);
}

.ms-cart-item__title {
	font-family: var(--font-display);
	font-size: var(--type-h3-size);
	font-weight: 400;
	line-height: var(--type-h3-lh);
	color: var(--text-primary);
	overflow-wrap: anywhere;
}

/* The name is a link; the kalava thread is its hover line. */
.ms-cart-item__title a {
	color: inherit;
	text-decoration: none;
	transition: text-decoration-color var(--duration-sm) var(--easing-standard);
}

@media (hover: hover) {
	.ms-cart-item__title a:hover {
		text-decoration: underline;
		text-decoration-color: var(--kalava-gold);
	}
}

.ms-cart-item__title a:focus-visible {
	outline: var(--focus-width) solid var(--focus-ring);
	outline-offset: var(--focus-offset);
	border-radius: var(--radius-xs);
}

.ms-cart-item__price {
	margin-top: var(--space-4);
}

.ms-cart-item__price .ms-price__row {
	gap: var(--space-2) var(--space-8);
}

/* The rows: icon and label, then the value; the date-specific rate as a soft note. */
.ms-cart-item__facts {
	grid-area: facts;
	display: grid;
	gap: var(--space-8);
	padding-top: var(--space-16);
	border-top: 1px solid var(--border-subtle);
}

.ms-cart-item__fact {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: var(--space-8);
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
}

.ms-cart-item__fact dt {
	display: flex;
	align-items: flex-start;
	gap: var(--space-8);
	color: var(--text-secondary);
}

.ms-cart-item__fact dt .ms-icon {
	flex-shrink: 0;
	margin-top: var(--space-2);
	color: var(--icon-ritual);
}

.ms-cart-item__fact dd {
	margin: 0;
	font-weight: 500;
	color: var(--text-primary);
}

.ms-cart-item__fact.is-accent {
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-2);
	padding: var(--space-8) var(--space-12);
	border-radius: var(--radius-sm);
	background-color: var(--surface-soft);
}

.ms-cart-item__fact.is-accent dt {
	font-weight: 600;
	color: var(--text-primary);
}

.ms-cart-item__fact.is-accent dd {
	font-weight: 400;
}

/* Additions in the cart: one line each, the name, then the price. */
.ms-cart-item__additions {
	grid-area: adds;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ms-cart-item__additions > li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-12);
	padding: var(--space-8) 0;
	border-bottom: 1px solid var(--border-subtle);
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
}

.ms-cart-item__addition {
	min-width: 0;
	font-weight: 600;
	color: var(--text-primary);
}

.ms-cart-item__addition-price {
	flex-shrink: 0;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--text-primary);
	text-align: end;
}

/* The additions entry row: the shared ms-entry row (components.css, ledger 5e) in its grid area. */
.ms-cart-item__actions {
	grid-area: acts;
}

.ms-cart-item__action {
	display: inline-flex;
	align-items: center;
	gap: var(--space-6);
	min-height: var(--target-min);
	padding: 0;
	border: 0;
	background: none;
	color: var(--action-primary);
	font-family: var(--font-ui);
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	line-height: var(--type-label-lh);
	text-decoration: none;
	cursor: pointer;
	transition: color var(--duration-sm) var(--easing-standard);
}

.ms-cart-item__action .ms-icon {
	flex-shrink: 0;
}

@media (hover: hover) {
	.ms-cart-item__action:hover > span {
		text-decoration: underline;
		text-decoration-color: var(--kalava-gold);
		text-underline-offset: 3px;
	}

	.ms-cart-item__remove:hover {
		color: var(--action-primary);
	}
}

.ms-cart-item__action:focus-visible {
	outline: var(--focus-width) solid var(--focus-ring);
	outline-offset: var(--focus-offset);
	border-radius: var(--radius-xs);
}

/* Quantity: the label, the stepper (components.css), then "Remove booking" as a quiet link. */
.ms-cart-item__qty {
	grid-area: qty;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-12);
	padding-top: var(--space-16);
	border-top: 1px solid var(--border-subtle);
}

.ms-cart-item__label {
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	line-height: var(--type-label-lh);
	color: var(--text-primary);
}

.ms-cart-item__qty-fixed {
	font-weight: 700;
	color: var(--text-primary);
}

.ms-cart-item__remove {
	margin-left: auto;
	color: var(--text-secondary);
	white-space: nowrap;
}

.ms-cart-item__subtotal {
	grid-area: sub;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-12);
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	line-height: var(--type-label-lh);
	color: var(--text-primary);
}

@media (min-width: 640px) {
	.ms-cart-item__subtotal {
		justify-content: flex-end;
		padding-top: var(--space-16);
		border-top: 1px solid var(--border-subtle);
	}
}

.ms-cart-item__subtotal strong {
	font-size: var(--type-price-md-size);
	font-weight: var(--type-price-md-weight);
	line-height: var(--type-price-md-lh);
	font-variant-numeric: tabular-nums;
	color: var(--text-price);
}

/* ---------- Families also added ---------- */
.ms-cart__also-title {
	margin: 0 0 var(--space-16);
	font-family: var(--font-display);
	font-size: var(--type-h3-size);
	font-weight: 400;
	line-height: var(--type-h3-lh);
	color: var(--text-primary);
}

.ms-cart__also-list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-16);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 640px) {
	.ms-cart__also-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.ms-cart__also-list > li {
	display: flex;
	min-width: 0;
}

.ms-cart__also-list > li > * {
	flex: 1 1 auto;
}

/* ---------- Booking summary ---------- */
.ms-summary {
	display: flex;
	flex-direction: column;
	gap: var(--space-16);
	padding: var(--space-24);
	border-radius: var(--radius-lg);
	background-color: var(--surface-raised);
	box-shadow: var(--shadow-card);
}

.ms-summary > * {
	margin: 0;
}

.ms-summary__title {
	font-family: var(--font-display);
	font-size: var(--type-h4-size);
	font-weight: 400;
	line-height: var(--type-h4-lh);
	color: var(--text-primary);
}

.ms-summary__rows {
	display: flex;
	flex-direction: column;
	margin: 0;
}

.ms-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-12);
	padding: var(--space-10) 0;
	border-bottom: 1px solid var(--border-subtle);
	font-size: var(--type-body-sm-size);
}

.ms-summary__rows > .ms-summary__row:first-child {
	padding-top: 0;
}

.ms-summary__row dt {
	min-width: 0;
	color: var(--text-body);
}

.ms-summary__row dd {
	flex-shrink: 0;
	margin: 0;
	font-weight: 600;
	color: var(--text-primary);
	white-space: nowrap;
}

.ms-summary__row--total {
	border-bottom: 0;
	font-size: var(--type-body-size);
}

.ms-summary__row--total dt {
	font-weight: 700;
	color: var(--text-primary);
}

/* Sentences never at 12px (D-111). */
.ms-summary__row--total dt small {
	display: block;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
	font-weight: 400;
	color: var(--text-secondary);
}

.ms-summary__row--total dd {
	font-weight: 700;
	color: var(--text-price);
}

/* An applied coupon (board screen 10): its row with Remove, then the discount, in green. */
.ms-summary__row--coupon {
	padding-bottom: 0;
	border-bottom: 0;
}

.ms-summary__row--discount dt small {
	display: block;
	margin-top: var(--space-4);
	font-size: var(--type-caption-size);
	line-height: var(--type-caption-lh);
	color: var(--text-body);
	white-space: normal;
}

.ms-summary__row--discount dd {
	color: var(--status-success-text);
}

/* Remove: quiet until hovered; a 44px target that does not make the row taller. */
.ms-summary__remove {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-block: -12px;
	color: var(--text-secondary);
	font-size: var(--type-caption-size);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 3px;
	transition: color var(--duration-sm) var(--easing-standard), text-decoration-color var(--duration-sm) var(--easing-standard);
}

.ms-summary__remove:hover {
	color: var(--action-primary);
	text-decoration-color: currentColor;
}

/* "Have a coupon?": the field and Apply side by side. */
.ms-summary__coupon {
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
}

.ms-summary__label {
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	color: var(--text-primary);
}

.ms-summary__coupon-row {
	display: flex;
	gap: var(--space-8);
}

.ms-summary__coupon-row .ms-btn {
	flex-shrink: 0;
}

/* The coupon's result, under the field: checking (grey), refused (error, with its icon), applied. */
.ms-summary__msg {
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
	color: var(--text-secondary);
}

.ms-summary__msg:empty {
	display: none;
}

.ms-summary__msg-line {
	display: flex;
	align-items: flex-start;
	gap: var(--space-6);
	margin: 0;
}

.ms-summary__msg-line + .ms-summary__msg-line {
	margin-top: var(--space-4);
}

.ms-summary__msg-line .ms-icon {
	flex-shrink: 0;
	margin-top: 1px;
}

.ms-summary__msg.is-error {
	color: var(--error-text);
}

.ms-summary__msg.is-ok {
	color: var(--status-success-text);
}

.ms-summary__coupon .ms-input[aria-invalid="true"] {
	border-color: var(--error-border);
}

/* What is paid when: a soft box. */
.ms-summary__pay {
	padding: var(--space-14);
	border-radius: var(--radius-lg);
	background-color: var(--surface-soft);
}

.ms-summary__pay .ms-summary__row {
	padding: var(--space-4) 0;
	border-bottom: 0;
}

.ms-summary__note {
	margin: var(--space-6) 0 0;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
	color: var(--text-secondary);
}

.ms-summary__next {
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
	text-align: center;
}

.ms-summary__next > * {
	margin: 0;
}

/* Board 15's checkout button and the room around it: woocommerce.css gave them, and it no longer loads
   (D-159). Sizes follow the summary's own text (1.25em = 18.75px text, 57.5px tall, 18.75px below). The
   block padding adds one gap at each end: woocommerce.css's clearfix boxes were flex items here. */
.ms-summary__next.wc-proceed-to-checkout {
	padding-block: calc(1em + var(--space-8)); /* ppn-allow: D-159 board 15 parity */
}

.ms-summary__next.wc-proceed-to-checkout a.checkout-button {
	display: block;
	margin-bottom: 1em; /* ppn-allow: D-159 board 15 parity */
	padding: 1em; /* ppn-allow: D-159 board 15 parity */
	font-size: 1.25em; /* ppn-allow: D-159 board 15 parity */
}

.ms-summary__hint {
	font-size: var(--type-caption-size);
	color: var(--text-secondary);
}

/* "Have a coupon?", folded under the total. */
.ms-coupon {
	border-top: 1px solid var(--border-subtle);
	border-bottom: 1px solid var(--border-subtle);
}

.ms-coupon__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-12);
	min-height: var(--target-min);
	color: var(--text-link);
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	line-height: var(--type-label-lh);
	list-style: none;
	cursor: pointer;
}

.ms-coupon__summary::-webkit-details-marker {
	display: none;
}

.ms-coupon__summary .ms-icon {
	flex-shrink: 0;
	transition: transform var(--duration-md) var(--easing-standard);
}

.ms-coupon[open] .ms-coupon__summary .ms-icon {
	transform: rotate(180deg);
}

.ms-coupon__summary:focus-visible {
	outline: var(--focus-width) solid var(--focus-ring);
	outline-offset: var(--focus-offset);
	border-radius: var(--radius-xs);
}

.ms-coupon > .ms-summary__coupon {
	padding-bottom: var(--space-16);
}

/* The policy line and the Need-help line under "Continue to checkout", left-aligned. */
.ms-summary__policy {
	display: flex;
	align-items: flex-start;
	gap: var(--space-8);
	padding-top: var(--space-16);
	border-top: 1px solid var(--border-subtle);
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
	color: var(--text-body);
	text-align: left;
}

.ms-summary__policy > .ms-icon {
	flex-shrink: 0;
	margin-top: var(--space-2);
	color: var(--icon-ritual);
}

.ms-summary .ms-needhelp {
	justify-content: flex-start;
}

/* ---------- Pinned bar below 1024px (parts/sticky-bar.php) ---------- */
/* The phone bar (footer.css, under 768px) carries on to 1023px on the cart, and steps aside while the
   summary's own button is on screen (cart.js), so one "Continue to checkout" is in view. */
@media (min-width: 768px) and (max-width: 1023.98px) {
	:root:has(body.ms-has-sticky) {
		--sticky-h: calc(var(--space-64) + var(--space-10) + env(safe-area-inset-bottom));
	}

	body.ms-has-sticky {
		padding-bottom: var(--sticky-h);
	}

	.ms-sticky--cart {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: var(--z-sticky);
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: var(--space-16);
		padding: var(--space-12) var(--space-24) calc(var(--space-12) + env(safe-area-inset-bottom));
		border-top: 1px solid var(--border-subtle);
		background-color: var(--surface-raised);
		box-shadow: var(--shadow-sheet);
		transition: transform var(--duration-md) var(--easing-out), visibility 0s;
	}

	.ms-sticky--cart .ms-sticky__due {
		display: flex;
		flex-direction: column;
		min-width: 0;
		margin: 0;
	}

	.ms-sticky--cart .ms-sticky__label {
		font-size: var(--type-meta-size);
		line-height: var(--type-meta-lh);
		color: var(--text-body);
	}

	.ms-sticky--cart .ms-sticky__amount {
		font-size: var(--type-price-md-size);
		font-weight: var(--type-price-md-weight);
		line-height: var(--type-price-md-lh);
		font-variant-numeric: tabular-nums;
		color: var(--text-price);
		white-space: nowrap;
	}
}

@media (max-width: 1023.98px) {
	.ms-sticky--cart.is-next-in-view {
		transform: translateY(100%);
		visibility: hidden;
		transition: transform var(--duration-sm) var(--easing-in), visibility 0s linear var(--duration-sm);
	}
}

@media (max-width: 1023.98px) and (prefers-reduced-motion: reduce) {
	.ms-sticky--cart,
	.ms-sticky--cart.is-next-in-view {
		transform: none;
		transition: opacity var(--duration-xs) linear, visibility 0s linear var(--duration-xs);
	}

	.ms-sticky--cart.is-next-in-view {
		opacity: 0;
	}
}

/* ---------- Empty booking: a raised centred card ---------- */
.ms-cart-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-16);
	max-width: 640px;
	margin: var(--space-48) auto var(--space-64);
	padding: var(--space-48) var(--space-24);
	border-radius: var(--radius-lg);
	background-color: var(--surface-raised);
	box-shadow: var(--shadow-card);
	text-align: center;
}

@media (min-width: 1024px) {
	.ms-cart-empty {
		max-width: 760px;
	}
}

.ms-cart-empty > * {
	margin: 0;
}

.ms-cart-empty__title {
	font-family: var(--font-display);
	font-size: var(--type-h2-size);
	font-weight: 400;
	line-height: var(--type-h2-lh);
	color: var(--text-primary);
}

.ms-cart-empty__text {
	max-width: 440px;
	font-size: var(--type-body-size);
	line-height: var(--type-body-lh);
	color: var(--text-body);
}

.ms-cart-empty__actions {
	display: grid;
	justify-items: center;
	gap: var(--space-12);
	margin-top: var(--space-8);
}

.ms-cart-empty__finder {
	min-height: var(--target-min);
	font-size: var(--type-body-sm-size);
	font-weight: 600;
	line-height: var(--type-label-lh);
	text-wrap: balance;
}

.ms-cart-empty__popular {
	display: grid;
	justify-items: center;
	gap: var(--space-12);
	width: 100%;
	margin-top: var(--space-16);
	padding-top: var(--space-24);
	border-top: 1px solid var(--border-subtle);
}

.ms-cart-empty__label {
	margin: 0;
	font-size: var(--type-body-sm-size);
	line-height: var(--type-label-lh);
	color: var(--text-secondary);
}

.ms-cart-empty__chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-8);
	max-width: 440px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 1024px) {
	.ms-cart-empty__chips {
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ms-cart__aside,
	.ms-cart-item__title a,
	.ms-cart-item__action,
	.ms-coupon__summary .ms-icon {
		transition: none;
	}
}
