/* Thank-you pages, classic look (Cozy pop adds its own in the 4i block of cozy.css):
   - order received (woocommerce/checkout/thankyou.php): confirmation card, next steps, upsell, and the
     order details in a side column from 1280 px (where the checkout summary was);
   - the thank-you upsell (inc/upsell.php, assets/js/upsell.js), also on /track-order/ (whose own cards
     are styled in fast-checkout.css). Loaded on those two pages only. */

/* ==========================================================================
   Order received
   ========================================================================== */
/* One column below 1280 px (the details card splits in two from 768 px), main | details from 1280 px
   (at 1024 the main column would be 450 px: too tight for the timeline and the upsell). */
.woocommerce-order.thanks { display: grid; grid-template-columns: minmax(0, 1fr); max-width: none; }
@media (min-width: 1280px) {
	.woocommerce-order.thanks { grid-template-columns: minmax(0, 1fr) 480px; column-gap: 80px; align-items: start; }
}
.thanks__main { min-width: 0; }

/* Confirmation card */
.thanks__hero { container-type: inline-size; margin: 0 0 32px; padding: 24px 20px 22px; border-radius: var(--radius); background: var(--soft); }
.thanks__check { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 0 16px; border-radius: 50%; background: var(--ink); color: var(--white); }
.thanks__check svg { stroke-width: 2.4; }
.thanks .thanks__hero .woocommerce-thankyou-order-received { margin: 0 0 20px; font-family: var(--serif); font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); }
.thanks .thanks__hero .woocommerce-order-overview {
	display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px;
	margin: 0; padding: 0; border-radius: 0; background: none; list-style: none;
	font-size: 12px; color: var(--muted);
}
.thanks .thanks__hero .woocommerce-order-overview li { min-width: 0; padding: 12px 0; border-top: 1px solid var(--line-strong); }
.thanks .thanks__hero .woocommerce-order-overview strong { display: block; margin-top: 3px; font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.thanks__pay { padding-top: 12px; border-top: 1px solid var(--line-strong); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.thanks__pay p { margin: 0; }
@media (min-width: 768px) {
	.thanks__hero { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 20px; padding: 32px 32px 28px; }
	.thanks__check { grid-row: 1 / span 3; margin: 0; }
	.thanks .thanks__hero .woocommerce-thankyou-order-received { font-size: 30px; }
	.thanks__pay { grid-column: 2; }
}
/* Overview chips: 2 × 2, or one line when the card is wide (single column from 768 to 1279 px). */
@container (min-width: 700px) {
	.thanks .thanks__hero .woocommerce-order-overview { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* Next steps under the card (inc/woocommerce.php; on /track-order/ inc/fast-checkout.php). From 768 px the four steps
   share one grid row: their own rows stay at the top instead of stretching to the tallest step (a title
   would drop when another step's text wraps to more lines). */
.thanks .next-steps { margin: 0 0 40px; }
@media (min-width: 768px) {
	.next-steps__item { align-content: start; }
}

/* Order details: a side card (below the main column on phones and tablets) */
.thanks__side { min-width: 0; padding: 22px 20px 6px; border-radius: var(--radius); background: var(--soft); }
@media (min-width: 768px) { .thanks__side { padding: 28px 32px 12px; } }
@media (min-width: 768px) and (max-width: 1279px) {
	.thanks__side { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 40px; align-items: start; }
	.thanks__side > * { grid-column: 1 / -1; }
	.thanks__side > .woocommerce-order-details { grid-column: 1; grid-row: 1; }
	.thanks .thanks__side > .woocommerce-customer-details { grid-column: 2; grid-row: 1; margin-top: 0; }
}
.thanks__side .woocommerce-order-details, .thanks__side .woocommerce-customer-details { margin: 0; }
.thanks__side .woocommerce-customer-details { margin-top: 28px; }
.thanks .thanks__side h2 { margin: 0 0 12px; font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.1; letter-spacing: -0.01em; }
.thanks__side table.shop_table { margin: 0; font-size: 14px; }
.thanks__side table.shop_table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.thanks__side table.shop_table th, .thanks__side table.shop_table td { padding: 12px 0; border-bottom: 1px solid var(--line-strong); vertical-align: top; }
.thanks__side table.shop_table td.product-total, .thanks__side table.shop_table tfoot td { padding-left: 12px; text-align: right; white-space: nowrap; }
.thanks__side table.shop_table tfoot th { font-weight: 400; color: var(--ink-2); }
.thanks__side table.shop_table tfoot tr:last-child > * { border-bottom: 0; }
.thanks__side table.shop_table tfoot tr.order-total > *, .thanks__side table.shop_table tfoot tr:nth-last-child(2) > * { font-size: 16px; font-weight: 500; color: var(--ink); }
.thanks__side .product-name { overflow: hidden; }
.thanks__side .product-name a { padding: 8px 0; color: inherit; } /* Inline padding: a 32 px tap target that keeps the text beside the photo. */
.thanks__side .product-quantity { font-weight: 400; color: var(--muted); white-space: nowrap; }
.thanks-item__img { float: left; width: 48px; margin: 0 12px 2px 0; overflow: hidden; border-radius: 4px; background: var(--card); }
.thanks-item__img img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; }
.thanks__side .wc-item-meta { overflow: hidden; }
.thanks__side .woocommerce-customer-details address { padding: 0 0 18px; border: 0; border-radius: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.thanks__side .woocommerce-customer-details address p { margin: 4px 0 0; }

/* ==========================================================================
   Thank-you upsell. Container queries: ~640 px column on /track-order/, the main column here:
   < 520 px stacked rows, 520–759 px photo on the left, ≥ 760 px photo | text | options in one line.
   ========================================================================== */
.upsell {
	container-type: inline-size;
	margin: 0 0 16px; padding: 24px 20px 6px;
	border: 1px solid var(--line); border-radius: var(--radius);
	background: var(--white); color: var(--ink);
}
.woocommerce-order .upsell { margin: 0 0 40px; }
.upsell__kicker {
	display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 12px;
	border-radius: 999px; background: var(--soft); color: var(--accent);
	font-size: 12px; font-weight: 500; letter-spacing: .02em; line-height: 1.25;
}
.upsell__kicker svg { flex: none; }
.upsell h2.upsell__title { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1.05; letter-spacing: -0.01em; }
.upsell__title em { font-style: italic; color: var(--accent); }
.upsell__sub { max-width: 62ch; margin: 10px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.upsell__note { max-width: 62ch; margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.upsell__list { display: grid; margin-top: 18px; }

.upsell-item {
	display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "img body" "buy buy";
	gap: 14px 16px; padding: 18px 0; border-top: 1px solid var(--line);
}
.upsell-item.is-added { grid-template-areas: "img body"; }
.upsell-item__img { grid-area: img; align-self: start; display: block; overflow: hidden; border-radius: 4px; background: var(--card); }
.upsell-item__img img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; }
.upsell-item__body { grid-area: body; align-self: center; min-width: 0; }
.upsell-item__buy { grid-area: buy; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.upsell-item__cat { margin: 0 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.upsell-item__name { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.25; }
.upsell-item__name a { display: inline-block; margin: -5px 0; padding: 5px 0; color: inherit; } /* 32 px tap target */
.upsell-item__name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.upsell-item__price { margin: 4px 0 0; font-size: 15px; }
.upsell-item__price del { margin-right: 4px; color: var(--muted); }
.upsell-item__price ins { text-decoration: none; color: var(--sale); }

/* Options: labelled groups of chips (colour dots when every colour has a known shade). */
.upsell-opt { display: grid; gap: 8px; }
.upsell-opt__label { margin: 0; font-size: 13px; font-weight: 500; }
.upsell-opt__current { font-weight: 400; color: var(--ink-2); }
.upsell-opt__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.upsell-opt.is-missing .upsell-opt__chips { animation: piece-shake .4s; }
.upsell-chip {
	position: relative; display: inline-flex; align-items: center; justify-content: center;
	min-width: 48px; min-height: 40px; padding: 6px 12px;
	border: 1px solid var(--line-strong); border-radius: 4px; background: var(--white); color: var(--ink);
	font-size: 14px; line-height: 1.2; cursor: pointer;
	transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s;
}
.upsell-chip:hover { border-color: var(--ink); }
.upsell-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.upsell-chip.is-na { color: var(--muted); background: linear-gradient(to top left, transparent calc(50% - .5px), var(--line-strong) 50%, transparent calc(50% + .5px)); }
.upsell-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.upsell-chip--dot { min-width: 0; width: 40px; min-height: 0; height: 40px; padding: 5px; border: 0; border-radius: 50%; background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); }
.upsell-chip--dot span { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.upsell-chip--dot:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.upsell-chip--dot[aria-pressed="true"] { background: var(--white); box-shadow: inset 0 0 0 2px var(--ink); }
.upsell-chip--dot.is-na { background: var(--white); }
.upsell-chip--dot.is-na span { opacity: .35; }
.upsell-chip--dot.is-na::after { content: ""; position: absolute; left: calc(50% - .75px); top: 7px; bottom: 7px; width: 1.5px; background: var(--ink); transform: rotate(45deg); }

.upsell-item__error { margin: -4px 0 0; font-size: 13px; font-weight: 500; color: var(--sale); }
.upsell-item__add { width: 100%; min-height: 48px; }
.upsell-item__add svg { flex: none; }
.upsell-item__add.is-loading { pointer-events: none; }
.upsell-item__add.is-loading svg { display: none; }
.upsell-item__add.is-loading::before {
	content: ""; flex: none; width: 16px; height: 16px;
	border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
	animation: upsell-spin .7s linear infinite;
}
@keyframes upsell-spin { to { transform: rotate(360deg); } }

/* A piece already added: green check, "Retirer". */
.upsell-item__done { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; font-size: 14px; font-weight: 500; line-height: 1.35; color: #1e6b45; }
.upsell-item__done svg { flex: none; margin-top: 1px; padding: 2px; border-radius: 50%; background: #1e6b45; color: var(--white); stroke-width: 3; }
.upsell-item__undo { display: inline-flex; align-items: center; min-height: 32px; margin-top: 4px; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.upsell-item__undo:hover { color: var(--ink); }
.upsell-item__undo.is-loading { opacity: .5; pointer-events: none; }
.upsell__status { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.upsell__status:not(:empty) { padding: 2px 0 18px; }

@container (max-width: 340px) {
	.upsell-opt__chips { gap: 6px; }
	.upsell-chip:not(.upsell-chip--dot) { padding-left: 9px; padding-right: 9px; }
}
@container (min-width: 520px) {
	.upsell-item { grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "img body" "img buy"; gap: 14px 20px; }
	.upsell-item__body { align-self: start; }
	.upsell-item__add { align-self: flex-start; width: auto; min-width: 260px; }
}
@container (min-width: 760px) {
	.upsell-item { grid-template-columns: 112px minmax(0, 1fr) minmax(0, 1.3fr); grid-template-rows: auto; grid-template-areas: "img body buy"; gap: 0 24px; align-items: start; }
	.upsell-item.is-added { grid-template-areas: "img body body"; }
	.upsell-item__add { align-self: stretch; min-width: 0; width: 100%; }
}
/* Side padding lines up with the cards around it: 20 / 32 px here, 22 px like the /track-order/ cards. */
.ufc-ty-wrap .upsell { padding-left: 22px; padding-right: 22px; }
/* /track-order/ order card: the "Total" label on the baseline of its larger amount. */
.ufc-ty-wrap .ufc-ty-total-row:last-child { align-items: baseline; }
@media (min-width: 768px) {
	.upsell { padding: 32px 32px 8px; }
	.upsell h2.upsell__title { font-size: 40px; }
}

/* Summary blocks refreshed after an add / a removal: a short highlight. */
@media (prefers-reduced-motion: no-preference) {
	.is-updated { animation: upsell-flash 1.6s var(--ease); }
	@keyframes upsell-flash { from { background-color: color-mix(in srgb, var(--accent) 14%, transparent); } }
}
