/* =====================================================================
   Galerie Prestige — affichage sur le site
   Chaque photo est posée dans un cadre aux proportions fixes : la grille
   reste régulière quelle que soit la photo publiée.
   La typographie hérite du thème : la galerie prend la voix du site.
   ===================================================================== */

.gp {
	--gp-espacement: 16px;
	--gp-arrondi: 2px;
	--gp-espace-entete: clamp(28px, 4vw, 56px);
	--gp-voile: rgba(20, 20, 20, .38);
	--gp-fond-cadre: #ecedee;
	--gp-marge-cadre: 8%;
	--gp-ratio: 4 / 5;
	--gp-courbe: cubic-bezier(.22, .61, .21, 1);
	/* Colonnes : --gp-col (Elementor) sinon --gp-colonnes* (code court) */
	--gp-col-actif: var(--gp-col, var(--gp-colonnes, 3));
	position: relative;
}
@media (max-width: 1024px) {
	.gp { --gp-col-actif: var(--gp-col, var(--gp-colonnes-tablette, 2)); }
}
@media (max-width: 767px) {
	.gp { --gp-col-actif: var(--gp-col, var(--gp-colonnes-mobile, 1)); }
}

/* ---------- Formats des cadres ---------- */
.gp--format-carre       { --gp-ratio: 1 / 1; }
.gp--format-portrait    { --gp-ratio: 4 / 5; }
.gp--format-paysage     { --gp-ratio: 3 / 2; }
.gp--format-panoramique { --gp-ratio: 16 / 9; }

/* ---------- Titre et description ---------- */
.gp__entete,
.gp__pied {
	display: flex;
	flex-direction: column;
	align-items: start;
	gap: .9em;
}
.gp__entete { margin-bottom: var(--gp-espace-entete); }
.gp__pied { margin-top: var(--gp-espace-entete); }

.gp__titre {
	margin: 0;
	font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.75rem);
	font-weight: 400;
	line-height: 1.12;
	letter-spacing: -.015em;
	text-wrap: balance;
}
.gp__description {
	max-width: 62ch;
	font-size: 1.0625rem;
	line-height: 1.7;
	opacity: .8;
	text-wrap: pretty;
}
.gp__description > :first-child { margin-top: 0; }
.gp__description > :last-child { margin-bottom: 0; }

/* ---------- Grille ---------- */
.gp__grille {
	display: grid;
	grid-template-columns: repeat(var(--gp-col-actif), minmax(0, 1fr));
	gap: var(--gp-espacement);
	margin: 0;
	padding: 0;
}
.gp--editoriale .gp__grille { grid-auto-flow: dense; }

.gp__photo {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
	min-width: 0;
}
.gp__photo--masquee { display: none !important; }

/* ---------- Le cadre : proportions fixes ---------- */
.gp__cadre {
	position: relative;
	display: block;
	box-sizing: border-box;
	aspect-ratio: var(--gp-ratio);
	overflow: hidden;
	isolation: isolate;
	border-radius: var(--gp-arrondi);
	background: rgba(127, 127, 127, .08);
	color: inherit;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}
a.gp__cadre { cursor: zoom-in; }
a.gp__cadre:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.gp__image {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	object-fit: cover;
	transition: transform 1.4s var(--gp-courbe);
}

/* Mode 1 — Recadrer : la photo remplit le cadre (position = point de cadrage) */
.gp--remplissage-recadrer .gp__image { position: absolute; inset: 0; }

/* Mode 2 — Passe-partout : photo entière sur fond uni, marge régulière */
.gp--remplissage-passe-partout .gp__cadre {
	display: flex;
	padding: var(--gp-marge-cadre);
	background: var(--gp-fond-cadre);
}
.gp--remplissage-passe-partout .gp__image {
	object-fit: contain;
	object-position: 50% 50%;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .12));
}

/* Mode 3 — Fond flouté : photo entière sur une version floutée d'elle-même */
.gp--remplissage-flou .gp__cadre::before {
	content: "";
	position: absolute;
	inset: -14%;
	z-index: -1;
	background: var(--gp-fond-image, none) center / cover no-repeat;
	filter: blur(24px) saturate(1.15) brightness(.9);
}
.gp--remplissage-flou .gp__image {
	position: absolute;
	inset: 0;
	object-fit: contain;
	object-position: 50% 50%;
}

/* ---------- Disposition éditoriale : une grande photo toutes les six ---------- */
.gp--editoriale .gp__photo:nth-child(6n + 1) {
	grid-column: span 2;
	grid-row: span 2;
}
.gp--editoriale .gp__photo:nth-child(6n + 1) .gp__cadre {
	flex: 1 1 auto;
	aspect-ratio: auto;
	min-height: 0;
}
@media (max-width: 767px) {
	.gp--editoriale .gp__photo:nth-child(6n + 1) {
		grid-column: 1 / -1;
		grid-row: auto;
	}
	.gp--editoriale .gp__photo:nth-child(6n + 1) .gp__cadre {
		flex: none;
		aspect-ratio: 3 / 2;
	}
}

/* ---------- Légendes ---------- */
.gp__legende {
	font-size: .875rem;
	line-height: 1.45;
	letter-spacing: .01em;
}
.gp--legendes-aucune .gp__legende { display: none; }
.gp--legendes-dessous .gp__legende {
	padding-top: .7em;
	opacity: .75;
}
.gp--legendes-survol .gp__legende {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	z-index: 3;
	padding: 3.5em 1.1em 1em;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
	border-radius: 0 0 var(--gp-arrondi) var(--gp-arrondi);
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .45s var(--gp-courbe), transform .45s var(--gp-courbe);
}

