/*
 * LPT — Carte cadeau : formulaire d'achat et aperçu de la carte.
 * Couleurs et polices du site (variables GeneratePress, valeurs de secours).
 */

.lpt-cc {
	--lpt-cc-rouge: var(--accent, #a6300b);
	--lpt-cc-bleu: var(--contrast-3, #004aad);
	--lpt-cc-sombre: var(--contrast, #353a3d);
	--lpt-cc-gris: #667780;
	--lpt-cc-beige: #e9e3d8;
	--lpt-cc-bord: #d5cec2;
	margin: 2rem 0;
	scroll-margin-top: 7rem; /* sous le menu collant */
}

.lpt-cc__test {
	margin: 0 0 1.5rem;
	padding: .75rem 1rem;
	border-left: 4px solid var(--lpt-cc-rouge);
	background: #fbeee9;
	font-size: .95em;
}

/* Disposition : champs à gauche, aperçu à droite (collé au défilement). */
.lpt-cc__form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	column-gap: 2.5rem;
	align-items: start;
}
.lpt-cc__champs,
.lpt-cc__payer { grid-column: 1; }
.lpt-cc__apercu {
	grid-column: 2;
	grid-row: 1 / span 2;
	position: sticky;
	top: 1.5rem;
}
.lpt-cc__form[hidden],
.lpt-cc__succes[hidden] { display: none; }

/* Groupes numérotés. */
.lpt-cc__groupe {
	margin: 0 0 1.75rem;
	padding: 0;
	border: 0;
	min-width: 0;
}
.lpt-cc__groupe legend {
	display: flex;
	align-items: center;
	gap: .6rem;
	margin: 0 0 .9rem;
	padding: 0;
	font-family: Lora, Georgia, serif;
	font-size: 1.3em;
	color: var(--lpt-cc-sombre);
}
.lpt-cc__num {
	display: inline-grid;
	place-items: center;
	width: 1.8rem;
	height: 1.8rem;
	border-radius: 50%;
	background: var(--lpt-cc-rouge);
	color: #fff;
	font-family: Lato, sans-serif;
	font-size: .75em;
	font-weight: 700;
}

/* Montants en pastilles. */
.lpt-cc__montants {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
}
.lpt-cc__montant { position: relative; cursor: pointer; }
.lpt-cc__montant input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}
.lpt-cc__montant span {
	display: block;
	min-width: 5.5rem;
	padding: .7rem 1.1rem;
	border: 2px solid var(--lpt-cc-bord);
	border-radius: 999px;
	background: #fff;
	text-align: center;
	font-weight: 700;
	font-size: 1.05em;
	color: var(--lpt-cc-sombre);
	transition: border-color .15s, background-color .15s;
}
.lpt-cc__montant:hover span { border-color: var(--lpt-cc-rouge); }
.lpt-cc__montant input:checked + span {
	border-color: var(--lpt-cc-rouge);
	background: var(--lpt-cc-rouge);
	color: #fff;
}
.lpt-cc__montant input:focus-visible + span {
	outline: 2px solid var(--lpt-cc-bleu);
	outline-offset: 2px;
}
.lpt-cc__libre { margin-top: .9rem; }
.lpt-cc__libre[hidden] { display: none; }
.lpt-cc__euros { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.lpt-cc__euros input { width: 8rem; }

/* Champs. */
.lpt-cc__champ { margin: 0 0 1rem; }
.lpt-cc__champ > label {
	display: block;
	margin-bottom: .3rem;
	font-weight: 700;
	font-size: .95em;
}
.lpt-cc__requis { font-weight: 400; color: var(--lpt-cc-gris); font-size: .9em; }
.lpt-cc__champ input[type="text"],
.lpt-cc__champ input[type="email"],
.lpt-cc__champ input[type="number"],
.lpt-cc__champ select,
.lpt-cc__champ textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: .65rem .8rem;
	border: 1px solid var(--lpt-cc-bord);
	border-radius: 6px;
	background: #fff;
	font: inherit;
	color: var(--lpt-cc-sombre);
}
.lpt-cc__euros input[type="number"] { width: 8rem; }
.lpt-cc__champ textarea { resize: vertical; min-height: 5.5rem; }
.lpt-cc__champ input:focus,
.lpt-cc__champ select:focus,
.lpt-cc__champ textarea:focus {
	border-color: var(--lpt-cc-bleu);
	outline: 2px solid rgba(0, 74, 173, .2);
}
.lpt-cc [aria-invalid="true"] { border-color: var(--lpt-cc-rouge) !important; }
.lpt-cc__compteur,
.lpt-cc__aide {
	display: block;
	margin-top: .3rem;
	font-size: .85em;
	color: var(--lpt-cc-gris);
}
.lpt-cc__compteur { text-align: right; }
.lpt-cc__case label {
	display: flex;
	gap: .55rem;
	align-items: flex-start;
	font-weight: 400;
}
.lpt-cc__case input { margin-top: .3rem; flex: none; }
.lpt-cc__piege {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Paiement. */
.lpt-cc__payer {
	padding: 1.25rem 1.25rem .5rem;
	border-radius: 10px;
	background: var(--base, #e8f0f3);
}
.lpt-cc__total {
	margin: 0 0 1rem;
	font-size: 1.15em;
}
.lpt-cc__total strong {
	font-family: Lora, Georgia, serif;
	font-size: 1.4em;
	color: var(--lpt-cc-rouge);
}
.lpt-cc__paypal { min-height: 110px; }
.lpt-cc__note,
.lpt-cc__admin { font-size: .85em; color: var(--lpt-cc-gris); }
.lpt-cc__admin { border-top: 1px dashed var(--lpt-cc-bord); padding-top: .6rem; }
.lpt-cc__erreur {
	margin: 0 0 1rem;
	padding: .7rem 1rem;
	border-left: 4px solid var(--lpt-cc-rouge);
	background: #fff;
	color: var(--lpt-cc-rouge);
	font-weight: 700;
}
.lpt-cc__erreur[hidden] { display: none; }
.lpt-cc--attente .lpt-cc__paypal { opacity: .4; pointer-events: none; }
.lpt-cc--attente .lpt-cc__payer::after {
	content: "Création de votre carte…";
	display: block;
	padding: 0 0 .75rem;
	font-weight: 700;
}

/* Aperçu : la carte A4 paysage en miniature, coupée en deux moitiés égales
   comme le PDF (photo, panneau). Tailles en unités du conteneur
   (cqw) : le texte suit la largeur de la carte, comme sur le PDF, avec une
   taille minimale lisible sur les petits écrans. */
.lpt-cc__carte {
	container-type: inline-size;
	display: grid;
	grid-template-columns: 50% 50%;
	aspect-ratio: 297 / 210;
	overflow: hidden;
	overflow: clip; /* la carte s'allonge si le texte minimum ne tient pas */
	border-radius: 6px;
	background: var(--lpt-cc-beige);
	box-shadow: 0 10px 30px rgba(53, 58, 61, .18);
}
.lpt-cc__photo {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.lpt-cc__panneau {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
	padding: 4.6cqw 4.7cqw 3cqw;
	color: var(--lpt-cc-sombre);
	line-height: 1.15;
}
.lpt-cc__logo { align-self: center; width: 31cqw; height: auto; margin: 0 0 3.6cqw; }
.lpt-cc__titre {
	font-family: Lora, Georgia, serif;
	font-size: max(4.7cqw, 20px);
	color: var(--lpt-cc-rouge);
}
.lpt-cc__occasion {
	margin: .5cqw 0 2.6cqw;
	font-family: Lora, Georgia, serif;
	font-style: italic;
	font-size: max(2cqw, 12px);
}
.lpt-cc__lib {
	display: block;
	font-size: max(1.05cqw, 8px);
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--lpt-cc-gris);
}
.lpt-cc__val {
	display: block;
	max-width: 100%;
	margin: .3cqw 0 1.6cqw;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: Lora, Georgia, serif;
	font-size: max(2.1cqw, 13px);
	color: var(--lpt-cc-bleu);
}
.lpt-cc__de { display: block; max-width: 100%; }
.lpt-cc__de[hidden] { display: none; }
.lpt-cc__valeur {
	margin: .2cqw 0 1.6cqw;
	font-family: Lora, Georgia, serif;
	font-weight: 700;
	font-size: max(3.6cqw, 18px);
	color: var(--lpt-cc-rouge);
}
.lpt-cc__mot {
	max-width: 100%;
	font-family: Lora, Georgia, serif;
	font-style: italic;
	font-size: max(1.45cqw, 10.5px);
	line-height: 1.35;
	white-space: pre-line;
	overflow-wrap: anywhere;
}
.lpt-cc__legende {
	margin: .8rem 0 0;
	font-size: .85em;
	color: var(--lpt-cc-gris);
}

/* Après l'achat. */
.lpt-cc__succes {
	padding: 1.75rem;
	border-radius: 10px;
	border-top: 5px solid var(--lpt-cc-rouge);
	background: var(--base, #e8f0f3);
	outline: none;
	scroll-margin-top: 2rem;
}
.lpt-cc__succes-titre {
	margin: 0 0 .75rem;
	font-family: Lora, Georgia, serif;
	font-size: 1.6em;
	color: var(--lpt-cc-rouge);
}
.lpt-cc__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem 1.5rem;
	margin: 1.25rem 0;
}
.lpt-cc__bouton {
	display: inline-block;
	padding: .85rem 1.6rem;
	border-radius: 999px;
	background: var(--lpt-cc-rouge);
	color: #fff !important;
	font-weight: 700;
	text-decoration: none !important;
}
.lpt-cc__bouton:hover,
.lpt-cc__bouton:focus { background: #84260a; }
.lpt-cc__lien { color: var(--lpt-cc-bleu); }
.lpt-cc__envoi { font-weight: 700; }

/* Fenêtre de résultat, par-dessus la page. */
.lpt-cc__modale {
	width: min(640px, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: 0;
	border-radius: 14px;
	background: #fff;
	color: var(--lpt-cc-sombre);
	box-shadow: 0 24px 60px rgba(30, 35, 38, .35);
	overflow: auto;
}
.lpt-cc__modale[open] { animation: lpt-cc-apparition .25s ease-out; }
.lpt-cc__modale::backdrop { background: rgba(30, 35, 38, .6); }
@keyframes lpt-cc-apparition {
	from { opacity: 0; transform: translateY(12px) scale(.98); }
	to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.lpt-cc__modale[open] { animation: none; }
}
html:has(.lpt-cc__modale[open]) { overflow: hidden; }
.lpt-cc__modale-corps {
	position: relative;
	padding: 1.75rem 1.75rem 1.25rem;
	border-top: 6px solid var(--lpt-cc-rouge);
}
.lpt-cc__fermer {
	position: absolute;
	top: .6rem;
	right: .6rem;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--lpt-cc-gris);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}
.lpt-cc__fermer:hover,
.lpt-cc__fermer:focus-visible { background: var(--base, #e8f0f3); color: var(--lpt-cc-sombre); }
.lpt-cc__modale-titre {
	display: flex;
	align-items: center;
	gap: .6rem;
	margin: 0 2.2rem 1rem 0;
	font-family: Lora, Georgia, serif;
	font-size: 1.55em;
	line-height: 1.2;
	color: var(--lpt-cc-rouge);
}
.lpt-cc__coche {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: #2f7d4f;
	color: #fff;
	font-family: Lato, sans-serif;
	font-size: 1.1rem;
}
.lpt-cc__modale-test {
	margin: 0 0 1rem;
	padding: .5rem .8rem;
	border-left: 4px solid var(--lpt-cc-rouge);
	background: #fbeee9;
	font-size: .9em;
}
.lpt-cc__modale-test[hidden] { display: none; }
.lpt-cc__modale-carte { margin: 0 0 1.1rem; }
.lpt-cc__modale-carte .lpt-cc__carte { box-shadow: 0 6px 18px rgba(53, 58, 61, .18); }
.lpt-cc__modale-infos { margin: 0; }
.lpt-cc__code { font-size: 1.15em; letter-spacing: .04em; }
.lpt-cc__modale .lpt-cc__actions { margin: 1.1rem 0; }
.lpt-cc__modale .lpt-cc__envoi { margin: 0 0 .75rem; font-size: .95em; }
.lpt-cc__modale-aide { margin: 0; font-size: .92em; color: var(--lpt-cc-gris); }
.lpt-cc__modale-pied { margin: 1rem 0 0; text-align: right; }
.lpt-cc__lien-bouton {
	padding: .4rem .2rem;
	border: 0;
	background: none;
	color: var(--lpt-cc-bleu);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Mobile : une colonne ; l'aperçu passe entre les champs et le paiement. */
@media (max-width: 860px) {
	.lpt-cc__form { grid-template-columns: minmax(0, 1fr); }
	.lpt-cc__apercu {
		grid-column: 1;
		grid-row: auto;
		position: static;
		margin: 0 0 1.75rem;
	}
	.lpt-cc__payer { padding: 1rem 1rem .25rem; }
	.lpt-cc__succes { padding: 1.25rem; }
	.lpt-cc__modale-corps { padding: 1.4rem 1.1rem 1rem; }
	.lpt-cc__modale-titre { font-size: 1.3em; }
	.lpt-cc__modale .lpt-cc__actions { flex-direction: column; align-items: stretch; text-align: center; }
}
