/* The Popup Widget. Software built by Baseline Creative; copying or reverse engineering it isn't allowed. */
.tpw {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	padding: 16px;
	box-sizing: border-box;
	pointer-events: none;
	align-items: center;
	justify-content: center;
}
.tpw[hidden] {
	display: none;
}

/* Positions: a 3 x 3 grid plus two bars. */
.tpw--top-left, .tpw--top-center, .tpw--top-right, .tpw--top-bar { align-items: flex-start; }
.tpw--bottom-left, .tpw--bottom-center, .tpw--bottom-right, .tpw--bottom-bar { align-items: flex-end; }
.tpw--top-left, .tpw--center-left, .tpw--bottom-left { justify-content: flex-start; }
.tpw--top-right, .tpw--center-right, .tpw--bottom-right { justify-content: flex-end; }
.tpw--top-bar, .tpw--bottom-bar { padding: 0; }

/* Layers: overlay (1), effects behind (2), box (3), effects in front (4). */
.tpw__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: var(--tpw-ovbg, #000);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: none;
}
.tpw--overlay .tpw__overlay {
	display: block;
	pointer-events: auto;
}
.tpw .tpw-fx--behind { z-index: 2 !important; position: absolute !important; }
.tpw .tpw-fx--front { z-index: 4 !important; position: absolute !important; }

.tpw__box {
	position: relative;
	z-index: 3;
	pointer-events: auto;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--tpw-w, 600px);
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	background: var(--tpw-bg, #fff);
	color: var(--tpw-fg, #1a1a1a);
	border-radius: var(--tpw-r, 12px);
	padding: var(--tpw-pad, 32px);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	opacity: 0;
	outline: none;
	transform: var(--tpw-from, none);
	transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tpw--clear .tpw__box {
	background: transparent;
	box-shadow: none;
}
.tpw--clear .tpw__close {
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.tpw--top-bar .tpw__box,
.tpw--bottom-bar .tpw__box {
	max-width: none;
	border-radius: 0;
}

/* How it appears. */
.tpw--anim-slide-up { --tpw-from: translateY(40px); }
.tpw--anim-slide-down { --tpw-from: translateY(-40px); }
.tpw--anim-slide-left { --tpw-from: translateX(60px); }
.tpw--anim-slide-right { --tpw-from: translateX(-60px); }
.tpw--anim-zoom { --tpw-from: scale(0.85); }
.tpw.is-open .tpw__overlay {
	opacity: var(--tpw-ov, 0.6);
}
.tpw.is-open .tpw__box {
	opacity: 1;
	/* Tilt (parallax) values come from popup.js; 0 when it's off. */
	transform: perspective(1000px) rotateX(var(--tpw-rx, 0deg)) rotateY(var(--tpw-ry, 0deg));
}
.tpw.is-tilting .tpw__box {
	transition: opacity 0.35s ease, transform 0.18s ease-out;
}
.tpw--anim-none .tpw__box,
.tpw--anim-none .tpw__overlay {
	transition: none;
}
.tpw__content img {
	max-width: 100%;
	height: auto;
	transition: transform 0.25s ease-out;
	transform: translate(var(--tpw-ix, 0px), var(--tpw-iy, 0px));
}

/* Content motion: pieces arrive one after another (popup.js sets --tpw-i). */
.tpw--tm-fade-up .tpw-tm,
.tpw--tm-slide-in .tpw-tm,
.tpw--tm-zoom-in .tpw-tm {
	opacity: 0;
	transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
	transition-delay: calc(var(--tpw-i, 0) * 110ms + 200ms);
}
.tpw--tm-fade-up .tpw-tm { transform: translateY(16px); }
.tpw--tm-slide-in .tpw-tm { transform: translateX(-24px); }
.tpw--tm-zoom-in .tpw-tm { transform: scale(0.9); }
.tpw.is-open .tpw-tm {
	opacity: 1;
	transform: none;
}

.tpw__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--tpw-x, inherit);
	font: 400 28px/36px system-ui, sans-serif;
	text-align: center;
	cursor: pointer;
	opacity: 0.7;
}
.tpw__close:hover,
.tpw__close:focus-visible {
	opacity: 1;
	background: rgba(127, 127, 127, 0.15);
}
.tpw__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.tpw__content > :first-child {
	margin-top: 0;
}
.tpw__content > :last-child {
	margin-bottom: 0;
}
html.tpw-lock,
html.tpw-lock body {
	overflow: hidden;
}
@media (max-width: 600px) {
	.tpw__box {
		padding: min(var(--tpw-pad, 32px), 24px);
	}
}

/* Reduced motion: a plain fade, nothing moves. */
@media (prefers-reduced-motion: reduce) {
	.tpw__box {
		transform: none !important;
		transition: opacity 0.2s linear;
	}
	.tpw__overlay {
		transition: opacity 0.2s linear;
	}
	.tpw .tpw-tm,
	.tpw__content img {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}
