/**
 * HDC Popups — frontend styles.
 *
 * Everything is scoped under .hdc-popup-root / .hdc-popup so the host theme
 * cannot bleed into the popup and the popup cannot bleed into the theme.
 */

.hdc-popup-root {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

/* Prevent background scroll while a popup is open. */
body.hdc-popup-open {
	overflow: hidden;
}

.hdc-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

/* Reset basics inside the popup container only. */
.hdc-popup,
.hdc-popup * {
	box-sizing: border-box;
	font-family: inherit;
	line-height: 1.5;
}

.hdc-popup {
	position: relative;
	z-index: 100000;
	width: 100%;
	max-width: var(--hdc-pop-w, 720px);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	background-color: #ffffff;
	color: #222222;
	-webkit-overflow-scrolling: touch;
}

/* Close button */
.hdc-popup-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #111111;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.hdc-popup-close:hover,
.hdc-popup-close:focus {
	background: #ffffff;
}

.hdc-popup-close:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

.hdc-popup-body {
	display: flex;
	flex-direction: column;
}

/* Images */
.hdc-popup-media {
	margin: 0;
}

.hdc-popup-image-link {
	display: block;
}

.hdc-popup-image {
	display: block;
	width: 100%;
	height: auto;
}

/* Content block */
.hdc-popup-content {
	padding: 28px 32px 32px;
}

/* Text alignment — driven by the "Text alignment" setting via .hdc-align-* on
   the popup. Targeting .hdc-popup-content keeps it authoritative over any
   per-layout default. */
.hdc-popup.hdc-align-left .hdc-popup-content {
	text-align: left;
}

.hdc-popup.hdc-align-center .hdc-popup-content {
	text-align: center;
}

.hdc-popup.hdc-align-right .hdc-popup-content {
	text-align: right;
}

.hdc-popup-heading {
	margin: 0 0 12px;
	font-size: 1.6rem;
	font-weight: 700;
	color: inherit;
}

.hdc-popup-text {
	margin: 0 0 20px;
	font-size: 1rem;
	color: inherit;
}

/* Buttons */
.hdc-popup-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 8px;
}

.hdc-popup.hdc-align-left .hdc-popup-buttons {
	justify-content: flex-start;
}

.hdc-popup.hdc-align-center .hdc-popup-buttons {
	justify-content: center;
}

.hdc-popup.hdc-align-right .hdc-popup-buttons {
	justify-content: flex-end;
}

.hdc-popup-btn {
	display: inline-block;
	padding: 12px 24px;
	border-radius: 6px;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.hdc-popup-btn:hover {
	opacity: 0.88;
}

.hdc-popup-btn:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * Layout: Horizontal — image on top, content below (default flex column).
 * ------------------------------------------------------------------------- */
.hdc-popup--horizontal .hdc-popup-image {
	border-radius: 10px 10px 0 0;
}

/* ---------------------------------------------------------------------------
 * Layout: Vertical — image beside content on desktop.
 * ------------------------------------------------------------------------- */
.hdc-popup--vertical .hdc-popup-body {
	flex-direction: row;
	align-items: stretch;
}

.hdc-popup--vertical .hdc-popup-media--side {
	flex: 0 0 42%;
	max-width: 42%;
}

.hdc-popup--vertical .hdc-popup-media--side .hdc-popup-image,
.hdc-popup--vertical .hdc-popup-media--side .hdc-popup-image-link {
	height: 100%;
}

.hdc-popup--vertical .hdc-popup-image {
	object-fit: cover;
	border-radius: 10px 0 0 10px;
}

.hdc-popup--vertical .hdc-popup-content {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* ---------------------------------------------------------------------------
 * Layout: Image only — single image fills the popup, no content area.
 * ------------------------------------------------------------------------- */
.hdc-popup--image_only {
	overflow: hidden; /* clip the image to the popup's rounded corners */
}

.hdc-popup--image_only .hdc-popup-media--full,
.hdc-popup--image_only .hdc-popup-image-link {
	display: block;
	line-height: 0; /* remove any inline-image gap below the image */
}

.hdc-popup--image_only .hdc-popup-image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

/* ---------------------------------------------------------------------------
 * Layout: Text only — compact, centered.
 * ------------------------------------------------------------------------- */
.hdc-popup--text_only {
	max-width: var(--hdc-pop-w, 480px);
}

.hdc-popup--text_only .hdc-popup-content {
	padding: 40px 36px;
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.hdc-popup {
		width: 90%;
		/* Below the desktop breakpoint, ignore any custom width and stay fluid. */
		max-width: none;
	}

	/* Vertical collapses to stacked. */
	.hdc-popup--vertical .hdc-popup-body {
		flex-direction: column;
	}

	.hdc-popup--vertical .hdc-popup-media--side {
		flex: 0 0 auto;
		max-width: 100%;
	}

	.hdc-popup--vertical .hdc-popup-image {
		border-radius: 10px 10px 0 0;
		max-height: 240px;
	}

	.hdc-popup-content {
		padding: 24px 22px 26px;
	}

	.hdc-popup-heading {
		font-size: 1.4rem;
	}
}

@media (max-width: 480px) {
	.hdc-popup-root {
		padding: 10px;
	}

	.hdc-popup {
		width: 95%;
		max-height: 95vh;
	}

	.hdc-popup-heading {
		font-size: 1.25rem;
	}

	.hdc-popup-text {
		font-size: 0.95rem;
	}

	.hdc-popup-buttons {
		flex-direction: column;
	}

	.hdc-popup-btn {
		width: 100%;
		text-align: center;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.hdc-popup {
		animation: hdc-popup-in 0.2s ease-out;
	}
}

@keyframes hdc-popup-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
