/* =========================================================
   CUNSE — Galerie photos
   Mosaïque animée, filtres, visionneuse plein écran
   ========================================================= */

.cunse-gal {
	--cg-bleu: #046bd2;
	--cg-bleu-fonce: #045cb4;
	--cg-encre: #1e293b;
	--cg-gris: #64748b;
	--cg-clair: #f0f5fa;
	--cg-blanc: #fff;
	--cg-radius: 16px;
	--cg-cols: 4;
	--cg-gap: 18px;
	--cg-ombre: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .25);
	--cg-ombre-h: 0 12px 32px -10px rgba(4, 107, 210, .38);

	position: relative;
	margin: 0 0 2.5rem;
	font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
	color: var(--cg-encre);
}

.cunse-gal *,
.cunse-gal *::before,
.cunse-gal *::after {
	box-sizing: border-box;
}

/* ---------- Bandeau d'en-tête ---------- */

.cunse-gal-hero {
	position: relative;
	margin: 0 0 2rem;
	padding: 46px 34px;
	border-radius: 20px;
	background: linear-gradient(120deg, #0b2f8a 0%, #0a1f5c 100%);
	color: #fff;
	text-align: center;
	overflow: hidden;
	box-shadow: 0 24px 48px -30px rgba(10, 31, 92, .9);
}

.cunse-gal-hero::after {
	content: "";
	position: absolute;
	top: -60%;
	right: -10%;
	width: 55%;
	height: 220%;
	background: radial-gradient(ellipse at center, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 65%);
	pointer-events: none;
}

.cunse-gal-hero-surtitre {
	display: block;
	margin-bottom: .55rem;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .74rem;
	font-weight: 700;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .72);
}

.cunse-gal-hero-titre {
	margin: 0 0 .6rem;
	color: #fff;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: clamp(1.8rem, 4vw, 2.9rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -.01em;
}

.cunse-gal-hero-soustitre {
	max-width: 62ch;
	margin: 0 auto;
	color: rgba(255, 255, 255, .85);
	font-size: 1rem;
	line-height: 1.6;
}

.cunse-gal-hero-compteur {
	display: inline-block;
	margin-top: 1.1rem;
	padding: 6px 16px;
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 999px;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .78rem;
	font-weight: 600;
	letter-spacing: .06em;
	color: rgba(255, 255, 255, .9);
}

/* ---------- Introduction ---------- */

.cunse-gal-intro {
	max-width: 68ch;
	margin: 0 auto 1.75rem;
	text-align: center;
	color: var(--cg-gris);
	font-size: 1.02rem;
	line-height: 1.65;
}

.cunse-gal-intro p:last-child {
	margin-bottom: 0;
}

/* ---------- Filtres ---------- */

.cunse-gal-filtres-front {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 0 0 1.75rem;
	padding: 0;
}

.cunse-gal-filtre {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 9px 16px;
	border: 1px solid #dbe4ef;
	border-radius: 999px;
	background: var(--cg-blanc);
	color: var(--cg-encre);
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .84rem;
	font-weight: 600;
	letter-spacing: .01em;
	line-height: 1.2;
	cursor: pointer;
	transition: color .25s ease, background-color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.cunse-gal-filtre:hover,
.cunse-gal-filtre:focus-visible {
	border-color: var(--cg-bleu);
	color: var(--cg-bleu);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px -10px rgba(4, 107, 210, .55);
	outline: none;
}

.cunse-gal-filtre.is-actif {
	border-color: transparent;
	background: linear-gradient(135deg, var(--cg-bleu) 0%, var(--cg-bleu-fonce) 100%);
	color: #fff;
	box-shadow: var(--cg-ombre-h);
}

.cunse-gal-filtre-nb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--cg-clair);
	color: var(--cg-gris);
	font-size: .72rem;
	font-weight: 700;
	transition: background-color .25s ease, color .25s ease;
}

.cunse-gal-filtre.is-actif .cunse-gal-filtre-nb {
	background: rgba(255, 255, 255, .22);
	color: #fff;
}

/* ---------- Mosaïque ---------- */

.cunse-gal-grille-front {
	column-count: var(--cg-cols);
	column-gap: var(--cg-gap);
}

