/* FastoPop frontend styles. Mobile-first, class-prefix scoped (.fastopop-*). */

.fastopop-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 23, 45, 0.65);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	padding: 16px;
	box-sizing: border-box;
	font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	animation: fastopop-fade 200ms ease-out;
}

@keyframes fastopop-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.fastopop-modal {
	background: #ffffff;
	color: #00172d;
	border-radius: 12px;
	width: 100%;
	max-width: 600px;
	padding: 32px 24px;
	box-shadow: 0 20px 50px rgba(0, 23, 45, 0.25);
	position: relative;
	box-sizing: border-box;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
}

/* Mode A (Fasto-branded template) defaults to center-aligned content.
   Custom HTML mode (.fastopop-content--custom_html) inherits whatever the merchant's HTML provides. */
.fastopop-content--branded {
	text-align: center;
}

.fastopop-modal--small  { max-width: 400px; }
.fastopop-modal--medium { max-width: 600px; }
.fastopop-modal--large  { max-width: 900px; }

.fastopop-overlay--fullpage {
	padding: 0;
}

/* =====================================================================
   Age verification mode — blocks page access until visitor confirms age.
   The overlay variant hides the close button; body class locks scrolling
   and blurs the page content behind the modal (variable-driven).
   ===================================================================== */
body.fastopop-av-active {
	overflow: hidden;
}
/* Blur all direct body children except our own overlay so the page content
   recedes behind the modal. Most WP themes wrap their layout in one or two
   direct-child divs (#wpwrap, #page, .site, etc.) which this catches cleanly. */
body.fastopop-av-active > *:not(.fastopop-overlay) {
	filter: blur(var(--fastopop-av-blur, 0));
	pointer-events: none;
	user-select: none;
}
.fastopop-overlay--age-verification .fastopop-close {
	display: none;
}
.fastopop-av-yes,
.fastopop-av-no {
	font-family: inherit;
}
/* Higher-specificity selector (.fastopop-modal.fastopop-modal--fullpage = 0,2,0)
   wins cleanly over the base .fastopop-modal max-width: 600px (0,1,0) regardless
   of source order. Sizing applies to both modes; layout (block vs flex-centered)
   differs by mode and is set in the rules below. */
.fastopop-modal.fastopop-modal--fullpage {
	max-width: 100vw;
	width: 100vw;
	height: 100vh;
	max-height: 100vh;
	border-radius: 0;
	padding: 0;
	overflow-y: auto;
}
/* Mode A fullpage: flex-centers its 640px content column both axes. */
.fastopop-modal.fastopop-modal--fullpage.fastopop-mode-branded {
	display: flex;
	align-items: center;
	justify-content: center;
}
/* Custom HTML fullpage: plain block layout so merchant HTML can fill 100vw × 100vh
   instead of getting flex-centered into a smaller box on wide viewports. */
.fastopop-modal.fastopop-modal--fullpage.fastopop-mode-custom_html {
	display: block;
}
/* Fullpage Mode A: constrain the readable column to 640px and add safe-area padding.
   Custom HTML fullpage is intentionally NOT scoped here — merchants fill the viewport. */
.fastopop-modal--fullpage.fastopop-mode-branded .fastopop-content {
	max-width: 640px;
	width: 100%;
	padding: 32px 24px;
	box-sizing: border-box;
}
/* Pin close to the viewport corner so it stays put if fullpage content scrolls. */
.fastopop-modal--fullpage .fastopop-close {
	position: fixed;
	top: 24px;
	right: 24px;
}

@media (min-width: 768px) {
	.fastopop-modal--fullpage.fastopop-mode-branded .fastopop-content {
		padding: 48px 40px;
	}
}

/* Theme isolation: neutralize button styling that the merchant's theme may apply
   globally (border, shadow, outline, background-image, text-shadow). Specificity
   0,1,1 wins over any unscoped `button` / `[type=submit]` theme rules without
   needing !important on every property. Color + background + padding stay
   property-by-property in the rules below so each button can claim its own look. */
