/*
 * Note: several rules below are qualified with .fsx-page because
 * figma-home.css resets `.fsx-page p { margin: 0 }` at a higher specificity
 * than a lone class, which silently flattened the summary spacing.
 */

/**
 * Cart page styles, from the Figma "Cart" frame (7146:3059).
 *
 * Layers on figma-home.css (tokens, chrome, cards) and figma-cart.css (the
 * drawer, which shares the basket).
 */

/* Layout (7146:3134) — 898 items / 390 summary, 32 gutter ------------------- */

.fsx-cartpage {
	padding: 40px 0 60px;
}

/* 898 + 32 + 390 is 1320 against a 1240 shell; as fixed tracks the summary
   overflowed. Same proportions, fluid. */
.fsx-cartpage__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
	gap: clamp(24px, 2.5%, 32px);
	align-items: start;
}

/* Items table (7146:3136) --------------------------------------------------- */

.fsx-carttable {
	background: #fff;
	border: 1px solid var(--g200);
	border-radius: 14px;
	overflow: hidden;
}

/* Five tracks: product, unit price, quantity, subtotal, remove. */
/* Product column flexes; the numeric columns stay put so they line up with the
   header row. */
.fsx-carttable__head,
.fsx-cartrow {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 108px 148px 108px 36px;
	align-items: center;
	gap: 16px;
	padding: 0 24px;
}

.fsx-carttable__head {
	height: 41px;
	background: var(--g50);
	border-bottom: 1px solid var(--g200);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--g500);
}

.fsx-cartrow {
	min-height: 125px;
	border-bottom: 1px solid var(--g200);
}

.fsx-cartrow__product {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.fsx-cartrow__media {
	flex-shrink: 0;
	width: 76px;
	height: 76px;
	border-radius: 10px;
	background: var(--media);
	overflow: hidden;
	display: grid;
	place-items: center;
}

.fsx-cartrow__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.fsx-cartrow__title {
	display: block;
	font-size: 16px;
	font-weight: 500;
	line-height: 24px;
	color: var(--g800);
}

.fsx-cartrow__title:hover {
	color: var(--p500);
}

.fsx-page .fsx-cartrow__stock {
	margin-top: 4px;
	font-size: 13px;
	line-height: 18px;
	color: #17a34a;
}

.fsx-cartrow__unit,
.fsx-cartrow__sub {
	font-size: 15px;
	color: var(--g700);
}

.fsx-cartrow__sub {
	font-weight: 600;
	font-size: 17px;
	color: var(--g800);
}

.fsx-cartrow__qty {
	display: inline-flex;
	align-items: center;
	justify-self: start;
	border: 1px solid var(--g300);
	border-radius: 8px;
	overflow: hidden;
}

.fsx-cartrow__qty button {
	width: 34px;
	height: 36px;
	border: 0;
	background: none;
	font-family: inherit;
	font-size: 16px;
	color: var(--g700);
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

.fsx-cartrow__qty button:hover {
	background: var(--p50);
	color: var(--p500);
}

.fsx-cartrow__qty span {
	min-width: 34px;
	text-align: center;
	font-size: 15px;
	font-weight: 500;
	color: var(--g800);
}

.fsx-cartrow__remove {
	position: relative;
	justify-self: end;
	width: 24px;
	height: 24px;
	border: 0;
	background: none;
	cursor: pointer;
	opacity: 0.45;
	transition: opacity 160ms ease;
}

.fsx-cartrow__remove:hover {
	opacity: 1;
}

.fsx-cartrow__remove::before,
.fsx-cartrow__remove::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 14px;
	height: 1.5px;
	background: var(--g600);
}

.fsx-cartrow__remove::before { transform: rotate(45deg); }
.fsx-cartrow__remove::after  { transform: rotate(-45deg); }

.fsx-carttable__empty {
	padding: 56px 24px;
	text-align: center;
	font-size: 16px;
	color: var(--g600);
	border-bottom: 1px solid var(--g200);
}

.fsx-carttable__empty a {
	display: block;
	margin-top: 8px;
	color: var(--p500);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Coupon row */

.fsx-coupon {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 24px;
}

.fsx-coupon input {
	width: 282px;
	height: 48px;
	padding: 0 16px;
	border: 1px solid var(--g300);
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	font-size: 15px;
	color: var(--g800);
	transition: border-color 160ms ease, box-shadow 160ms ease;
}

.fsx-coupon input:focus {
	outline: none;
	border-color: var(--p500);
	box-shadow: 0 0 0 3px rgba(65, 36, 128, 0.12);
}

.fsx-page .fsx-coupon .fsx-btn {
	min-width: 129px;
	cursor: pointer;
	font-family: inherit;
}

.fsx-page .fsx-coupon__msg {
	flex-basis: 100%;
	font-size: 13px;
	line-height: 18px;
	min-height: 18px;
}

.fsx-coupon__msg.is-ok {
	color: #17a34a;
}

.fsx-coupon__msg.is-error {
	color: #c02626;
}

/* Free shipping banner */

.fsx-shipbanner {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin-top: 16px;
	padding: 24px;
	background: var(--g50);
	border: 1px solid var(--g200);
	border-radius: 14px;
}

.fsx-shipbanner__icon {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--p200);
	position: relative;
	transition: background-color 200ms ease;
}

.fsx-shipbanner__icon::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 8px;
	height: 15px;
	border: solid #fff;
	border-width: 0 2.5px 2.5px 0;
	transform: translateY(-2px) rotate(45deg);
}

