/* Revolutionary Popups – frontend styles
 * Variables (--rp-bg, --rp-text, --rp-radius, --rp-width) are written per
 * popup inline via the style attribute so each instance can be themed
 * without bloating the stylesheet.
 */

.rp-popup {
	position: fixed; inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	/* Match the active theme's body font via the suite font contract. */
	font-family: var(--rev-font, inherit);
}
.rp-popup[hidden] { display: none; }

.rp-popup .rp-popup-backdrop {
	position: absolute; inset: 0;
	background: rgba(0,0,0,0.6);
	pointer-events: auto;
	opacity: 0;
	transition: opacity .2s ease;
}
.rp-popup.is-open .rp-popup-backdrop { opacity: 1; }

.rp-popup .rp-popup-window {
	position: relative;
	background: var(--rp-bg, #fff);
	color: var(--rp-text, #1f2937);
	border-radius: var(--rp-radius, 8px);
	max-width: var(--rp-width, 480px);
	width: calc(100% - 32px);
	max-height: 90vh;
	overflow: auto;
	box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
	pointer-events: auto;
	transform: translateY(20px) scale(.98);
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
}
.rp-popup.is-open .rp-popup-window { opacity: 1; transform: translateY(0) scale(1); }

.rp-popup .rp-popup-body { padding: 32px 28px 28px; }
.rp-popup .rp-popup-title { margin: 0 0 12px; font-size: 22px; line-height: 1.25; }
.rp-popup .rp-popup-content { font-size: 15px; line-height: 1.55; }
.rp-popup .rp-popup-content > *:first-child { margin-top: 0; }
.rp-popup .rp-popup-content > *:last-child { margin-bottom: 0; }

.rp-popup .rp-popup-close {
	position: absolute;
	top: 8px; right: 10px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: inherit;
	opacity: .6;
	cursor: pointer;
	padding: 4px 8px;
}
.rp-popup .rp-popup-close:hover { opacity: 1; }

/* Layouts ----------------------------------------------------------------- */

.rp-popup.rp-layout-top,
.rp-popup.rp-layout-bottom {
	align-items: flex-start;
	background: transparent;
}
.rp-popup.rp-layout-bottom { align-items: flex-end; }
.rp-popup.rp-layout-top    .rp-popup-backdrop,
.rp-popup.rp-layout-bottom .rp-popup-backdrop { display: none; }
.rp-popup.rp-layout-top    .rp-popup-window,
.rp-popup.rp-layout-bottom .rp-popup-window {
	max-width: none;
	width: 100%;
	border-radius: 0;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.rp-popup.rp-layout-top    .rp-popup-body { padding: 18px 24px; }
.rp-popup.rp-layout-bottom .rp-popup-body { padding: 18px 24px; }

.rp-popup.rp-layout-slide {
	align-items: flex-end;
	justify-content: flex-end;
	background: transparent;
	padding: 24px;
}
.rp-popup.rp-layout-slide .rp-popup-backdrop { display: none; }
.rp-popup.rp-layout-slide .rp-popup-window {
	max-width: var(--rp-width, 360px);
	transform: translateX(20px);
}
.rp-popup.rp-layout-slide.is-open .rp-popup-window { transform: translateX(0); }

/* Accessibility ----------------------------------------------------------- */

/* The dialog container only receives focus programmatically (to announce
 * its title), so suppress its ring — but keep a clear ring on the genuinely
 * interactive controls inside. */
.rp-popup .rp-popup-window:focus { outline: none; }
.rp-popup .rp-popup-window:focus-visible { outline: 2px solid var(--rp-accent, #2563eb); outline-offset: 2px; }
.rp-popup .rp-popup-close:focus-visible,
.rp-popup .rp-popup-content a:focus-visible,
.rp-popup .rp-popup-content button:focus-visible {
	outline: 2px solid var(--rp-accent, #2563eb);
	outline-offset: 2px;
}

/* Respect the visitor's motion preference: drop the entrance/exit
 * transitions so nothing slides or fades for those who opt out. */
@media ( prefers-reduced-motion: reduce ) {
	.rp-popup .rp-popup-backdrop,
	.rp-popup .rp-popup-window {
		transition: none !important;
	}
	.rp-popup.rp-layout-slide .rp-popup-window { transform: none; }
}

html.rp-popup-open { overflow: hidden; }

/* Entrance / exit animations ---------------------------------------------
 * The window's base transition (above) is the "fade" default. A named
 * entrance replaces it with a keyframe on open; a named exit plays while
 * .is-closing is set (the runtime hides the element after --rp-anim-ms). */
.rp-popup { --rp-anim-ms: 240ms; }
.rp-popup .rp-popup-backdrop { transition-duration: var(--rp-anim-ms); }
.rp-popup .rp-popup-window { transition-duration: var(--rp-anim-ms), var(--rp-anim-ms); }
.rp-popup.rp-overlay-blur .rp-popup-backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.rp-popup.is-open.rp-anim-in-slide-top .rp-popup-window    { animation: rp-in-slide-top var(--rp-anim-ms) ease-out both; }
.rp-popup.is-open.rp-anim-in-slide-bottom .rp-popup-window { animation: rp-in-slide-bottom var(--rp-anim-ms) ease-out both; }
.rp-popup.is-open.rp-anim-in-slide-left .rp-popup-window   { animation: rp-in-slide-left var(--rp-anim-ms) ease-out both; }
.rp-popup.is-open.rp-anim-in-slide-right .rp-popup-window  { animation: rp-in-slide-right var(--rp-anim-ms) ease-out both; }
.rp-popup.is-open.rp-anim-in-zoom .rp-popup-window         { animation: rp-in-zoom var(--rp-anim-ms) ease-out both; }
.rp-popup.is-open.rp-anim-in-bounce .rp-popup-window       { animation: rp-in-bounce calc(var(--rp-anim-ms) * 2) cubic-bezier(.34,1.56,.64,1) both; }

.rp-popup.is-closing .rp-popup-backdrop { opacity: 0; }
.rp-popup.is-closing.rp-anim-out-fade .rp-popup-window         { opacity: 0; }
.rp-popup.is-closing.rp-anim-out-slide-top .rp-popup-window    { animation: rp-out-slide-top var(--rp-anim-ms) ease-in both; }
.rp-popup.is-closing.rp-anim-out-slide-bottom .rp-popup-window { animation: rp-out-slide-bottom var(--rp-anim-ms) ease-in both; }
.rp-popup.is-closing.rp-anim-out-slide-left .rp-popup-window   { animation: rp-out-slide-left var(--rp-anim-ms) ease-in both; }
.rp-popup.is-closing.rp-anim-out-slide-right .rp-popup-window  { animation: rp-out-slide-right var(--rp-anim-ms) ease-in both; }
.rp-popup.is-closing.rp-anim-out-zoom .rp-popup-window         { animation: rp-out-zoom var(--rp-anim-ms) ease-in both; }

@keyframes rp-in-slide-top    { from { opacity: 0; transform: translateY(-48px); } to { opacity: 1; transform: none; } }
@keyframes rp-in-slide-bottom { from { opacity: 0; transform: translateY(48px); }  to { opacity: 1; transform: none; } }
@keyframes rp-in-slide-left   { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
@keyframes rp-in-slide-right  { from { opacity: 0; transform: translateX(48px); }  to { opacity: 1; transform: none; } }
@keyframes rp-in-zoom         { from { opacity: 0; transform: scale(.8); }         to { opacity: 1; transform: none; } }
@keyframes rp-in-bounce       { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.04); } 100% { transform: none; } }
@keyframes rp-out-slide-top    { to { opacity: 0; transform: translateY(-48px); } }
@keyframes rp-out-slide-bottom { to { opacity: 0; transform: translateY(48px); } }
@keyframes rp-out-slide-left   { to { opacity: 0; transform: translateX(-48px); } }
@keyframes rp-out-slide-right  { to { opacity: 0; transform: translateX(48px); } }
@keyframes rp-out-zoom         { to { opacity: 0; transform: scale(.8); } }

@media ( prefers-reduced-motion: reduce ) {
	.rp-popup .rp-popup-window,
	.rp-popup.is-closing .rp-popup-window { animation: none !important; }
	.rp-popup.is-closing .rp-popup-window { opacity: 0; }
}

/* Blocks-built content: the window becomes a plain frame around the
 * document; the layout carries its own padding and colors. */
.rp-popup .rp-popup-body--blocks { padding: 0; }
.rp-popup .rp-popup-body--blocks .rp-popup-content { font-size: inherit; line-height: inherit; }
.rp-popup .rp-popup-body--blocks .rb-document--popup > .rb-section:first-child { margin-top: 0; }
.rp-popup .rp-popup-body--blocks .rp-popup-title.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); margin: -1px; }

/* Opt-in native slide-in. Consume the current theme's tokens without changing
 * them. Literal per-popup colors remain the fallback for themes without tokens. */
.rp-popup.rp-native-slide { box-sizing: border-box; padding: 16px; }
.rp-native-slide .rp-popup-window {
	box-sizing: border-box;
	width: 100%;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	background: var(--dash-mode-surface, var(--rp-bg, #fff));
	color: var(--dash-mode-text, var(--rp-text, #1f2937));
	border: 1px solid var(--dash-mode-border, transparent);
}
.rp-native-slide .rp-popup-body { padding-top: 64px; }
.rp-native-slide .rp-popup-title { color: inherit; overflow-wrap: anywhere; }
.rp-native-slide .rp-popup-close {
	box-sizing: border-box;
	width: 44px; height: 44px;
	min-width: 44px; min-height: 44px;
	display: flex; align-items: center; justify-content: center;
	opacity: 1;
}
.rp-native-slide .rp-popup-content a { overflow-wrap: anywhere; }
.rp-native-slide .rp-popup-content .btn { min-height: 44px; box-sizing: border-box; }
.rp-native-slide .rp-popup-close:focus-visible,
.rp-native-slide .rp-popup-content a:focus-visible {
	outline: 2px solid var(--dash-mode-accent, currentColor);
	outline-offset: 2px;
}
/* Leave the existing left-side Ruby launcher reachable on narrow phones. */
@media (max-width: 600px) {
	.rp-popup.rp-native-slide { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
	.rp-native-slide .rp-popup-window { max-height: calc(100dvh - 112px - env(safe-area-inset-bottom)); }
}
/* Reuse the motion preference approach in tcoppedge b482be1, bounded to opt-in. */
@media (prefers-reduced-motion: reduce) {
	.rp-native-slide .rp-popup-window { transition: none; transform: none; }
}
