/*
 * Post-subscribe add-on step (2026-07-31, Ara: "click on any of the
 * subscribe, it shouldn't take them right away to WooCommerce checkout...
 * ask them if they wanna add certain add ons... once they're finished
 * adding or non adding, they can skip it, then take them to the
 * WooCommerce"). Scoped to the /pricing/ page's Cube cards only.
 *
 * Visual language matches the existing "Build Your Own" wizard
 * (.pricing-wizard__addon in pricing.css) deliberately — same orange
 * accent, navy text, checkbox-style selection indicator — so this reads as
 * part of the same system rather than a bolted-on separate component.
 * Colors/fonts pulled exclusively from design-tokens.css, no hardcoded hex
 * except the pure white card background and shadow rgba, which mirror the
 * existing wizard's own convention.
 */

.addon-step {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.addon-step[hidden] {
	display: none;
}

.addon-step__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(13, 19, 43, 0.55);
	backdrop-filter: blur(2px);
}

.addon-step__panel {
	position: relative;
	background: #fff;
	border-radius: 20px;
	padding: 2rem 2rem 1.75rem;
	max-width: 720px;
	width: 100%;
	max-height: min(85vh, 780px);
	overflow-y: auto;
	box-shadow: 0 24px 64px rgba(13, 19, 43, 0.28);
}

.addon-step__close {
	position: absolute;
	top: 1.1rem;
	right: 1.1rem;
	width: 32px;
	height: 32px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: var(--color-grey-light);
	border-radius: 8px;
	color: var(--color-navy-dark);
	cursor: pointer;
	transition: background 0.15s ease;
}
.addon-step__close:hover {
	background: #e4e4ea;
}

.addon-step__eyebrow {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-orange-accent);
	margin: 0 0 0.4rem;
}

.addon-step__title {
	font-family: var(--font-heading);
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--color-navy-dark);
	margin: 0 0 0.4rem;
	padding-right: 2rem;
	line-height: 1.25;
}

.addon-step__sub {
	font-size: 0.9rem;
	color: var(--color-navy-dark);
	opacity: 0.65;
	margin: 0 0 1.5rem;
}

.addon-step__grid {
	margin-bottom: 1.75rem;
}

/*
 * PAGED GRID (2026-08-12). The grid layout that used to live directly on
 * .addon-step__grid now lives on each .addon-step__page inside it — one
 * page per group of up to 4 add-ons, only one visible ([hidden] on the
 * rest) so the modal's footprint never changes as the visitor pages
 * through the full catalog instead of only ever seeing the first 4.
 */
.addon-step__page {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.9rem;
}
.addon-step__page[hidden] {
	display: none;
}

.addon-step__card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.4rem;
	padding: 0.9rem;
	border: 1.5px solid #ececf2;
	border-radius: 14px;
	background: #fff;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.addon-step__card:hover {
	border-color: var(--color-orange-accent);
	transform: translateY(-1px);
}
.addon-step__card.is-selected {
	border-color: var(--color-orange-accent);
	background: #fff8f0;
}
.addon-step__card.is-recommended {
	border-color: color-mix(in srgb, var(--color-orange-accent) 45%, #ececf2);
}
.addon-step__card.is-recommended.is-selected {
	border-color: var(--color-orange-accent);
}

.addon-step__card-image {
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: 8px;
	overflow: hidden;
	background: var(--color-grey-light);
}
.addon-step__card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.addon-step__card-badge {
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--color-orange-accent);
	background: color-mix(in srgb, var(--color-orange-accent) 12%, #fff);
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
}
.addon-step__card-badge[hidden] {
	display: none;
}

.addon-step__card-name {
	font-weight: 700;
	color: var(--color-navy-dark);
	font-size: 0.88rem;
	line-height: 1.3;
}
.addon-step__card-desc {
	font-weight: 400;
	color: var(--color-navy-dark);
	opacity: 0.65;
	font-size: 0.76rem;
	line-height: 1.4;
}

.addon-step__card-price {
	font-weight: 700;
	color: var(--color-orange-accent);
	font-size: 0.85rem;
}
.addon-step__card-price em {
	font-style: normal;
	font-weight: 500;
	opacity: 0.7;
}

.addon-step__card-check {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 18px;
	height: 18px;
	border-radius: 5px;
	border: 2px solid #ececf2;
	background: #fff;
	transition: background 0.2s ease, border-color 0.2s ease;
}
.addon-step__card.is-selected .addon-step__card-check {
	background: var(--color-orange-accent);
	border-color: transparent;
}
.addon-step__card.is-selected .addon-step__card-check::after {
	content: '';
	display: block;
	width: 4px;
	height: 8px;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(45deg);
	margin: 2px auto 0;
}

.addon-step__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--color-grey-light);
}

