/* ============================================================
   Discovery Design Boost — front-end popup styles
   --------------------------------------------------------------
   Three placements (modal / top banner / bottom banner) and two
   formats (image / text). Fonts and colours inherit from the host
   theme; padding, radius, gaps and animation are strict so that an
   opinionated theme can't mangle the layout.
   ============================================================ */

.dd-boost-popup[hidden] {
	display: none !important;
}

.dd-boost-popup {
	--dd-popup-pad-y: 16px;
	--dd-popup-pad-x: 20px;
	--dd-popup-radius: 8px;
	/* Colour tokens — overridable per popup via inline custom properties on
	   the wrapper. Defaults inherit from the surrounding theme so a popup
	   without explicit colour overrides blends in. */
	--dd-popup-bg: #fff;
	--dd-popup-fg: inherit;
	--dd-popup-accent: currentColor;
	--dd-popup-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	--dd-popup-banner-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	--dd-popup-divider: rgba(0, 0, 0, 0.08);

	position: fixed;
	z-index: 99999;

	font: inherit;
	color: var(--dd-popup-fg);
	box-sizing: border-box;
	-webkit-font-smoothing: inherit;
}

.dd-boost-popup *,
.dd-boost-popup *::before,
.dd-boost-popup *::after {
	box-sizing: border-box;
}

/* ---------- Modal: centred overlay with backdrop ---------- */

.dd-boost-popup--modal {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.dd-boost-popup--modal .dd-boost-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

.dd-boost-popup--modal .dd-boost-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	background: var(--dd-popup-bg);
	border-radius: var(--dd-popup-radius);
	box-shadow: var(--dd-popup-shadow);
	overflow: hidden;
	transform: translateY(8px);
	opacity: 0;
	transition: transform 200ms ease, opacity 200ms ease;
}

.dd-boost-popup--modal.dd-boost-popup--visible .dd-boost-popup__dialog {
	transform: translateY(0);
	opacity: 1;
}

/* ---------- Banners: full-width strip, no backdrop ---------- */

.dd-boost-popup--banner-top,
.dd-boost-popup--banner-bottom {
	left: 0;
	right: 0;
	background: var(--dd-popup-bg);
	border-color: var(--dd-popup-divider);
}

.dd-boost-popup--banner-top {
	top: 0;
	border-bottom: 1px solid var(--dd-popup-divider);
	box-shadow: var(--dd-popup-banner-shadow);
	transform: translateY(-100%);
	transition: transform 240ms ease;
}

.dd-boost-popup--banner-bottom {
	bottom: 0;
	border-top: 1px solid var(--dd-popup-divider);
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
	transform: translateY(100%);
	transition: transform 240ms ease;
}

.dd-boost-popup--banner-top.dd-boost-popup--visible,
.dd-boost-popup--banner-bottom.dd-boost-popup--visible {
	transform: translateY(0);
}

