/**
 * WehfiGO Newsletter — footer form states, homepage section, popup.
 * Version 1.1.0 (WEHFIGO_NEWSLETTER_VERSION). Tokens only, both themes.
 */

/* =========================================================
   Shared form (footer / homepage / popup)
   ========================================================= */

.wehfigo-newsletter-form {
	/* display:block beats the legacy .wehfigo-footer__newsletter-form
	   flex rule (same specificity, this sheet loads later) so the row,
	   honeypot and status line stack correctly in the footer slot. */
	display: block;
	font-family: var(--font-family-body);
}

.wehfigo-newsletter-form__row {
	display: flex;
	gap: var(--space-2);
}

/* display:flex above would beat the UA [hidden] rule — restate it
   (JS hides the row after a successful signup). */
.wehfigo-newsletter-form__row[hidden] {
	display: none;
}

.wehfigo-newsletter-form__row input[type="email"] {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 44px;
	margin: 0;
	padding: var(--space-2) var(--space-4);
	background: var(--color-page-bg);
	border: 1px solid var(--color-page-border);
	border-radius: var(--radius-md);
	color: var(--color-page-heading);
	font-family: var(--font-family-body);
	font-size: var(--text-label);
	box-shadow: none;
	transition: border-color var(--duration-fast) var(--ease-standard),
		box-shadow var(--duration-fast) var(--ease-standard);
}

.wehfigo-newsletter-form__row input[type="email"]::placeholder {
	color: var(--color-page-muted);
}

.wehfigo-newsletter-form__row input[type="email"]:focus {
	outline: none;
	border-color: var(--color-primary);
	box-shadow: var(--shadow-focus);
}

.wehfigo-newsletter-form__row button {
	flex-shrink: 0;
	min-height: 44px;
	margin: 0;
	padding: var(--space-2) var(--space-5);
	background: var(--color-primary);
	border: 0;
	border-radius: var(--radius-md);
	color: var(--color-brand-white);
	font-family: var(--font-family-brand);
	font-size: var(--text-label);
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard);
}

.wehfigo-newsletter-form__row button:hover {
	background: var(--color-primary-hover);
	color: var(--color-brand-white);
}

.wehfigo-newsletter-form__row button:focus-visible {
	outline: none;
	box-shadow: var(--shadow-focus);
}

.wehfigo-newsletter-form.is-sending .wehfigo-newsletter-form__row button {
	opacity: 0.7;
	cursor: wait;
}

/* Honeypot: removed from layout and pointer flow, still in the DOM. */
.wehfigo-newsletter-form__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Inline status banner: must stay readable in light + dark. */
.wehfigo-newsletter-form__msg {
	margin: var(--space-3) 0 0;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
	border: 1px solid var(--color-page-border);
	background: var(--color-page-bg-alt);
	font-size: var(--text-label);
	line-height: 1.5;
	font-weight: 600;
	color: var(--color-page-heading);
}

.wehfigo-newsletter-form__msg[hidden] {
	display: none !important;
}

.wehfigo-newsletter-form__msg.is-success {
	color: var(--color-page-heading);
	border-color: rgba(214, 0, 28, 0.35);
	background: var(--color-chip-tint, rgba(214, 0, 28, 0.08));
}

.wehfigo-newsletter-form__msg.is-error {
	color: var(--color-page-heading);
	border-color: rgba(214, 0, 28, 0.55);
	background: rgba(214, 0, 28, 0.12);
}

html[data-theme="dark"] .wehfigo-newsletter-form__msg,
html[data-theme="dark"] .wehfigo-newsletter-form__msg.is-success,
html[data-theme="dark"] .wehfigo-newsletter-form__msg.is-error {
	color: #f3f4f6;
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .wehfigo-newsletter-form__msg.is-success {
	border-color: rgba(255, 120, 130, 0.45);
	background: rgba(214, 0, 28, 0.22);
}

html[data-theme="dark"] .wehfigo-newsletter-form__msg.is-error {
	border-color: rgba(255, 120, 130, 0.65);
	background: rgba(214, 0, 28, 0.28);
}

/* Success swap: the row hides (JS), the message carries the state. */
.wehfigo-newsletter-form.is-success .wehfigo-newsletter-form__msg.is-success::before {
	content: "\2713\0020";
}

@media (max-width: 480px) {
	.wehfigo-newsletter-form__row {
		flex-direction: column;
	}
}

/* =========================================================
   Homepage section — one centered token panel
   ========================================================= */

.wehfigo-newsletter__panel {
	max-width: 660px;
	margin-inline: auto;
	padding: var(--space-7) var(--space-5);
	background:
		linear-gradient(160deg, var(--color-chip-tint), transparent 55%),
		var(--color-page-bg-alt);
	border: 1px solid var(--color-page-border);
	border-radius: var(--radius-xl);
	text-align: center;
}

@media (min-width: 768px) {
	.wehfigo-newsletter__panel {
		padding: var(--space-8) var(--space-9);
	}
}

.wehfigo-newsletter__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin-bottom: var(--space-4);
	background: var(--color-brand-red-muted);
	border-radius: var(--radius-pill);
	color: var(--color-chip-ink);
}

.wehfigo-newsletter__icon .wehfigo-icon svg {
	width: var(--icon-lg);
	height: var(--icon-lg);
}

.wehfigo-newsletter__heading {
	margin: 0 0 var(--space-3);
	font-family: var(--font-family-brand);
	font-size: var(--text-h2);
	font-weight: 700;
	line-height: 1.2;
	color: var(--color-page-heading);
}

