/* ── Base offer box ──
   The default (resting) border is always visible. The animated glow border
   and the heartbeat pulse override it when their option is enabled. */
.elmur-offer {
	position: relative;
	padding: 1.5rem;
	margin: 1.5rem 0;
	border-radius: var(--radius-lg, 16px);
	background: var(--color-bg-alt, #1a1a1a);
	border: 2px solid var(--elmur-offer-color);
	overflow: hidden;
}

.elmur-offer__title {
	margin: 0 0 0.75rem;
	font-size: 1.25rem;
	color: var(--elmur-offer-color);
}

.elmur-offer__content p:last-child {
	margin-bottom: 0;
}

/* ── Animated glow border ── */
@keyframes elmur-glow-rotate {
	0%   { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.elmur-offer--glow {
	border-color: transparent;
}

.elmur-offer--glow::before {
	content: '';
	position: absolute;
	inset: -3px;
	border-radius: inherit;
	background: conic-gradient(
		from 0deg,
		transparent 0%,
		var(--elmur-offer-color) 20%,
		color-mix(in srgb, var(--elmur-offer-color) 55%, var(--elmur-offer-on)) 40%,
		var(--elmur-offer-color) 60%,
		transparent 80%
	);
	animation: elmur-glow-rotate 3s linear infinite;
	z-index: 0;
}

.elmur-offer--glow::after {
	content: '';
	position: absolute;
	inset: 2px;
	border-radius: calc(var(--radius-lg, 16px) - 2px);
	background: var(--color-bg-alt, #1a1a1a);
	z-index: 1;
}

.elmur-offer--glow > * {
	position: relative;
	z-index: 2;
}

/* ── Countdown timer ── */
.elmur-offer__countdown {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin-top: 1rem;
	/* Never wrap: the units shrink to fit instead of dropping to a new row. */
	flex-wrap: nowrap;
}

.elmur-offer__countdown-unit {
	display: flex;
	flex-direction: column;
	align-items: center;
	/* Flexible + shrinkable so all four units always stay on one line. */
	flex: 1 1 auto;
	min-width: 0;
	max-width: 4rem;
	background: var(--color-bg, #111);
	border: 1px solid var(--color-border, #333);
	border-radius: var(--radius-sm, 8px);
	padding: 0.4rem 0.5rem;
}

.elmur-offer__countdown-value {
	font-size: clamp(1.05rem, 4.5vw, 1.5rem);
	font-weight: 700;
	line-height: 1;
	color: var(--elmur-offer-color);
	font-variant-numeric: tabular-nums;
}

.elmur-offer__countdown-label {
	font-size: clamp(0.5rem, 1.7vw, 0.6rem);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	white-space: nowrap;
	color: var(--color-text-muted, #888);
	margin-top: 0.2rem;
}

.elmur-offer__countdown-sep {
	font-size: clamp(1rem, 3.5vw, 1.4rem);
	font-weight: 700;
	color: var(--color-text-muted, #888);
	line-height: 1;
	padding-bottom: 0.8rem;
}

/* ── CTA button ── */
.elmur-offer__cta {
	display: inline-block;
	margin-top: 1.25rem;
	padding: 0.65rem 1.5rem;
	border-radius: var(--radius-sm, 8px);
	background: var(--elmur-offer-cta-color, var(--elmur-offer-color));
	color: var(--elmur-offer-on);
	font-weight: 700;
	font-size: 0.95rem;
	text-decoration: none;
	letter-spacing: 0.03em;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 0 0 0 var(--elmur-offer-cta-color, var(--elmur-offer-color));
}

.elmur-offer__cta:hover,
.elmur-offer__cta:focus {
	background: var(--elmur-offer-cta-color, var(--elmur-offer-color-hover));
	transform: translateY(-2px);
	box-shadow: 0 6px 20px color-mix(in srgb, var(--elmur-offer-cta-color, var(--elmur-offer-color)) 45%, transparent);
	color: var(--elmur-offer-on);
	text-decoration: none;
}

.elmur-offer__cta:active {
	transform: translateY(0);
}

/* ── Footnote (legal small print) ── */
.elmur-offer__legal {
	margin: 0.75rem 0 0;
	font-size: 0.72rem;
	line-height: 1.4;
	color: var(--color-text-muted, #888);
}

.elmur-offer__legal a {
	color: inherit;
	text-decoration: underline;
}

/* ── Pulsing heartbeat border (offer-color halo, double-beat then rest) ── */
@keyframes elmur-offer-heartbeat {
	0%, 45%, 100% { box-shadow: 0 0 0 0 transparent; }
	10%           { box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--elmur-offer-color) 38%, transparent); }
	20%           { box-shadow: 0 0 0 0 transparent; }
	30%           { box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--elmur-offer-color) 38%, transparent); }
}

.elmur-offer--pulse {
	border-color: var(--elmur-offer-color);
	animation: elmur-offer-heartbeat 1.6s ease-in-out infinite;
}

/* ── CTA "click me" wiggle: rests, then a short nudge ── */
@keyframes elmur-offer-cta-wiggle {
	0%, 85%, 100% { transform: rotate(0deg); }
	88%           { transform: rotate(-3deg); }
	91%           { transform: rotate(3deg); }
	94%           { transform: rotate(-3deg); }
	97%           { transform: rotate(2deg); }
}

.elmur-offer--cta-wiggle .elmur-offer__cta {
	transform-origin: center;
	animation: elmur-offer-cta-wiggle 4.5s ease-in-out infinite;
}

/* Pause the wiggle on interaction so the hover lift stays clean */
.elmur-offer--cta-wiggle .elmur-offer__cta:hover,
.elmur-offer--cta-wiggle .elmur-offer__cta:focus {
	animation: none;
}

/* ── Corner ribbon ── */
.elmur-offer__ribbon {
	position: absolute;
	top: 1.425rem;
	right: -1.75rem;
	width: 8rem;
	transform: rotate(45deg);
	transform-origin: center;
	background: var(--elmur-ribbon-color, var(--elmur-offer-color));
	color: var(--elmur-offer-on);
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	text-align: center;
	padding: 0.26rem 0;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	z-index: 3;
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}


/* ── Entrance animation (fade / slide in) ── */
.elmur-offer--entrance.is-entrance-pending {
	opacity: 0;
	transform: translateY(1.25rem);
}

.elmur-offer--entrance.is-entrance-in {
	opacity: 1;
	transform: none;
	transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ── Respect reduced-motion preferences ── */
@media (prefers-reduced-motion: reduce) {
	.elmur-offer--glow::before,
	.elmur-offer--pulse,
	.elmur-offer--cta-wiggle .elmur-offer__cta {
		animation: none;
	}

	.elmur-offer--pulse {
		box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--elmur-offer-color) 25%, transparent);
	}

	/* Entrance stays visible without motion */
	.elmur-offer--entrance.is-entrance-pending {
		opacity: 1;
		transform: none;
	}
}

/* ── Mobile: center the countdown and the button; title/text stay left ── */
@media (max-width: 37.5em) {
	.elmur-offer__countdown {
		justify-content: center;
	}

	.elmur-offer__cta {
		display: block;
		width: fit-content;
		margin-left: auto;
		margin-right: auto;
	}
}