.fastopop-overlay button,
.fastopop-modal button {
	border: 0;
	box-shadow: none;
	outline: none;
	background-image: none;
	text-shadow: none;
}

.fastopop-close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: transparent;
	border: 0;
	box-shadow: none;
	line-height: 1;
	color: #00172d;
	cursor: pointer;
	padding: 6px 8px;
	/* Flex centers the inline SVG cross regardless of font/glyph quirks. */
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.fastopop-close:hover,
.fastopop-close:focus {
	opacity: 0.7;
	outline: none;
}

/* ============================================================
   Custom HTML mode — strip the modal frame so the merchant's
   HTML IS the entire visual. Size variants (small/medium/large/
   fullpage) still control modal width/height; we only remove
   the chrome (background, padding, radius, shadow).
   Mode A (fastopop-mode-branded) is untouched.
   ============================================================ */
.fastopop-mode-custom_html {
	background: transparent;
	padding: 0;
	border-radius: 12px;
	/* Clip merchant content at the rounded corners. The base .fastopop-modal
	   sets overflow-y: auto; we override here because Custom HTML modals are
	   sized to fit their content — fullpage handles tall content separately. */
	overflow: hidden;
	box-shadow: none;
}
.fastopop-mode-custom_html .fastopop-content {
	padding: 0;
}

/* Pill-style close button so it stays readable on whatever the
   merchant's HTML places behind it. */
.fastopop-mode-custom_html .fastopop-close {
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: rgba(0, 0, 0, 0.5);
	color: #ffffff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	line-height: 1;
}
.fastopop-mode-custom_html .fastopop-close:hover,
.fastopop-mode-custom_html .fastopop-close:focus {
	background: rgba(0, 0, 0, 0.75);
	opacity: 1;
	outline: none;
}

/* Full page Custom HTML — keep close button at the 24px inset that the
   existing fullpage rule already uses. Higher selector specificity here
   overrides the 12px from the rule above. position: fixed cascades from
   .fastopop-modal--fullpage .fastopop-close. */
.fastopop-mode-custom_html.fastopop-modal--fullpage .fastopop-close {
	top: 24px;
	right: 24px;
}

/* Full page Custom HTML — undo the rounded corners + restore vertical scroll
   (the base custom_html rule above sets overflow:hidden for the rounded-corner
   clip, but fullpage popups can be tall and must scroll). */
.fastopop-mode-custom_html.fastopop-modal--fullpage {
	border-radius: 0;
	overflow-y: auto;
}
/* Let merchant content with height: 100% on its outer wrapper actually fill
   the viewport top-to-bottom. Scoped to Custom HTML only — Mode A fullpage
   relies on the flex container's align-items: center for its centered
   640px column, which would break if .fastopop-content stretched to 100%. */
.fastopop-mode-custom_html.fastopop-modal--fullpage .fastopop-content {
	height: 100%;
}

.fastopop-headline {
	font-weight: 700;
	font-size: 24px;
	line-height: 1.2;
	margin: 0 0 8px;
	color: #00172d;
}
.fastopop-subheadline {
	font-weight: 600;
	font-size: 16px;
	margin: 0 0 16px;
	color: #00172d;
	opacity: 0.85;
}
.fastopop-body {
	font-size: 15px;
	line-height: 1.5;
	margin: 0 0 20px;
	color: #00172d;
}
.fastopop-body p {
	margin: 0 0 12px;
}
.fastopop-body p:last-child {
	margin-bottom: 0;
}
.fastopop-body a {
	color: #005ee0;
}

.fastopop-cta {
	display: inline-block;
	background: #005ee0;
	color: #ffffff;
	text-decoration: none;
	font-weight: 600;
	padding: 12px 24px;
	border-radius: 8px;
	transition: opacity 150ms ease;
}
.fastopop-cta:hover,
.fastopop-cta:focus {
	opacity: 0.9;
	color: #ffffff;
	outline: none;
}

