/**
 * Keystone quote popup — engagement-triggered modal
 * ------------------------------------------------------------------
 * Styles the modal shell only. Content (chip/headline/body/button)
 * intentionally reuses the same shared tokens as `.keystone-cta--panel`
 * (see assets/css/cta-blocks.css and assets/css/tokens.css) so the
 * popup reads as the same design system, not a second one — and so a
 * `body.brand-{slug}` token override reskins it for free if this
 * feature is ever adopted by another brand. It is Swift Cargo-only
 * today; see the enqueue gate in functions.php.
 *
 * Loaded only on Swift Cargo single posts (see
 * keystone_quote_popup_assets()), so every selector below is
 * effectively scoped to that brand by the enqueue condition — same
 * reasoning cta-blocks.css uses for its own `.keystone-cta*` scoping,
 * just enforced server-side here instead of by a unique class prefix.
 *
 * @package Keystone
 * @since   1.0.50
 */

.keystone-quote-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.keystone-quote-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	animation: keystone-quote-popup-fade-in 0.2s ease;
}

.keystone-quote-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	box-sizing: border-box;
	padding: 32px 28px 28px;
	border-radius: var(--keystone-card-radius, 14px);
	background: var(--wp--preset--color--base, #ffffff);
	/* Same elevation token as .keystone-cta--panel — this popup is that
	   block's own content promoted to an interrupt moment, so it keeps
	   the same visual weight rather than inventing a new one. */
	box-shadow: var(--keystone-card-shadow, 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 6px 2px rgba(0, 0, 0, 0.15));
	animation: keystone-quote-popup-rise-in 0.25s ease;
}

.keystone-quote-popup__dialog:focus {
	outline: none;
}

.keystone-quote-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	border-radius: 999px;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--wp--preset--color--contrast-2, #4a5568);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.keystone-quote-popup__close:hover {
	background: var(--keystone-card-bg, #f1f1f4);
}

.keystone-quote-popup__close:focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast, #1a1a1a);
	outline-offset: 2px;
}

/* ── Chip / headline / body — same look as .keystone-cta--panel ────── */

.keystone-quote-popup__chip {
	margin: 0 0 12px;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--wp--preset--color--contrast-2, #4a5568);
}

.keystone-quote-popup__title {
	margin: 0 0 10px;
	padding-right: 22px; /* clears the close button */
	font-size: 1.2rem;
	line-height: 1.3;
}

.keystone-quote-popup__body {
	margin: 0 0 22px;
}

/* ── Action row + button — identical treatment to .keystone-cta__action ── */

.keystone-quote-popup__action {
	margin: 0;
	text-align: right;
}

.keystone-quote-popup__button {
	display: inline-block;
	max-width: 100%;
	box-sizing: border-box;
	padding: 12px 26px;
	border-radius: 999px;
	background: var(--wp--preset--color--accent, #377dff);
	color: var(--wp--preset--color--base, #ffffff);
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.keystone-quote-popup__button:hover,
.keystone-quote-popup__button:focus-visible {
	box-shadow: var(--keystone-card-shadow-hover, 0 2px 3px rgba(0, 0, 0, 0.30), 0 6px 10px 4px rgba(0, 0, 0, 0.15));
}

.keystone-quote-popup__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast, #1a1a1a);
	outline-offset: 2px;
}

/* Lock background scroll while the modal is open. */
body.keystone-quote-popup-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.keystone-quote-popup__dialog {
		padding: 26px 20px 20px;
	}

	.keystone-quote-popup__button {
		display: block;
		width: 100%;
	}
}

@keyframes keystone-quote-popup-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes keystone-quote-popup-rise-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.keystone-quote-popup__backdrop,
	.keystone-quote-popup__dialog {
		animation: none;
	}

	.keystone-quote-popup__button {
		transition: none;
	}
}
