/**
 * Lemontec Popup – oohm
 *
 * Only the layout lives here. Fonts, headline sizes, text and the button come
 * from the oohm theme (`h3`, `h5`, `subtitle`, `p`, `wp-element-button`), the
 * colors match the theme's audio popup (`.music-intro-overlay`).
 *
 * So this file must not set font sizes or weights on theme elements.
 *
 * The theme's reset (`button`, `[type="button"]`, `img, svg { width: 100% }`) loads
 * after this file with the same specificity, and WooCommerce pages add
 * `.woocommerce img { height: auto }`. So buttons, images and icons are prefixed
 * with `.lmt-popup-root` and the SVG icons get explicit sizes.
 */

.lmt-popup-root {
	/* Theme colors: beige-light, blue-night. */
	--lmt-popup-background: #f0ece4;
	--lmt-popup-color: #1a3842;
	--lmt-popup-radius: 10px;
	--lmt-popup-offset-mobile: 16px;
	--lmt-popup-offset-desktop: 24px;
	--lmt-popup-offset: var(--lmt-popup-offset-mobile);
	--lmt-popup-gutter: 16px;
	--lmt-popup-max-width: 440px;
	--lmt-popup-max-width-wide: 880px;
	--lmt-popup-padding: 24px;
	--lmt-popup-image-height: 220px;
	--lmt-popup-close-size: 36px;
	--lmt-popup-close-gap: 8px;
	--lmt-popup-close-space: calc(var(--lmt-popup-close-size) + var(--lmt-popup-close-gap));
	--lmt-popup-toggle-size: 56px;
	--lmt-popup-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	--lmt-popup-backdrop: rgba(0, 0, 0, 0.85);
	--lmt-popup-duration: 300ms;
	--lmt-popup-z-index: 100000;
}

@media (min-width: 768px) {
	.lmt-popup-root {
		--lmt-popup-offset: var(--lmt-popup-offset-desktop);
		--lmt-popup-gutter: 24px;
		--lmt-popup-padding: 40px;
		--lmt-popup-image-height: 260px;
		--lmt-popup-toggle-size: 64px;
	}
}

/* Popup */

.lmt-popup {
	position: fixed;
	z-index: var(--lmt-popup-z-index);
	right: var(--lmt-popup-gutter);
	bottom: var(--lmt-popup-offset);
	left: var(--lmt-popup-gutter);
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	max-width: var(--lmt-popup-max-width);
	/* Leaves room for the close button above the popup. */
	max-height: calc(100dvh - var(--lmt-popup-offset) - var(--lmt-popup-gutter) - var(--lmt-popup-close-space));
	margin: 0 0 0 auto;
	padding: 0;
	color: var(--lmt-popup-color);
	background: var(--lmt-popup-background);
	border-radius: var(--lmt-popup-radius);
	box-shadow: var(--lmt-popup-shadow);
	opacity: 1;
	transform: none;
	transform-origin: bottom right;
	transition:
		opacity var(--lmt-popup-duration) ease,
		transform var(--lmt-popup-duration) ease,
		display var(--lmt-popup-duration) allow-discrete;
}

.lmt-popup[hidden] {
	display: none;
	opacity: 0;
	transform: translateY(12px) scale(0.96);
}

@starting-style {
	.lmt-popup {
		opacity: 0;
		transform: translateY(12px) scale(0.96);
	}
}

.lmt-popup:focus {
	outline: none;
}

.lmt-popup-root--has-toggle .lmt-popup {
	bottom: calc(var(--lmt-popup-offset) + var(--lmt-popup-toggle-size) + 12px);
	max-height: calc(100dvh - var(--lmt-popup-offset) - var(--lmt-popup-toggle-size) - 12px - var(--lmt-popup-gutter) - var(--lmt-popup-close-space));
}

.lmt-popup-root--left .lmt-popup {
	margin: 0 auto 0 0;
	transform-origin: bottom left;
}

