/* Mark Vence - Popup Adapter 1.3.3 - overlay.css (T-61 lane O, 2026-11-05, STATE D-131; 1.3.2 fix batch 1: root overflow clip, F189;
 * 1.3.3 fix batch 2: the close keyframe starts from the swipe offset, F-FB2O)
 *
 * ONE scrim + ONE motion for every popup the adapter marks as an overlay (class `mv-overlay` on the
 * modal root, added by popup-adapter.js for the ids in mvPopupConfig.overlays - default 962 / 913 /
 * 759 / 780 / 845 / 1011, mark-vence-popup-adapter.php). The contract every popup follows is
 * Branding/prep-2026-10/16_visual-language/05_build/overlay-contract.md.
 *
 * Values: ONLY the kit tokens (kit post 6 Custom CSS, block mv-ov-tokens, tools/shell/t61/o-kit-tokens.php):
 * --mv-ov-dur, --mv-ov-ease, --mv-scrim, --mv-backdrop, --mv-panel-from. Each is read ONCE below into a
 * private --mv-pa-* variable with a fallback = the D-131 value, used only when the kit block is missing
 * (deploy-order safety; the fallback for the blur is "none" = darken only).
 *
 * The mechanism (Gate B - alternatives in overlay-contract.md §6):
 *  - SCRIM: the modal root's own background (the native Overlay control) is switched off here and the
 *    scrim is drawn by the root's ::before (absolute, inset 0 = exactly the root's box, so search 780's
 *    root that starts under the header keeps the header un-dimmed; z-index -1 inside the root's own
 *    stacking context = above the page, below the panel; pointer-events none = a click there still
 *    lands on the root, which is what Pro's "click on the overlay closes" listens to).
 *    The blur radius is STATIC: backdrop-filter is set once and NEVER transitioned or animated
 *    (04_perf B5: an animated radius stalled 133-317 ms at 390 CPU x4). Only the scrim's OPACITY moves.
 *  - PANEL: .dialog-widget-content slides from its own edge (data-mv-ov-edge, measured by the adapter
 *    from the popup's native position on every open) by --mv-panel-from, on the `translate` property -
 *    `transform` stays free for the swipe-to-close drag (inline style, adapter row A11).
 *  - CLOSE: the adapter delays Pro's hide by the token duration and sets .mv-ov-closing (+ inert)
 *    meanwhile; the same curve runs backwards.
 *  - STACKING (manager answer Q4): only the TOP overlay's scrim is visible. .mv-ov-under hides a lower
 *    one's scrim; .mv-ov-instant shows / hides a scrim without a fade, so the page stays at one constant
 *    darkness while one overlay hands over to the other (962 -> 1011 size guide, 962 -> 913 cart).
 *  - Native entrance / exit animations must be None on every overlay (contract §3); !important on the
 *    motion lines below beats Elementor's own `.animated` duration and a popup's Animation Duration
 *    control (both write animation-duration on the same element).
 * Accessibility: prefers-reduced-motion = 0 ms (here AND in the kit, so a missing kit never animates);
 * prefers-reduced-transparency = no blur (here) + alpha 0.6 (kit token).
 */

.elementor-popup-modal.mv-overlay {
	--mv-pa-dur: var(--mv-ov-dur, 700ms);
	--mv-pa-ease: var(--mv-ov-ease, cubic-bezier(0.4, 0, 0.2, 1));
	--mv-pa-scrim: var(--mv-scrim, rgb(11 15 26 / 0.4));
	--mv-pa-backdrop: var(--mv-backdrop, none);
	--mv-pa-travel: var(--mv-panel-from, 100%);
	--mv-pa-from: 0 var(--mv-pa-travel); /* default edge = bottom (bottom sheet) */
	background-color: transparent !important; /* native Overlay colour = fallback only (contract §3) */
	background-image: none !important;
	/* A panel sliding in is clipped at the root's edge (780: under the header).
	 * 1.3.2 (fix batch 1, STATE F189): `clip`, not `hidden`. `hidden` makes the root a SCROLL container:
	 * ~250 ms after open Pro focuses the X (a11y_navigation, plain focus() = scroll into view), and in
	 * an RTL root the part of 759's panel still off the LEFT edge is scrollable overflow - the root
	 * scrolled by the panel's remaining offset (live 1440: scrollLeft 0 -> -206 Chromium, -349 WebKit)
	 * and the drawer jumped. `clip` clips the same box but cannot be scrolled. `hidden` stays first as
	 * the fallback for an engine without `overflow: clip` (Safari < 16). */
	overflow: hidden;
	overflow: clip;
}

/* Edge of the panel, from the popup's own native position (popup-adapter.js ovEdge()). */
.elementor-popup-modal.mv-overlay[data-mv-ov-edge="right"] { --mv-pa-from: var(--mv-pa-travel) 0; }
.elementor-popup-modal.mv-overlay[data-mv-ov-edge="left"]  { --mv-pa-from: calc(-1 * var(--mv-pa-travel)) 0; }
.elementor-popup-modal.mv-overlay[data-mv-ov-edge="top"]   { --mv-pa-from: 0 calc(-1 * var(--mv-pa-travel)); }
.elementor-popup-modal.mv-overlay[data-mv-ov-edge="bottom"] { --mv-pa-from: 0 var(--mv-pa-travel); }

/* ---- scrim ---- */
.elementor-popup-modal.mv-overlay::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-color: var(--mv-pa-scrim);
	-webkit-backdrop-filter: var(--mv-pa-backdrop); /* static - never in a transition / keyframe */
	backdrop-filter: var(--mv-pa-backdrop);
	animation: mv-ov-fade-in var(--mv-pa-dur) var(--mv-pa-ease) both;
}
.elementor-popup-modal.mv-overlay.mv-ov-instant::before {
	animation: none;
	opacity: 1;
}
.elementor-popup-modal.mv-overlay.mv-ov-closing::before {
	animation: mv-ov-fade-out var(--mv-pa-dur) var(--mv-pa-ease) both;
}
.elementor-popup-modal.mv-overlay.mv-ov-closing.mv-ov-instant::before,
.elementor-popup-modal.mv-overlay.mv-ov-under::before {
	animation: none;
	opacity: 0;
}

/* ---- panel ---- */
.elementor-popup-modal.mv-overlay > .dialog-widget-content {
	animation: mv-ov-panel-in var(--mv-pa-dur) var(--mv-pa-ease) both !important;
}
.elementor-popup-modal.mv-overlay.mv-ov-closing > .dialog-widget-content {
	animation: mv-ov-panel-out var(--mv-pa-dur) var(--mv-pa-ease) both !important;
}

@keyframes mv-ov-fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes mv-ov-fade-out  { from { opacity: 1; } to { opacity: 0; } }
@keyframes mv-ov-panel-in  { from { translate: var(--mv-pa-from); } to { translate: 0 0; } }
/* 1.3.3 (F-FB2O): the close starts where a swipe left the sheet - --mv-pa-drag (px, set on the sheet by
 * popup-adapter.js ovHoldDrag() at close start, cleared on the next open); unset = 0, the 1.3.2 motion. */
@keyframes mv-ov-panel-out { from { translate: 0 var(--mv-pa-drag, 0px); } to { translate: var(--mv-pa-from); } }

/* ---- accessibility ---- */
@media (prefers-reduced-motion: reduce) {
	.elementor-popup-modal.mv-overlay { --mv-pa-dur: 0ms; }
}
@media (prefers-reduced-transparency: reduce) {
	.elementor-popup-modal.mv-overlay { --mv-pa-backdrop: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.elementor-popup-modal.mv-overlay { --mv-pa-backdrop: none; }
}
