/*
 * Popup newsletter — styles desktop/mobile/accessibilité.
 *
 * Réutilise les variables de palette déjà définies globalement dans
 * color-palette.css (--zb-surface-*, --zb-text-*, --zb-accent*,
 * --zb-border-subtle) : ce fichier ne redéfinit aucune couleur, il
 * s'aligne sur l'identité déjà en place. Chargé uniquement sur les pages
 * autorisées (voir inc/newsletter-popup.php, enqueue conditionnel).
 */

.zb-nlp {
	position: fixed;
	inset: 0;
	/* Volontairement très élevé : le thème parent Blocksy utilise déjà des
	   z-index jusqu'à 9999999 par endroits (menu mobile, modales WooCommerce) —
	   100000 pouvait donc rester masqué derrière eux. */
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.zb-nlp[hidden] {
	display: none;
}

.zb-nlp__overlay {
	position: absolute;
	inset: 0;
	background: rgba(18, 21, 25, 0.5);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.zb-nlp.is-open .zb-nlp__overlay {
	opacity: 1;
}

.zb-nlp__dialog {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: 90vh;
	overflow-y: auto;
	background: var(--zb-surface-card, #fff);
	border: 1px solid var(--zb-border-subtle, #e6e0d3);
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(35, 38, 31, 0.22);
	padding: 40px 36px 32px;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.zb-nlp.is-open .zb-nlp__dialog {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.zb-nlp__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 999px;
	color: var(--zb-text-secondary, #5f6259);
	cursor: pointer;
}

.zb-nlp__close:hover {
	background: var(--zb-surface-alt, #f1ece3);
	color: var(--zb-text-heading, #23261f);
}

.zb-nlp__close:focus-visible {
	outline: 2px solid var(--zb-accent, #39a751);
	outline-offset: 2px;
}

.zb-nlp__title {
	margin: 0 32px 12px 0;
	font-size: 1.4rem;
	line-height: 1.3;
	color: var(--zb-text-heading, #23261f);
	text-wrap: balance;
}

.zb-nlp__text {
	margin: 0 0 22px;
	color: var(--zb-text-body, #40433c);
	line-height: 1.5;
}

.zb-nlp__form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.zb-nlp__row {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.zb-nlp__row input[type="email"] {
	flex: 1 1 220px;
	min-width: 0;
	min-height: 48px;
	padding: 0 14px;
	border: 1px solid var(--zb-border-subtle, #e6e0d3);
	border-radius: 10px;
	font-size: 0.95rem;
	color: var(--zb-text-heading, #23261f);
	background: #fff;
}

.zb-nlp__row input[type="email"]:focus-visible {
	outline: 2px solid var(--zb-accent, #39a751);
	outline-offset: 1px;
}

.zb-nlp__submit {
	flex: 0 0 auto;
	min-height: 48px;
	min-width: 44px;
	padding: 0 22px;
	background: var(--zb-accent, #39a751);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-weight: 600;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.zb-nlp__submit:hover {
	background: var(--zb-accent-bright, #277f42);
}

.zb-nlp__submit:focus-visible {
	outline: 2px solid var(--zb-accent-deep, #237a3d);
	outline-offset: 2px;
}

.zb-nlp__submit:disabled,
.zb-nlp__submit.is-loading {
	opacity: 0.7;
	cursor: default;
}

.zb-nlp__hp {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.zb-nlp__consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--zb-text-secondary, #5f6259);
}

.zb-nlp__consent input[type="checkbox"] {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 2px;
}

.zb-nlp__consent a {
	color: var(--zb-accent-deep, #237a3d);
}

.zb-nlp__consent a:hover {
	color: var(--zb-accent-bright, #277f42);
}

.zb-nlp__message {
	min-height: 1.2em;
	font-size: 0.88rem;
}

.zb-nlp__message.is-success {
	color: var(--zb-accent-deep, #237a3d);
}

.zb-nlp__message.is-error {
	color: #b3261e;
}

.zb-nlp__secondary {
	align-self: center;
	background: none;
	border: none;
	padding: 8px;
	min-height: 44px;
	color: var(--zb-text-secondary, #5f6259);
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}

.zb-nlp__secondary:hover {
	color: var(--zb-text-heading, #23261f);
}

.zb-nlp__secondary:focus-visible {
	outline: 2px solid var(--zb-accent, #39a751);
	outline-offset: 2px;
}

/* --- Mobile : carte "bottom-sheet", jamais plein écran --- */
@media (max-width: 640px) {
	.zb-nlp {
		align-items: flex-end;
		padding: 0;
	}

	.zb-nlp__dialog {
		max-width: none;
		width: 100%;
		max-height: 82vh;
		border-radius: 20px 20px 0 0;
		padding: 28px 20px calc(24px + env(safe-area-inset-bottom, 0px));
		transform: translateY(100%);
	}

	.zb-nlp.is-open .zb-nlp__dialog {
		transform: translateY(0);
	}

	.zb-nlp__title {
		font-size: 1.2rem;
	}

	.zb-nlp__row {
		flex-direction: column;
	}

	.zb-nlp__row input[type="email"],
	.zb-nlp__submit {
		width: 100%;
	}
}

/* --- Mouvement réduit : apparition directe, sans animation --- */
@media (prefers-reduced-motion: reduce) {
	.zb-nlp__overlay,
	.zb-nlp__dialog {
		transition: none;
	}

	.zb-nlp__dialog {
		transform: none;
	}

	.zb-nlp.is-open .zb-nlp__dialog {
		transform: none;
	}
}

@media (prefers-color-scheme: dark) {
	.zb-nlp__dialog {
		box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
	}
}
