/* =========================================================================
 * Curvita — Launch popup (first-visit welcome experience)
 * -------------------------------------------------------------------------
 * Full-viewport overlay with glassmorphic card. Hidden by default via
 * the [hidden] attribute on #curvita-launch-popup; JS reveals it only
 * after the bot-detection gates pass.
 *
 * Sections:
 *   1. Overlay container + lock state
 *   2. Backdrop
 *   3. Canvas layers (confetti + fireworks)
 *   4. Glassmorphic card
 *   5. Brand mark + headings + subtitle
 *   6. CTA button + close X + footnote
 *   7. Animations (entrance, message swap, exit)
 *   8. Mobile responsive
 *   9. prefers-reduced-motion
 * ========================================================================= */


/* ─── 1. Overlay container ───────────────────────────────────────── */

.curvita-launch-popup {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--sp-4);
	overflow: hidden;
	overscroll-behavior: contain;
	-webkit-tap-highlight-color: transparent;
}

/* When [hidden] is present (default + after dismiss), display: none
 * keeps the popup completely out of the layout tree. */
.curvita-launch-popup[hidden] {
	display: none !important;
}

/* Body class added by JS while the popup is open — locks scroll. */
body.curvita-launch-open {
	overflow: hidden;
}


/* ─── 2. Backdrop ────────────────────────────────────────────────── */

.curvita-launch-popup__backdrop {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgb(255 166 201 / 95%) 0%, rgb(226 124 124 / 92%) 100%);
	cursor: pointer;
}


/* ─── 3. Canvas layers ───────────────────────────────────────────── */

/* Confetti rains down from above the viewport. Pointer-events:none so
 * clicks pass through to the backdrop / card. */
