/* AiGenics Popup — the image only, shown as it is (no frame, corners or shadow); responsive on desktop, tablet and mobile */
.agpp {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	opacity: 0;
	transition: opacity .25s ease;
}
.agpp[hidden] { display: none; }
.agpp--visible { opacity: 1; }
.agpp *, .agpp *::before, .agpp *::after { box-sizing: border-box; }

.agpp__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 17, 26, 0.62);
	cursor: pointer;
}

/* the box is exactly as big as the image: never wider than 760 px or the screen, never taller than the screen */
.agpp__dialog {
	position: relative;
	display: inline-block;
	max-width: min(760px, 100%);
	line-height: 0;
	transform: translateY(16px) scale(0.98);
	transition: transform .25s ease;
	outline: none;
}
.agpp--visible .agpp__dialog { transform: none; }

.agpp__image {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: 100% !important;
	max-height: calc(100vh - 48px) !important;
	max-height: calc(100dvh - 48px) !important;
	margin: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	object-fit: contain;
}

/* close button: a medium white circle just outside the image's top-right corner (the theme's own button styles are reset) */
.agpp .agpp__close {
	all: unset;
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 2;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #ffffff;
	color: #1f2430;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	line-height: 1;
	transition: background-color .15s ease, color .15s ease;
}
.agpp .agpp__close svg { display: block; width: 16px; height: 16px; }
.agpp .agpp__close:hover { background: #f1f1f3; color: #a2262d; }
.agpp .agpp__close:focus-visible { outline: 2px solid #a2262d; outline-offset: 2px; }

/* the page behind does not scroll while the popup is open */
html.agpp-open, html.agpp-open body { overflow: hidden !important; }

/* mobile */
@media (max-width: 600px) {
	.agpp { padding: 20px; }
	.agpp__image { max-height: calc(100vh - 40px) !important; max-height: calc(100dvh - 40px) !important; }
	.agpp .agpp__close { top: -12px; right: -12px; width: 30px; height: 30px; }
	.agpp .agpp__close svg { width: 15px; height: 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.agpp, .agpp__dialog { transition: none; }
}