/* Centered: all insets set and auto margins center the popup on both axes. */
.lmt-popup-root--center .lmt-popup {
	top: calc(var(--lmt-popup-gutter) + var(--lmt-popup-close-space));
	bottom: var(--lmt-popup-gutter);
	height: fit-content;
	max-height: calc(100dvh - 2 * var(--lmt-popup-gutter) - var(--lmt-popup-close-space));
	margin: auto;
	transform-origin: center;
}

.lmt-popup-backdrop {
	position: fixed;
	z-index: calc(var(--lmt-popup-z-index) - 1);
	inset: 0;
	background: var(--lmt-popup-backdrop);
	opacity: 1;
	transition:
		opacity var(--lmt-popup-duration) ease,
		display var(--lmt-popup-duration) allow-discrete;
}

.lmt-popup-backdrop[hidden] {
	display: none;
	opacity: 0;
}

@starting-style {
	.lmt-popup-backdrop {
		opacity: 0;
	}
}

/* Close button: sits above the popup, so it never covers the image or the text. */

.lmt-popup-root .lmt-popup__close {
	position: absolute;
	top: calc(-1 * var(--lmt-popup-close-space));
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--lmt-popup-close-size);
	height: var(--lmt-popup-close-size);
	margin: 0;
	padding: 0;
	color: var(--lmt-popup-color);
	background: var(--lmt-popup-background);
	border: 0;
	border-radius: 50%;
	box-shadow: var(--lmt-popup-shadow);
	cursor: pointer;
}

.lmt-popup-root .lmt-popup__close svg {
	width: 14px;
	height: 14px;
}

.lmt-popup__close:focus-visible,
.lmt-popup__button:focus-visible,
.lmt-popup-root .lmt-popup-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Body: the scroll container, so the close button outside is not cut off. */

.lmt-popup__body {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: inherit;
}

.lmt-popup__content {
	padding: var(--lmt-popup-padding);
}

/* Image on top (default, and always on mobile): fades out towards the text below. */

.lmt-popup__media {
	position: relative;
	height: var(--lmt-popup-image-height);
}

.lmt-popup-root .lmt-popup__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.lmt-popup__media + .lmt-popup__content {
	/* The faded part of the image already gives space above the text. */
	padding-top: 0;
}

/* Image left or right: two columns on desktop, the image fills the full height. */

