/**
 * ThornBloom Exit-Intent Popup — component styles
 *
 * Midnight-blue card on dark blurred backdrop. IvyPresto heading +
 * Cormorant Garamond body. Gold hairline border. Fully keyboard-
 * accessible focus rings. Respects prefers-reduced-motion.
 *
 * Spec: user brief 2026-04-23. Dedicated file (NOT appended to
 * templates.css) per feedback_css_overlay_verification.md — 308 KB
 * ceiling on SG Optimizer auto-min.
 *
 * @since 2.7.39 (exit-popup)
 */

/* ── Screen-reader-only label helper (reusable) ─────────────────── */
.tb-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Root overlay — full viewport, layered above everything ────── */
.tb-exit-popup {
	position: fixed;
	inset: 0;
	z-index: 10000; /* above mini-cart drawer (9000) + sticky CTA (8000) */
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.tb-exit-popup[aria-hidden="false"] {
	display: flex;
}

/* Backdrop — dark, slightly blurred */
.tb-exit-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	cursor: pointer;
}

/* ── Card ──────────────────────────────────────────────────────── */
.tb-exit-popup__card {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: var(--realm-bg, #070A14);
	border: 1px solid rgba(209, 178, 140, 0.35);
	border-radius: 2px;
	padding: 48px 40px 40px;
	color: var(--tb-ivory, #E8E1D5);

	/* Subtle gold inner glow + drop shadow */
	box-shadow:
		0 24px 60px rgba(0, 0, 0, 0.6),
		inset 0 0 0 1px rgba(209, 178, 140, 0.08);
}

/* Fade + slight rise on open (skipped for reduced-motion, see below) */
.tb-exit-popup[aria-hidden="false"] .tb-exit-popup__card {
	animation: tb-exit-popup-in 240ms cubic-bezier(0.2, 0, 0.1, 1);
}

@keyframes tb-exit-popup-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Close button ─────────────────────────────────────────────── */
.tb-exit-popup__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid rgba(209, 178, 140, 0.25);
	border-radius: 2px;
	color: var(--realm-metallic, #D1B28C);
	cursor: pointer;
	transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
	padding: 0;
}

.tb-exit-popup__close:hover {
	transform: scale(1.05);
	border-color: var(--realm-metallic, #D1B28C);
	background: rgba(209, 178, 140, 0.06);
}

.tb-exit-popup__close:focus-visible {
	outline: 2px solid var(--realm-metallic, #D1B28C);
	outline-offset: 2px;
}

/* ── Body content ─────────────────────────────────────────────── */
.tb-exit-popup__body {
	text-align: center;
}

.tb-exit-popup__eyebrow {
	font-family: var(--tb-font-body, 'Cormorant Garamond', Georgia, serif);
	font-style: italic;
	font-size: 14px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--realm-metallic, #D1B28C);
	margin: 0 0 12px;
}

.tb-exit-popup__heading {
	font-family: var(--tb-font-display, 'ivypresto-display', 'Cinzel Decorative', 'Cinzel', Georgia, serif);
	font-weight: 600;
	font-size: 38px;
	line-height: 1.15;
	letter-spacing: 0.01em;
	color: var(--tb-ivory, #E8E1D5);
	margin: 0 0 16px;
}

.tb-exit-popup__heading em {
	font-style: italic;
	color: var(--realm-metallic, #D1B28C);
}

.tb-exit-popup__subhead {
	font-family: var(--tb-font-body, 'Cormorant Garamond', Georgia, serif);
	font-style: italic;
	font-size: 17px;
	line-height: 1.55;
	color: var(--tb-ivory, #E8E1D5);
	opacity: 0.88;
	margin: 0 auto 24px;
	max-width: 40ch;
}

/* ── Form ─────────────────────────────────────────────────────── */
.tb-exit-popup__form {
	display: flex;
	gap: 10px;
	margin: 0 0 14px;
	flex-wrap: wrap;
}

.tb-exit-popup__email {
	flex: 1 1 220px;
	min-width: 0;
	padding: 12px 14px;
	font-family: var(--tb-font-body, 'Cormorant Garamond', Georgia, serif);
	font-size: 16px;
	line-height: 1.4;
	color: var(--tb-ivory, #E8E1D5);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(209, 178, 140, 0.35);
	border-radius: 2px;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 180ms ease, background 180ms ease;
}

.tb-exit-popup__email::placeholder {
	color: rgba(232, 225, 213, 0.45);
	font-style: italic;
}

.tb-exit-popup__email:focus-visible {
	outline: 2px solid var(--realm-metallic, #D1B28C);
	outline-offset: 2px;
	border-color: var(--realm-metallic, #D1B28C);
	background: rgba(255, 255, 255, 0.06);
}

.tb-exit-popup__submit {
	flex: 0 0 auto;
	padding: 12px 22px;
	font-family: var(--tb-font-heading, 'ivypresto-display', 'Cinzel', Georgia, serif);
	font-weight: 600;
	font-size: 15px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: var(--realm-metallic, #D1B28C);
	color: var(--realm-bg, #070A14);
	border: 1px solid var(--realm-metallic, #D1B28C);
	border-radius: 2px;
	cursor: pointer;
	transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.tb-exit-popup__submit:hover,
.tb-exit-popup__submit:focus-visible {
	background: #E1C29A;
	border-color: #E1C29A;
}

.tb-exit-popup__submit:focus-visible {
	outline: 2px solid var(--realm-metallic, #D1B28C);
	outline-offset: 2px;
}

.tb-exit-popup__submit:disabled {
	opacity: 0.6;
	cursor: wait;
}

/* Shared MailerLite msg element — handler writes into .tb-ml-form__msg */
.tb-exit-popup__msg {
	flex: 0 0 100%;
	min-height: 1.2em;
	margin: 0;
	font-family: var(--tb-font-body, 'Cormorant Garamond', Georgia, serif);
	font-size: 14px;
	text-align: center;
	color: var(--realm-metallic, #D1B28C);
}

.tb-exit-popup__finefooter {
	font-family: var(--tb-font-body, 'Cormorant Garamond', Georgia, serif);
	font-style: italic;
	font-size: 13px;
	color: rgba(232, 225, 213, 0.6);
	margin: 0;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
	.tb-exit-popup {
		padding: 16px;
	}

	.tb-exit-popup__card {
		max-width: min(92vw, 420px);
		padding: 56px 22px 28px;
	}

	.tb-exit-popup__heading {
		font-size: 26px;
	}

	.tb-exit-popup__subhead {
		font-size: 16px;
		margin-bottom: 20px;
	}

	.tb-exit-popup__form {
		flex-direction: column;
		gap: 8px;
	}

	.tb-exit-popup__email,
	.tb-exit-popup__submit {
		flex: 1 1 100%;
		width: 100%;
	}
}

/* ── Reduced motion — instant display, no fade/rise ───────────── */
@media (prefers-reduced-motion: reduce) {
	.tb-exit-popup[aria-hidden="false"] .tb-exit-popup__card {
		animation: none;
	}

	.tb-exit-popup__close,
	.tb-exit-popup__submit,
	.tb-exit-popup__email {
		transition: none;
	}
}