.cunse-gal-item {
	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 var(--cg-gap);
	padding: 0;
	border-radius: var(--cg-radius);
	background: var(--cg-clair);
	overflow: hidden;
	box-shadow: var(--cg-ombre);
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	transform: translateZ(0);
	transition: box-shadow .35s ease, transform .35s ease;
}

.cunse-gal-item.est-masque,
.cunse-gal-item.est-filtre {
	display: none;
}

.cunse-gal-item:hover {
	box-shadow: var(--cg-ombre-h);
	transform: translateY(-3px);
}

.cunse-gal-item > button.cunse-gal-ouvre {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: zoom-in;
	appearance: none;
	-webkit-appearance: none;
}

.cunse-gal-item > button.cunse-gal-ouvre:focus-visible {
	outline: 3px solid var(--cg-bleu);
	outline-offset: 3px;
}

.cunse-gal-media {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: var(--cg-ratio, 1.5);
	overflow: hidden;
	background:
		linear-gradient(100deg, #e8eef6 20%, #f5f8fc 40%, #e8eef6 60%)
		#e8eef6;
	background-size: 300% 100%;
	animation: cunse-gal-skeleton 1.4s ease-in-out infinite;
}

.cunse-gal-item.est-chargee .cunse-gal-media {
	animation: none;
	background: #e8eef6;
}

@keyframes cunse-gal-skeleton {
	0%   { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

.cunse-gal-media img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	opacity: 0;
	transform: scale(1.02);
	transition: opacity .6s ease, transform .7s cubic-bezier(.22, .61, .36, 1);
}

.cunse-gal-item.est-chargee .cunse-gal-media img {
	opacity: 1;
	transform: scale(1);
}

.cunse-gal-item:hover .cunse-gal-media img,
.cunse-gal-ouvre:focus-visible .cunse-gal-media img {
	transform: scale(1.06);
}

/* ---------- Légende ---------- */

.cunse-gal-legende {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 44px 16px 14px;
	background: linear-gradient(to top, rgba(8, 21, 40, .88) 0%, rgba(8, 21, 40, .55) 45%, rgba(8, 21, 40, 0) 100%);
	color: #fff;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity .35s ease, transform .35s cubic-bezier(.22, .61, .36, 1);
	pointer-events: none;
}

.cunse-gal-item:hover .cunse-gal-legende,
.cunse-gal-ouvre:focus-visible .cunse-gal-legende {
	opacity: 1;
	transform: translateY(0);
}

.cunse-gal-legende-titre {
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .95rem;
	font-weight: 700;
	line-height: 1.3;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.cunse-gal-legende-meta {
	font-size: .78rem;
	font-weight: 500;
	opacity: .88;
	letter-spacing: .01em;
}

/* ---------- Loupe ---------- */

.cunse-gal-loupe {
	position: absolute;
	top: 12px;
	right: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: var(--cg-bleu);
	box-shadow: 0 4px 12px -4px rgba(15, 23, 42, .4);
	opacity: 0;
	transform: scale(.75) translateY(-4px);
	transition: opacity .3s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
	pointer-events: none;
}

.cunse-gal-loupe svg {
	display: block;
	width: 20px;
	height: 20px;
	max-width: none;
}

.cunse-gal-item:hover .cunse-gal-loupe,
.cunse-gal-ouvre:focus-visible .cunse-gal-loupe {
	opacity: 1;
	transform: scale(1) translateY(0);
}

/* ---------- Apparition au défilement ---------- */

.cunse-gal--anim .cunse-gal-item {
	opacity: 0;
	transform: translateY(22px) scale(.985);
	transition: opacity .6s cubic-bezier(.22, .61, .36, 1), transform .6s cubic-bezier(.22, .61, .36, 1), box-shadow .35s ease;
}

.cunse-gal--anim .cunse-gal-item.est-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.cunse-gal--anim .cunse-gal-item.est-visible:hover {
	transform: translateY(-3px) scale(1);
}

/* Réapparition lors d'un changement de filtre */
.cunse-gal--anim .cunse-gal-item.est-nouvelle {
	animation: cunse-gal-pop .5s cubic-bezier(.22, .61, .36, 1) both;
}

@keyframes cunse-gal-pop {
	from { opacity: 0; transform: translateY(14px) scale(.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Bouton « voir plus » ---------- */

.cunse-gal-plus-zone {
	display: flex;
	justify-content: center;
	margin-top: 1.5rem;
}

.cunse-gal-plus {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 26px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--cg-bleu) 0%, var(--cg-bleu-fonce) 100%);
	color: #fff;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .9rem;
	font-weight: 700;
	letter-spacing: .02em;
	cursor: pointer;
	box-shadow: var(--cg-ombre-h);
	transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}

.cunse-gal-plus:hover {
	transform: translateY(-2px);
	filter: brightness(1.06);
	box-shadow: 0 16px 34px -12px rgba(4, 107, 210, .55);
}

.cunse-gal-plus-reste {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .22);
	font-size: .76rem;
}

.cunse-gal-compte {
	margin: 1rem 0 0;
	color: var(--cg-gris);
	font-size: .82rem;
	text-align: center;
}

/* ---------- Visionneuse plein écran ---------- */

.cunse-gal-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3.5rem 1rem 5.5rem;
	background: rgba(6, 14, 27, .94);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s ease;
}

.cunse-gal-lb.est-ouverte {
	opacity: 1;
	visibility: visible;
}

.cunse-gal-lb-scene {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: min(1400px, 100%);
	max-height: 100%;
}

.cunse-gal-lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 9rem);
	border-radius: 10px;
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
	opacity: 0;
	transform: scale(.965);
	transition: opacity .35s ease, transform .45s cubic-bezier(.22, .61, .36, 1);
}