.fastopop-poweredby {
	margin: 20px 0 0;
	font-size: 12px;
	text-align: center;
}
/* Link inherits the merchant's body color so it stays readable on any background.
   Underline + hover opacity are the link affordances, not color. */
.fastopop-poweredby a {
	color: inherit;
	text-decoration: underline;
}
.fastopop-poweredby a:hover,
.fastopop-poweredby a:focus {
	opacity: 0.7;
	outline: none;
}

.fastopop-form {
	margin: 16px 0 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: left;
}
.fastopop-content--branded .fastopop-form {
	/* Center the form column but keep inputs left-aligned for readability. */
	max-width: 360px;
	margin-left: auto;
	margin-right: auto;
}
.fastopop-input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid rgba(0, 23, 45, 0.2);
	border-radius: 6px;
	font: inherit;
	color: #00172d;
	background: #ffffff;
}
.fastopop-input:focus {
	outline: none;
	border-color: #005ee0;
	box-shadow: 0 0 0 3px rgba(0, 94, 224, 0.18);
}
.fastopop-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 13px;
	line-height: 1.4;
	color: #00172d;
}
.fastopop-consent input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
}
.fastopop-consent a {
	color: #005ee0;
}
.fastopop-form-submit {
	background: #005ee0;
	color: #ffffff;
	border: 0;
	font: inherit;
	font-weight: 600;
	padding: 12px 24px;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 150ms ease;
}
.fastopop-form-submit:hover,
.fastopop-form-submit:focus {
	opacity: 0.9;
	outline: none;
}
.fastopop-form-submit[disabled] {
	opacity: 0.6;
	cursor: default;
}
.fastopop-form-message {
	color: #b3261e;
	font-size: 13px;
}
.fastopop-form-success {
	color: #00172d;
	font-weight: 600;
	margin: 0;
}
/* Honeypot — off-screen and inaccessible to humans, but bots fill it. */
.fastopop-hp {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	opacity: 0 !important;
}

@media (min-width: 768px) {
	/* Desktop padding scoped to Mode A only — Custom HTML mode keeps padding:0
	   so merchant content renders edge-to-edge. */
	.fastopop-modal.fastopop-mode-branded {
		padding: 40px 32px;
	}
	.fastopop-headline {
		font-size: 28px;
	}
}

/* =====================================================================
   Sticky bars — full-width strips fixed to the top or bottom edge.
   No backdrop, no scroll lock. Sits below modal overlays (999999) so a
   modal always covers a bar, and above typical theme headers.
   JS sets `top` on top bars to clear the WP admin bar; the admin-bar
   rules below are the no-JS-measurement fallback for the first paint.
   ===================================================================== */
.fastopop-bar {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 999990;
	box-sizing: border-box;
	max-height: 40vh;
	overflow-y: auto;
	font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	color: #00172d;
	box-shadow: 0 2px 12px rgba(0, 23, 45, 0.18);
}
.fastopop-bar--top {
	top: 0;
	animation: fastopop-bar-down 250ms ease-out;
}
.fastopop-bar--bottom {
	bottom: 0;
	box-shadow: 0 -2px 12px rgba(0, 23, 45, 0.18);
	animation: fastopop-bar-up 250ms ease-out;
}
body.admin-bar .fastopop-bar--top {
	top: 32px;
}
@media screen and (max-width: 782px) {
	body.admin-bar .fastopop-bar--top {
		top: 46px;
	}
}
@keyframes fastopop-bar-down {
	from { transform: translateY(-100%); }
	to   { transform: translateY(0); }
}
@keyframes fastopop-bar-up {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
	.fastopop-bar--top,
	.fastopop-bar--bottom {
		animation: none;
	}
}

/* Branded bars get the merchant's bg colour inline; this is the fallback. */
.fastopop-bar--branded {
	background: #ffffff;
}
/* Custom HTML bars: the merchant's HTML is the whole visual. */
.fastopop-bar--custom_html {
	background: transparent;
}

/* Theme isolation, same reasoning as the modal rule above. */
.fastopop-bar button {
	border: 0;
	box-shadow: none;
	outline: none;
	background-image: none;
	text-shadow: none;
}

