/* ============================================================================ *
 * FRO Galerie — styles publics
 * Grille immersive plein largeur (style Photos iPhone) + lightbox pleine page.
 * Classes prfixes `fro-gallery-*` pour viter tout conflit avec le thme.
 * ============================================================================ */

/* --- Conteneur : pleine largeur disponible, sans marges latrales excessives --- */
.fro-gallery {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.fro-gallery * {
	box-sizing: border-box;
}

.fro-gallery-empty {
	padding: 60px 20px;
	text-align: center;
	color: #4a5568;
	font-size: 1rem;
}

/* --- Grille : dense, lastique, responsive sans media queries figes --- *
 * auto-fill + minmax : le nombre de colonnes s'adapte  la largeur relle.
 * Mobile (~320-600px) : minmax(100px,1fr) -> 3 colonnes sur un phone courant.
 * Au-del, la grille se densifie automatiquement (4, 5, 6+ colonnes). */
.fro-gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 6px;
	width: 100%;
	padding: 6px;
}

/* Grille plus serre sur petits crans pour maximiser la surface photo. */
@media (max-width: 480px) {
	.fro-gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		gap: 4px;
		padding: 4px;
	}
}

/* --- Desktop (PC) : 5 colonnes fixes, photos plus grandes --- *
 * Mobile/tablette (< 992px) inchangs : auto-fill conserve son comportement
 * (3 colonnes sur tlphone). Sur PC on fige  5 colonnes et on centre la
 * grille dans une largeur maximale pour viter des photos dmesures
 * sur les crans ultra-larges. */
@media (min-width: 992px) {
	.fro-gallery-grid {
		grid-template-columns: repeat(5, 1fr);
		max-width: 1600px;
		margin-left: auto;
		margin-right: auto;
		gap: 10px;
		padding: 10px 20px;
	}
}

/* --- Cellule : carr homogne, recadrage cover, coins lgrement arrondis --- */
.fro-gallery-cell {
	margin: 0;
	padding: 0;
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 6px;
	background: #e2e8f0;
}

.fro-gallery-cell-btn {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.fro-gallery-cell-btn:focus-visible {
	outline: 3px solid #2c7a7b;
	outline-offset: -3px;
	z-index: 2;
	position: relative;
}

.fro-gallery-cell img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .35s ease, opacity .3s ease;
	will-change: transform;
}

/* Survol (souris) : zoom lger, comme l'aperu Photos. */
@media (hover: hover) {
	.fro-gallery-cell-btn:hover img {
		transform: scale(1.04);
	}
}

/* --- Fallback <noscript> : liste verticale simple --- */
.fro-gallery-noscript {
	list-style: none;
	margin: 0;
	padding: 6px;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 6px;
}

.fro-gallery-noscript li {
	margin: 0;
}

.fro-gallery-noscript img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

/* ============================================================================ *
 * LIGHTBOX — visionneuse immersive pleine page
 * ============================================================================ */

.fro-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .94);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease;
	-webkit-tap-highlight-color: transparent;
	touch-action: none; /* la navigation swipe est gre en JS */
}

.fro-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

/* Conteneur image : occupe tout l'espace utile sans dformer l'image. */
.fro-lightbox-stage {
	position: relative;
	max-width: 100%;
	max-height: 100%;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.fro-lightbox-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	opacity: 0;
	transition: opacity .2s ease;
}

.fro-lightbox-img.is-loaded {
	opacity: 1;
}

/* --- Boutons de contrle : grands, accessibles, visibles au survol et au focus --- */
.fro-lightbox-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	cursor: pointer;
	font-size: 28px;
	line-height: 1;
	z-index: 3;
	transition: background .2s ease, opacity .2s ease;
	-webkit-tap-highlight-color: transparent;
}

.fro-lightbox-btn:hover {
	background: rgba(255, 255, 255, .28);
}

.fro-lightbox-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.fro-lightbox-btn:disabled {
	opacity: .25;
	cursor: default;
}

.fro-lightbox-btn.fro-prev {
	left: 12px;
}

.fro-lightbox-btn.fro-next {
	right: 12px;
}

.fro-lightbox-btn svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
}

/* --- Bouton fermer (haut droite) --- */
.fro-lightbox-close {
	position: absolute;
	top: 12px;
	right: 12px;
	transform: none;
	z-index: 4;
}

/* --- Compteur (haut gauche) --- */
.fro-lightbox-counter {
	position: absolute;
	top: 18px;
	left: 18px;
	z-index: 3;
	color: rgba(255, 255, 255, .85);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .5px;
	pointer-events: none;
}

/* --- Indicateur de chargement --- */
.fro-lightbox-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 38px;
	height: 38px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: fro-spin .8s linear infinite;
	z-index: 2;
}

@keyframes fro-spin {
	to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Mobile : boutons plus grands, toujours visibles (pas de hover), plein cran naturel --- */
@media (max-width: 768px) {
	.fro-lightbox-btn {
		width: 48px;
		height: 48px;
		font-size: 24px;
	}
	.fro-lightbox-btn.fro-prev { left: 6px; }
	.fro-lightbox-btn.fro-next { right: 6px; }
	.fro-lightbox-close { top: 8px; right: 8px; }
	.fro-lightbox-counter { top: 12px; left: 12px; font-size: 13px; }
}

/* Prfrence rduit mouvement : dsactive les transitions superflues. */
@media (prefers-reduced-motion: reduce) {
	.fro-gallery-cell img,
	.fro-lightbox,
	.fro-lightbox-img {
		transition: none;
	}
}

/* ============================================================================ *
 * MISE EN PAGE DE LA PAGE GALERIE (titre + zone principale)
 * ============================================================================ */

/* Fond neutre pour mettre les photos en valeur (pleine largeur). */
/* body en flex column + hauteur minimale : le footer reste au plus bas
 * de la page mme quand la galerie contient peu de photos (sticky footer). */
body.fro-gallery-body {
	margin: 0;
	background: #f7f9fa;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

/* Bande de titre : laisse passer le header fixe en haut. */
.fro-gallery-title-wrap {
	width: 100%;
	padding: 90px 5% 18px;
	background: #fff;
	border-bottom: 1px solid #e6e9ec;
}

.fro-gallery-title {
	margin: 0;
	font-size: clamp(1.4rem, 3.5vw, 2.2rem);
	font-weight: 700;
	color: #002a3d;
	line-height: 1.2;
}

/* Zone principale : pleine largeur. flex:1 pousse le footer vers le bas
 * (sticky footer) ; padding-bottom spare la grille du footer. */
.fro-gallery-main {
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0 0 64px;
	flex: 1 0 auto;
}
