/* FF Popups – Frontend Styles */

/* =========================================================================
   Overlay backdrop
   Hidden with display:none so the browser has no "invisible element" to
   skip compositing — the animation always gets a real layout to start from.
   ========================================================================= */

.ff-popup {
	display: none;
	align-items: center;
	justify-content: center;
	position: fixed;
	inset: 0;
	z-index: 99999;
}

.ff-popup--has-overlay {
	background: rgba( 0, 0, 0, 0.6 );
}

/* Opacity and transform are set and animated entirely via inline styles
   by frontend.js — no CSS animation or transition needed here. */

/* =========================================================================
   Position variants
   ========================================================================= */

.ff-popup--center       { align-items: center;     justify-content: center;     }
.ff-popup--top-left     { align-items: flex-start; justify-content: flex-start; padding: 24px; }
.ff-popup--top-right    { align-items: flex-start; justify-content: flex-end;   padding: 24px; }
.ff-popup--bottom-left  { align-items: flex-end;   justify-content: flex-start; padding: 24px; }
.ff-popup--bottom-right { align-items: flex-end;   justify-content: flex-end;   padding: 24px; }

/* =========================================================================
   Container — flex column so header/footer never scroll
   ========================================================================= */

.ff-popup__container {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.3 );
	width: 100%;
	max-height: 90vh;
	overflow: hidden;
	/* Isolate stacking context so block content can't leak above the header */
	isolation: isolate;
}

/* Container transform is animated by frontend.js via inline styles. */

/* =========================================================================
   Header — close button row, never scrolls, always on top
   ========================================================================= */

.ff-popup__header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-shrink: 0;
	padding: 8px 8px 0;
	position: relative;
	z-index: 2; /* above scrollable block content */
}

.ff-popup__header--has-title {
	justify-content: space-between;
	padding: 20px 8px 0 24px;
}

.ff-popup__title {
	margin: 0;
	font-size: 1.35em;
	font-weight: 600;
	line-height: 1.3;
}

/* =========================================================================
   Close button
   44 × 44 px touch target. pointer-events: all ensures clicks land here
   even if a parent has pointer-events overridden by theme/plugin CSS.
   ========================================================================= */

.ff-popup__close {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	color: #555;
	padding: 0;
	position: relative;
	z-index: 2;
	pointer-events: all;
	transition: color 0.15s ease, background 0.15s ease;
}

.ff-popup__close:hover,
.ff-popup__close:focus {
	color: #111;
	background: rgba( 0, 0, 0, 0.08 );
	outline: none;
}

/* =========================================================================
   Body — only this zone scrolls
   ========================================================================= */

.ff-popup__body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	position: relative;
	z-index: 1;
}

/* =========================================================================
   Content
   ========================================================================= */

.ff-popup__content {
	padding: 16px 24px 24px;
}

/* =========================================================================
   Footer & CTA button
   ========================================================================= */

.ff-popup__footer {
	flex-shrink: 0;
	padding: 0 24px 24px;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	position: relative;
	z-index: 2;
	flex-direction: column;
	text-align: center;}

.ff-popup__btn {
	display: inline-block;
	padding: 12px 24px;
	border-radius: 5px;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ff-popup__btn--primary {
	background: #1a73e8;
	color: #fff;
	border: 2px solid #1a73e8;
}
.ff-popup__btn--primary:hover,
.ff-popup__btn--primary:focus {
	background: #1558c0;
	border-color: #1558c0;
	color: #fff;
}

.ff-popup__btn--secondary {
	background: transparent;
	color: #1a73e8;
	border: 2px solid #1a73e8;
}
.ff-popup__btn--secondary:hover,
.ff-popup__btn--secondary:focus {
	background: #1a73e8;
	color: #fff;
}

.ff-popup__btn--link {
	background: none;
	border: none;
	color: #1a73e8;
	padding: 12px 4px;
	text-decoration: underline;
}
.ff-popup__btn--link:hover,
.ff-popup__btn--link:focus {
	color: #1558c0;
}

/* =========================================================================
   Body scroll lock
   ========================================================================= */

body.ff-popup-open {
	overflow: hidden;
}

/* =========================================================================
   Mobile
   ========================================================================= */

@media ( max-width: 600px ) {
	.ff-popup {
		align-items: flex-end !important;
		justify-content: center !important;
		padding: 0 !important;
	}

	.ff-popup__container {
		border-radius: 16px 16px 0 0;
		max-height: 88vh;
	}

	.ff-popup__title {
		font-size: 1.2em;
	}
}
