.toh-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	opacity: 0;
	transition: opacity 0.3s ease;
}

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

.toh-popup.is-open {
	opacity: 1;
}

.toh-popup-open {
	overflow: hidden;
}

.toh-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(28, 25, 23, 0.6);
}

.toh-popup__dialog {
	position: relative;
	display: flex;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 3rem);
	max-height: calc(100dvh - 3rem);
	background: var(--wp--preset--color--cream, #fff8ee);
	color: var(--wp--preset--color--dark, #1c1917);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	transform: translateY(16px);
	transition: transform 0.3s ease;
}

.toh-popup.is-open .toh-popup__dialog {
	transform: none;
}

.toh-popup__scroll {
	display: grid;
	grid-template-columns: 1fr;
	width: 100%;
	overflow: auto;
	overscroll-behavior: contain;
}

.toh-popup.has-image .toh-popup__dialog {
	max-width: 1040px;
}

.toh-popup.has-image .toh-popup__scroll {
	grid-template-columns: 1fr 1fr;
}

.toh-popup__media {
	position: relative;
	min-height: 100%;
}

.toh-popup__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.toh-popup__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.75rem, 4vw, 3.75rem);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.975rem;
	line-height: 1.65;
}

.toh-popup__heading {
	margin: 0 0 1.25rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(2rem, 3.4vw, 2.75rem);
	font-weight: 500;
	line-height: 1.05;
	color: var(--wp--preset--color--accent, #76333f);
}

.toh-popup__content > * {
	margin: 0 0 1em;
}

.toh-popup__content > :last-child {
	margin-bottom: 0;
}

.toh-popup__content strong {
	font-weight: 600;
}

.toh-popup__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 2rem;
}

.toh-popup__buttons .wp-element-button {
	text-decoration: none;
	padding: 0.9rem 1.75rem;
}

.toh-popup__buttons .is-secondary {
	background: transparent;
	color: var(--wp--preset--color--accent, #76333f);
}

.toh-popup__buttons .is-secondary:hover {
	background: var(--wp--preset--color--accent, #76333f);
	color: #fff;
}

.toh-popup__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--cream, #fff8ee);
	color: var(--wp--preset--color--dark, #1c1917);
	cursor: pointer;
	transition: transform 0.2s ease;
}

.toh-popup__close:hover {
	transform: rotate(90deg);
}

.toh-popup__close:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, #76333f);
	outline-offset: 2px;
}

@media (max-width: 781px) {
	.toh-popup {
		padding: 1rem;
	}

	.toh-popup__dialog,
	.toh-popup.has-image .toh-popup__dialog {
		max-width: 480px;
		max-height: calc(100vh - 2rem);
		max-height: calc(100dvh - 2rem);
	}

	.toh-popup__scroll,
	.toh-popup.has-image .toh-popup__scroll {
		display: block;
	}

	.toh-popup__media {
		min-height: 0;
	}

	.toh-popup__media img {
		position: static;
		height: auto;
		aspect-ratio: 16 / 10;
		max-height: 35vh;
	}

	.toh-popup__body {
		padding: 2rem 1.5rem 2.25rem;
		font-size: 0.925rem;
	}
}

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