.curvita-launch-popup__confetti,
.curvita-launch-popup__fireworks {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.curvita-launch-popup__fireworks {
	mix-blend-mode: screen;       /* Bursts brighten the pink backdrop */
}


/* ─── 4. Glassmorphic card ───────────────────────────────────────── */

.curvita-launch-popup__card {
	position: relative;
	z-index: 2;
	max-width: 540px;
	width: 100%;
	padding: clamp(32px, 5vw, 56px) clamp(24px, 5vw, 64px);
	text-align: center;
	background: rgb(255 255 255 / 18%);
	backdrop-filter: blur(24px) saturate(180%);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	border: 2px solid rgb(255 255 255 / 50%);
	box-shadow: 0 24px 80px rgb(0 0 0 / 25%), inset 0 1px 0 rgb(255 255 255 / 30%);
	color: var(--c-white);
	font-family: var(--font-heading);
}


/* ─── 5. Brand mark + headings + subtitle ────────────────────────── */

.curvita-launch-popup__brand {
	font-family: var(--font-heading);
	font-size: 11px;
	letter-spacing: 0.3em;
	font-weight: 600;
	color: rgb(255 255 255 / 92%);
	margin-bottom: var(--sp-3);
	text-transform: uppercase;
}

.curvita-launch-popup__heading {
	font-family: var(--font-heading);
	font-size: clamp(24px, 4vw, 34px);
	font-weight: 600;
	line-height: 1.2;
	color: var(--c-white);
	margin: 0 0 var(--sp-3) 0;
	min-height: 2.4em;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
	letter-spacing: -0.005em;
}

.curvita-launch-popup__subtitle {
	font-family: var(--font-body);
	font-size: clamp(15px, 1.6vw, 17px);
	line-height: 1.5;
	color: rgb(255 255 255 / 92%);
	margin: 0 0 var(--sp-6) 0;
	min-height: 3em;
	font-weight: 400;
	transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.curvita-launch-popup__heading.is-fading,
.curvita-launch-popup__subtitle.is-fading {
	opacity: 0;
}


/* ─── 6. CTA button + close X + footnote ─────────────────────────── */

.curvita-launch-popup__cta {
	display: inline-block;
	padding: 16px 44px;
	background: var(--c-white);
	color: var(--c-navy);
	border: 0;
	border-radius: 0;
	font-family: var(--font-heading);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	cursor: pointer;
	transition: transform 0.2s, background 0.2s, color 0.2s;
	min-height: 48px;
	box-shadow: 0 4px 20px rgb(0 0 0 / 18%);
}
.curvita-launch-popup__cta:hover,
.curvita-launch-popup__cta:focus-visible {
	background: var(--c-navy);
	color: var(--c-white);
	transform: translateY(-2px);
	outline: none;
}
.curvita-launch-popup__cta:active {
	transform: translateY(0);
}

.curvita-launch-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 0;
	color: rgb(255 255 255 / 80%);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.15s, transform 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.curvita-launch-popup__close:hover,
.curvita-launch-popup__close:focus-visible {
	color: var(--c-white);
	transform: scale(1.15);
	outline: none;
}

.curvita-launch-popup__footnote {
	font-family: var(--font-body);
	font-size: 11px;
	color: rgb(255 255 255 / 70%);
	margin: var(--sp-4) 0 0 0;
	letter-spacing: 0.04em;
}


/* ─── 7. Entrance + exit animations ──────────────────────────────── */

@keyframes curvita-launch-fade-in {
	0%   { opacity: 0; }
	100% { opacity: 1; }
}

@keyframes curvita-launch-card-in {
	0%   { opacity: 0; transform: scale(0.85) translateY(20px); }
	100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes curvita-launch-fade-out {
	0%   { opacity: 1; }
	100% { opacity: 0; }
}

@keyframes curvita-launch-card-out {
	0%   { opacity: 1; transform: scale(1) translateY(0); }
	100% { opacity: 0; transform: scale(0.92) translateY(10px); }
}

.curvita-launch-popup.is-entering .curvita-launch-popup__backdrop {
	animation: curvita-launch-fade-in 0.5s ease forwards;
}
.curvita-launch-popup.is-entering .curvita-launch-popup__card {
	animation: curvita-launch-card-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.curvita-launch-popup.is-exiting .curvita-launch-popup__backdrop {
	animation: curvita-launch-fade-out 0.4s ease forwards;
}
.curvita-launch-popup.is-exiting .curvita-launch-popup__card {
	animation: curvita-launch-card-out 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}


/* ─── 8. Mobile responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
	.curvita-launch-popup {
		padding: var(--sp-3);
		align-items: flex-end;
	}
	.curvita-launch-popup__card {
		padding: 36px 24px 28px;
		max-width: 100%;
		margin-bottom: env(safe-area-inset-bottom, 0);
	}
	.curvita-launch-popup__heading {
		min-height: auto;
		margin-bottom: 12px;
	}
	.curvita-launch-popup__subtitle {
		min-height: auto;
		margin-bottom: var(--sp-5);
	}
	.curvita-launch-popup__cta {
		display: block;
		width: 100%;
		padding: 16px;
	}
	.curvita-launch-popup__close {
		top: 8px;
		right: 8px;
	}
	.curvita-launch-popup__brand {
		font-size: 10px;
	}
}

/* On really tall mobile, center the card so it's not glued to the bottom */
@media (max-width: 600px) and (min-height: 800px) {
	.curvita-launch-popup {
		align-items: center;
	}
}


/* ─── 9. Reduced motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.curvita-launch-popup__confetti,
	.curvita-launch-popup__fireworks {
		display: none;
	}
	.curvita-launch-popup.is-entering .curvita-launch-popup__backdrop,
	.curvita-launch-popup.is-entering .curvita-launch-popup__card,
	.curvita-launch-popup.is-exiting .curvita-launch-popup__backdrop,
	.curvita-launch-popup.is-exiting .curvita-launch-popup__card {
		animation-duration: 0.01s !important;
	}
	.curvita-launch-popup__heading,
	.curvita-launch-popup__subtitle {
		transition-duration: 0.01s !important;
	}
}

/* Launch coupon line — permanent (not part of the rotating messages).
   Flat design per brand: no rounded corners, no shadows. */
.curvita-launch-popup__coupon {
	margin: 18px 0 22px;
	font-family: 'Lato', sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--c-navy, #0E243F);
}

.curvita-launch-popup__coupon-text {
	display: block;
	margin-bottom: 8px;
}

.curvita-launch-popup__coupon-code {
	display: inline-block;
	padding: 8px 18px;
	font-family: 'Montserrat', sans-serif;
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 2px;
	color: var(--c-navy, #0E243F);
	background: var(--c-white, #FFF);
	border: 2px dashed var(--c-pink-brand, #FFA6C9);
	user-select: all;
}

@media (max-width: 600px) {
	.curvita-launch-popup__coupon {
		font-size: 14px;
		margin: 14px 0 18px;
	}
	.curvita-launch-popup__coupon-code {
		font-size: 17px;
		padding: 7px 14px;
	}
}
