/*
 * BGT site-wide popup.
 *
 * Hidden by default; the JS driver flips `.is-open` on the root
 * after the configured delay (if no session-dismissal flag is set).
 *
 * Backdrop colour is set inline by the JS driver based on the
 * admin's chosen opacity, so we deliberately do NOT set
 * background-color on .bgt-site-popup__backdrop here.
 *
 * Palette is restrained and travel-magazine in feel:
 *   - Surface:      pure white
 *   - Accent rail:  muted gold #c8a464 (brass / club-house)
 *   - Eyebrow:      same muted gold, uppercase + letter-spaced
 *   - Heading:      charcoal #1a1a1a in `Hind`
 *   - Body:         #4a4a4a in the site Raleway stack
 *   - Body links:   deep golf green #2f5d3a
 *   - CTA:          charcoal #1f2933 with light shadow,
 *                   gold focus ring
 *   - Close:        neutral gray with a soft circular hover,
 *                   gold focus ring
 *
 * The brand red `#b63327` is intentionally NOT used here - it
 * pushes the popup into "alert" territory rather than the calm,
 * editorial register the rest of the site reads in.
 */

.bgt-site-popup {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	opacity: 0;
	transition: opacity 240ms ease;
	box-sizing: border-box;
}

.bgt-site-popup * {
	box-sizing: border-box;
}

.bgt-site-popup.is-open {
	display: flex;
	opacity: 1;
}

.bgt-site-popup__backdrop {
	position: absolute;
	inset: 0;
}

/*
 * Card. The 2px gold rail at the top is a subtle brand cue;
 * when the popup has a hero image the rail is dropped via the
 * `--with-hero` modifier because the photograph carries the
 * visual anchoring instead.
 */
/*
 * The card width and the hero image height are driven by two CSS
 * custom properties set inline on the .bgt-site-popup root by the
 * footer renderer (see altair-child/includes/site-popup.php):
 *
 *   --bgt-site-popup-width        480 | 520 | 640 | 760
 *   --bgt-site-popup-hero-height  140 | 160 | 220
 *
 * Fallback values mirror the historical defaults so the popup
 * still renders correctly if the inline style is ever stripped.
 */
.bgt-site-popup__card {
	position: relative;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.04);
	padding: 44px 36px 32px;
	max-width: var(--bgt-site-popup-width, 520px);
	width: 100%;
	max-height: calc(100vh - 48px);
	overflow: hidden auto;
	text-align: left;
	font-family: 'Raleway', 'Helvetica Neue', Arial, Verdana, sans-serif;
	color: #555;
	line-height: 1.6;
	border-top: 2px solid #c8a464;
}

.bgt-site-popup__card--with-hero {
	border-top: 0;
}

/*
 * Hero image. Pulled through the card's horizontal + top padding
 * with negative margins so it bleeds to the card edges; the
 * card's `overflow: hidden` + `border-radius` clips the top
 * corners cleanly. The 28px bottom margin gives the image some
 * breathing room before the eyebrow / title appear.
 */
.bgt-site-popup__hero {
	margin: -44px -36px 28px;
	background: #f3f4f6;
	line-height: 0;
}

.bgt-site-popup__hero img {
	display: block;
	width: 100%;
	height: var(--bgt-site-popup-hero-height, 160px);
	object-fit: cover;
	/* `object-position` is set inline per-popup by the renderer
	   from the admin's focal-point select; this default applies
	   only when no inline override is present. */
	object-position: center center;
}

/*
 * Eyebrow label. Optional - rendered only when the admin sets
 * the Eyebrow field on the popup. Letter-spaced uppercase in the
 * muted gold accent.
 */
.bgt-site-popup__eyebrow {
	margin: 0 0 8px;
	font-family: 'Raleway', 'Helvetica Neue', Arial, Verdana, sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #b08847;
}

.bgt-site-popup__title {
	margin: 0 0 14px;
	font-family: 'Hind', 'Helvetica Neue', Arial, sans-serif;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.25;
	color: #1a1a1a;
	letter-spacing: -0.005em;
}

.bgt-site-popup__body {
	margin: 0 0 24px;
	font-size: 16px;
	line-height: 1.65;
	color: #4a4a4a;
}

.bgt-site-popup__body p {
	margin: 0 0 12px;
}

.bgt-site-popup__body p:last-child {
	margin-bottom: 0;
}

.bgt-site-popup__body a {
	color: #2f5d3a;
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color 180ms ease;
}

.bgt-site-popup__body a:hover,
.bgt-site-popup__body a:focus {
	color: #1f3f27;
}

/*
 * Close button. Quiet neutral default; soft circular gray fill
 * on hover; gold ring on `:focus-visible` for keyboard users.
 * 36x36 hit area keeps it comfortably tappable on touch.
 */
