/* Home Popup Maker – front end */
.hpm-popup[hidden] { display: none !important; }

.hpm-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}
.hpm-popup *, .hpm-popup *::before, .hpm-popup *::after { box-sizing: border-box; }

.hpm-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, var(--hpm-overlay, .6));
	opacity: 0;
	transition: opacity .25s ease;
}

.hpm-dialog {
	position: relative;
	width: 100%;
	max-width: var(--hpm-width, 520px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	background-color: var(--hpm-bg, #fff);
	color: var(--hpm-text, #1d2327);
	border-radius: 10px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	transform: translateY(16px) scale(.98);
	opacity: 0;
	transition: transform .3s ease, opacity .3s ease;
	outline: none;
}

.hpm-popup.hpm-open .hpm-overlay { opacity: 1; }
.hpm-popup.hpm-open .hpm-dialog { transform: none; opacity: 1; }

.hpm-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .9);
	color: #1d2327;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
	line-height: 1;
}
.hpm-close:hover { background: #fff; }
.hpm-close:focus-visible,
.hpm-button:focus-visible { outline: 3px solid var(--hpm-accent, #2563eb); outline-offset: 2px; }

.hpm-media img,
.hpm-image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 320px;
	object-fit: cover;
	margin: 0;
}

.hpm-body {
	padding: 28px 32px 32px;
	text-align: center;
}

.hpm-subtitle {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--hpm-accent, #2563eb);
}

.hpm-popup .hpm-heading {
	margin: 0 0 12px;
	font-size: clamp(22px, 4vw, 30px);
	line-height: 1.2;
	color: inherit;
}

.hpm-description {
	font-size: 16px;
	line-height: 1.6;
	max-width: 60ch;
	margin: 0 auto;
}
.hpm-description p { margin: 0 0 12px; color: inherit; }
.hpm-description p:last-child { margin-bottom: 0; }
.hpm-description a { color: var(--hpm-accent, #2563eb); }

.hpm-popup .hpm-button {
	display: inline-block;
	margin-top: 22px;
	padding: 12px 28px;
	border: 0;
	border-radius: 6px;
	background: var(--hpm-accent, #2563eb);
	color: var(--hpm-btn-text, #fff);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter .15s ease;
}
.hpm-popup .hpm-button:hover { filter: brightness(1.08); color: var(--hpm-btn-text, #fff); }

/* Image beside text */
@media (min-width: 640px) {
	.hpm-pos-left:not(.hpm-no-image) {
		display: grid;
		grid-template-columns: 2fr 3fr;
	}
	.hpm-pos-left .hpm-media img {
		height: 100%;
		max-height: none;
	}
	.hpm-pos-left .hpm-body {
		text-align: left;
		align-self: center;
	}
	.hpm-pos-left .hpm-description { margin: 0; }
}

/* Image behind text */
.hpm-pos-background {
	background-size: cover;
	background-position: center;
}
.hpm-pos-background:not(.hpm-no-image) .hpm-body {
	padding: 56px 32px;
	background: rgba(0, 0, 0, .45);
	color: #fff;
}
.hpm-pos-background:not(.hpm-no-image) .hpm-subtitle { color: #fff; opacity: .9; }

body.hpm-lock { overflow: hidden; }

@media (max-width: 599px) {
	.hpm-body { padding: 22px 20px 24px; }
	.hpm-media img, .hpm-image { max-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
	.hpm-overlay, .hpm-dialog { transition: none; }
}
