/**
 * Rigauds Gallery — styles publics.
 * Namespace : .rgg (grille), .rgg-modal (fenêtre), .rgg-lb (visionneuse).
 * Les variables --rgg-* sont posées par le CSS d'instance généré (valeurs validées).
 */

/* ------------------------------------------------------------------ */
/* Racine + grille d'accueil                                          */
/* ------------------------------------------------------------------ */

/* Identité Domaine des Rigauds : palette et typos du site
   (Mulish pour le texte, freightdispcmp-pro pour les titres). */
.rgg,
.rgg-modal,
.rgg-lb {
	--rgg-ink: #121E14;
	--rgg-cream: #FBF9F4;
	--rgg-beige: #EFECE6;
	--rgg-mist: #DDEDE0;
	--rgg-muted: #5C6A5E;
	--rgg-serif: "freightdispcmp-pro", "Freight Disp Pro", Georgia, serif;
	font-family: "Mulish", system-ui, sans-serif;
}

.rgg {
	position: relative;
	width: 100%;
	max-width: 100%;
	--rgg-gap: 8px;
	--rgg-radius: 12px;
	--rgg-height: 480px;
	--rgg-cols: repeat(4, minmax(0, 1fr));
	--rgg-rows: repeat(2, minmax(0, 1fr));
	--rgg-accent: #37503D;
	--rgg-z: 99990;
}

/* Occupe toute la largeur du conteneur flexbox Elementor. */
.elementor-widget-rigaux_gallery {
	width: 100%;
}

.rgg-grid {
	display: grid;
	grid-template-columns: var(--rgg-cols);
	grid-template-rows: var(--rgg-rows);
	grid-auto-flow: row dense;
	gap: var(--rgg-gap);
	height: var(--rgg-height);
}

.rgg--radius-outer .rgg-grid {
	border-radius: var(--rgg-radius);
	overflow: hidden;
}

.rgg--radius-all .rgg-item {
	border-radius: var(--rgg-radius);
}