/* ---------- Survols (souris uniquement) ---------- */
@media (hover: hover) {
	.gp--survol-zoom .gp__photo:hover .gp__image { transform: scale(1.045); }
	.gp--survol-voile .gp__cadre::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 2;
		background: var(--gp-voile);
		opacity: 0;
		transition: opacity .5s var(--gp-courbe);
		pointer-events: none;
	}
	.gp--survol-voile .gp__photo:hover .gp__cadre::after { opacity: 1; }
	.gp--legendes-survol .gp__photo:hover .gp__legende,
	.gp--legendes-survol .gp__photo:focus-within .gp__legende {
		opacity: 1;
		transform: none;
	}
}
/* Écrans tactiles : la légende reste visible */
@media (hover: none) {
	.gp--legendes-survol .gp__legende { opacity: 1; transform: none; }
}

/* ---------- Apparition au défilement (activée par le script) ---------- */
.gp--apparition.gp--pret .gp__photo {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity .9s var(--gp-courbe), transform .9s var(--gp-courbe);
	transition-delay: var(--gp-delai, 0ms);
}
.gp--apparition.gp--pret .gp__photo.est-visible {
	opacity: 1;
	transform: none;
}

/* ---------- Bouton « Voir toutes les photos » ---------- */
.gp__suite {
	display: flex;
	justify-content: center;
	margin-top: clamp(28px, 4vw, 48px);
}
.gp__voir-plus {
	appearance: none;
	font: inherit;
	font-size: .95rem;
	letter-spacing: .02em;
	color: inherit;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: var(--gp-arrondi);
	padding: 1em 2.2em;
	cursor: pointer;
	transition: background-color .35s var(--gp-courbe);
}
.gp__voir-plus:hover { background: rgba(127, 127, 127, .12); }
.gp__voir-plus:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.gp__voir-plus-nombre { opacity: .55; margin-left: .35em; }

/* =====================================================================
   Plein écran
   ===================================================================== */
.gp-pe {
	--pe-fond: rgba(18, 18, 20, .97);
	--pe-texte: #f1f1f1;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: grid;
	grid-template-rows: auto 1fr auto;
	background: var(--pe-fond);
	color: var(--pe-texte);
	opacity: 0;
	visibility: hidden;
	transition: opacity .4s ease, visibility 0s linear .4s;
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
	touch-action: pan-y;
}
.gp-pe.est-ouvert {
	opacity: 1;
	visibility: visible;
	transition: opacity .4s cubic-bezier(.22, .61, .21, 1), visibility 0s;
}
html.gp-pe-bloque, html.gp-pe-bloque body { overflow: hidden !important; }

.gp-pe__barre {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px clamp(16px, 3vw, 32px);
	padding-top: max(18px, env(safe-area-inset-top));
}
.gp-pe__infos { display: flex; align-items: baseline; gap: 14px; min-width: 0; opacity: .8; }
.gp-pe__compteur { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gp-pe__titre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .65; }

.gp-pe__scene {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 clamp(12px, 7vw, 96px);
}
.gp-pe__image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	opacity: 0;
	transform: scale(.985);
	transition: opacity .5s cubic-bezier(.22, .61, .21, 1), transform .7s cubic-bezier(.22, .61, .21, 1);
}
.gp-pe__image.est-chargee { opacity: 1; transform: none; }

.gp-pe__chargement {
	position: absolute;
	width: 28px; height: 28px;
	border: 1.5px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0;
	animation: gp-rotation .9s linear infinite;
	transition: opacity .3s;
	pointer-events: none;
}
.gp-pe.en-chargement .gp-pe__chargement { opacity: .5; transition-delay: .25s; }
@keyframes gp-rotation { to { transform: rotate(360deg); } }

.gp-pe__legende {
	min-height: 3.2em;
	max-width: 70ch;
	margin: 0 auto;
	padding: 16px clamp(16px, 6vw, 96px) max(22px, env(safe-area-inset-bottom));
	text-align: center;
	line-height: 1.5;
	opacity: .85;
}

.gp-pe button {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	box-shadow: none;
	-webkit-tap-highlight-color: transparent;
}
.gp-pe button:focus-visible { outline: 1.5px solid currentColor; outline-offset: 4px; border-radius: 2px; }
.gp-pe__fermer { display: inline-flex; align-items: center; gap: 10px; opacity: .8; transition: opacity .25s; }
.gp-pe__fermer:hover { opacity: 1; }
.gp-pe__fermer svg { width: 18px; height: 18px; }

.gp-pe__fleche {
	position: absolute;
	top: 50%;
	width: 56px;
	height: 96px;
	margin-top: -48px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: .6;
	transition: opacity .25s, transform .35s cubic-bezier(.22, .61, .21, 1);
}
.gp-pe__fleche:hover { opacity: 1; }
.gp-pe__fleche svg { width: 26px; height: 26px; }
.gp-pe__precedente { left: clamp(4px, 2vw, 28px); }
.gp-pe__suivante { right: clamp(4px, 2vw, 28px); }
.gp-pe__precedente:hover { transform: translateX(-3px); }
.gp-pe__suivante:hover { transform: translateX(3px); }
.gp-pe.une-seule .gp-pe__fleche { display: none; }

@media (max-width: 767px) {
	.gp-pe__scene { padding: 0; }
	.gp-pe__fleche { top: auto; bottom: -64px; margin: 0; height: 56px; width: 56px; }
	.gp-pe__legende { padding-left: 64px; padding-right: 64px; }
	.gp-pe__titre, .gp-pe__fermer-texte { display: none; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
	.gp__image,
	.gp__legende,
	.gp--apparition.gp--pret .gp__photo,
	.gp-pe,
	.gp-pe__image,
	.gp-pe__fleche {
		transition: none !important;
		transform: none !important;
	}
	.gp--apparition.gp--pret .gp__photo { opacity: 1; }
}