.fsx-cartpage.is-unlocked .fsx-shipbanner__icon {
	background: #17a34a;
}

.fsx-shipbanner__body {
	flex: 1 1 auto;
	min-width: 0;
}

.fsx-page .fsx-shipbanner__title {
	font-size: 18px;
	font-weight: 600;
	line-height: 28px;
	color: var(--g800);
}

.fsx-page .fsx-shipbanner__sub {
	font-size: 14px;
	line-height: 20px;
	color: var(--g600);
	margin-bottom: 14px;
}

.fsx-cartpage.is-unlocked .fsx-ship__fill {
	background: #17a34a;
}

/* Order summary (7146:3407) ------------------------------------------------- */

.fsx-summary {
	position: sticky;
	top: 96px;
	background: #fff;
	border: 1px solid var(--g200);
	border-radius: 14px;
	overflow: hidden;
}

.fsx-summary__head {
	padding: 22px 24px;
	border-bottom: 1px solid var(--g200);
}

.fsx-summary__head h2 {
	margin: 0;
	font-family: "Clash Display", "Public Sans", sans-serif;
	font-weight: 600;
	font-size: 20px;
	line-height: 28px;
	color: var(--ink);
}

.fsx-summary__body {
	padding: 20px 24px 24px;
}

.fsx-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-size: 15px;
	color: var(--g700);
}

.fsx-page .fsx-summary__label {
	margin-top: 26px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--g500);
}

/* Shipping options */

.fsx-shipopts {
	margin-top: 14px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fsx-shipopt {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
}

.fsx-shipopt input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.fsx-shipopt__dot {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	border: 1.5px solid var(--g300);
	border-radius: 50%;
	position: relative;
	transition: border-color 160ms ease;
}

.fsx-shipopt__dot::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--p500);
	transform: scale(0);
	transition: transform 160ms ease;
}

.fsx-shipopt input:checked + .fsx-shipopt__dot {
	border-color: var(--p500);
}

.fsx-shipopt input:checked + .fsx-shipopt__dot::after {
	transform: scale(1);
}

.fsx-shipopt input:focus-visible + .fsx-shipopt__dot {
	outline: 2px solid var(--p500);
	outline-offset: 2px;
}

.fsx-shipopt__label {
	flex: 1 1 auto;
	font-size: 14px;
	line-height: 20px;
	color: var(--g700);
}

.fsx-shipopt__price {
	font-size: 13px;
	font-weight: 600;
	color: #17a34a;
}

/* Applied coupon */

.fsx-applied {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 22px;
	padding: 11px 12px;
	border: 1px dashed var(--p200);
	border-radius: 8px;
	background: var(--p50);
}

.fsx-applied__tag {
	flex: 1 1 auto;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--p500);
}

.fsx-applied__amt {
	font-size: 15px;
	font-weight: 600;
	color: #17a34a;
}

.fsx-applied__remove {
	border: 0;
	background: none;
	padding: 0;
	font-family: inherit;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--g500);
	cursor: pointer;
}

.fsx-applied__remove:hover {
	color: #c02626;
}

/* Total + CTA */

.fsx-summary__total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--g200);
	font-size: 18px;
	color: var(--g800);
}

.fsx-summary__total strong {
	font-family: "Clash Display", "Public Sans", sans-serif;
	font-weight: 600;
	font-size: 28px;
	color: var(--ink);
}

.fsx-page .fsx-summary__cta {
	width: 100%;
	margin-top: 20px;
}

.fsx-page .fsx-summary__note {
	margin-top: 14px;
	font-size: 13px;
	line-height: 18px;
	color: var(--g500);
	text-align: center;
}

/* Trust row reuses the product page marks, stacked and centred here. */
.fsx-assure--summary {
	margin-top: 22px;
	padding-top: 20px;
	gap: 8px;
	border-top: 1px solid var(--g200);
}

.fsx-assure--summary .fsx-assure__item {
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
}

.fsx-assure--summary .fsx-assure__item p {
	font-size: 12px;
	line-height: 16px;
	color: var(--g600);
	font-weight: 500;
}

.fsx-assure--summary .fsx-assure__icon {
	width: 20px;
	height: 20px;
	margin-top: 0;
}

.fsx-accept {
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px solid var(--g200);
}

.fsx-page .fsx-accept p {
	font-size: 13px;
	color: var(--g500);
}

.fsx-accept .fsx-cardflags {
	margin-top: 12px;
	gap: 8px;
	flex-wrap: wrap;
}

/* The footer flags sit on black; these sit on white. */
.fsx-accept .fsx-cardflag {
	border-color: var(--g200);
	background: var(--g50);
}

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

@media (max-width: 1100px) {
	.fsx-cartpage__grid {
		grid-template-columns: 1fr;
	}

	.fsx-summary {
		position: static;
	}

	.fsx-carttable__head {
		display: none;
	}

	.fsx-cartrow {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"product remove"
			"qty     sub";
		row-gap: 14px;
		padding: 20px;
	}

	.fsx-cartrow__product { grid-area: product; }
	.fsx-cartrow__qty     { grid-area: qty; }
	.fsx-cartrow__sub     { grid-area: sub; justify-self: end; }
	.fsx-cartrow__remove  { grid-area: remove; }

	/* Unit price is implied by the subtotal once the header row is gone. */
	.fsx-cartrow__unit { display: none; }
}

@media (max-width: 640px) {
	.fsx-coupon input {
		width: 100%;
	}
}

/* [hidden] needs an explicit rule here because .fsx-coupon sets display. */
.fsx-page .fsx-coupon[hidden] {
	display: none;
}
