/* ENV Popup – frontend styles (see popup.php) */

.env-popup[hidden] {
	display: none;
}

.env-popup {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000; /* above site navigation (10000) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.env-popup.is-visible {
	opacity: 1;
}

.env-popup__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.7);
	cursor: pointer;
}

.env-popup__dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 36px 24px 28px;
	border-radius: 12px;
	background: var(--env-popup-bg, #fff);
	color: var(--env-popup-color, #111);
	text-align: center;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
	transform: scale(0.95);
	transition: transform 0.2s ease;
}

.env-popup__dialog:focus {
	outline: none;
}

.env-popup.is-visible .env-popup__dialog {
	transform: scale(1);
}

.env-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 28px;
	height: 28px;
	padding: 5px;
	border: 0;
	border-radius: 50%;
	background: #ddd;
	color: #fff;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.env-popup__close svg {
	display: block;
	width: 18px;
	height: 18px;
}

.env-popup__close:hover,
.env-popup__close:focus-visible {
	background: #fff;
	color: #000;
}

.env-popup__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.env-popup__image-link {
	display: block;
}

.env-popup__image {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto 16px;
}

/* Banner variant: image only, the whole popup is the (linked) image. */
.env-popup--image-only .env-popup__dialog {
	max-width: 500px;
	padding: 0;
	border-radius: 0;
	overflow: visible;
	box-shadow: none;
}

/* The dialog can't scroll in this variant, so size it from the image ratio
   to keep tall banners fully on screen. */
.env-popup--image-only .env-popup__dialog {
	max-width: min(500px, calc((100vh - 48px) * var(--env-popup-img-ratio, 1)));
}

.env-popup--image-only .env-popup__image {
	width: 100%;
	margin: 0;
}

.env-popup--image-only .env-popup__close {
	top: -15px;
	right: -15px;
}

.env-popup__title {
	margin: 0 0 12px;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
	color: inherit;
}

.env-popup__text {
	margin: 0 0 20px;
	font-size: 1rem;
	line-height: 1.5;
}

.env-popup__text > :first-child {
	margin-top: 0;
}

.env-popup__text > :last-child {
	margin-bottom: 0;
}

.env-popup__text a {
	color: inherit;
	text-decoration: underline;
}

.env-popup__button,
.env-popup__button:visited {
	display: inline-block;
	padding: 12px 28px;
	border-radius: 6px;
	background: var(--env-popup-btn-bg, #00354c);
	color: var(--env-popup-btn-color, #fff);
	font-weight: 700;
	line-height: 1.3;
	text-decoration: none;
	transition: filter 0.15s ease;
}

.env-popup__button:hover,
.env-popup__button:focus-visible {
	filter: brightness(1.12);
	color: var(--env-popup-btn-color, #fff);
	text-decoration: none;
}

html.env-popup-open,
html.env-popup-open body {
	overflow: hidden;
}

@media (max-width: 480px) {
	.env-popup__dialog {
		padding: 32px 16px 20px;
	}

	/* keep the outside close button on screen */
	.env-popup--image-only {
		padding: 24px;
	}

	.env-popup__title {
		font-size: 1.25rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.env-popup,
	.env-popup__dialog {
		transition: none;
	}
}
