/*
 * F4MPL – Carnet de station : newsletter (extension F4MPL Newsletter).
 * 1. Le formulaire, écrit au crayon, partout où il apparaît dans le carnet.
 * 2. La fenêtre d'inscription mise en scène en lettre par avion (voir lettre.js).
 */

/* ------------------------------------------------------------------ */
/* 1. Le formulaire au crayon                                          */
/* ------------------------------------------------------------------ */

.carnet .f4mpl-nl-form,
.lettre-feuille .f4mpl-nl-form {
	--f4mpl-nl-text: var(--carnet-mine, #3E3F44);
	--f4mpl-nl-gap: 14px;
	max-width: 460px;
	padding: 0 !important;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--carnet-mine, #3E3F44);
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: 23px;
	line-height: 1.2;
}

.carnet .f4mpl-nl-heading,
.lettre-feuille .f4mpl-nl-heading {
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: 36px !important;
	font-weight: 700;
	line-height: 1.05;
	color: var(--carnet-mine, #3E3F44) !important;
	margin: 0 0 6px !important;
}

.carnet .f4mpl-nl-subtext,
.lettre-feuille .f4mpl-nl-subtext {
	font-size: 22px !important;
	color: #5E5F64 !important;
	opacity: 1;
	margin: 0 0 18px !important;
}

.carnet .f4mpl-nl-form label,
.lettre-feuille .f4mpl-nl-form label {
	font-weight: 400;
	font-size: 19px;
	color: #6E6A60;
	margin: 0 !important;
}

.carnet .f4mpl-nl-form input[type="email"],
.carnet .f4mpl-nl-form input[type="text"],
.lettre-feuille .f4mpl-nl-form input[type="email"],
.lettre-feuille .f4mpl-nl-form input[type="text"] {
	padding: 2px 2px 4px !important;
	margin: 0 0 16px !important;
	border: 0;
	border-bottom: 1.5px dashed rgba(62, 63, 68, 0.55);
	border-radius: 0;
	background: transparent;
	color: var(--wp--preset--color--crayon-bleu, #33599A);
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: 26px;
	line-height: 1.2;
	box-shadow: none;
	outline: 0;
}

.carnet .f4mpl-nl-form input::placeholder,
.lettre-feuille .f4mpl-nl-form input::placeholder {
	color: rgba(62, 63, 68, 0.32);
}

.carnet .f4mpl-nl-form input[type="email"]:focus,
.carnet .f4mpl-nl-form input[type="text"]:focus,
.lettre-feuille .f4mpl-nl-form input[type="email"]:focus,
.lettre-feuille .f4mpl-nl-form input[type="text"]:focus {
	border-bottom: 2px solid var(--wp--preset--color--crayon-bleu, #33599A);
}

.carnet .f4mpl-nl-consent,
.lettre-feuille .f4mpl-nl-consent {
	font-size: 18px !important;
	line-height: 1.15;
	color: #5E5F64 !important;
	margin: 0 0 16px !important;
	cursor: pointer;
}

.carnet .f4mpl-nl-consent input[type="checkbox"],
.lettre-feuille .f4mpl-nl-consent input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	width: 20px !important;
	height: 20px;
	margin: 0.05em 0 0 !important;
	border: 1.6px solid var(--carnet-mine, #3E3F44);
	border-radius: 3px 5px 3px 4px;
	background: transparent no-repeat center / 22px;
	cursor: pointer;
	transform: rotate(-3deg);
}

.carnet .f4mpl-nl-consent input[type="checkbox"]:checked,
.lettre-feuille .f4mpl-nl-consent input[type="checkbox"]:checked {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 13 Q7 15 9.5 20 Q14 8 23 1' fill='none' stroke='%23B3261E' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.carnet .f4mpl-nl-form button,
.lettre-feuille .f4mpl-nl-form button:not(.f4mpl-nl-popup-close) {
	padding: 6px 22px 8px !important;
	border: 2px solid var(--carnet-mine, #3E3F44);
	border-radius: 14px 10px 13px 9px;
	background: transparent;
	color: var(--carnet-mine, #3E3F44);
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.1;
	transform: rotate(-1deg);
	transition: color .15s, border-color .15s;
}

.carnet .f4mpl-nl-form button:hover,
.lettre-feuille .f4mpl-nl-form button:not(.f4mpl-nl-popup-close):hover {
	background: transparent;
	color: var(--wp--preset--color--rouge, #B3261E);
	border-color: var(--wp--preset--color--rouge, #B3261E);
}

.carnet .f4mpl-nl-form button:disabled,
.lettre-feuille .f4mpl-nl-form button:disabled {
	opacity: .55;
}

.carnet .f4mpl-nl-hint,
.lettre-feuille .f4mpl-nl-hint {
	font-size: 18px;
	color: #6E6A60;
	opacity: 1;
	margin: 14px 0 0 !important;
}

.carnet .f4mpl-nl-message,
.lettre-feuille .f4mpl-nl-message {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.15;
	color: var(--wp--preset--color--crayon-bleu, #33599A);
	margin: 14px 0 0 !important;
}

/* Dans les pages : une enveloppe « par avion », pour ne pas la confondre
   avec l'encadré « Retrouve ta carte QSL ». Étiquettes cachées (lues par
   les lecteurs d'écran), prénom et e-mail sur une ligne.
   « display: contents » neutralise les paragraphes que WordPress ajoute
   parfois autour des champs. */
.carnet form.f4mpl-nl-form.f4mpl-nl-form {
	--lettre-papier: #F4EEDD;
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
	column-gap: 14px;
	align-items: end;
	box-sizing: border-box;
	max-width: 560px;
	margin: 6px 0 0 !important;
	padding: 16px 18px 16px !important;
	border: 7px solid transparent;
	border-radius: 4px;
	background:
		linear-gradient(var(--lettre-papier), var(--lettre-papier)) padding-box,
		repeating-linear-gradient(-45deg, #B3261E 0 9px, var(--lettre-papier) 9px 13px, #24408E 13px 22px, var(--lettre-papier) 22px 26px) border-box;
	box-shadow: 0 1px 1px rgba(60, 40, 15, 0.18), 0 6px 14px -6px rgba(60, 40, 15, 0.35);
	transform: rotate(-0.6deg);
	text-align: left;
	color: var(--wp--preset--color--encre-bleue, #24408E);
}

/* Timbre et oblitération */
.carnet form.f4mpl-nl-form.f4mpl-nl-form::before,
.carnet form.f4mpl-nl-form.f4mpl-nl-form::after {
	content: "";
	position: absolute;
	pointer-events: none;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form::before {
	top: 8px;
	right: 10px;
	width: 46px;
	height: 55px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 64 76'%3E%3Cdefs%3E%3Cmask id='d'%3E%3Crect x='-4' y='-4' width='64' height='76' fill='white'/%3E%3Cg fill='black'%3E%3Ccircle cx='-1.0' cy='-4' r='2.2'/%3E%3Ccircle cx='-1.0' cy='72' r='2.2'/%3E%3Ccircle cx='5.2' cy='-4' r='2.2'/%3E%3Ccircle cx='5.2' cy='72' r='2.2'/%3E%3Ccircle cx='11.4' cy='-4' r='2.2'/%3E%3Ccircle cx='11.4' cy='72' r='2.2'/%3E%3Ccircle cx='17.6' cy='-4' r='2.2'/%3E%3Ccircle cx='17.6' cy='72' r='2.2'/%3E%3Ccircle cx='23.8' cy='-4' r='2.2'/%3E%3Ccircle cx='23.8' cy='72' r='2.2'/%3E%3Ccircle cx='30.0' cy='-4' r='2.2'/%3E%3Ccircle cx='30.0' cy='72' r='2.2'/%3E%3Ccircle cx='36.2' cy='-4' r='2.2'/%3E%3Ccircle cx='36.2' cy='72' r='2.2'/%3E%3Ccircle cx='42.4' cy='-4' r='2.2'/%3E%3Ccircle cx='42.4' cy='72' r='2.2'/%3E%3Ccircle cx='48.6' cy='-4' r='2.2'/%3E%3Ccircle cx='48.6' cy='72' r='2.2'/%3E%3Ccircle cx='54.8' cy='-4' r='2.2'/%3E%3Ccircle cx='54.8' cy='72' r='2.2'/%3E%3Ccircle cx='61.0' cy='-4' r='2.2'/%3E%3Ccircle cx='61.0' cy='72' r='2.2'/%3E%3Ccircle cx='-4' cy='2.0' r='2.2'/%3E%3Ccircle cx='60' cy='2.0' r='2.2'/%3E%3Ccircle cx='-4' cy='8.2' r='2.2'/%3E%3Ccircle cx='60' cy='8.2' r='2.2'/%3E%3Ccircle cx='-4' cy='14.4' r='2.2'/%3E%3Ccircle cx='60' cy='14.4' r='2.2'/%3E%3Ccircle cx='-4' cy='20.6' r='2.2'/%3E%3Ccircle cx='60' cy='20.6' r='2.2'/%3E%3Ccircle cx='-4' cy='26.8' r='2.2'/%3E%3Ccircle cx='60' cy='26.8' r='2.2'/%3E%3Ccircle cx='-4' cy='33.0' r='2.2'/%3E%3Ccircle cx='60' cy='33.0' r='2.2'/%3E%3Ccircle cx='-4' cy='39.2' r='2.2'/%3E%3Ccircle cx='60' cy='39.2' r='2.2'/%3E%3Ccircle cx='-4' cy='45.4' r='2.2'/%3E%3Ccircle cx='60' cy='45.4' r='2.2'/%3E%3Ccircle cx='-4' cy='51.6' r='2.2'/%3E%3Ccircle cx='60' cy='51.6' r='2.2'/%3E%3Ccircle cx='-4' cy='57.8' r='2.2'/%3E%3Ccircle cx='60' cy='57.8' r='2.2'/%3E%3Ccircle cx='-4' cy='64.0' r='2.2'/%3E%3Ccircle cx='60' cy='64.0' r='2.2'/%3E%3Ccircle cx='-4' cy='70.2' r='2.2'/%3E%3Ccircle cx='60' cy='70.2' r='2.2'/%3E%3C/g%3E%3C/mask%3E%3C/defs%3E%3Crect x='-4' y='-4' width='64' height='76' fill='%23FBF8F0' mask='url(%23d)'/%3E%3Crect x='3' y='3' width='50' height='62' fill='%233D6E8F'/%3E%3Crect x='3' y='52' width='50' height='13' fill='%232D5470'/%3E%3Cpath d='M28 34 L23 52 M28 34 L33 52 M24.6 45 H31.4 M23.7 49 H32.3 M28 34 V29' stroke='%23F6F0E0' stroke-width='1.3' fill='none'/%3E%3Cpath d='M21 26 Q28 19 35 26 M17 22 Q28 11 39 22 M13 18 Q28 3 43 18' stroke='%23F6F0E0' stroke-width='1.2' fill='none'/%3E%3Ctext x='7' y='12' font-family='Helvetica,Arial,sans-serif' font-size='7' font-weight='700' fill='%23F6F0E0'%3E73%3C/text%3E%3Ctext x='28' y='61' text-anchor='middle' font-family='Helvetica,Arial,sans-serif' font-size='6' font-weight='700' fill='%23F6F0E0'%3EF4MPL%3C/text%3E%3C/svg%3E") center / contain no-repeat;
	transform: rotate(3deg);
	filter: drop-shadow(0 1px 1px rgba(60, 40, 15, 0.25));
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form::after {
	top: 30px;
	right: 20px;
	width: 58px;
	height: 26px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 40'%3E%3Cpath d='M2 8 q7 -5 14 0 t14 0 t14 0 t14 0 t14 0 t14 0 M2 20 q7 -5 14 0 t14 0 t14 0 t14 0 t14 0 t14 0 M2 32 q7 -5 14 0 t14 0 t14 0 t14 0 t14 0 t14 0' fill='none' stroke='%2324408E' stroke-opacity='.45' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
	transform: rotate(-8deg);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form > * {
	grid-column: 1 / -1;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form > p:not([class]) {
	display: contents;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form br {
	display: none;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form label[for] {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	margin: 0 !important;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-heading {
	grid-column: 1 / -1;
	padding-right: 74px;
	font-size: 27px !important;
	line-height: 1.05;
	margin: 0 0 4px !important;
	text-align: left !important;
	color: var(--wp--preset--color--encre-bleue, #24408E) !important;
	transform: rotate(-1deg);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-subtext {
	padding-right: 30px;
	font-size: 18px !important;
	line-height: 1.12;
	margin: 0 0 8px !important;
	text-align: left !important;
	color: #5E5F64 !important;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form input[name="first_name"] {
	grid-column: 1;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form input[type="email"] {
	grid-column: 1 / -1;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form:has(input[name="first_name"]) input[type="email"] {
	grid-column: 2;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form input[type="email"],
.carnet form.f4mpl-nl-form.f4mpl-nl-form input[type="text"]:not([name="website"]) {
	width: 100%;
	font-size: 23px;
	padding: 2px 2px 3px !important;
	margin: 0 0 12px !important;
	border: 0;
	border-bottom: 1.4px solid rgba(36, 64, 142, 0.35);
	color: var(--wp--preset--color--encre-bleue, #24408E);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form input[type="email"]:focus,
.carnet form.f4mpl-nl-form.f4mpl-nl-form input[type="text"]:focus {
	border-bottom: 2px solid var(--wp--preset--color--encre-bleue, #24408E);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-consent {
	grid-column: 1 / -1;
	font-size: 14.5px !important;
	line-height: 1.1;
	margin: 0 0 10px !important;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-consent input[type="checkbox"] {
	width: 17px !important;
	height: 17px;
	border-color: var(--wp--preset--color--encre-bleue, #24408E);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form button {
	display: inline-block;
	grid-column: 1 / -1;
	justify-self: start;
	margin: 0 !important;
	padding: 2px 16px 4px !important;
	font-size: 22px;
	color: var(--wp--preset--color--encre-bleue, #24408E);
	border-color: var(--wp--preset--color--encre-bleue, #24408E);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form button:hover {
	color: var(--wp--preset--color--rouge, #B3261E);
	border-color: var(--wp--preset--color--rouge, #B3261E);
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-hint {
	font-size: 14.5px;
	line-height: 1.1;
	margin: 8px 0 0 !important;
}

.carnet form.f4mpl-nl-form.f4mpl-nl-form .f4mpl-nl-message {
	font-size: 20px;
	margin: 8px 0 0 !important;
}

/* ------------------------------------------------------------------ */
/* 2. La lettre par avion                                              */
/* ------------------------------------------------------------------ */

.f4mpl-nl-popup-overlay.est-lettre {
	padding: 0;
	overflow: hidden;
	background: radial-gradient(ellipse at 50% 45%, rgba(20, 12, 4, 0.55), rgba(10, 6, 2, 0.82));
	-webkit-tap-highlight-color: transparent;
}

.f4mpl-nl-popup-overlay.est-lettre.lettre-prete {
	display: block !important;
}

.f4mpl-nl-popup-overlay.est-lettre:not(.lettre-prete) {
	display: none !important;
}

.lettre-scene {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 0;
	height: 0;
	pointer-events: none;
}

.lettre-enveloppe {
	position: absolute;
	width: min(340px, 86vw);
	aspect-ratio: 320 / 200;
	left: calc(min(340px, 86vw) / -2);
	top: calc(min(340px, 86vw) * -0.3125);
	will-change: transform;
}

.lettre-face {
	position: absolute;
	inset: 0;
}

.lettre-face svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

.lettre-face--avant {
	filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.45)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.lettre-face--dos {
	perspective: 900px;
}

.lettre-interieur,
.lettre-poche {
	position: absolute;
	inset: 0;
}

.lettre-interieur {
	z-index: 1;
	filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.45));
}

.lettre-poche {
	z-index: 4;
}

/* Rabat */
.lettre-rabat {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 62%;
	z-index: 5;
	transform-origin: 50% 0;
	transform-style: preserve-3d;
}

.lettre-rabat.est-ouvert {
	z-index: 2;
}

.lettre-rabat__face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	filter: drop-shadow(0 2px 2px rgba(60, 40, 15, 0.28));
}

.lettre-rabat__face svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}

.lettre-rabat__face--dedans {
	transform: rotateY(180deg);
	filter: none;
}

/* La feuille : rognée sous le bord de l'enveloppe tant qu'elle est dedans */
.lettre-clip {
	position: absolute;
	inset: 0;
	z-index: 3;
	clip-path: inset(-300vh -100vw 3px -100vw);
}

.lettre-clip.est-sortie {
	z-index: 6;
	clip-path: none;
}

.lettre-mouvement {
	position: absolute;
	left: 50%;
	top: 50%;
	filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
	will-change: transform;
}

.f4mpl-nl-popup-box.lettre-feuille {
	position: relative;
	box-sizing: border-box;
	width: min(380px, calc(100vw - 28px));
	max-height: calc(100vh - 28px);
	max-height: calc(100dvh - 28px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 34px 28px 26px 30px;
	animation: none;
	pointer-events: auto;
	background-color: var(--carnet-papier, #F6F0E0);
	background-image: url(../images/grain-papier.png), radial-gradient(circle, rgba(115, 105, 85, 0.42) 0.9px, transparent 1.3px);
	background-size: 256px 256px, 19px 19px;
	background-position: 0 0, 9px 9px;
	border-radius: 0 0 3px 3px;
	/* Bord du haut détaché des micro-perforations du carnet */
	-webkit-mask: radial-gradient(circle at 5px 0, transparent 2.2px, #000 2.7px) 0 0 / 10px 6px repeat-x, linear-gradient(#000, #000) 0 6px / 100% calc(100% - 6px) no-repeat;
	mask: radial-gradient(circle at 5px 0, transparent 2.2px, #000 2.7px) 0 0 / 10px 6px repeat-x, linear-gradient(#000, #000) 0 6px / 100% calc(100% - 6px) no-repeat;
}

.lettre-feuille .f4mpl-nl-form {
	margin: 0 !important;
	max-width: none;
	box-shadow: none !important;
}

/* Fermer : une croix au crayon */
.lettre-feuille .f4mpl-nl-popup-close {
	top: 14px;
	right: 12px;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--carnet-mine, #3E3F44);
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: 34px;
	line-height: 1;
	z-index: 2;
}

.lettre-feuille .f4mpl-nl-popup-close:hover,
.lettre-feuille .f4mpl-nl-popup-close:focus-visible {
	color: var(--wp--preset--color--rouge, #B3261E);
	background: transparent;
}

.lettre-feuille .f4mpl-nl-heading {
	padding-right: 30px;
}

/* Adresse manuscrite au recto */
.lettre-adresse {
	position: absolute;
	left: 30%;
	right: 6%;
	top: 52%;
	margin: 0;
	display: flex;
	flex-direction: column;
	transform: rotate(-2deg);
	font-family: var(--wp--preset--font-family--manuscrit);
	font-size: clamp(17px, 5.6vw, 22px);
	line-height: 1.12;
	color: var(--wp--preset--color--encre-bleue, #24408E);
}

.lettre-adresse span {
	border-bottom: 1px solid rgba(36, 64, 142, 0.18);
	padding-left: 6px;
}

.lettre-adresse__de {
	font-size: 0.75em;
	color: #5E5F64;
	border-bottom: 0 !important;
	padding-top: 4px;
}

.lettre-cachet {
	opacity: 0;
}
