.timed-popup-overlay[hidden] {
	display: none !important;
}

.timed-popup-overlay {
	--timed-popup-overlay-opacity: 0.65;
	--timed-popup-width: 600px;
	--timed-popup-width-desktop: var(--timed-popup-width);
	--timed-popup-width-tablet: var(--timed-popup-width-desktop);
	--timed-popup-width-mobile: var(--timed-popup-width-tablet);
	--timed-popup-fade-in-duration: 180ms;
	--timed-popup-fade-out-duration: 180ms;
	--timed-popup-close-color: #d63638;
	--timed-popup-close-background: #fff;
	--timed-popup-close-hover-color: #fff;
	--timed-popup-close-hover-background: #d63638;
	--timed-popup-close-border-color: #d63638;
	--timed-popup-close-hover-border-color: #d63638;
	--timed-popup-close-focus-ring-color: #fff;
	--timed-popup-close-top: 10px;
	--timed-popup-close-right: 10px;
	--timed-popup-close-bottom: auto;
	--timed-popup-close-left: auto;
	--timed-popup-box-background: #fff;
	--timed-popup-box-bg-image: none;
	--timed-popup-box-bg-size: cover;
	--timed-popup-box-bg-position: center center;
	--timed-popup-box-bg-repeat: no-repeat;
	--timed-popup-box-bg-attachment: scroll;
	--timed-popup-box-bg-opacity: 1;
	--timed-popup-box-bg-tint: rgba(0, 0, 0, 0);
	--timed-popup-box-bg-blend: normal;
	--timed-popup-box-min-height: 0;
	--timed-popup-box-color: #1d2327;
	--timed-popup-box-padding-top: 72px;
	--timed-popup-box-padding-right: clamp(20px, 4vw, 42px);
	--timed-popup-box-padding-bottom: clamp(24px, 4vw, 42px);
	--timed-popup-box-padding-left: clamp(20px, 4vw, 42px);
	--timed-popup-title-padding-top: 0;
	--timed-popup-title-padding-right: 0;
	--timed-popup-title-padding-bottom: 0;
	--timed-popup-title-padding-left: 0;
	--timed-popup-box-border: 0 solid transparent;
	--timed-popup-box-border-top: 0 solid transparent;
	--timed-popup-box-border-right: 0 solid transparent;
	--timed-popup-box-border-bottom: 0 solid transparent;
	--timed-popup-box-border-left: 0 solid transparent;
	--timed-popup-box-radius-top-left: 8px;
	--timed-popup-box-radius-top-right: 8px;
	--timed-popup-box-radius-bottom-right: 8px;
	--timed-popup-box-radius-bottom-left: 8px;
	--timed-popup-box-margin-top: 0;
	--timed-popup-box-margin-right: 0;
	--timed-popup-box-margin-bottom: 0;
	--timed-popup-box-margin-left: 0;
	--timed-popup-box-height: auto;
	--timed-popup-box-min-width: 0;
	--timed-popup-box-max-width: 100%;
	--timed-popup-box-max-height: calc(100dvh - 40px);
	--timed-popup-box-overflow: hidden;
	--timed-popup-box-opacity: 1;
	--timed-popup-box-outline: none;
	--timed-popup-box-outline-offset: 0;
	--timed-popup-box-font-family: inherit;
	--timed-popup-box-font-size: inherit;
	--timed-popup-box-font-weight: inherit;
	--timed-popup-box-line-height: inherit;
	--timed-popup-box-letter-spacing: normal;
	--timed-popup-box-text-transform: none;
	--timed-popup-box-align-items: center;
	--timed-popup-box-justify-content: center;
	--timed-popup-box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	--timed-popup-content-align: inherit;
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: var(--timed-popup-box-align-items);
	justify-content: var(--timed-popup-box-justify-content);
	box-sizing: border-box;
	padding: 20px;
	background: rgba(0, 0, 0, var(--timed-popup-overlay-opacity));
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: none;
	overscroll-behavior: none;
}

/*
 * The mounted state makes the transparent overlay paintable before the open
 * state is applied. This prevents browsers from coalescing display and opacity
 * changes and skipping the fade-in transition.
 */
.timed-popup-overlay.is-mounted {
	visibility: visible;
}

