/* ==========================================================================
   CEG Gallery — feuille de style
   Toutes les valeurs pilotées depuis Elementor passent par des variables CSS.
   ========================================================================== */

.ceg-gallery {
	--ceg-ratio: 9 / 16;
	--ceg-cols: 3;
	--ceg-gap: 14px;
	--ceg-radius: 0px;
	--ceg-placeholder: #cbbdb0;
	--ceg-hover-scale: 1.045;
	--ceg-hover-border: #c9a961;
	--ceg-hover-inset: 8px;
	--ceg-cap-overlay: rgba(18, 41, 75, 0.72);
	--ceg-cap-color: #fff;
	--ceg-meta-color: #c9a961;
	--ceg-lb-backdrop: rgba(18, 41, 75, 0.94);
	--ceg-lb-control: #fff;
	--ceg-lb-control-hover: #c9a961;
	--ceg-lb-maxh: 78vh;
	--ceg-slides: 3;
	--ceg-edge: 0px;
	--ceg-arrow-color: #fff;
	--ceg-arrow-bg: rgba(18, 41, 75, 0.75);
	--ceg-arrow-bg-hover: #c9a961;
	--ceg-arrow-size: 44px;
	--ceg-arrow-offset: 12px;
	--ceg-arrow-radius: 0px;
	--ceg-dot-color: #cbbdb0;
	--ceg-dot-active: #c9a961;
	--ceg-dot-size: 8px;
	--ceg-dots-gap: 18px;
}

/* --- Slider --------------------------------------------------------------- */

.ceg-gallery--slider {
	position: relative;
}

.ceg-gallery__viewport {
	overflow: hidden;
}

