/*
 * Site popup — rendered by inc/site/site-popup.php (D-046), and only while the
 * popup can show. Enqueued from the footer, so nothing here sits on the
 * critical path: the dialog stays closed until at least its delay has passed.
 *
 * Tokens come from assets/brand-tokens.css. Every var() carries its literal
 * fallback so the dialog is never unstyled if that sheet is dropped. D-042's
 * split holds: --brand-primary is for ink, borders and button fills;
 * --brand-vivid is light only (the glow and the keyline), never text.
 *
 * Button hover and focus states are declared explicitly, so the parent theme's
 * reset cannot repaint them; this sheet prints last and wins ties on order.
 */

.pmvr-popup,
.pmvr-popup *,
.pmvr-popup *::before,
.pmvr-popup *::after{box-sizing:border-box}

.pmvr-popup{
	--pmvr-popup-ready:1; /* site-popup.js opens nothing until this sheet has applied */
	--pmvr-popup-in:cubic-bezier(.16,1,.3,1);
	--pmvr-popup-out:cubic-bezier(.4,0,1,1);
	--pmvr-popup-error:#F4B8A8;
	position:fixed;
	inset:0;
	width:min(30rem,calc(100vw - 2rem));
	max-width:none;
	max-height:none;
	margin:auto;
	padding:0;
	border:0;
	overflow:visible;
	background:transparent;
	color:var(--color-text,#FBFBFB);
	color-scheme:dark;
	font-family:var(--font-b,'Lato','Lato FB R','Lato FB A',-apple-system,BlinkMacSystemFont,sans-serif);
	font-size:1rem;
	line-height:1.5;
	opacity:0;
	transform:translateY(10px);
	transition:opacity .16s var(--pmvr-popup-out),transform .16s var(--pmvr-popup-out),overlay .16s allow-discrete,display .16s allow-discrete;
}
.pmvr-popup[open]{
	opacity:1;
	transform:none;
	transition-duration:.28s;
	transition-timing-function:var(--pmvr-popup-in);
}
@starting-style{
	.pmvr-popup[open]{opacity:0;transform:translateY(10px)}
}

/* Horizon keyline: the thin violet light along the top edge (Blue Hour device). */
.pmvr-popup::before{
	content:"";
	position:absolute;
	z-index:1;
	top:0;
	left:8%;
	right:8%;
	height:1px;
	background:linear-gradient(90deg,transparent,var(--brand-vivid,#6D52F4) 50%,transparent);
	pointer-events:none;
}

/* ::backdrop does not inherit custom properties in every browser still in use,
   so its colour is --color-bg-deep written out. */
.pmvr-popup::backdrop{
	background-color:rgba(7,6,21,0);
	transition:background-color .16s linear,overlay .16s allow-discrete,display .16s allow-discrete;
}
.pmvr-popup[open]::backdrop{background-color:rgba(7,6,21,.66)}
@starting-style{
	.pmvr-popup[open]::backdrop{background-color:rgba(7,6,21,0)}
}

/* The panel fills the dialog edge to edge, so a click that lands on the dialog
   element itself can only have come from the backdrop. */
.pmvr-popup__panel{
	position:relative;
	max-height:calc(100vh - 2rem);
	max-height:calc(100dvh - 2rem);
	overflow-y:auto;
	overscroll-behavior:contain;
	padding:1.9rem 2.2rem 2.1rem;
	border:1px solid var(--color-border,rgba(251,251,251,.10));
	border-radius:4px;
	background-color:var(--color-surface,#141227);
	/* Violet light from above, at the .12 cap the Blue Hour profile sets over flat ground. */
	background-image:radial-gradient(120% 60% at 50% 0%,color-mix(in srgb,var(--brand-vivid,#6D52F4) 12%,transparent),transparent 70%);
	box-shadow:0 30px 80px rgba(0,0,0,.55);
}

.pmvr-popup [hidden]{display:none}

/* ── Campaign photo (optional) ───────────────────────────────────────────── */

/* Full bleed: the negative margins cancel the panel's padding, so the photo
   meets the panel's border on three sides. The ground under it is the deep
   Blue Hour tone, so a photo still loading reads as night sky, not a hole. */
.pmvr-popup__media{
	position:relative;
	margin:-1.9rem -2.2rem 1.5rem;
	aspect-ratio:16/9;
	overflow:hidden;
	border-radius:3px 3px 0 0;
	background-color:var(--color-bg-deep,#070615);
}
.pmvr-popup__media img{
	display:block;
	width:100%;
	height:100%;
	object-fit:cover;
	object-position:50% 55%;
	opacity:0;
	transition:opacity .45s var(--pmvr-popup-in);
}
.pmvr-popup__media img.is-loaded{opacity:1}
/* A soft fall to the panel colour, so the photo settles into the card
   instead of ending on a hard line above the heading. */
.pmvr-popup__media::after{
	content:"";
	position:absolute;
	inset:auto 0 0;
	height:28%;
	background:linear-gradient(to bottom,transparent,color-mix(in srgb,var(--color-surface,#141227) 55%,transparent));
	pointer-events:none;
}

/* With a photo the close button sits on it, top right, on a dark disc that
   keeps the X readable over a bright sky. The heading gets the full width. */
.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close{
	position:absolute;
	z-index:2;
	top:.6rem;
	right:.6rem;
	margin:0;
}
.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close,
.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close:focus{
	background:rgba(7,6,21,.58);
	color:var(--color-text,#FBFBFB);
}
.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close:hover{background:rgba(7,6,21,.8)}

/* ── Header row ──────────────────────────────────────────────────────────── */

.pmvr-popup__bar{display:flex;align-items:flex-start;gap:1rem}
.pmvr-popup__bar > .pmvr-popup__title{flex:1 1 auto;min-width:0}

.pmvr-popup__title{
	margin:0;
	font-family:var(--font-d,'Albert Sans','Albert Sans FB R','Albert Sans FB A',-apple-system,BlinkMacSystemFont,sans-serif);
	font-size:clamp(1.4rem,1.15rem + 1.1vw,1.75rem);
	font-weight:300;
	line-height:1.15;
	letter-spacing:-.015em;
	color:var(--color-text,#FBFBFB);
	text-wrap:pretty;
}
/* Form views move focus to their heading by script, for screen readers. It is
   not in the tab order, so it needs no ring. */
.pmvr-popup__title:focus{outline:none}
.pmvr-popup__title--form{font-size:clamp(1.3rem,1.1rem + .6vw,1.55rem)}
/* "Place — Villa": the villa is the emphasis, as in the site's own headings
   (italic, accent), and never splits across lines. */
.pmvr-popup__title em{display:inline-block;font-style:italic;color:var(--color-text,#FBFBFB)}
.pmvr-popup__nowrap{white-space:nowrap}

.pmvr-popup__close{
	flex:0 0 auto;
	display:inline-flex;
	align-items:center;
	justify-content:center;
	width:44px;
	height:44px;
	margin:-.55rem -.85rem 0 auto;
	padding:0;
	border:0;
	border-radius:50%;
	cursor:pointer;
	transition:color .2s,background-color .2s;
}
.pmvr-popup__close,
.pmvr-popup__close:focus{background:none;color:var(--color-muted,#C2BCE0)}
.pmvr-popup__close:hover{background:rgba(251,251,251,.07);color:var(--color-text,#FBFBFB)}
.pmvr-popup__close:focus-visible{border-radius:50%}

.pmvr-popup__back{
	display:inline-flex;
	align-items:center;
	gap:.35rem;
	min-height:44px;
	margin:-.55rem 0 0 -.6rem;
	padding:0 .6rem;
	border:0;
	border-radius:4px;
	font:700 .74rem/1 var(--font-b,'Lato',-apple-system,BlinkMacSystemFont,sans-serif);
	letter-spacing:.12em;
	text-transform:uppercase;
	cursor:pointer;
	transition:color .2s,background-color .2s;
}
.pmvr-popup__back,
.pmvr-popup__back:focus{background:none;color:var(--color-muted,#C2BCE0)}
.pmvr-popup__back:hover{background:rgba(251,251,251,.05);color:var(--color-text,#FBFBFB)}

/* ── Intro ───────────────────────────────────────────────────────────────── */

.pmvr-popup__body{margin:1rem 0 1.6rem}
.pmvr-popup__body p{margin:0 0 .8em;font-size:1rem;line-height:1.62;color:var(--soft,rgba(251,251,251,.80))}
.pmvr-popup__body p:last-child{margin-bottom:0}

.pmvr-popup__alt{
	display:grid;
	gap:.9rem;
	margin-top:1.5rem;
	padding-top:1.35rem;
	border-top:1px solid var(--color-border,rgba(251,251,251,.10));
}
.pmvr-popup__note{margin:0;font-size:.95rem;font-style:italic;line-height:1.6;color:var(--color-muted,#C2BCE0)}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.pmvr-popup__btn{
	display:flex;
	align-items:center;
	justify-content:center;
	width:100%;
	min-height:50px;
	margin:0;
	padding:.85rem 1.4rem;
	border:1px solid transparent;
	border-radius:4px;
	font:700 .78rem/1.35 var(--font-b,'Lato',-apple-system,BlinkMacSystemFont,sans-serif);
	letter-spacing:.12em;
	text-transform:uppercase;
	text-align:center;
	text-decoration:none;
	white-space:normal;
	cursor:pointer;
	transition:background-color .2s,border-color .2s,color .2s,transform .2s var(--pmvr-popup-in);
}
.pmvr-popup__btn:active{transform:scale(.985)}
.pmvr-popup__btn:focus-visible{outline:2px solid var(--brand-primary-hover,#B9ADFA);outline-offset:3px}
.pmvr-popup__btn[disabled]{cursor:progress;opacity:.72}

.pmvr-popup__btn--primary,
.pmvr-popup__btn--primary:focus{background:var(--brand-primary,#9E8CF8);border-color:var(--brand-primary,#9E8CF8);color:var(--color-on-primary,#0A0818)}
.pmvr-popup__btn--primary:hover{background:var(--brand-primary-hover,#B9ADFA);border-color:var(--brand-primary-hover,#B9ADFA);color:var(--color-on-primary,#0A0818)}

.pmvr-popup__btn--ghost,
.pmvr-popup__btn--ghost:focus{background:transparent;border-color:color-mix(in srgb,var(--brand-primary,#9E8CF8) 45%,transparent);color:var(--brand-primary,#9E8CF8)}
.pmvr-popup__btn--ghost:hover{background:color-mix(in srgb,var(--brand-primary,#9E8CF8) 8%,transparent);border-color:var(--brand-primary-hover,#B9ADFA);color:var(--brand-primary-hover,#B9ADFA)}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.pmvr-popup__kicker{
	margin:.35rem 0 .45rem;
	font-size:.7rem;
	font-weight:700;
	line-height:1.5;
	letter-spacing:.14em;
	text-transform:uppercase;
	color:var(--color-muted,#C2BCE0);
}
.pmvr-popup__form{margin:1.25rem 0 0}
.pmvr-popup__fields{display:grid;gap:.95rem;margin:0 0 1.1rem}
.pmvr-popup__pair{display:grid;grid-template-columns:repeat(auto-fit,minmax(9rem,1fr));gap:.95rem}
.pmvr-popup__field{display:grid;gap:.4rem;min-width:0}
.pmvr-popup__field label{
	font-size:.7rem;
	font-weight:700;
	line-height:1.4;
	letter-spacing:.14em;
	text-transform:uppercase;
	color:var(--color-muted,#C2BCE0);
}
.pmvr-popup__optional{font-weight:400;letter-spacing:.04em;text-transform:none;color:var(--color-muted,#C2BCE0)}

.pmvr-popup__field input,
.pmvr-popup__field select,
.pmvr-popup__field textarea{
	display:block;
	width:100%;
	min-width:0;
	min-height:48px;
	margin:0;
	padding:.7rem .85rem;
	border:1px solid rgba(194,188,224,.5);
	/* Half-strength --color-muted: 3.4:1 against the panel, the WCAG 1.4.11
	   minimum for a field's edge. */
	border-color:color-mix(in srgb,var(--color-muted,#C2BCE0) 50%,transparent);
	border-radius:4px;
	background:var(--color-bg-deep,#070615);
	color:var(--color-text,#FBFBFB);
	/* 16px: iOS zooms the page on focus into anything smaller. */
	font:400 1rem/1.4 var(--font-b,'Lato',-apple-system,BlinkMacSystemFont,sans-serif);
	box-shadow:none;
	transition:border-color .2s;
}
.pmvr-popup__field textarea{min-height:5.25rem;resize:vertical}
.pmvr-popup__field input::-webkit-date-and-time-value{text-align:left}
.pmvr-popup__field input:focus,
.pmvr-popup__field select:focus,
.pmvr-popup__field textarea:focus{border-color:var(--brand-primary,#9E8CF8)}
.pmvr-popup__field input:focus-visible,
.pmvr-popup__field select:focus-visible,
.pmvr-popup__field textarea:focus-visible{outline:2px solid var(--brand-primary-hover,#B9ADFA);outline-offset:1px}
.pmvr-popup__field [aria-invalid="true"]{border-color:var(--pmvr-popup-error)}
/* The nightly budget band (D-075) is the popup's only select; its list keeps the panel's colours. */
.pmvr-popup__field select option{background:var(--color-bg-deep,#070615);color:var(--color-text,#FBFBFB)}

/* Status and errors come from RM Inquiry's inquiry.js; only their look is set here. */
.pmvr-popup__status{margin:0 0 1rem;font-size:.95rem;line-height:1.55;color:var(--soft,rgba(251,251,251,.80))}
.pmvr-popup__status:focus{outline:none}
.pmvr-popup__status.is-error{color:var(--pmvr-popup-error)}
.pmvr-popup__status.is-success{font-size:1.02rem;color:var(--color-text,#FBFBFB)}

.pmvr-popup .rm-inquiry__field-error{margin:0;font-size:.85rem;line-height:1.45;color:var(--pmvr-popup-error)}
.pmvr-popup .rm-inquiry__error-summary{margin:0 0 1.1rem;padding:.75rem .95rem;border-left:2px solid var(--pmvr-popup-error);background:rgba(244,184,168,.07)}
.pmvr-popup .rm-inquiry__error-summary:focus{outline:none}
.pmvr-popup .rm-inquiry__error-summary h3{margin:0 0 .3rem;font-family:inherit;font-size:.9rem;font-weight:700;line-height:1.4;color:var(--color-text,#FBFBFB)}
.pmvr-popup .rm-inquiry__error-summary ul{margin:0;padding-left:1.1rem}
.pmvr-popup .rm-inquiry__error-summary a{color:var(--pmvr-popup-error);text-decoration:underline;text-underline-offset:2px}

/* Holds the challenge's height, so the button does not jump when it renders. */
.pmvr-popup__turnstile{min-height:65px}

/* Sent: RM Inquiry's thank-you line and reference stay; the form steps aside. */
.pmvr-popup__view.is-sent .pmvr-popup__back,
.pmvr-popup__view.is-sent .pmvr-popup__fields,
.pmvr-popup__view.is-sent .pmvr-popup__turnstile,
.pmvr-popup__view.is-sent .pmvr-popup__submit,
.pmvr-popup__view.is-sent .rm-inquiry__error-summary{display:none}

/* ── Motion ──────────────────────────────────────────────────────────────── */

.pmvr-popup__view--in{animation:pmvrPopupView .2s var(--pmvr-popup-in) both}
@keyframes pmvrPopupView{from{opacity:0;transform:translateY(4px)}}

/* ── Phones: a bottom sheet, never a full-screen takeover ────────────────── */

@media (max-width:640px){
	.pmvr-popup{
		width:100%;
		margin:auto 0 0;
		transform:translateY(100%);
		transition:opacity .2s var(--pmvr-popup-out),transform .2s var(--pmvr-popup-out),overlay .2s allow-discrete,display .2s allow-discrete;
	}
	.pmvr-popup[open]{transform:none;transition-duration:.34s}
	@starting-style{
		.pmvr-popup[open]{opacity:1;transform:translateY(100%)}
	}
	.pmvr-popup::before{left:0;right:0}
	.pmvr-popup__panel{
		max-height:calc(100vh - .75rem);
		max-height:calc(100dvh - .75rem);
		padding:1.05rem 1.25rem calc(1.35rem + env(safe-area-inset-bottom,0px));
		border-width:1px 0 0;
		border-radius:12px 12px 0 0;
	}
	.pmvr-popup__body{margin:.7rem 0 1.25rem}
	.pmvr-popup__alt{margin-top:1.2rem;padding-top:1.1rem}
	/* A shorter crop on phones, so the photo never turns the sheet into a
	   full-screen takeover. */
	.pmvr-popup__media{
		margin:-1.05rem -1.25rem 1.1rem;
		aspect-ratio:12/5;
		border-radius:11px 11px 0 0;
	}
}

/* Short phones (an iPhone SE is 568 px tall): the text alone fills the sheet,
   so the photo is left out and the close button returns to the header row. */
@media (max-width:640px) and (max-height:640px){
	.pmvr-popup__media{display:none}
	.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close{
		position:static;
		margin:-.55rem -.85rem 0 auto;
	}
	.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close,
	.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close:focus{
		background:none;
		color:var(--color-muted,#C2BCE0);
	}
	.pmvr-popup__panel--media [data-pmvr-popup-view="intro"] .pmvr-popup__close:hover{
		background:rgba(251,251,251,.07);
		color:var(--color-text,#FBFBFB);
	}
}

/* Last, so it overrides the sheet's slide as well. The [open] selectors are
   listed because the open-state duration rules above outrank the bare class. */
@media (prefers-reduced-motion:reduce){
	.pmvr-popup,
	.pmvr-popup[open],
	.pmvr-popup::backdrop,
	.pmvr-popup[open]::backdrop,
	.pmvr-popup__btn,
	.pmvr-popup__close,
	.pmvr-popup__back,
	.pmvr-popup__field input,
	.pmvr-popup__field select,
	.pmvr-popup__field textarea,
	.pmvr-popup__media img{transition:none}
	.pmvr-popup,
	.pmvr-popup[open],
	.pmvr-popup__btn:active{transform:none}
	.pmvr-popup__view--in{animation:none}
}