.timed-popup-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Opening and closing fades are independently enabled per popup. */
.timed-popup-overlay.is-opening.timed-popup-fade-in {
	transition: opacity var(--timed-popup-fade-in-duration) ease;
}

.timed-popup-overlay.is-closing {
	visibility: visible;
	pointer-events: none;
}

.timed-popup-overlay.is-closing:not(.is-open) {
	opacity: 0;
}

.timed-popup-overlay.is-closing.timed-popup-fade-out {
	transition: opacity var(--timed-popup-fade-out-duration) ease;
}

.timed-popup-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	isolation: isolate;
	width: min(var(--timed-popup-width-desktop), calc(100vw - 40px));
	height: var(--timed-popup-box-height);
	min-width: var(--timed-popup-box-min-width);
	max-width: min(var(--timed-popup-box-max-width), 100%);
	max-height: calc(100vh - 40px);
	max-height: min(var(--timed-popup-box-max-height), calc(100dvh - 40px));
	min-height: min(var(--timed-popup-box-min-height), calc(100vh - 40px));
	min-height: min(var(--timed-popup-box-min-height), calc(100dvh - 40px));
	box-sizing: border-box;
	margin: var(--timed-popup-box-margin-top) var(--timed-popup-box-margin-right) var(--timed-popup-box-margin-bottom) var(--timed-popup-box-margin-left);
}

.timed-popup-box-background {
	position: absolute;
	inset: 0;
	z-index: 0;
	box-sizing: border-box;
	overflow: hidden;
	border-radius: inherit;
	pointer-events: none;
}

/* Keep image opacity independent from the optional tint opacity. */
.timed-popup-box-background::before,
.timed-popup-box-background::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
}

.timed-popup-box-background::before {
	background-image: var(--timed-popup-box-bg-image);
	background-size: var(--timed-popup-box-bg-size);
	background-position: var(--timed-popup-box-bg-position);
	background-repeat: var(--timed-popup-box-bg-repeat);
	background-attachment: var(--timed-popup-box-bg-attachment);
	opacity: var(--timed-popup-box-bg-opacity);
}

.timed-popup-box-background::after {
	background-color: var(--timed-popup-box-bg-tint);
	mix-blend-mode: var(--timed-popup-box-bg-blend);
}

.timed-popup-content {
	position: relative;
	z-index: 1;
}

.timed-popup-content {
	box-sizing: border-box;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	min-height: 0;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	text-align: var(--timed-popup-content-align);
}

/* Original plugin appearance retained for pop-ups created before 1.6.0. */
.timed-popup-appearance-classic .timed-popup-dialog {
	overflow: hidden;
	background: #fff;
	color: #1d2327;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.timed-popup-appearance-classic .timed-popup-content {
	padding: var(--timed-popup-box-padding-top) var(--timed-popup-box-padding-right) var(--timed-popup-box-padding-bottom) var(--timed-popup-box-padding-left);
}

/* Quick mode: preserve active-theme typography and standard element styling. */
.timed-popup-appearance-theme .timed-popup-dialog {
	overflow: hidden;
	background: var(--wp--preset--color--base, var(--wp--preset--color--background, Canvas));
	color: inherit;
	border: 1px solid var(--wp--preset--color--contrast-2, rgba(0, 0, 0, 0.12));
	border-radius: var(--wp--custom--border-radius, 8px);
	box-shadow: var(--wp--preset--shadow--natural, 0 20px 60px rgba(0, 0, 0, 0.35));
	font: inherit;
}

.timed-popup-appearance-theme .timed-popup-content {
	padding: var(--timed-popup-box-padding-top) var(--timed-popup-box-padding-right) var(--timed-popup-box-padding-bottom) var(--timed-popup-box-padding-left);
	font: inherit;
}