.ceg-gallery__track {
	display: flex;
	gap: var(--ceg-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	padding-inline: var(--ceg-edge);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scroll-padding-inline: var(--ceg-edge);
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

/* Mode ruban : aucune aimantation, le mouvement doit rester continu. */
.ceg-gallery--marquee .ceg-gallery__track {
	scroll-snap-type: none;
}

.ceg-gallery--marquee .ceg-gallery__track > .ceg-item {
	scroll-snap-align: none;
}

/* Pendant le glissement piloté en JS, on désactive l'aimantation :
   les deux mécanismes se battent et c'est ce qui produit les à-coups. */
.ceg-gallery__track.is-animating {
	scroll-snap-type: none;
}

.ceg-gallery__track::-webkit-scrollbar {
	display: none;
}

.ceg-gallery__track > .ceg-item {
	flex: 0 0 calc((100% - (2 * var(--ceg-edge)) - (var(--ceg-slides) - 1) * var(--ceg-gap)) / var(--ceg-slides));
	min-width: 0;
	scroll-snap-align: start;
}

/* Les thèmes habillent volontiers tous les <button> du site (fond, bordure,
   largeur pleine). On impose donc la géométrie de la flèche. */
.ceg-gallery__nav {
	position: absolute !important;
	top: 50%;
	z-index: 3;
	display: grid !important;
	place-items: center;
	flex: none !important;
	width: var(--ceg-arrow-size, 44px) !important;
	height: var(--ceg-arrow-size, 44px) !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: var(--ceg-arrow-radius, 0) !important;
	background: var(--ceg-arrow-bg, rgba(18, 41, 75, 0.75)) !important;
	box-shadow: none !important;
	color: var(--ceg-arrow-color, #fff) !important;
	font-size: 0 !important;
	line-height: 1 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	cursor: pointer;
	transform: translateY(-50%);
	transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.ceg-gallery__nav--prev { left: var(--ceg-arrow-offset); }
.ceg-gallery__nav--next { right: var(--ceg-arrow-offset); }

.ceg-gallery__nav:hover {
	background: var(--ceg-arrow-bg-hover, #c9a961) !important;
}

.ceg-gallery__nav:focus-visible {
	outline: 2px solid var(--ceg-arrow-bg-hover);
	outline-offset: 3px;
}

.ceg-gallery__nav[disabled] {
	opacity: 0.25;
	cursor: default;
}

.ceg-gallery__nav svg {
	display: block !important;
	width: 40% !important;
	height: 40% !important;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ceg-gallery__dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin-top: var(--ceg-dots-gap);
}

.ceg-gallery__dots:empty {
	display: none;
}

.ceg-gallery__dot {
	flex: none !important;
	width: var(--ceg-dot-size, 8px) !important;
	height: var(--ceg-dot-size, 8px) !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: var(--ceg-dot-color, #cbbdb0) !important;
	box-shadow: none !important;
	font-size: 0 !important;
	line-height: 1 !important;
	cursor: pointer;
	transition: background 0.25s ease, transform 0.25s ease;
}

.ceg-gallery__dot.is-active {
	background: var(--ceg-dot-active, #c9a961) !important;
	transform: scale(1.3);
}

.ceg-gallery__dot:focus-visible {
	outline: 2px solid var(--ceg-dot-active);
	outline-offset: 3px;
}

.ceg-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--ceg-cols), minmax(0, 1fr));
	gap: var(--ceg-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* --- Tuile ---------------------------------------------------------------- */

.ceg-gallery .ceg-item {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--ceg-placeholder);
	border-radius: var(--ceg-radius);
	aspect-ratio: var(--ceg-ratio);
	overflow: hidden;
	-webkit-appearance: none;
	appearance: none;
}

.ceg-gallery[data-ceg-lightbox="1"] .ceg-item {
	cursor: zoom-in;
}

.ceg-gallery .ceg-item__img {
	--ceg-focus-x: 50%;
	--ceg-focus-y: 50%;
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: var(--ceg-focus-x) var(--ceg-focus-y);
	transition: transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ceg-gallery .ceg-item:hover .ceg-item__img,
.ceg-gallery .ceg-item:focus-visible .ceg-item__img {
	transform: scale(var(--ceg-hover-scale));
}

/* Filet intérieur au survol */
.ceg-gallery .ceg-item::after {
	content: "";
	position: absolute;
	inset: var(--ceg-hover-inset);
	border: 1px solid var(--ceg-hover-border);
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: none;
}

.ceg-gallery .ceg-item:hover::after,
.ceg-gallery .ceg-item:focus-visible::after {
	opacity: 0.85;
}

.ceg-gallery .ceg-item:focus-visible {
	outline: 2px solid var(--ceg-hover-border);
	outline-offset: 3px;
}

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

.ceg-gallery .ceg-item__cap {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: block;
	padding: 30px 16px 14px;
	text-align: left;
	background: linear-gradient(to top, var(--ceg-cap-overlay), transparent);
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: none;
}

.ceg-gallery--caps-visible .ceg-item__cap,
.ceg-gallery .ceg-item:hover .ceg-item__cap,
.ceg-gallery .ceg-item:focus-visible .ceg-item__cap {
	opacity: 1;
}

.ceg-gallery .ceg-item__title {
	display: block;
	color: var(--ceg-cap-color);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.04em;
	line-height: 1.35;
}

.ceg-gallery .ceg-item__meta {
	display: block;
	margin-top: 3px;
	color: var(--ceg-meta-color);
	font-size: 11.5px;
	font-weight: 400;
	letter-spacing: 0.05em;
}

/* ==========================================================================
   Fenêtre de zoom — injectée dans <body>, hérite des variables via inline style
   ========================================================================== */

.ceg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 4vmin;
	background: var(--ceg-lb-backdrop, rgba(18, 41, 75, 0.94));
}

.ceg-lb.is-open {
	display: flex;
}

.ceg-lb__fig {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	animation: ceg-lb-in 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes ceg-lb-in {
	from { opacity: 0; transform: scale(0.985); }
	to   { opacity: 1; transform: scale(1); }
}

/* contain : l'image est toujours affichée en entier, jamais recadrée */
.ceg-lb__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: var(--ceg-lb-maxh, 78vh);
	object-fit: contain;
}

.ceg-lb__cap {
	text-align: center;
	color: var(--ceg-lb-control, #fff);
	font-size: 13.5px;
	font-weight: 500;
	letter-spacing: 0.05em;
}

.ceg-lb__cap b {
	font-weight: 500;
}

.ceg-lb__cap i {
	font-style: normal;
	margin-left: 10px;
	font-weight: 400;
	color: var(--ceg-meta-color, #c9a961);
}

.ceg-lb__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	cursor: pointer;
	background: transparent;
	color: var(--ceg-lb-control, #fff);
	border: 1px solid currentColor;
	opacity: 0.55;
	transition: opacity 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.ceg-lb__btn:hover {
	opacity: 1;
	color: var(--ceg-lb-control-hover, #c9a961);
	background: rgba(255, 255, 255, 0.06);
}

.ceg-lb__btn:focus-visible {
	opacity: 1;
	outline: 2px solid var(--ceg-lb-control-hover, #c9a961);
	outline-offset: 2px;
}

.ceg-lb__btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ceg-lb__close { top: 20px; right: 20px; }
.ceg-lb__prev  { left: 20px;  top: 50%; transform: translateY(-50%); }
.ceg-lb__next  { right: 20px; top: 50%; transform: translateY(-50%); }

.ceg-lb__count {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	color: var(--ceg-lb-control, #fff);
	opacity: 0.65;
	font-size: 12px;
	letter-spacing: 0.12em;
}

.ceg-lb--single .ceg-lb__prev,
.ceg-lb--single .ceg-lb__next,
.ceg-lb--single .ceg-lb__count {
	display: none;
}

body.ceg-lb-open {
	overflow: hidden;
}

/* --- Adaptatif ------------------------------------------------------------ */

@media (max-width: 600px) {
	.ceg-lb__prev { left: 8px; }
	.ceg-lb__next { right: 8px; }
	.ceg-lb__btn  { width: 42px; height: 42px; }
	.ceg-lb__img  { max-height: 68vh; }
}

@media (prefers-reduced-motion: reduce) {
	.ceg-gallery__track { scroll-snap-type: x mandatory; }
	.ceg-gallery .ceg-item__img,
	.ceg-gallery .ceg-item__cap { transition: none; }
	.ceg-gallery .ceg-item:hover .ceg-item__img { transform: none; }
	.ceg-lb__fig { animation: none; }
}