.addon-step__skip {
	background: none;
	border: none;
	color: var(--color-navy-dark);
	opacity: 0.6;
	font-weight: 600;
	font-size: 0.88rem;
	cursor: pointer;
	padding: 0.6rem 0.5rem;
	transition: opacity 0.15s ease;
}
.addon-step__skip:hover {
	opacity: 1;
}

.addon-step__continue {
	background: var(--color-orange-accent);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0.85rem 1.75rem;
	font-weight: 700;
	font-size: 0.92rem;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
.addon-step__continue[aria-busy="true"] {
	opacity: 0.7;
	cursor: default;
}

@media (max-width: 560px) {
	.addon-step__panel {
		padding: 1.5rem 1.25rem 1.5rem;
		border-radius: 16px;
	}
	.addon-step__page {
		grid-template-columns: 1fr 1fr;
	}
	.addon-step__foot {
		flex-direction: column-reverse;
		align-items: stretch;
		gap: 0.75rem;
	}
	.addon-step__continue {
		width: 100%;
	}
}

/* =====================================================================
 * COMPACT + CHECKBOX FIX — 2026-07-31
 * =====================================================================
 * Ara: "this needs to be compacted and the button icons and shape needs
 * fixing use rounded square or place holders view a few add-ons that works
 * best with the selected package."
 *
 * Three changes, appended so the originals above stay readable as history:
 *
 * 1. SIX CARDS, NOT TWELVE. Handled server-side (functions.php) — the modal
 *    now renders the tier-recommended six. This block just tightens what is
 *    left so those six fit without scrolling.
 *
 * 2. IMAGES WERE THE BULK. 16/10 art at ~200px wide made each card taller
 *    than its own text. Now a 56px rounded-square tile beside the name — the
 *    thumbnail identifies the add-on, it does not need to illustrate it.
 *
 * 3. THE CHECKBOX WAS ORANGE. --color-orange-accent is flagged in
 *    design-tokens.css as "legacy standalone accent — NOT in the gradient",
 *    so the one piece of state feedback in this flow was off-brand. Now the
 *    signature gradient, and the tick is properly centred (it was
 *    positioned only by rotation, so it sat off-centre in the box).
 * ===================================================================== */

.addon-step__grid {
	margin-bottom: 1.1rem;
}
.addon-step__page {
	/* Two columns of wider, shorter cards rather than three narrow tall ones
	   — a horizontal card puts the name, price and thumbnail on one line. */
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.6rem;
}

.addon-step__card {
	flex-direction: row;
	align-items: center;
	gap: 0.7rem;
	padding: 0.65rem 2.4rem 0.65rem 0.65rem; /* right pad clears the check */
	text-align: left;
}

/* Rounded-square tile, as asked. Fixed 56px so every card is the same
   height regardless of the source art's aspect ratio. */
.addon-step__card-image {
	width: 56px;
	height: 56px;
	flex: none;
	aspect-ratio: auto;
	border-radius: 10px;
}

.addon-step__card-name {
	font-size: 0.85rem;
	line-height: 1.3;
}
.addon-step__card-desc {
	font-size: 0.72rem;
	line-height: 1.35;
}

.addon-step__card-price {
	font-size: 0.82rem;
}

/* Badge moves inline under the name instead of overlaying the image, where
   it was covering the artwork it sat on. */
.addon-step__card-badge {
	display: inline-block;
	margin-top: 0.15rem;
	align-self: flex-start;
}

/* ---- checkbox ---------------------------------------------------------- */

.addon-step__card-check {
	top: 50%;
	right: 0.7rem;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	border-radius: 6px;
	/* Flex-centre the tick rather than relying on the rotation alone. */
	display: flex;
	align-items: center;
	justify-content: center;
}

.addon-step__card.is-selected .addon-step__card-check {
	background: var(--gradient-signature);
	border-color: transparent;
}

.addon-step__card.is-selected .addon-step__card-check::after {
	/* Nudged up 1px: a rotated tick's optical centre sits below its
	   geometric centre. */
	margin-top: -2px;
	transform: rotate(45deg);
}

/* ---- text column ------------------------------------------------------- */

.addon-step__card > span:not(.addon-step__card-image):not(.addon-step__card-check) {
	min-width: 0;
}

/*
 * .addon-step__nav — prev/next carousel controls (2026-08-12), only
 * rendered by functions.php when there's more than one page of add-ons.
 * Deliberately small/quiet: this is secondary navigation, not a second CTA,
 * so it stays off the signature gradient reserved for .addon-step__continue
 * and uses the original orange-accent/navy-text pairing this component's
 * header comment calls out as its visual language.
 */
.addon-step__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	margin: 0 0 1.1rem;
}