.cunse-gal-lb-img.est-prete {
	opacity: 1;
	transform: scale(1);
}

.cunse-gal-lb-img.va-gauche { animation: cunse-gal-slide-g .45s cubic-bezier(.22,.61,.36,1) both; }
.cunse-gal-lb-img.va-droite { animation: cunse-gal-slide-d .45s cubic-bezier(.22,.61,.36,1) both; }

@keyframes cunse-gal-slide-g {
	from { opacity: 0; transform: translateX(38px) scale(.97); }
	to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes cunse-gal-slide-d {
	from { opacity: 0; transform: translateX(-38px) scale(.97); }
	to   { opacity: 1; transform: translateX(0) scale(1); }
}

.cunse-gal-lb-spinner {
	position: absolute;
	width: 38px;
	height: 38px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cunse-gal-spin .8s linear infinite;
	opacity: 0;
	transition: opacity .2s ease;
}

.cunse-gal-lb.est-chargement .cunse-gal-lb-spinner {
	opacity: 1;
}

@keyframes cunse-gal-spin {
	to { transform: rotate(360deg); }
}

.cunse-gal-lb-barre {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 1rem 1.5rem 1.4rem;
	background: linear-gradient(to top, rgba(6, 14, 27, .95), rgba(6, 14, 27, 0));
	color: #fff;
	text-align: center;
	pointer-events: none;
}

.cunse-gal-lb-titre {
	font-family: Montserrat, Roboto, sans-serif;
	font-size: 1.02rem;
	font-weight: 700;
}

.cunse-gal-lb-legende {
	max-width: 80ch;
	margin: 0 auto;
	font-size: .9rem;
	line-height: 1.5;
	opacity: .9;
}

.cunse-gal-lb-meta {
	font-size: .78rem;
	letter-spacing: .04em;
	text-transform: uppercase;
	opacity: .65;
}

.cunse-gal-lb-btn {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 46px;
	min-width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	cursor: pointer;
	transition: background-color .25s ease, transform .25s ease, border-color .25s ease;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.cunse-gal-lb-btn:hover,
.cunse-gal-lb-btn:focus-visible {
	background: rgba(255, 255, 255, .22);
	border-color: rgba(255, 255, 255, .5);
	transform: scale(1.08);
	outline: none;
}

.cunse-gal-lb-btn svg {
	display: block;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	max-width: none;
}

.cunse-gal-lb-prec svg,
.cunse-gal-lb-suiv svg {
	width: 22px;
	height: 22px;
}

.cunse-gal-lb-prec { top: 50%; left: 1.1rem; margin-top: -23px; }
.cunse-gal-lb-suiv { top: 50%; right: 1.1rem; margin-top: -23px; }
.cunse-gal-lb-fermer { top: 1.1rem; right: 1.1rem; }

.cunse-gal-lb-compteur {
	position: absolute;
	top: 1.4rem;
	left: 1.5rem;
	color: rgba(255, 255, 255, .75);
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .82rem;
	font-weight: 600;
	letter-spacing: .06em;
}

body.cunse-gal-fige {
	overflow: hidden;
}

/* ---------- Accès réservé ---------- */

.cunse-gal-reserve {
	max-width: 520px;
	margin: 2.5rem auto;
	padding: 2.5rem 2rem;
	border: 1px solid #dbe4ef;
	border-radius: 20px;
	background: linear-gradient(180deg, #fff 0%, #f7fafd 100%);
	box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 20px 40px -28px rgba(15, 23, 42, .4);
	text-align: center;
	font-family: Roboto, system-ui, sans-serif;
	color: #1e293b;
}

.cunse-gal-reserve-cadenas {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	margin-bottom: 1rem;
	border-radius: 50%;
	background: linear-gradient(135deg, #046bd2 0%, #045cb4 100%);
	color: #fff;
	box-shadow: 0 12px 28px -14px rgba(4, 107, 210, .8);
}

.cunse-gal-reserve h2 {
	margin: 0 0 .6rem;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: 1.35rem;
	font-weight: 700;
}

.cunse-gal-reserve > p {
	margin: 0 auto 1.5rem;
	max-width: 42ch;
	color: #64748b;
	line-height: 1.6;
}

.cunse-gal-reserve-form {
	text-align: left;
}

.cunse-gal-reserve-form label {
	display: block;
	margin-bottom: .8rem;
	font-size: .86rem;
	font-weight: 600;
	color: #334155;
}

.cunse-gal-reserve-form input[type="text"],
.cunse-gal-reserve-form input[type="password"] {
	width: 100%;
	margin-top: .3rem;
	padding: 11px 13px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: .95rem;
}

.cunse-gal-reserve-form input:focus {
	border-color: #046bd2;
	outline: 2px solid rgba(4, 107, 210, .18);
}

.cunse-gal-reserve-form .login-remember label {
	font-weight: 500;
}

.cunse-gal-reserve-form input[type="submit"] {
	width: 100%;
	padding: 12px 20px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #046bd2 0%, #045cb4 100%);
	color: #fff;
	font-family: Montserrat, Roboto, sans-serif;
	font-size: .92rem;
	font-weight: 700;
	cursor: pointer;
	transition: filter .2s ease, transform .2s ease;
}

.cunse-gal-reserve-form input[type="submit"]:hover {
	filter: brightness(1.07);
	transform: translateY(-1px);
}

.cunse-gal-reserve-liens {
	margin: .9rem 0 0;
	text-align: center;
	font-size: .85rem;
}

.cunse-gal-reserve-note {
	margin: 0;
	padding: .9rem 1rem;
	border-radius: 10px;
	background: #fff7ed;
	color: #9a3412;
	font-size: .9rem;
}

.cunse-gal-vide-front {
	padding: 2.5rem;
	border: 1px dashed #cbd5e1;
	border-radius: 16px;
	background: #f8fafc;
	color: #64748b;
	text-align: center;
}

/* ---------- Réactivité ---------- */

@media (max-width: 1200px) {
	.cunse-gal-grille-front { column-count: min(var(--cg-cols), 3); }
}

@media (max-width: 900px) {
	.cunse-gal-grille-front { column-count: 2; }
	.cunse-gal-legende { opacity: 1; transform: none; padding: 34px 12px 11px; }
	.cunse-gal-loupe { display: none; }
}

@media (max-width: 560px) {
	.cunse-gal-grille-front { column-count: 1; }
	.cunse-gal-filtres-front { gap: 8px; }
	.cunse-gal-filtre { padding: 8px 13px; font-size: .8rem; }
	.cunse-gal-lb { padding: 3rem .5rem 6rem; }
	.cunse-gal-lb-prec { left: .4rem; }
	.cunse-gal-lb-suiv { right: .4rem; }
	.cunse-gal-lb-btn { width: 40px; height: 40px; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
	.cunse-gal *,
	.cunse-gal-lb * {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}

	.cunse-gal--anim .cunse-gal-item {
		opacity: 1;
		transform: none;
	}
}

/* ---------- Impression ---------- */

@media print {
	.cunse-gal-filtres-front,
	.cunse-gal-plus-zone,
	.cunse-gal-lb { display: none !important; }
	.cunse-gal-item { break-inside: avoid; box-shadow: none; }
}