.bgt-site-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: #8a8a8a;
	cursor: pointer;
	/*
	 * The visible X glyph is drawn with the two pseudo-elements
	 * below (rotated bars) instead of the `&times;` character in
	 * the markup. Reason: the `&times;` glyph's optical centre
	 * sits noticeably above its line-box centre in most webfonts,
	 * so flex-centring still looks "high and slightly right"
	 * inside a circular button. The CSS-drawn X is always pixel-
	 * perfect centred and inherits colour from the parent for the
	 * normal / hero / hover / focus states. The `&times;` is kept
	 * in the DOM (hidden via font-size: 0) so the accessible name
	 * still falls back to it if pseudo-elements ever fail.
	 */
	font-size: 0;
	line-height: 1;
	padding: 0;
	transition: background-color 180ms ease, color 180ms ease;
}

.bgt-site-popup__close::before,
.bgt-site-popup__close::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 2px;
	background-color: currentColor;
	border-radius: 1px;
}

.bgt-site-popup__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.bgt-site-popup__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.bgt-site-popup__close:hover,
.bgt-site-popup__close:focus {
	background-color: rgba(15, 23, 42, 0.06);
	color: #1a1a1a;
	outline: none;
}

.bgt-site-popup__close:focus-visible {
	box-shadow: 0 0 0 2px rgba(200, 164, 100, 0.55);
}

/*
 * When the card has a hero image, the close button needs to read
 * over the photograph. Switch to a translucent dark pill so the
 * `&times;` glyph keeps contrast regardless of the image. The
 * 1px white inner ring + soft drop shadow guarantee legibility
 * even over very light or busy photographs.
 */
.bgt-site-popup__card--with-hero .bgt-site-popup__close {
	background-color: rgba(15, 23, 42, 0.55);
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 1px 4px rgba(0, 0, 0, 0.22);
}

.bgt-site-popup__card--with-hero .bgt-site-popup__close:hover,
.bgt-site-popup__card--with-hero .bgt-site-popup__close:focus {
	background-color: rgba(15, 23, 42, 0.78);
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 2px 6px rgba(0, 0, 0, 0.28);
}

.bgt-site-popup__card--with-hero .bgt-site-popup__close:focus-visible {
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 2px 6px rgba(0, 0, 0, 0.28), 0 0 0 2px rgba(200, 164, 100, 0.7);
}

/*
 * CTA button. Charcoal fill, white text, modest shadow that
 * deepens on hover. Gold focus ring is the only colour cue that
 * pairs with the eyebrow / accent rail.
 */
.bgt-site-popup__cta {
	display: inline-block;
	padding: 13px 26px;
	background: #1f2933;
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.015em;
	text-decoration: none;
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
	transition: background-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.bgt-site-popup__cta:hover,
.bgt-site-popup__cta:focus {
	background: #0f1620;
	color: #fff;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
	transform: translateY(-1px);
	outline: none;
}

.bgt-site-popup__cta:focus-visible {
	box-shadow: 0 0 0 3px rgba(200, 164, 100, 0.55), 0 4px 12px rgba(15, 23, 42, 0.22);
}

.bgt-site-popup__cta:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/*
 * Mobile (<= 600px). Slimmer outer gutter, slightly tighter card
 * padding, smaller hero, and a full-width CTA so it lands as an
 * obvious thumb target.
 *
 * The card max-width keeps the admin-selected width as the upper
 * cap, but the 100vw-32px width formula guarantees the card
 * never overflows the viewport on narrow phones. So with the
 * "Feature 760" preset on a 360px-wide phone, the card collapses
 * to ~328px (viewport minus gutter) - not 760px.
 *
 * Hero height is scaled to 75% of the admin selection on mobile
 * to preserve the existing desktop-to-mobile compression ratio
 * (the previous 160px desktop / 120px mobile pair was 0.75).
 */
@media (max-width: 600px) {
	.bgt-site-popup {
		padding: 12px;
		align-items: flex-end;
	}

	.bgt-site-popup__card {
		width: calc(100vw - 32px);
		padding: 32px 24px 24px;
		border-radius: 14px;
	}

	.bgt-site-popup__hero {
		margin: -32px -24px 22px;
	}

	.bgt-site-popup__hero img {
		height: calc(var(--bgt-site-popup-hero-height, 160px) * 0.75);
	}

	.bgt-site-popup__title {
		font-size: 22px;
	}

	.bgt-site-popup__body {
		font-size: 15px;
		margin-bottom: 20px;
	}

	.bgt-site-popup__cta {
		display: block;
		width: 100%;
		text-align: center;
		padding: 14px 22px;
	}
}

@media (max-width: 600px) and (min-height: 640px) {
	/*
	 * On phones tall enough to fit a centred modal comfortably,
	 * re-centre vertically. Short viewports (landscape phone)
	 * leave it anchored to the bottom edge.
	 */
	.bgt-site-popup {
		align-items: center;
	}
}

/*
 * Respect the user's OS-level reduced-motion setting - skip the
 * fade, hover lift, and color transitions entirely so the popup
 * shows / hides / hovers instantly.
 */
@media (prefers-reduced-motion: reduce) {
	.bgt-site-popup,
	.bgt-site-popup__cta,
	.bgt-site-popup__close,
	.bgt-site-popup__body a {
		transition: none;
	}

	.bgt-site-popup__cta:hover,
	.bgt-site-popup__cta:focus {
		transform: none;
	}
}