/* Common custom controls. */
.timed-popup-appearance-custom .timed-popup-dialog {
	overflow: hidden;
	background: var(--timed-popup-box-background);
	color: var(--timed-popup-box-color);
	border-top: var(--timed-popup-box-border-top);
	border-right: var(--timed-popup-box-border-right);
	border-bottom: var(--timed-popup-box-border-bottom);
	border-left: var(--timed-popup-box-border-left);
	border-top-left-radius: var(--timed-popup-box-radius-top-left);
	border-top-right-radius: var(--timed-popup-box-radius-top-right);
	border-bottom-right-radius: var(--timed-popup-box-radius-bottom-right);
	border-bottom-left-radius: var(--timed-popup-box-radius-bottom-left);
	box-shadow: var(--timed-popup-box-shadow);
	outline: var(--timed-popup-box-outline);
	outline-offset: var(--timed-popup-box-outline-offset);
	opacity: var(--timed-popup-box-opacity);
	overflow: var(--timed-popup-box-overflow);
	font-family: var(--timed-popup-box-font-family);
	font-size: var(--timed-popup-box-font-size);
	font-weight: var(--timed-popup-box-font-weight);
	line-height: var(--timed-popup-box-line-height);
	letter-spacing: var(--timed-popup-box-letter-spacing);
	text-transform: var(--timed-popup-box-text-transform);
}

.timed-popup-appearance-custom .timed-popup-content {
	padding: var(--timed-popup-box-padding-top) var(--timed-popup-box-padding-right) var(--timed-popup-box-padding-bottom) var(--timed-popup-box-padding-left);
}

/* CSS-only mode leaves only the structural and accessibility layer. */
.timed-popup-appearance-unstyled .timed-popup-dialog {
	overflow: visible;
	background: transparent;
	color: inherit;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.timed-popup-appearance-unstyled .timed-popup-content {
	padding: var(--timed-popup-box-padding-top) var(--timed-popup-box-padding-right) var(--timed-popup-box-padding-bottom) var(--timed-popup-box-padding-left);
}

.timed-popup-title {
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	padding-top: var(--timed-popup-title-padding-top);
	padding-right: var(--timed-popup-title-padding-right);
	padding-bottom: var(--timed-popup-title-padding-bottom);
	padding-left: var(--timed-popup-title-padding-left);
}

.timed-popup-body {
	position: relative;
	z-index: 1;
	min-width: 0;
	overflow-wrap: anywhere;
}

.timed-popup-body > :first-child {
	margin-top: 0;
}

.timed-popup-body > :last-child {
	margin-bottom: 0;
}


.timed-popup-content input,
.timed-popup-content select,
.timed-popup-content textarea,
.timed-popup-content button {
	max-width: 100%;
	box-sizing: border-box;
}

.timed-popup-content img,
.timed-popup-content picture,
.timed-popup-content video,
.timed-popup-content iframe,
.timed-popup-content table,
.timed-popup-content canvas {
	max-width: 100%;
}

.timed-popup-click-confirmation {
	position: relative;
	z-index: 2;
	display: grid;
	gap: 10px;
	flex: 0 0 auto;
	box-sizing: border-box;
	padding: 16px clamp(20px, 4vw, 42px) 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.14);
	background: rgba(255, 255, 255, 0.96);
	color: #1d2327;
}

.timed-popup-click-confirmation[hidden] {
	display: none !important;
}

.timed-popup-click-confirmation__check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	font: inherit;
	line-height: 1.45;
	cursor: pointer;
}

.timed-popup-click-confirmation__check input {
	flex: 0 0 auto;
	margin-top: 0.2em;
}

