/* CWA Popup Infolettre */
.cwa-pi[hidden] { display: none !important; }

.cwa-pi {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	opacity: 0;
	transition: opacity .5s ease;
}
.cwa-pi.is-open { opacity: 1; }
@media (max-width: 782px) {
	html.cwa-pi-lock { overflow: hidden; }
}
.cwa-pi *, .cwa-pi *::before, .cwa-pi *::after { box-sizing: border-box; }

.cwa-pi__overlay {
	position: absolute;
	inset: 0;
	background: var(--cwa-pi-overlay, #41577e);
	opacity: .78;
}

.cwa-pi__dialog {
	position: relative;
	width: 100%;
	max-width: 460px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: var(--cwa-pi-bg, #fff);
	color: var(--cwa-pi-text, #5b4d47);
	font-family: var(--cwa-pi-font-text, inherit);
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
	opacity: 0;
	transform: translateY(28px) scale(.96);
	transition: transform .55s cubic-bezier(.22, 1, .36, 1), opacity .45s ease;
}
.cwa-pi.is-open .cwa-pi__dialog { opacity: 1; transform: none; }

.cwa-pi .cwa-pi__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--cwa-pi-btn-bg, #41577e);
	color: var(--cwa-pi-btn-text, #fff);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 30px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
	transition: background .25s ease, transform .25s ease;
}
/* Le X est dessiné en CSS (deux traits fins) : toujours centré, peu importe la police du thème. */
.cwa-pi .cwa-pi__close span { display: none; }
.cwa-pi .cwa-pi__close::before,
.cwa-pi .cwa-pi__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 1.5px;
	border-radius: 1px;
	background: currentColor;
}
.cwa-pi .cwa-pi__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.cwa-pi .cwa-pi__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cwa-pi .cwa-pi__close:hover,
.cwa-pi .cwa-pi__close:focus-visible {
	background: var(--cwa-pi-title, #a2844a);
	color: var(--cwa-pi-btn-text, #fff);
	transform: scale(1.08);
}

.cwa-pi__image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 220px;
	object-fit: cover;
	border-radius: 14px 14px 0 0;
}

.cwa-pi__body {
	padding: clamp(34px, 8vw, 40px) clamp(20px, 6vw, 32px) clamp(20px, 5vw, 28px);
	text-align: center;
}

.cwa-pi__title {
	margin: 0 0 12px;
	padding: 0;
	color: var(--cwa-pi-title, #a2844a);
	font-family: var(--cwa-pi-font-title, inherit);
	font-size: clamp(20px, 5.4vw, 26px);
	font-weight: 500;
	line-height: 1.25;
	overflow-wrap: break-word;
}

.cwa-pi__text { margin: 0 0 22px; font-family: inherit; font-size: 17px; line-height: 1.55; }
.cwa-pi__text p, .cwa-pi__message, .cwa-pi__consent, .cwa-pi__consent a { font-family: inherit; color: inherit; }
.cwa-pi__text p { margin: 0 0 10px; padding: 0; }
.cwa-pi__text p:last-child { margin-bottom: 0; }

.cwa-pi__form {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}
/* Prénom et nom côte à côte quand il y a la place; les autres champs prennent toute la largeur. */
.cwa-pi__form .cwa-pi__input,
.cwa-pi__form .cwa-pi__button { flex: 1 1 100%; }
.cwa-pi__form .cwa-pi__input--name { flex: 1 1 140px; min-width: 0; }

.cwa-pi__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.cwa-pi .cwa-pi__input,
.cwa-pi-inline .cwa-pi__input {
	width: 100%;
	height: 50px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid rgba(0, 0, 0, .25);
	border-radius: 35px;
	background: #fff;
	color: var(--cwa-pi-text, #5b4d47);
	font-family: var(--cwa-pi-font-text, inherit);
	font-size: 16px; /* 16px min. : évite le zoom automatique sur iOS */
	text-align: center;
}
.cwa-pi .cwa-pi__input:focus,
.cwa-pi-inline .cwa-pi__input:focus {
	outline: 2px solid var(--cwa-pi-btn-bg, #41577e);
	outline-offset: 1px;
}
.cwa-pi .cwa-pi__input.is-invalid,
.cwa-pi-inline .cwa-pi__input.is-invalid { border-color: #c0392b; }

.cwa-pi .cwa-pi__button,
.cwa-pi-inline .cwa-pi__button {
	width: 100%;
	min-height: 50px;
	margin: 0;
	padding: 12px 20px;
	border: 0;
	border-radius: 35px;
	background: var(--cwa-pi-btn-bg, #41577e);
	color: var(--cwa-pi-btn-text, #fff);
	font-family: var(--cwa-pi-font-text, inherit);
	font-size: 17px;
	font-weight: 400;
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.2;
	cursor: pointer;
	transition: filter .2s ease;
}
.cwa-pi .cwa-pi__button:hover,
.cwa-pi-inline .cwa-pi__button:hover,
.cwa-pi .cwa-pi__button:focus-visible,
.cwa-pi-inline .cwa-pi__button:focus-visible { filter: brightness(1.12); }
.cwa-pi .cwa-pi__button[disabled],
.cwa-pi-inline .cwa-pi__button[disabled] { opacity: .6; cursor: wait; }

.cwa-pi__message {
	margin: 14px 0 0;
	padding: 0;
	font-size: 15px;
	line-height: 1.5;
}
.cwa-pi__message.is-error { color: #c0392b; }
.cwa-pi__message.is-success { font-size: 17px; font-weight: 600; }

.cwa-pi__consent {
	margin: 16px 0 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.5;
	opacity: .75;
}
.cwa-pi__consent a { color: inherit; text-decoration: underline; }

.cwa-pi-launcher[hidden] { display: none !important; }
.cwa-pi-launcher {
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	width: var(--cwa-pi-launcher-size, 84px);
	height: var(--cwa-pi-launcher-size, 84px);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--cwa-pi-title, #a2844a);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	animation: cwa-pi-fade .7s ease both;
}
.cwa-pi-launcher--left { left: 20px; }
.cwa-pi-launcher--right { right: 20px; }
.cwa-pi-launcher:focus-visible { outline: 2px solid var(--cwa-pi-btn-bg, #41577e); outline-offset: 4px; }

.cwa-pi-launcher__art {
	display: block;
	width: 100%;
	height: 100%;
	transition: transform .25s ease;
}
.cwa-pi-launcher__art img,
.cwa-pi-launcher__art svg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.cwa-pi-launcher:hover .cwa-pi-launcher__art,
.cwa-pi-launcher:focus-visible .cwa-pi-launcher__art { transform: scale(1.1) rotate(-4deg); }

/* Animation « flotte » (aussi utilisée par « magique ») */
.cwa-pi-launcher--float,
.cwa-pi-launcher--magic { animation: cwa-pi-fade .7s ease both, cwa-pi-float 3.6s ease-in-out infinite; }

/* Animation « magique » : lueur dorée + étoiles scintillantes */
.cwa-pi-launcher--magic .cwa-pi-launcher__art { animation: cwa-pi-glow 2.8s ease-in-out infinite; }

.cwa-pi-launcher__spark {
	position: absolute;
	width: 14px;
	height: 14px;
	background: var(--cwa-pi-title, #a2844a);
	clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
	opacity: 0;
	pointer-events: none;
	animation: cwa-pi-twinkle 2.4s ease-in-out infinite;
}
.cwa-pi-launcher__spark--1 { top: -6px; left: 8%; }
.cwa-pi-launcher__spark--2 { top: 12%; right: -8px; width: 10px; height: 10px; animation-delay: .8s; }
.cwa-pi-launcher__spark--3 { bottom: 4%; left: -8px; width: 8px; height: 8px; animation-delay: 1.6s; }

/* Pastille ronde : l'image se lit comme un bouton */
.cwa-pi-launcher--circle {
	background: var(--cwa-pi-bg, #fff);
	border: 2px solid var(--cwa-pi-title, #a2844a);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.cwa-pi-launcher--circle .cwa-pi-launcher__art {
	box-sizing: border-box;
	padding: 16%;
}
.cwa-pi-launcher--circle:hover,
.cwa-pi-launcher--circle:focus-visible { border-color: var(--cwa-pi-btn-bg, #41577e); }
.cwa-pi-launcher--circle.cwa-pi-launcher--magic .cwa-pi-launcher__art { animation: none; }

@keyframes cwa-pi-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes cwa-pi-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}
@keyframes cwa-pi-glow {
	0%, 100% { filter: drop-shadow(0 0 2px rgba(195, 166, 111, .35)); }
	50% { filter: drop-shadow(0 0 12px rgba(195, 166, 111, .95)); }
}
@keyframes cwa-pi-twinkle {
	0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
	50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

@media (max-width: 480px) {
	.cwa-pi { padding: 14px; }
	.cwa-pi__dialog { max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); }
	.cwa-pi__image { max-height: 160px; }
	.cwa-pi__text { font-size: 15px; margin-bottom: 18px; }
	.cwa-pi-launcher {
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		width: calc(var(--cwa-pi-launcher-size, 84px) * .8);
		height: calc(var(--cwa-pi-launcher-size, 84px) * .8);
	}
	.cwa-pi-launcher--left { left: 12px; }
	.cwa-pi-launcher--right { right: 12px; }
}

/* Formulaire intégré : [cwa_infolettre] */
.cwa-pi-inline {
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	margin: 0 auto;
	color: var(--cwa-pi-text, #5b4d47);
	font-family: var(--cwa-pi-font-text, inherit);
	text-align: center;
}
.cwa-pi-inline *, .cwa-pi-inline *::before, .cwa-pi-inline *::after { box-sizing: border-box; }
.cwa-pi-inline--left { margin-left: 0; text-align: left; }
.cwa-pi-inline__title {
	margin: 0 0 8px;
	padding: 0;
	color: var(--cwa-pi-title, #a2844a);
	font-family: var(--cwa-pi-font-title, inherit);
	font-size: clamp(18px, 4.6vw, 22px);
	line-height: 1.3;
}
.cwa-pi-inline__text { margin: 0 0 16px; padding: 0; font-size: 16px; line-height: 1.55; }
.cwa-pi-inline__form {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}
.cwa-pi-inline .cwa-pi__input { flex: 1 1 220px; width: auto; min-width: 0; }
.cwa-pi-inline .cwa-pi__input--name { flex: 1 1 150px; }
.cwa-pi-inline .cwa-pi__input--date { flex: 1 1 260px; }
.cwa-pi-inline .cwa-pi__button { flex: 0 0 auto; width: auto; padding-left: 28px; padding-right: 28px; white-space: nowrap; }
@media (max-width: 480px) {
	.cwa-pi-inline .cwa-pi__button { flex: 1 1 100%; }
}

/* X qui dépasse du coin en haut à droite */
.cwa-pi {
	overflow-y: auto;
}
.cwa-pi .cwa-pi__overlay {
	position: fixed;
}
.cwa-pi .cwa-pi__dialog {
	overflow: visible;
	max-height: none;
	margin: auto;
}
.cwa-pi .cwa-pi__close {
	top: -14px;
	right: -14px;
}
@media (max-width: 480px) {
	.cwa-pi .cwa-pi__close {
		top: -10px;
		right: -10px;
	}
}

/* Écrans peu hauts (téléphone à l'horizontale) : on retire l'image pour garder le formulaire visible */
@media (max-height: 520px) {
	.cwa-pi__image { display: none; }
	.cwa-pi__body { padding: 30px 22px 16px; }
	.cwa-pi__text { margin-bottom: 14px; }
	.cwa-pi__consent { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.cwa-pi, .cwa-pi__dialog { transition: none; }
	.cwa-pi__dialog { transform: none; }
	.cwa-pi-launcher, .cwa-pi-launcher__art, .cwa-pi-launcher__spark { animation: none; }
	.cwa-pi-launcher__spark { opacity: .8; }
}