@media (min-width: 768px) {
	.lmt-popup-root--image-left .lmt-popup,
	.lmt-popup-root--image-right .lmt-popup {
		max-width: var(--lmt-popup-max-width-wide);
	}

	.lmt-popup-root--image-left .lmt-popup__body:has(.lmt-popup__media),
	.lmt-popup-root--image-right .lmt-popup__body:has(.lmt-popup__media) {
		display: grid;
		grid-template-columns: 1fr 1fr;
		align-items: center;
	}

	.lmt-popup-root--image-left .lmt-popup__media,
	.lmt-popup-root--image-right .lmt-popup__media {
		align-self: stretch;
		height: auto;
		min-height: 100%;
	}

	.lmt-popup-root--image-left .lmt-popup__media + .lmt-popup__content,
	.lmt-popup-root--image-right .lmt-popup__media + .lmt-popup__content {
		padding-top: var(--lmt-popup-padding);
	}

	.lmt-popup-root--image-left .lmt-popup__image {
		mask-image: linear-gradient(to right, #000 55%, transparent);
	}

	.lmt-popup-root--image-right .lmt-popup__media {
		order: 2;
	}

	.lmt-popup-root--image-right .lmt-popup__image {
		mask-image: linear-gradient(to left, #000 55%, transparent);
	}
}

/* Content */

.lmt-popup-root--text-center .lmt-popup__content {
	text-align: center;
}

.lmt-popup-root--text-center .lmt-popup__text :is(ul, ol) {
	padding-left: 0;
	list-style-position: inside;
}

.lmt-popup-root .lmt-popup__logo {
	display: block;
	width: auto;
	max-width: 160px;
	height: auto;
	max-height: 40px;
}

.lmt-popup-root--text-center .lmt-popup__logo {
	margin-inline: auto;
}

.lmt-popup__divider {
	width: 48px;
	height: 0;
	margin: 16px 0;
	border: 0;
	border-top: 1px solid currentColor;
	opacity: 0.3;
}

.lmt-popup-root--text-center .lmt-popup__divider {
	margin-inline: auto;
}

.lmt-popup__eyebrow,
.lmt-popup__headline,
.lmt-popup__subline {
	margin: 0 0 8px;
	color: inherit;
}

.lmt-popup__content > :is(.lmt-popup__eyebrow, .lmt-popup__headline, .lmt-popup__subline):last-child,
.lmt-popup__content > :is(.lmt-popup__eyebrow, .lmt-popup__headline, .lmt-popup__subline):has(+ .lmt-popup__divider) {
	margin-bottom: 0;
}

.lmt-popup__text > * {
	margin: 0 0 0.75em;
}

.lmt-popup__text > :last-child {
	margin-bottom: 0;
}

.lmt-popup__text a {
	color: inherit;
	text-decoration: underline;
}

/* Sizes from the "Formats" dropdown of the text editor, keep in sync with editor-content.css. */
.lmt-popup__text .lmt-popup-small {
	font-size: 0.875em;
}

.lmt-popup__text .lmt-popup-large {
	font-size: 1.25em;
}

/* Theme button (`wp-element-button`) with an arrow. */
.lmt-popup-root .lmt-popup__button {
	display: inline-flex;
	gap: 10px;
	align-items: center;
	margin-top: 24px;
	text-decoration: none;
}

.lmt-popup-root .lmt-popup__button-arrow {
	flex-shrink: 0;
	width: 16px;
	height: 12px;
}

.lmt-popup__note {
	margin: 12px 0 0;
	font-size: 1.2rem;
	line-height: 1.5;
	opacity: 0.7;
}

/* Floating button, in the colors of the theme button. */

.lmt-popup-root .lmt-popup-toggle {
	position: fixed;
	z-index: var(--lmt-popup-z-index);
	right: var(--lmt-popup-gutter);
	bottom: var(--lmt-popup-offset);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--lmt-popup-toggle-size);
	height: var(--lmt-popup-toggle-size);
	margin: 0;
	padding: 0;
	color: var(--lmt-popup-background);
	background: var(--lmt-popup-color);
	border: 2px solid var(--lmt-popup-color);
	border-radius: 50%;
	box-shadow: var(--lmt-popup-shadow);
	cursor: pointer;
	transition:
		color var(--lmt-popup-duration) ease,
		background-color var(--lmt-popup-duration) ease,
		transform var(--lmt-popup-duration) ease;
}

.lmt-popup-root .lmt-popup-toggle[hidden] {
	display: none;
}

/* The open centered popup has its own close button, the floating button would only cover it. */
.lmt-popup-root--center .lmt-popup:not([hidden]) ~ .lmt-popup-toggle {
	display: none;
}

.lmt-popup-root .lmt-popup-toggle:hover,
.lmt-popup-root .lmt-popup-toggle:focus-visible {
	color: var(--lmt-popup-color);
	background: var(--lmt-popup-background);
	transform: scale(1.05);
}

/* Centered: bottom left, the side cart bubble of the theme sits bottom right. */
.lmt-popup-root.lmt-popup-root--left .lmt-popup-toggle,
.lmt-popup-root.lmt-popup-root--center .lmt-popup-toggle {
	right: auto;
	left: var(--lmt-popup-gutter);
}

.lmt-popup-root .lmt-popup-toggle__icon {
	display: block;
	width: 50%;
	height: 50%;
	object-fit: contain;
}

@media (prefers-reduced-motion: reduce) {
	.lmt-popup,
	.lmt-popup-backdrop,
	.lmt-popup-toggle {
		transition: none;
	}
}