.addon-step__nav-btn {
	width: 28px;
	height: 28px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid #ececf2;
	border-radius: 8px;
	background: #fff;
	color: var(--color-navy-dark);
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.addon-step__nav-btn:hover:not(:disabled) {
	border-color: var(--color-orange-accent);
	background: #fff8f0;
}
.addon-step__nav-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.addon-step__nav-indicator {
	min-width: 3.75rem;
	font-size: 0.76rem;
	font-weight: 600;
	color: var(--color-navy-dark);
	opacity: 0.6;
	text-align: center;
}

@media (max-width: 640px) {
	.addon-step__page {
		grid-template-columns: 1fr;
	}
}
/* 2026-08-12 mobile audit: this modal + its paged carousel nav are BRAND
   NEW today (2026-08-12) and had zero mobile/tablet verification before
   this pass. Live-measured both the close (X) button and the prev/next
   nav buttons at 28-32px -- below the ~40-44px minimum touch target -- at
   every width, since neither has a mobile-specific size rule. Kept
   separate from the grid-column collapse above (that's a layout decision
   tied to the 2x2/1x4 card grid, not a touch-target one) and widened to
   860px so it also covers 768px tablets, which are touch-first devices --
   confirmed still 28-32px there before this fix. Desktop/laptop widths
   above 860px keep the original compact sizing from the 2026-07-31
   compaction pass (mouse-driven, not a touch-target concern there).
   CSS-only: does not touch the carousel's paging/selection JS. */
@media (max-width: 860px) {
	.addon-step__close {
		width: 44px;
		height: 44px;
	}
	/* Larger close button eats 12px further left than the title's
	   padding-right (2rem) budgeted for -- widen the reserve so the title
	   text can't wrap under the button at narrow widths. */
	.addon-step__title {
		padding-right: 2.75rem;
	}
	.addon-step__nav-btn {
		width: 44px;
		height: 44px;
	}
}

/* =====================================================================
 * LAYOUT + COLOUR FIXES — 2026-07-31 (round 2)
 * =====================================================================
 * Ara, with a screenshot: "do you see the problems?"
 *
 * Four, all traceable to the previous pass flipping .addon-step__card from
 * a vertical stack to `flex-direction: row` WITHOUT giving the children a
 * layout. Measured before fixing:
 *
 *   1. PRICE RUNS UNDER THE CHECKBOX. The check is absolutely positioned at
 *      right:0.7rem (x=616 on a card ending at 628); the price is a normal
 *      flex child that grew to x=588 and kept going, so "/month" rendered
 *      beneath it. The 38px right padding was not enough, and padding was
 *      the wrong tool — the price needed to stop, not the card to grow.
 *   2. NAMES WRAP TO 3 LINES. With no min-width:0 and no flex basis, the
 *      name box collapsed to its longest word and wrapped repeatedly.
 *   3. BADGE SHOVES CONTENT. "GREAT FOR THIS PACKAGE" was still an in-flow
 *      child, so on the one recommended card it stole horizontal space and
 *      pushed the name and price sideways — that card alone is misaligned.
 *   4. EVERYTHING IS ORANGE. Ten usages of --color-orange-accent: eyebrow,
 *      prices, borders, badge, checkbox, Continue button. design-tokens.css
 *      marks that token "legacy standalone accent — NOT in the gradient".
 *      I fixed only the checkbox last round and missed the other nine.
 * ===================================================================== */

/* ---- card grid: fixed columns, no fighting ------------------------------ */

/*
 * An explicit 3-column grid rather than flex. Thumbnail and checkbox are
 * fixed-width; the text column takes what remains. This is what stops the
 * price and the name from negotiating for the same pixels.
 */
.addon-step__card {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 0.7rem;
	padding: 0.65rem 0.75rem;
	/* Room for the absolutely-positioned check, reserved as a grid track
	   below instead of as blanket padding. */
	padding-right: 2.5rem;
}
.addon-step__card-image {
	grid-column: 1;
	grid-row: 1 / span 2;
}

/* min-width:0 is what actually permits the text column to shrink; without
   it a grid item refuses to go below its longest word. */
.addon-step__card-name {
	min-width: 0;
	grid-column: 2;
	grid-row: 1;
	font-size: 0.85rem;
	line-height: 1.3;
}

.addon-step__card-desc {
	min-width: 0;
	grid-column: 2;
	grid-row: 2;
	font-size: 0.72rem;
	line-height: 1.35;
	color: var(--color-navy-dark);
	opacity: 0.65;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.addon-step__card-price {
	grid-column: 3;
	grid-row: 1 / span 2;
	white-space: nowrap;
	font-size: 0.82rem;
	/* The price is its own track now, so it can never slide under the check. */
	padding-right: 0.15rem;
}

/*
 * The badge leaves the flow entirely and pins to the card's top-left corner,
 * overlaying the thumbnail. In-flow it was stealing a column from the two
 * elements that carry the actual information.
 */
.addon-step__card-badge {
	position: absolute;
	top: -0.45rem;
	left: 0.55rem;
	margin: 0;
	z-index: 1;
	padding: 0.1rem 0.4rem;
	font-size: 0.55rem;
	letter-spacing: 0.03em;
	border-radius: 999px;
	white-space: nowrap;
}

/* ---- colour: gradient/purple, not orange -------------------------------- */

.addon-step__eyebrow,
.addon-step__card-price {
	color: var(--color-purple-primary);
}

.addon-step__card:hover,
.addon-step__card:focus-visible,
.addon-step__card.is-selected,
.addon-step__card[aria-pressed="true"] {
	border-color: var(--color-purple-primary);
}

.addon-step__card-badge {
	color: #fff;
	background: var(--gradient-signature);
}

/*
 * The primary action carries the signature gradient, matching every other
 * primary CTA on the site (checkout place-order, add-to-cart, portal
 * "Add to plan"). A solid orange button here was the single largest
 * off-brand element in the purchase flow.
 */
.addon-step__continue {
	background: var(--gradient-signature);
	border: 0;
	border-radius: var(--radius-pill, 999px);
	transition: filter 0.16s ease-out, transform 0.16s ease-out;
}

.addon-step__continue:hover {
	filter: brightness(1.07);
	transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
	.addon-step__continue {
		transition: none;
	}

	.addon-step__continue:hover {
		transform: none;
	}
}