/* Close sits top-right so it stays reachable when the content wraps on mobile.
   Branded content reserves room for it via padding-right; Custom HTML content
   is told (in the editor help note) to leave ~48px free on the right. */
.fastopop-bar__close {
	position: absolute;
	top: 6px;
	right: 8px;
	width: 32px;
	height: 32px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: #00172d;
	border-radius: 50%;
	cursor: pointer;
	line-height: 1;
}
.fastopop-bar__close:hover {
	opacity: 0.7;
}
.fastopop-bar__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.fastopop-bar--custom_html .fastopop-bar__close {
	background: rgba(0, 0, 0, 0.5);
	color: #ffffff;
}
.fastopop-bar--custom_html .fastopop-bar__close:hover {
	background: rgba(0, 0, 0, 0.75);
	opacity: 1;
}

/* Branded layout: one row on desktop inside a centred max-width container —
   the container keeps the form clear of floating corner buttons (cookie
   consent badges, chat launchers) on wide screens. Wraps on narrow screens. */
.fastopop-bar__content.fastopop-content--branded {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 16px;
	max-width: 960px;
	margin: 0 auto;
	padding: 10px 56px 10px 16px;
	box-sizing: border-box;
	text-align: left;
}
.fastopop-bar__text {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	min-width: 0;
}
.fastopop-bar__headline {
	font-weight: 700;
	font-size: 15px;
}
.fastopop-bar__subheadline {
	font-weight: 600;
	opacity: 0.85;
}
.fastopop-bar__body,
.fastopop-bar__body p {
	display: inline;
	margin: 0;
}
.fastopop-bar__body a {
	color: inherit;
	text-decoration: underline;
}
.fastopop-bar .fastopop-cta {
	padding: 8px 16px;
	font-size: 14px;
	border-radius: 6px;
	white-space: nowrap;
}

/* Capture form: [email][Subscribe] as one joined unit, consent after it,
   all on the headline's row on desktop. Flex-basis values let the row break
   naturally (unit first, then consent) as the viewport narrows. */
.fastopop-bar .fastopop-form {
	flex: 1 1 520px;
	max-width: 760px;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 14px;
	margin: 0;
}
.fastopop-bar .fastopop-form__unit {
	display: flex;
	flex: 1 1 280px;
	min-width: 0;
}
.fastopop-bar .fastopop-input {
	width: auto;
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 10px;
}
.fastopop-bar .fastopop-form__unit .fastopop-input:not(:first-child) {
	margin-left: 6px;
}
.fastopop-bar .fastopop-form__unit .fastopop-input:last-of-type {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}
.fastopop-bar .fastopop-form-submit {
	flex: 0 0 auto;
	padding: 8px 16px;
	border-radius: 0 6px 6px 0;
	white-space: nowrap;
}
.fastopop-bar .fastopop-consent {
	flex: 0 1 auto;
	font-size: 12px;
	align-items: center;
}
.fastopop-bar .fastopop-consent input[type="checkbox"] {
	margin-top: 0;
}
.fastopop-bar .fastopop-form-message {
	flex-basis: 100%;
}

/* Thank-you state reuses the modal markup; compact it to one line. */
.fastopop-bar .fastopop-headline {
	font-size: 15px;
	margin: 0;
}
.fastopop-bar .fastopop-subheadline,
.fastopop-bar .fastopop-body,
.fastopop-bar .fastopop-body p {
	margin: 0;
	font-size: 14px;
}
.fastopop-bar .fastopop-poweredby {
	margin: 0;
	font-size: 11px;
}

@media (max-width: 600px) {
	/* Phones: headline on top, [email][Subscribe] side by side, consent below. */
	.fastopop-bar__content.fastopop-content--branded {
		justify-content: flex-start;
	}
	.fastopop-bar__text,
	.fastopop-bar .fastopop-form,
	.fastopop-bar .fastopop-form__unit,
	.fastopop-bar .fastopop-consent {
		flex-basis: 100%;
		max-width: 100%;
	}
}
