/**
 * LiveWell Awareness Popup — styles.
 *
 * Positioning strategy: a fixed, full-viewport flex overlay with the dialog
 * centred by "margin: auto". Auto margins keep the dialog perfectly centred
 * while still allowing the overlay to scroll when the dialog is taller than
 * the viewport (which is what happens on small phones and short landscape
 * screens), instead of clipping the top of the image.
 */

/* -------------------------------------------------- Wrapper / overlay */

.lwi-popup {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2147483000; /* above theme headers, cookie bars and chat widgets */
	display: flex;
	/*
	 * Vertical centring is done by "margin: auto" on the dialog below, not by
	 * align-items. That matters on short screens: when the dialog is taller
	 * than the viewport, an auto margin collapses to zero and the dialog sits
	 * flush at the top where it can be scrolled to. Aligning with
	 * align-items: center instead would push the top edge above the scroll
	 * area, where the visitor could never reach it.
	 */
	align-items: flex-start;
	justify-content: center;
	padding: 20px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: rgba(0, 0, 0, 0.75);
	opacity: 0;
	transition: opacity 0.25s ease;
}

/* Wins over the display rule above, so the popup stays invisible until
   JavaScript removes the attribute. */
.lwi-popup[hidden] {
	display: none !important;
}

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

.lwi-popup,
.lwi-popup * {
	box-sizing: border-box;
}

/* Prevents the page behind the popup from scrolling. */
body.lwi-popup-open {
	overflow: hidden;
	padding-right: var(--lwi-scrollbar-width, 0px);
}

/* ------------------------------------------------------------- Dialog */

.lwi-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 760px; /* fallback for browsers without min() support */
	max-width: min(760px, 100%);
	margin: auto; /* centres on both axes and allows scrolling when tall */
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	transform: translateY(10px) scale(0.98);
	transition: transform 0.25s ease;
}

.lwi-popup.is-visible .lwi-popup__dialog {
	transform: translateY(0) scale(1);
}

.lwi-popup__image {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

/* --------------------------------------------------------- Close button */

.lwi-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	color: #ffffff;
	font-size: 26px;
	font-weight: 700;
	line-height: 1;
	font-family: Arial, Helvetica, sans-serif;
	text-align: center;
	text-decoration: none;
	background: rgba(0, 0, 0, 0.6);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

/*
 * Grow the button on pointer hover only. Focus deliberately does not change
 * the size: JavaScript moves focus here as soon as the popup opens, and the
 * close target must stay a predictable 44x44 px. Keyboard users get an
 * outline instead, which does not affect the element's box.
 */
.lwi-popup__close:hover {
	background: #000000;
	transform: scale(1.06);
}

.lwi-popup__close:focus {
	background: #000000;
}

.lwi-popup__close:focus-visible {
	outline: 3px solid #ffd400;
	outline-offset: 2px;
}

/* --------------------------------------------- Visually hidden caption */

.lwi-popup__caption {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------- Small screens */

@media (max-width: 600px) {
	.lwi-popup {
		padding: 12px;
	}

	.lwi-popup__dialog {
		max-width: 100%;
		border-radius: 10px;
	}

	.lwi-popup__close {
		top: 8px;
		right: 8px;
		width: 44px;
		height: 44px;
		font-size: 24px;
	}
}

/* Short landscape phones: reclaim vertical space so the image stays visible. */
@media (max-height: 480px) {
	.lwi-popup {
		padding: 8px;
	}

	.lwi-popup__dialog {
		max-width: min(560px, 100%);
	}
}

/* ---------------------------------------------------- Motion & printing */

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

	.lwi-popup__dialog {
		transform: none;
	}
}

@media print {
	.lwi-popup {
		display: none !important;
	}
}