.wehfigo-newsletter__subline {
	max-width: 46ch;
	margin: 0 auto var(--space-5);
	font-size: var(--text-label);
	line-height: 1.6;
	color: var(--color-page-muted);
}

.wehfigo-newsletter-form--panel {
	max-width: 460px;
	margin-inline: auto;
}

/* =========================================================
   Popup — small token-styled modal
   ========================================================= */

.wehfigo-newsletter-popup {
	position: fixed;
	inset: 0;
	z-index: var(--z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-5);
}

/* display:flex above would beat the UA [hidden] rule — restate it. */
.wehfigo-newsletter-popup[hidden] {
	display: none;
}

.wehfigo-newsletter-popup__backdrop {
	position: absolute;
	inset: 0;
	background: var(--color-overlay);
	opacity: 0;
	transition: opacity var(--duration-base) var(--ease-standard);
}

.wehfigo-newsletter-popup__dialog {
	position: relative;
	width: min(420px, 100%);
	max-height: calc(100vh - var(--space-8));
	overflow-y: auto;
	padding: var(--space-7) var(--space-6) var(--space-6);
	background: var(--color-page-bg);
	border: 1px solid var(--color-page-border);
	border-radius: var(--radius-xl);
	box-shadow: var(--shadow-lg);
	text-align: center;
	opacity: 0;
	transform: translateY(var(--reveal-distance)) scale(0.98);
	transition: opacity var(--duration-slow) var(--ease-emphasized),
		transform var(--duration-slow) var(--ease-emphasized);
}

.wehfigo-newsletter-popup__dialog:focus {
	outline: none;
}

.wehfigo-newsletter-popup.is-open .wehfigo-newsletter-popup__backdrop {
	opacity: 1;
}

.wehfigo-newsletter-popup.is-open .wehfigo-newsletter-popup__dialog {
	opacity: 1;
	transform: none;
}

/* Reduced motion: no entrance choreography, just appear. */
.wehfigo-newsletter-popup.is-reduced .wehfigo-newsletter-popup__backdrop,
.wehfigo-newsletter-popup.is-reduced .wehfigo-newsletter-popup__dialog {
	transition: none;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.wehfigo-newsletter-popup__backdrop,
	.wehfigo-newsletter-popup__dialog {
		transition: none !important;
		transform: none !important;
	}
}

.wehfigo-newsletter-popup__close {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: var(--radius-pill);
	color: var(--color-page-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background var(--duration-fast) var(--ease-standard),
		color var(--duration-fast) var(--ease-standard);
}

.wehfigo-newsletter-popup__close:hover {
	background: var(--color-page-bg-alt);
	color: var(--color-page-heading);
}

.wehfigo-newsletter-popup__close:focus-visible {
	outline: none;
	box-shadow: var(--shadow-focus);
}

.wehfigo-newsletter-popup__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-bottom: var(--space-3);
	background: var(--color-brand-red-muted);
	border-radius: var(--radius-pill);
	color: var(--color-chip-ink);
}

/* px-scale tokens: Listeo's 10px root shrinks rem tokens to 5/8,
   so --text-h2 would render ~13.75px here. */
.wehfigo-newsletter-popup__heading {
	margin: 0 0 var(--space-2);
	font-family: var(--font-family-brand);
	font-size: var(--text-card-title-lg);
	font-weight: 700;
	line-height: 1.2;
	color: var(--color-page-heading);
}

.wehfigo-newsletter-popup__text {
	margin: 0 0 var(--space-4);
	font-size: var(--text-label);
	line-height: 1.6;
	color: var(--color-page-muted);
}

/* Small modal: input stacks over the button for a calm layout. */
.wehfigo-newsletter-form--popup .wehfigo-newsletter-form__row {
	flex-direction: column;
}

/* Scroll lock while the popup is open. */
body.wehfigo-popup-open {
	overflow: hidden;
}

/* =========================================================
   Footer slot polish — the shared form inherits the old
   .wehfigo-footer__newsletter-form look via its own classes;
   just keep spacing tight inside the footer column.
   ========================================================= */

.wehfigo-footer__newsletter .wehfigo-newsletter-form__msg {
	margin-top: var(--space-2);
}

@media (max-width: 767px) {
	.wehfigo-footer__newsletter .wehfigo-newsletter-form__row {
		flex-direction: column;
	}
}

/* =========================================================
   Slow heartbeat on newsletter boxes (panel + popup dialog)
   Stops after first click / focus (.is-still). Very subtle scale.
   ========================================================= */

@keyframes wehfigo-nl-heartbeat {
	0%,
	100% {
		transform: scale(1);
	}
	12% {
		transform: scale(1.012);
	}
	24% {
		transform: scale(1);
	}
	36% {
		transform: scale(1.008);
	}
	55%,
	100% {
		transform: scale(1);
	}
}

.wehfigo-newsletter__panel.wehfigo-heartbeat:not(.is-still) {
	transform-origin: center center;
	animation: wehfigo-nl-heartbeat 2.8s ease-in-out infinite;
	will-change: transform;
}

.wehfigo-newsletter-popup.is-open .wehfigo-newsletter-popup__dialog.wehfigo-heartbeat:not(.is-still) {
	transform-origin: center center;
	animation: wehfigo-nl-heartbeat 2.8s ease-in-out infinite;
	will-change: transform;
}

.wehfigo-newsletter__panel.wehfigo-heartbeat.is-still,
.wehfigo-newsletter-popup__dialog.wehfigo-heartbeat.is-still {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.wehfigo-newsletter__panel.wehfigo-heartbeat,
	.wehfigo-newsletter-popup__dialog.wehfigo-heartbeat {
		animation: none !important;
	}
}

