/* Agrandir les images — la visionneuse. Classes en agi-*, sélecteurs préfixés par .agi pour
   passer devant les styles du thème (boutons, figures, images). */

html.agi-ouvert {
	overflow: hidden !important;
}

.agi {
	position: fixed;
	inset: 0;
	z-index: 2147483000; /* au-dessus des en-têtes fixes, du sommaire latéral, de la barre d'admin */
	background: rgba(12, 14, 18, 0.94);
	color: #fff;
	opacity: 0;
	transition: opacity 0.18s ease;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior: contain;
}
.agi.agi-visible {
	opacity: 1;
}
.agi[hidden],
.agi [hidden] {
	display: none !important;
}

.agi .agi-scene {
	position: absolute;
	inset: 56px 12px 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}
@media (min-width: 768px) {
	.agi:not(.agi-seule) .agi-scene {
		left: 72px;
		right: 72px;
	}
}

.agi .agi-figure {
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: 100%;
}

.agi .agi-image {
	display: block;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 2px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.18s ease;
	cursor: default;
}
.agi .agi-image.agi-prete {
	opacity: 1;
}

.agi .agi-legende {
	margin: 0;
	padding: 0;
	font-size: 15px;
	line-height: 1.45;
	font-style: normal;
	text-align: center;
	color: #e9ebee;
	background: none;
}

.agi .agi-compteur {
	position: absolute;
	top: 0;
	left: 16px;
	margin: 0;
	padding: 0;
	font-size: 15px;
	line-height: 56px;
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
	color: #c9cdd3;
}

.agi button.agi-bouton {
	all: unset;
	box-sizing: border-box;
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: #fff;
	background: rgba(0, 0, 0, 0.45);
	cursor: pointer;
	touch-action: manipulation;
	transition: background-color 0.15s ease;
}
.agi button.agi-bouton:hover {
	background: rgba(255, 255, 255, 0.18);
}
.agi button.agi-bouton:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
.agi button.agi-bouton svg {
	display: block;
	width: 24px;
	height: 24px;
	pointer-events: none;
}
.agi button.agi-fermer {
	top: 6px;
	right: 8px;
}
.agi button.agi-prec,
.agi button.agi-suiv {
	top: 50%;
	margin-top: -22px;
}
.agi button.agi-prec {
	left: 12px;
}
.agi button.agi-suiv {
	right: 12px;
}
@media (min-width: 768px) {
	.agi button.agi-prec,
	.agi button.agi-suiv {
		width: 48px;
		height: 48px;
		margin-top: -24px;
	}
}

/* Chargement : un anneau au centre tant que l'image n'est pas arrivée. */
.agi.agi-charge::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: agi-tourne 0.8s linear infinite;
}
@keyframes agi-tourne {
	to {
		transform: rotate(360deg);
	}
}

/* Image introuvable : la légende reste seule à l'écran. */
.agi.agi-erreur .agi-image {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.agi,
	.agi .agi-image {
		transition: none;
	}
	.agi.agi-charge::after {
		animation-duration: 2s;
	}
}