.dd-boost-popup--banner-top .dd-boost-popup__inner,
.dd-boost-popup--banner-bottom .dd-boost-popup__inner {
	position: relative;
	width: 100%;
	margin: 0 auto;
	padding: var(--dd-popup-pad-y) calc(var(--dd-popup-pad-x) + 32px) var(--dd-popup-pad-y) var(--dd-popup-pad-x);
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

/* ---------- Close button ----------
   Inline SVG inside a circular button. Stays neutral (transparent + soft
   hover) for banners and gets a slightly stronger surface when overlaid on
   modal content so it reads well against any image. */

.dd-boost-popup__close {
	position: absolute;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: inherit;
	padding: 0;
	margin: 0;
	font: inherit;
	transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.dd-boost-popup__close-icon {
	display: block;
	width: 14px;
	height: 14px;
	pointer-events: none;
	opacity: 0.75;
	transition: opacity 120ms ease;
}

.dd-boost-popup__close:hover .dd-boost-popup__close-icon {
	opacity: 1;
}

.dd-boost-popup__close:hover {
	background: rgba(0, 0, 0, 0.06);
}

.dd-boost-popup__close:focus-visible {
	outline: 2px solid var(--dd-popup-accent);
	outline-offset: 2px;
}

.dd-boost-popup__close:focus-visible .dd-boost-popup__close-icon {
	opacity: 1;
}

/* Modal: slightly larger hit target sits in the dialog corner. Background
   is intentionally semi-opaque white so the icon remains legible against
   any image content sitting underneath. */
.dd-boost-popup--modal .dd-boost-popup__close {
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.92);
	color: #1d1d1f;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	z-index: 1;
}

.dd-boost-popup--modal .dd-boost-popup__close:hover {
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* Banners: floats vertically centred on the right of the strip. */
.dd-boost-popup--banner-top .dd-boost-popup__close,
.dd-boost-popup--banner-bottom .dd-boost-popup__close {
	top: 50%;
	right: 8px;
	transform: translateY(-50%);
}

/* ---------- Image content ---------- */

.dd-boost-popup__link {
	display: block;
	line-height: 0;
}

.dd-boost-popup--modal.dd-boost-popup--image .dd-boost-popup__dialog {
	width: fit-content;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
}

.dd-boost-popup--modal .dd-boost-popup--image img,
.dd-boost-popup--modal img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
}

.dd-boost-popup--banner-top.dd-boost-popup--image img,
.dd-boost-popup--banner-bottom.dd-boost-popup--image img {
	display: block;
	max-height: 64px;
	width: auto;
	height: auto;
	border-radius: 4px;
}

/* ---------- Text content ----------
   Inherits font + colour from the theme, but enforces strict padding,
   spacing, and resets so opinionated theme styles don't break the layout. */

.dd-boost-popup__text {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 24px 28px;
	font: inherit;
	color: inherit;
}

.dd-boost-popup--banner-top .dd-boost-popup__text,
.dd-boost-popup--banner-bottom .dd-boost-popup__text {
	padding: 0;
	flex-direction: row;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	flex: 1 1 auto;
	min-width: 0;
}

.dd-boost-popup__content {
	min-width: 0;
	flex: 1 1 auto;
}

.dd-boost-popup__heading {
	margin: 0 0 4px;
	font: inherit;
	font-weight: 700;
	font-size: 1.0625em;
	line-height: 1.3;
	color: inherit;
}

.dd-boost-popup__body {
	font: inherit;
	font-size: 1em;
	line-height: 1.5;
	color: inherit;
}

.dd-boost-popup__body>* {
	margin-top: 0;
	font: inherit;
	color: inherit;
}

.dd-boost-popup__body>*:not(:last-child) {
	margin-bottom: 8px;
}

.dd-boost-popup__body p {
	margin: 0;
}

.dd-boost-popup__body p+p {
	margin-top: 8px;
}

.dd-boost-popup__body a {
	color: var(--dd-popup-accent);
	text-decoration: underline;
}

.dd-boost-popup__body ul,
.dd-boost-popup__body ol {
	margin: 0;
	padding-left: 1.25em;
}

.dd-boost-popup__body li+li {
	margin-top: 4px;
}

/* CTA — neutral pill that picks up the accent colour when set, otherwise
   falls back to currentColor so it keeps working in inherit-from-theme mode. */
.dd-boost-popup__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	padding: 8px 16px;
	border-radius: 6px;
	border: 1px solid var(--dd-popup-accent);
	background: transparent;
	color: var(--dd-popup-accent);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.2;
	white-space: nowrap;
	transition: background-color 120ms ease, color 120ms ease;
}

.dd-boost-popup__cta:hover {
	background: var(--dd-popup-accent);
	color: var(--dd-popup-bg);
}

.dd-boost-popup__cta:focus {
	outline: 2px solid var(--dd-popup-accent);
	outline-offset: 2px;
}

.dd-boost-popup--modal .dd-boost-popup__cta {
	align-self: flex-start;
}

/* Banners that mix an image with text content: keep alignment tidy. */
.dd-boost-popup--banner-top.dd-boost-popup--image .dd-boost-popup__inner,
.dd-boost-popup--banner-bottom.dd-boost-popup--image .dd-boost-popup__inner {
	justify-content: center;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {

	.dd-boost-popup--modal .dd-boost-popup__dialog,
	.dd-boost-popup--banner-top,
	.dd-boost-popup--banner-bottom {
		transition: none;
		transform: none;
	}
}

/* ---------- Small viewports ---------- */

@media (max-width: 600px) {
	.dd-boost-popup__text {
		padding: 20px 22px;
	}

	.dd-boost-popup--banner-top .dd-boost-popup__inner,
	.dd-boost-popup--banner-bottom .dd-boost-popup__inner {
		padding: 14px 44px 14px 16px;
		gap: 12px;
	}

	.dd-boost-popup--banner-top .dd-boost-popup__text,
	.dd-boost-popup--banner-bottom .dd-boost-popup__text {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	.dd-boost-popup--banner-top .dd-boost-popup__cta,
	.dd-boost-popup--banner-bottom .dd-boost-popup__cta {
		align-self: flex-start;
	}
}