/* Widget « Photo avec Leo » */

.cieau-photo-leo {
	--cpl-couleur: #0B4F71;
	position: relative;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	min-height: 460px;
	overflow: hidden;
	background: var(--cpl-couleur);
	color: #fff;
	font-family: "Poppins", "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

/* Barre d'administration WordPress (utilisateur connecté) : l'écran doit tenir sous elle. */
.admin-bar .cieau-photo-leo {
	height: calc(100vh - 32px);
	height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
	.admin-bar .cieau-photo-leo {
		height: calc(100vh - 46px);
		height: calc(100dvh - 46px);
	}
}

.cieau-photo-leo *,
.cieau-photo-leo *::before,
.cieau-photo-leo *::after {
	box-sizing: border-box;
}

.cieau-photo-leo [hidden] {
	display: none !important;
}

.cieau-photo-leo .cpl-screen {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
	text-align: center;
}

/* ---------------------------------------------------------------- Boutons */

.cieau-photo-leo .cpl-btn,
.cieau-photo-leo .cpl-btn:hover,
.cieau-photo-leo .cpl-btn:focus {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	border: 0;
	border-radius: 999px;
	padding: 16px 28px;
	min-height: 54px;
	width: 100%;
	max-width: 360px;
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	cursor: pointer;
	box-shadow: none;
}

.cieau-photo-leo .cpl-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.cieau-photo-leo .cpl-btn--principal,
.cieau-photo-leo .cpl-btn--principal:hover,
.cieau-photo-leo .cpl-btn--principal:focus {
	background: #fff;
	color: var(--cpl-couleur);
}

.cieau-photo-leo .cpl-btn--secondaire,
.cieau-photo-leo .cpl-btn--secondaire:hover,
.cieau-photo-leo .cpl-btn--secondaire:focus {
	background: transparent;
	color: #fff;
	box-shadow: inset 0 0 0 2px #fff;
}

/* ------------------------------------------------------------ Célébration */

.cieau-photo-leo .cpl-celebration,
.cieau-photo-leo .cpl-intro,
.cieau-photo-leo .cpl-resultat,
.cieau-photo-leo .cpl-erreur,
.cieau-photo-leo .cpl-apercu {
	background: radial-gradient(circle at 50% 40%, #2bb7d6 0%, var(--cpl-couleur) 75%);
}

.cieau-photo-leo .cpl-celebration {
	cursor: pointer;
}

.cieau-photo-leo .cpl-saut {
	position: relative;
	z-index: 1;
	width: min(55vw, 300px);
	max-width: none;
	height: auto;
	transform-origin: 50% 100%;
}

.cieau-photo-leo .cpl-celebration.is-active .cpl-saut {
	animation: cpl-saut 0.9s cubic-bezier(0.3, 0.7, 0.4, 1) infinite;
}

@keyframes cpl-saut {
	0%   { transform: translateY(0) scale(1.12, 0.86); }
	25%  { transform: translateY(-6%) scale(0.94, 1.08); }
	50%  { transform: translateY(-32%) scale(1, 1) rotate(-4deg); }
	75%  { transform: translateY(-6%) scale(0.96, 1.04); }
	100% { transform: translateY(0) scale(1.12, 0.86); }
}

.cieau-photo-leo .cpl-eclats {
	position: absolute;
	top: 45%;
	left: 50%;
	width: 0;
	height: 0;
}

.cieau-photo-leo .cpl-goutte {
	position: absolute;
	top: -9px;
	left: -7px;
	width: 14px;
	height: 18px;
	border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
	background: #bfefff;
	opacity: 0;
}

.cieau-photo-leo .cpl-celebration.is-active .cpl-goutte {
	animation: cpl-eclat 1.8s ease-out infinite;
	animation-delay: var(--d);
}

@keyframes cpl-eclat {
	0%   { opacity: 0; transform: rotate(var(--a)) translateY(-10px) scale(0.4); }
	15%  { opacity: 1; }
	100% { opacity: 0; transform: rotate(var(--a)) translateY(-40vmin) scale(1); }
}

.cieau-photo-leo .cpl-bravo {
	position: relative;
	z-index: 1;
	margin: 0;
	font-size: clamp(36px, 11vw, 64px);
	font-weight: 800;
	line-height: 1;
	text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.cieau-photo-leo .cpl-celebration.is-active .cpl-bravo {
	animation: cpl-bravo 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes cpl-bravo {
	from { opacity: 0; transform: scale(0.3); }
	to   { opacity: 1; transform: scale(1); }
}

/* ---------------------------------------------------------------- Accueil */

.cieau-photo-leo .cpl-intro-leo {
	width: min(45vw, 240px);
	max-width: none;
	height: auto;
}

.cieau-photo-leo .cpl-intro-titre {
	margin: 0;
	color: #fff;
	font-family: inherit;
	font-size: clamp(24px, 7vw, 36px);
	font-weight: 800;
	line-height: 1.15;
}

.cieau-photo-leo .cpl-intro-texte,
.cieau-photo-leo .cpl-recompense,
.cieau-photo-leo .cpl-erreur-msg,
.cieau-photo-leo .cpl-resultat-note {
	max-width: 420px;
	margin: 0;
	color: #fff;
	font-size: 17px;
	line-height: 1.45;
}

.cieau-photo-leo .cpl-recompense {
	font-weight: 700;
}

/* ----------------------------------------------------------------- Caméra */

.cieau-photo-leo .cpl-camera {
	justify-content: flex-start;
	gap: 0;
	padding: 0;
	background: #000;
}

.cieau-photo-leo .cpl-scene {
	position: relative;
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	overflow: hidden;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

.cieau-photo-leo .cpl-video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #111;
}

.cieau-photo-leo .cpl-video.is-miroir {
	transform: scaleX(-1);
}

.cieau-photo-leo .cpl-leo {
	position: absolute;
	width: auto;
	max-width: none;
	touch-action: none;
	-webkit-user-drag: none;
	-webkit-user-select: none;
	user-select: none;
	cursor: grab;
}

.cieau-photo-leo .cpl-titre,
.cieau-photo-leo .cpl-date {
	position: absolute;
	right: 0;
	left: 0;
	color: #fff;
	text-align: center;
	text-shadow: 0 0 0.25em rgba(0, 0, 0, 0.5);
	pointer-events: none;
}

.cieau-photo-leo .cpl-titre {
	top: 0;
	padding: 4% 6% 0;
	font-weight: 800;
	line-height: 1.15;
	background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.cieau-photo-leo .cpl-date {
	bottom: 0;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 0 6% 4%;
	font-weight: 700;
	line-height: 1;
	background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
}

.cieau-photo-leo .cpl-aide {
	position: absolute;
	bottom: 18%;
	left: 50%;
	width: max-content;
	max-width: 86%;
	padding: 10px 16px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.6);
	font-size: 15px;
	line-height: 1.3;
	transform: translateX(-50%);
	pointer-events: none;
}

.cieau-photo-leo .cpl-scene.is-flash::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: #fff;
	animation: cpl-flash 0.35s ease-out forwards;
	pointer-events: none;
}

@keyframes cpl-flash {
	from { opacity: 0.9; }
	to   { opacity: 0; }
}

.cieau-photo-leo .cpl-barre {
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px 16px;
	width: 100%;
	padding: 12px 20px max(16px, env(safe-area-inset-bottom));
	background: #000;
}

.cieau-photo-leo .cpl-taille {
	grid-row: 1;
	grid-column: 1 / -1;
	width: 100%;
	margin: 0;
	accent-color: #fff;
}

.cieau-photo-leo .cpl-changer,
.cieau-photo-leo .cpl-declencheur,
.cieau-photo-leo .cpl-retourner {
	grid-row: 2;
}

.cieau-photo-leo .cpl-changer {
	grid-column: 1;
	justify-self: start;
}

.cieau-photo-leo .cpl-retourner {
	grid-column: 3;
	justify-self: end;
}

.cieau-photo-leo .cpl-btn--icone,
.cieau-photo-leo .cpl-btn--icone:hover,
.cieau-photo-leo .cpl-btn--icone:focus {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	max-width: 54px;
	height: 54px;
	padding: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
}

.cieau-photo-leo .cpl-btn--icone svg {
	width: 26px;
	height: 26px;
}

.cieau-photo-leo .cpl-declencheur,
.cieau-photo-leo .cpl-declencheur:hover,
.cieau-photo-leo .cpl-declencheur:focus {
	grid-column: 2;
	appearance: none;
	-webkit-appearance: none;
	width: 78px;
	height: 78px;
	margin: 0;
	padding: 0;
	border: 5px solid #fff;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	cursor: pointer;
}

.cieau-photo-leo .cpl-declencheur:active {
	background: #fff;
}

/* --------------------------------------------------------------- Résultat */

.cieau-photo-leo .cpl-resultat {
	justify-content: flex-start;
	overflow-y: auto;
}

.cieau-photo-leo .cpl-resultat-img {
	flex: 0 1 auto;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 58vh;
	max-height: 58dvh;
	border: 4px solid #fff;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
	.cieau-photo-leo .cpl-celebration.is-active .cpl-saut,
	.cieau-photo-leo .cpl-celebration.is-active .cpl-goutte,
	.cieau-photo-leo .cpl-celebration.is-active .cpl-bravo {
		animation: none;
		opacity: 1;
	}

	.cieau-photo-leo .cpl-goutte {
		display: none;
	}
}