.timed-popup-click-confirmation__button {
	justify-self: start;
	min-height: 42px;
	padding: 8px 16px;
	border: 1px solid currentColor;
	border-radius: 6px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.timed-popup-click-confirmation__button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.timed-popup-click-confirmation__status {
	margin: 0;
	font: inherit;
	font-weight: 600;
}

/*
 * The close control uses explicit normal, hover, and keyboard-focus states. Avoiding
 * currentColor here prevents the computed hover foreground and background
 * from resolving to the same value. Critical visibility rules are hardened
 * against aggressive theme button styles while custom CSS can still override
 * them deliberately with the {{close}} selector and !important.
 */
.timed-popup-overlay .timed-popup-close {
	-webkit-appearance: none;
	appearance: none;
	position: absolute !important;
	top: var(--timed-popup-close-top) !important;
	right: var(--timed-popup-close-right) !important;
	bottom: var(--timed-popup-close-bottom) !important;
	left: var(--timed-popup-close-left) !important;
	z-index: 20 !important;
	display: inline-flex !important;
	visibility: visible !important;
	opacity: 1 !important;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	min-height: 48px;
	box-sizing: border-box;
	margin: 0 !important;
	padding: 4px 12px;
	overflow: visible;
	clip: auto;
	text-indent: 0;
	white-space: nowrap;
	border-style: solid !important;
	border-width: 3px !important;
	border-color: var(--timed-popup-close-border-color) !important;
	border-radius: 6px;
	background-color: var(--timed-popup-close-background) !important;
	background-image: none !important;
	color: var(--timed-popup-close-color) !important;
	-webkit-text-fill-color: var(--timed-popup-close-color) !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
	font-family: Arial, Helvetica, sans-serif !important;
	font-size: 32px !important;
	font-style: normal !important;
	font-weight: 900 !important;
	line-height: 1 !important;
	letter-spacing: normal !important;
	text-align: center;
	text-decoration: none !important;
	text-transform: none !important;
	transform: none !important;
	filter: none !important;
	pointer-events: auto !important;
	cursor: pointer;
}

/*
 * The script focuses the close control when a pop-up opens. Focus therefore
 * keeps the normal colors; only an actual pointer hover uses hover colors.
 */
.timed-popup-overlay .timed-popup-close:focus,
.timed-popup-overlay .timed-popup-close:focus-visible {
	visibility: visible !important;
	opacity: 1 !important;
	border-color: var(--timed-popup-close-border-color) !important;
	background-color: var(--timed-popup-close-background) !important;
	background-image: none !important;
	color: var(--timed-popup-close-color) !important;
	-webkit-text-fill-color: var(--timed-popup-close-color) !important;
	transform: none !important;
	filter: none !important;
}

.timed-popup-overlay .timed-popup-close:hover,
.timed-popup-overlay .timed-popup-close:active {
	visibility: visible !important;
	opacity: 1 !important;
	border-color: var(--timed-popup-close-hover-border-color) !important;
	background-color: var(--timed-popup-close-hover-background) !important;
	background-image: none !important;
	color: var(--timed-popup-close-hover-color) !important;
	-webkit-text-fill-color: var(--timed-popup-close-hover-color) !important;
	transform: none !important;
	filter: none !important;
}

.timed-popup-overlay .timed-popup-close:focus {
	outline: none;
}

.timed-popup-overlay .timed-popup-close:focus-visible {
	outline: 3px solid var(--timed-popup-close-focus-ring-color) !important;
	outline-offset: 3px;
}

body.timed-popup-open {
	overflow: hidden;
}

@media (max-width: 1024px) {
	.timed-popup-dialog {
		width: min(var(--timed-popup-width-tablet), calc(100vw - 40px));
	}
}

@media (max-width: 600px) {
	.timed-popup-overlay {
		padding: 8px;
	}

	.timed-popup-dialog,
	.timed-popup-content {
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
	}

	.timed-popup-dialog {
		width: min(var(--timed-popup-width-mobile), calc(100vw - 16px));
		min-height: min(var(--timed-popup-box-min-height), calc(100vh - 16px));
		min-height: min(var(--timed-popup-box-min-height), calc(100dvh - 16px));
	}

}

@media (prefers-reduced-motion: reduce) {
	.timed-popup-overlay,
	.timed-popup-overlay.is-opening,
	.timed-popup-overlay.is-closing {
		transition: none !important;
	}
}

.timed-popup-overlay .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Optional frame override lets box borders, corners, and shadows work in every appearance mode. */
.timed-popup-frame-override .timed-popup-dialog {
	border-top: var(--timed-popup-box-border-top);
	border-right: var(--timed-popup-box-border-right);
	border-bottom: var(--timed-popup-box-border-bottom);
	border-left: var(--timed-popup-box-border-left);
	border-top-left-radius: var(--timed-popup-box-radius-top-left);
	border-top-right-radius: var(--timed-popup-box-radius-top-right);
	border-bottom-right-radius: var(--timed-popup-box-radius-bottom-right);
	border-bottom-left-radius: var(--timed-popup-box-radius-bottom-left);
	box-shadow: var(--timed-popup-box-shadow);
}

/* Touch-safe navigation for in-popup choice flows. */
.timed-popup-content [data-timed-popup-choice],
.timed-popup-content [data-timed-popup-choice-back] {
	position: relative;
	z-index: 3;
	pointer-events: auto !important;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
}