.rgg-item {
	position: relative;
	margin: 0;
	overflow: hidden;
	grid-column: span var(--w, 1);
	grid-row: span var(--h, 1);
	background: var(--rgg-beige, #EFECE6);
}

.rgg-item .rgg-img,
.rgg-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rgg-item__btn {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.rgg-item__btn:focus-visible {
	outline: 3px solid var(--rgg-cream, #FBF9F4);
	outline-offset: -3px;
}

/* Survols */
.rgg--hover-zoom .rgg-item img {
	transition: transform 0.4s ease;
}

@media (hover: hover) {
	.rgg--hover-zoom .rgg-item:hover img {
		transform: scale(1.045);
	}
}

.rgg--hover-dim .rgg-item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: #000;
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

@media (hover: hover) {
	.rgg--hover-dim .rgg-item:hover::after {
		opacity: 0.14;
	}
}

/* ------------------------------------------------------------------ */
/* Bouton « Afficher toutes les photos »                               */
/* ------------------------------------------------------------------ */

/* Reprend le bouton du site (nav) : beige, filet vert-noir, ombre interne,
   lévitation au survol. Chaque état repose fond/texte/bordure : aucun style
   global de boutons (thème ou kit Elementor) ne peut s'y substituer. */
.rgg-open {
	position: absolute;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.1;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	white-space: nowrap;
}

.rgg-open:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 2px;
}

.rgg-open--light,
.rgg-open--light:hover,
.rgg-open--light:focus,
.rgg-open--light:active {
	background: var(--rgg-beige, #EFECE6);
	color: var(--rgg-ink, #121E14);
	border: 0.5px solid var(--rgg-ink, #121E14);
	box-shadow: 0 0 15px 0 #E9E6E0 inset;
}

.rgg-open--dark,
.rgg-open--dark:hover,
.rgg-open--dark:focus,
.rgg-open--dark:active {
	background: rgba(18, 30, 20, 0.92);
	color: var(--rgg-cream, #FBF9F4);
	border: 1px solid rgba(251, 249, 244, 0.35);
}

.rgg-open--accent,
.rgg-open--accent:hover,
.rgg-open--accent:focus,
.rgg-open--accent:active {
	background: var(--rgg-accent);
	color: var(--rgg-cream, #FBF9F4);
	border: 1px solid var(--rgg-accent);
}

@media (hover: hover) {
	.rgg-open:hover {
		transform: translateY(-3px);
		box-shadow: 0 6px 16px rgba(18, 30, 20, 0.16);
	}

	.rgg-open--light:hover {
		box-shadow: 0 0 15px 0 #E9E6E0 inset, 0 6px 16px rgba(18, 30, 20, 0.16);
	}
}

.rgg-open:active {
	transform: scale(0.97);
}

.rgg-open--br { right: 20px; bottom: 20px; }
.rgg-open--bl { left: 20px; bottom: 20px; }
.rgg-open--tr { right: 20px; top: 20px; }
.rgg-open--tl { left: 20px; top: 20px; }
.rgg-open--center {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

@media (hover: hover) {
	.rgg-open--center:hover {
		transform: translate(-50%, calc(-50% - 3px));
	}
}

.rgg-open--center:active {
	transform: translate(-50%, -50%) scale(0.97);
}

/* Compteur du carrousel mobile */
.rgg-badge {
	display: none;
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(18, 30, 20, 0.72);
	color: var(--rgg-cream, #FBF9F4);
	font-size: 12px;
	font-weight: 500;
	pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Carrousel (preset carousel) : grande photo + bande de miniatures    */
/* ------------------------------------------------------------------ */

.rgg-car__stage {
	position: relative;
}

/* La grille devient une piste à balayage (mêmes règles que le
   carrousel mobile, mais à toutes les largeurs d'écran). */
.rgg--carousel .rgg-grid {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.rgg--carousel .rgg-grid::-webkit-scrollbar {
	display: none;
}

.rgg--carousel .rgg-item {
	flex: 0 0 100%;
	scroll-snap-align: center;
	height: 100%;
}

.rgg--carousel .rgg-badge {
	display: block;
}

/* Flèches — même famille que le bouton « light » du site. */
.rgg-car__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0.5px solid var(--rgg-ink, #121E14);
	border-radius: 50%;
	background: var(--rgg-beige, #EFECE6);
	color: var(--rgg-ink, #121E14);
	box-shadow: 0 0 15px 0 #E9E6E0 inset;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.rgg-car__prev { left: 14px; }
.rgg-car__next { right: 14px; }

@media (hover: hover) {
	.rgg-car__nav:hover {
		box-shadow: 0 0 15px 0 #E9E6E0 inset, 0 6px 16px rgba(18, 30, 20, 0.16);
	}
}

.rgg-car__nav:active {
	transform: translateY(-50%) scale(0.94);
}

.rgg-car__nav:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 2px;
}

/* Bande de miniatures. Gap doublé : seul espace visible du carrousel,
   il donne le côté aéré de la maquette. --rgg-thumbs = visibles. */
.rgg-car__thumbs {
	display: flex;
	gap: calc(var(--rgg-gap) * 2);
	margin-top: calc(var(--rgg-gap) * 2);
	overflow-x: auto;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.rgg-car__thumbs::-webkit-scrollbar {
	display: none;
}

.rgg-car__thumb {
	flex: 0 0 calc((100% - (var(--rgg-thumbs, 3) - 1) * var(--rgg-gap) * 2) / var(--rgg-thumbs, 3));
	aspect-ratio: 16 / 9;
	padding: 0;
	border: 0;
	border-radius: var(--rgg-radius);
	overflow: hidden;
	background: var(--rgg-beige, #EFECE6);
	cursor: pointer;
	scroll-snap-align: start;
	opacity: 0.7;
	transition: opacity 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.rgg--radius-none .rgg-car__thumb {
	border-radius: 0;
}

.rgg-car__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rgg-car__thumb.is-active {
	opacity: 1;
}

@media (hover: hover) {
	.rgg-car__thumb:hover {
		opacity: 1;
	}
}

.rgg-car__thumb:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 2px;
}

/* Message éditeur (galerie vide) */
.rgg-empty {
	padding: 14px 16px;
	border: 1px dashed #C9D3C7;
	border-radius: 8px;
	background: #F4F6F1;
	color: #37503D;
	font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Mobile : carrousel / empilé / grille                                */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
	/* Carrousel à balayage (façon Airbnb) */
	.rgg--m-carousel .rgg-grid {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.rgg--m-carousel .rgg-grid::-webkit-scrollbar {
		display: none;
	}

	.rgg--m-carousel .rgg-item {
		flex: 0 0 100%;
		scroll-snap-align: center;
		height: 100%;
	}

	.rgg--m-carousel .rgg-badge {
		display: block;
	}

	/* Photos empilées */
	.rgg--m-stack .rgg-grid {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		grid-auto-rows: 58vw;
		height: auto;
	}

	.rgg--m-stack .rgg-item {
		grid-column: span 1 !important;
		grid-row: span 1 !important;
	}

	.rgg--m-stack .rgg-item--m-hide {
		display: none;
	}

	/* Petite grille 2 colonnes */
	.rgg--m-grid .rgg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: none;
		grid-auto-rows: 32vw;
		height: auto;
	}

	.rgg--m-grid .rgg-item {
		grid-column: span 1 !important;
		grid-row: span 1 !important;
	}

	.rgg-open {
		font-size: 13px;
		padding: 8px 13px;
	}

	/* Carrousel : balayage tactile, pas de flèches. */
	.rgg-car__nav {
		display: none;
	}
}

/* ------------------------------------------------------------------ */
/* Fenêtre « toutes les photos »                                       */
/* ------------------------------------------------------------------ */

html.rgg-lock,
body.rgg-lock {
	overflow: hidden !important;
}

.rgg-modal {
	position: fixed;
	inset: 0;
	z-index: var(--rgg-z, 99990);
	display: flex;
	flex-direction: column;
	background: var(--rgg-cream, #FBF9F4);
	color: var(--rgg-ink, #121E14);
	visibility: hidden;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
	pointer-events: none;
}

.rgg-modal.is-open {
	visibility: visible;
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.rgg-modal__bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 14px;
	height: 64px;
	padding: 0 22px;
	background: var(--rgg-cream, #FBF9F4);
	border-bottom: 1px solid var(--rgg-beige, #EFECE6);
}

.rgg-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rgg-ink, #121E14);
	cursor: pointer;
	flex: 0 0 auto;
}

.rgg-modal__close:hover,
.rgg-modal__close:focus {
	background: var(--rgg-mist, #DDEDE0);
	color: var(--rgg-ink, #121E14);
}

.rgg-modal__close:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 2px;
}

.rgg-modal__title {
	font-size: 15px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rgg-modal__scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.rgg-modal__inner {
	max-width: 1128px;
	margin: 0 auto;
	padding: 18px 24px 90px;
}

.rgg-modal__heading {
	margin: 18px 0 22px;
	font-family: var(--rgg-serif, Georgia, serif);
	font-size: 34px;
	font-style: italic;
	font-weight: 300;
	line-height: 1.1;
	color: var(--rgg-accent, #37503D);
}

/* Navigation par espaces (« Visite photo ») */
.rgg-nav {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 20px 14px;
	margin: 0 0 30px;
}

.rgg-nav__item,
.rgg-nav__item:hover,
.rgg-nav__item:focus {
	display: block;
	text-decoration: none;
	color: inherit;
}

.rgg-nav__thumb {
	display: block;
	aspect-ratio: 20 / 13;
	border-radius: 8px;
	overflow: hidden;
	background: var(--rgg-beige, #EFECE6);
}

.rgg-nav__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

@media (hover: hover) {
	.rgg-nav__item:hover .rgg-nav__thumb img {
		transform: scale(1.05);
	}

	.rgg-nav__item:hover .rgg-nav__label {
		color: var(--rgg-accent, #37503D);
	}
}

.rgg-nav__label {
	display: block;
	margin-top: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	transition: color 0.2s ease;
}

.rgg-nav__count {
	display: block;
	font-size: 12px;
	color: var(--rgg-muted, #5C6A5E);
}

.rgg-nav__item:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 3px;
	border-radius: 8px;
}

/* Sections par espace */
.rgg-sec {
	display: grid;
	grid-template-columns: minmax(170px, 250px) minmax(0, 1fr);
	gap: 0 36px;
	padding: 26px 0;
}

/* Filet fin entre les espaces, façon édition. */
.rgg-sec + .rgg-sec {
	border-top: 1px solid var(--rgg-beige, #EFECE6);
}

.rgg-sec__head {
	position: sticky;
	top: 14px;
	align-self: start;
}

.rgg-sec__title {
	margin: 0;
	font-family: var(--rgg-serif, Georgia, serif);
	font-size: 26px;
	font-style: italic;
	font-weight: 300;
	line-height: 1.15;
	color: var(--rgg-accent, #37503D);
}

.rgg-sec__title:focus {
	outline: none;
}

.rgg-sec__count {
	margin-top: 4px;
	font-size: 13px;
	color: var(--rgg-muted, #5C6A5E);
}

.rgg-sec__photos {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.rgg-row {
	display: grid;
	gap: 14px;
}

.rgg-row--1 { grid-template-columns: minmax(0, 1fr); }
.rgg-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rgg-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rgg-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.rgg-ph {
	margin: 0;
	min-width: 0;
}

.rgg-ph img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	border-radius: 8px;
	background: var(--rgg-beige, #EFECE6);
}

.rgg-row--1 .rgg-ph img { aspect-ratio: 3 / 2; }
.rgg-row--2 .rgg-ph img { aspect-ratio: 1 / 1; }
.rgg-row--3 .rgg-ph img { aspect-ratio: 1 / 1; }
.rgg-row--4 .rgg-ph img { aspect-ratio: 1 / 1; }

.rgg-ph__btn {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
	-webkit-appearance: none;
	appearance: none;
}

.rgg-ph__btn:focus-visible {
	outline: 2px solid var(--rgg-accent);
	outline-offset: 3px;
	border-radius: 8px;
}

.rgg-ph__cap {
	padding-top: 6px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--rgg-muted, #5C6A5E);
}

@media (max-width: 1023px) {
	.rgg-sec {
		display: block;
		padding: 22px 0;
	}

	.rgg-sec__head {
		position: static;
		margin-bottom: 12px;
	}
}

@media (max-width: 767px) {
	.rgg-modal__bar {
		height: 56px;
		padding: 0 14px;
	}

	.rgg-modal__inner {
		padding: 12px 16px 70px;
	}

	.rgg-modal__heading {
		font-size: 26px;
	}

	.rgg-sec__title {
		font-size: 22px;
	}

	.rgg-nav {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px 10px;
	}

	.rgg-row--2,
	.rgg-row--3,
	.rgg-row--4 {
		gap: 10px;
	}
}

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

.rgg-lb {
	position: fixed;
	inset: 0;
	z-index: calc(var(--rgg-z, 99990) + 5);
	background: #101812;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.2s ease, visibility 0.2s;
	pointer-events: none;
	touch-action: pan-y;
}

.rgg-lb.is-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.rgg-lb__bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	padding: 12px 16px;
}

.rgg-lb__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rgg-cream, #FBF9F4);
	cursor: pointer;
}

.rgg-lb__close:hover {
	background: rgba(251, 249, 244, 0.16);
	color: var(--rgg-cream, #FBF9F4);
}

.rgg-lb__counter {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	color: var(--rgg-cream, #FBF9F4);
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.02em;
}

.rgg-lb__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px 68px;
}

.rgg-lb__fig {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.rgg-lb__img {
	max-width: 100%;
	max-height: calc(100vh - 150px);
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	border-radius: 2px;
	transition: opacity 0.18s ease;
}

.rgg-lb__img.is-loading {
	opacity: 0.35;
}

.rgg-lb__cap {
	margin-top: 12px;
	max-width: 720px;
	color: rgba(251, 249, 244, 0.85);
	font-size: 13px;
	line-height: 1.45;
	text-align: center;
}

.rgg-lb__cap:empty {
	display: none;
}

.rgg-lb__prev,
.rgg-lb__next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(251, 249, 244, 0.35);
	border-radius: 50%;
	background: rgba(16, 24, 18, 0.35);
	color: var(--rgg-cream, #FBF9F4);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.rgg-lb__prev { left: 16px; }
.rgg-lb__next { right: 16px; }

.rgg-lb__prev:hover,
.rgg-lb__next:hover {
	background: rgba(76, 162, 95, 0.32);
	border-color: rgba(76, 162, 95, 0.55);
	color: var(--rgg-cream, #FBF9F4);
}

.rgg-lb__close:focus-visible,
.rgg-lb__prev:focus-visible,
.rgg-lb__next:focus-visible {
	outline: 2px solid var(--rgg-cream, #FBF9F4);
	outline-offset: 2px;
}

@media (max-width: 767px) {
	.rgg-lb__stage {
		padding: 56px 10px 70px;
	}

	.rgg-lb__prev,
	.rgg-lb__next {
		top: auto;
		bottom: 14px;
		transform: none;
		width: 40px;
		height: 40px;
	}

	.rgg-lb__prev { left: 14px; }
	.rgg-lb__next { right: 14px; }

	.rgg-lb__img {
		max-height: calc(100vh - 140px);
	}
}

/* ------------------------------------------------------------------ */
/* Divers                                                              */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.rgg *,
	.rgg-modal,
	.rgg-modal *,
	.rgg-lb,
	.rgg-lb * {
		transition: none !important;
	}
}

@media print {
	.rgg-open,
	.rgg-badge {
		display: none !important;
	}
}
