/*
 * Fenêtre surgissante du stage de théâtre « Les ’Tis Comédiens » (includes/popup-stage.php,
 * assets/js/popup-stage.js). Chargée seulement sur la page d'accueil du site.
 *
 * D'après les maquettes validées :
 * - carte verticale (illustration en haut, texte dessous) jusqu'à 859 px de large ;
 * - carte horizontale (illustration à gauche, texte à droite) à partir de 860 px, et sur
 *   les écrans larges mais bas (téléphone à l'horizontale).
 * La carte tient toujours dans la hauteur de l'écran : l'illustration se réduit en hauteur
 * (recadrée) avant que le texte ou le bouton ne soient coupés.
 * <dialog> ouvert en fenêtre modale (showModal) : au-dessus de tout (couche supérieure),
 * dont l'en-tête, le menu et les deux boutons flottants ; fond de page assombri et flouté.
 */

.ltl-popup-stage {
	--lps-creme: #fdf4ec;
	--lps-pastille: #f3e4d7;
	--lps-bordeaux: #7b1344;
	--lps-bordeaux-survol: #93194f;
	--lps-or: #b48a36;
	--lps-marine: var(--ltl-marine, #0e1b3d);
	--lps-marge: 16px;
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: var(--lps-marge);
	overflow: hidden;
	border: 0;
	background: transparent;
	color: var(--lps-marine);
	font-family: var(--ltl-font-texte, "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif);
}

.ltl-popup-stage[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.ltl-popup-stage::backdrop {
	background: rgba(8, 18, 48, 0.62);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.ltl-popup-stage *,
.ltl-popup-stage *::before,
.ltl-popup-stage *::after {
	box-sizing: border-box;
}

/* Carte verticale (mobile et tablette). */
.ltl-popup-stage__carte {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(100%, 480px);
	max-height: 100%;
	overflow: hidden;
	border-radius: 24px;
	background: var(--lps-creme);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	container-type: inline-size;
}

.ltl-popup-stage__illustration {
	flex: 0 1 auto;
	min-height: 72px;
	height: 79cqi; /* Proportion de la maquette mobile. */
	max-height: 380px;
	overflow: hidden;
	background: #1e2c47;
}

/* Plus précis que « body.ltl-page img » (page.css : height: auto). */
.ltl-popup-stage .ltl-popup-stage__illustration img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: 50% 30%;
}

.ltl-popup-stage__contenu {
	flex: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 16px 20px 22px;
	text-align: center;
}

/* Dernier recours (écran très bas) : le texte défile dans la carte, jamais coupé. */
@media (max-height: 520px) {
	.ltl-popup-stage__contenu {
		flex: 0 1 auto;
		min-height: 0;
		overflow-y: auto;
	}
}

/* Remise à zéro de faible priorité : les marges ci-dessous l'emportent. */
.ltl-popup-stage :where(p, h2, ul) {
	margin: 0;
	padding: 0;
}

.ltl-popup-stage__surtitre {
	color: var(--lps-marine);
	font-size: 15px;
	font-size: clamp(12px, 3.7cqi, 18px);
	font-weight: 700;
	letter-spacing: 0.28em;
	line-height: 1.2;
	text-transform: uppercase;
	/* Compense l'espacement après la dernière lettre : texte vraiment centré. */
	margin-right: -0.28em;
}

.ltl-popup-stage__surtitre::after {
	content: "";
	display: block;
	width: 7.5em;
	height: 2px;
	margin: 0.75em auto 0;
	background: var(--lps-or);
}

.ltl-popup-stage__titre {
	margin-top: 10px;
	color: var(--lps-marine);
	font-family: inherit;
	font-size: 44px;
	font-size: clamp(30px, 13.2cqi, 62px);
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 0.98;
	text-transform: uppercase;
	text-wrap: balance;
}

.ltl-popup-stage__accroche {
	margin-top: 10px;
	color: var(--lps-bordeaux);
	font-size: 17px;
	font-size: clamp(15px, 4.4cqi, 22px);
	font-style: italic;
	font-weight: 600;
	text-wrap: balance;
	line-height: 1.25;
}

.ltl-popup-stage__format {
	margin-top: 6px;
	color: var(--lps-marine);
	font-size: 18px;
	font-size: clamp(15px, 4.7cqi, 22px);
	font-weight: 600;
	line-height: 1.25;
}

.ltl-popup-stage__pastilles {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 12px;
	list-style: none;
}

.ltl-popup-stage__pastilles li {
	margin: 0;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--lps-pastille);
	color: var(--lps-marine);
	font-size: 14px;
	font-size: clamp(13px, 3.6cqi, 17px);
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
}

.ltl-popup-stage__prix {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	margin-top: 14px;
	color: var(--lps-bordeaux);
	font-size: 22px;
	font-size: clamp(18px, 5.8cqi, 28px);
	font-weight: 600;
	line-height: 1.2;
}

.ltl-popup-stage__prix::before,
.ltl-popup-stage__prix::after {
	content: "";
	flex: 1 1 0;
	min-width: 16px;
	max-width: 64px;
	height: 2px;
	margin-inline: auto;
	background: var(--lps-or);
}

.ltl-popup-stage__prix span {
	flex: none;
	white-space: nowrap;
}

.ltl-popup-stage__prix strong {
	font-weight: 800;
}

.ltl-popup-stage__bouton {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4em;
	width: 100%;
	min-height: 52px;
	margin-top: 14px;
	padding: 10px 24px;
	border-radius: 999px;
	background: linear-gradient(180deg, #8a1a4f, var(--lps-bordeaux));
	color: #fff;
	font-size: 20px;
	font-size: clamp(17px, 5.6cqi, 26px);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: 0 8px 18px rgba(123, 19, 68, 0.28);
	transition: background-color 0.2s ease, transform 0.2s var(--ltl-ease, ease);
}

.ltl-popup-stage__bouton:hover,
.ltl-popup-stage__bouton:focus-visible {
	background: var(--lps-bordeaux-survol);
	color: #fff;
}

.ltl-popup-stage__fleche {
	font-weight: 600;
}

/* Bouton fermer : rond, 48 px, en haut à droite (sur l'illustration en carte verticale). */
.ltl-popup-stage__fermer {
	position: absolute;
	z-index: 2;
	top: 12px;
	right: 12px;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 2px solid transparent; /* Pastille blanche sur l'illustration (maquette mobile). */
	border-radius: 50%;
	background: #fff;
	color: var(--lps-marine);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.ltl-popup-stage__fermer span,
.ltl-popup-stage__fermer span::before {
	display: block;
	width: 22px;
	height: 2.5px;
	border-radius: 2px;
	background: currentColor;
	transform: rotate(45deg);
}

.ltl-popup-stage__fermer span::before {
	content: "";
	transform: rotate(90deg);
}

.ltl-popup-stage__fermer:hover {
	background: var(--lps-pastille);
}

.ltl-popup-stage :focus-visible {
	outline: 3px solid var(--ltl-turquoise-lien, #00788a);
	outline-offset: 3px;
}

/* Carte horizontale : ordinateur, et écrans larges mais bas. */
@media (min-width: 860px), (min-width: 640px) and (max-height: 559.98px) {
	.ltl-popup-stage {
		--lps-marge: 24px;
	}

	.ltl-popup-stage__carte {
		flex-direction: row;
		align-items: stretch;
		width: min(100%, 940px);
		border-radius: 28px;
	}

	.ltl-popup-stage__illustration {
		position: relative;
		flex: 0 0 50.4%;
		height: auto;
		min-height: 0;
		max-height: none;
	}

	.ltl-popup-stage .ltl-popup-stage__illustration img {
		position: absolute;
		inset: 0;
		object-position: 50% 50%;
	}

	.ltl-popup-stage__contenu {
		flex: 1 1 0;
		justify-content: center;
		min-width: 0;
		max-height: calc(100vh - 2 * var(--lps-marge));
		max-height: calc(100dvh - 2 * var(--lps-marge));
		overflow-y: auto;
		padding: 40px 20px 40px;
		padding: 3cqi 2.2cqi 3.2cqi;
	}

	.ltl-popup-stage__surtitre {
		font-size: clamp(12px, 2.25cqi, 20px);
		margin-top: 0.3em;
	}

	.ltl-popup-stage__titre {
		margin-top: 0.3em;
		font-size: clamp(30px, 6.7cqi, 64px);
	}

	.ltl-popup-stage__accroche {
		margin-top: 0.6em;
		font-size: clamp(15px, 2.2cqi, 22px);
	}

	.ltl-popup-stage__format {
		margin-top: 0.35em;
		font-size: clamp(15px, 2.45cqi, 23px);
	}

	.ltl-popup-stage__pastilles {
		gap: 8px 0;
		margin-top: 2.1cqi;
	}

	.ltl-popup-stage__pastilles li {
		font-size: clamp(13px, 1.6cqi, 16px);
		padding: 0.4em 0.75em;
	}

	/* Point séparateur entre les pastilles, comme sur la maquette ordinateur. */
	.ltl-popup-stage__pastilles li + li::before {
		content: "•";
		content: "•" / "";
		position: absolute;
		left: -9px;
		top: 50%;
		transform: translate(-50%, -50%);
		color: var(--lps-marine);
	}

	.ltl-popup-stage__pastilles li {
		position: relative;
	}

	.ltl-popup-stage__pastilles li + li {
		margin-left: 18px;
	}

	.ltl-popup-stage__prix {
		margin-top: 2.2cqi;
		font-size: clamp(18px, 3cqi, 28px);
	}

	.ltl-popup-stage__prix::before,
	.ltl-popup-stage__prix::after {
		max-width: 72px;
	}

	.ltl-popup-stage__bouton {
		min-height: 56px;
		width: 92%;
		margin-top: 2.4cqi;
		font-size: clamp(17px, 2.75cqi, 26px);
	}

	.ltl-popup-stage__fermer {
		top: 16px;
		right: 16px;
		border-color: var(--lps-marine);
		background: transparent;
		box-shadow: none;
	}
}

/* Pendant l'ouverture : page immobile (sans saut : script), boutons flottants masqués. */
html.ltl-popup-stage-ouverte {
	overflow: hidden;
}

html.ltl-popup-stage-ouverte .ltl-formules-flottant,
html.ltl-popup-stage-ouverte .ltl-contact-flottant {
	visibility: hidden;
}

/* Apparition douce, sauf si les mouvements sont réduits. */
@media (prefers-reduced-motion: no-preference) {
	.ltl-popup-stage[open] .ltl-popup-stage__carte {
		animation: ltl-popup-stage-entree 0.3s var(--ltl-ease, ease) both;
	}

	.ltl-popup-stage[open]::backdrop {
		animation: ltl-popup-stage-fond 0.3s ease both;
	}
}

@keyframes ltl-popup-stage-entree {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.98);
	}
}

@keyframes ltl-popup-stage-fond {
	from {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ltl-popup-stage__bouton {
		transition: none;
	}
}

@media print {
	.ltl-popup-stage {
		display: none !important;
	}
}
