/* ==========================================================================
   ESC SA – page « Réalisations » : galerie filtrable + visionneuse (lightbox)
   Couleurs et polices du thème (variables --theme-*), sans dépendance.
   ========================================================================== */

.esc-gallery-intro {
	max-width: 860px;
	margin: 0 auto 2.8em;
	text-align: center;
	font-size: 1.07em;
}
.esc-gallery-intro > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ filters */
.esc-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 0 0 2.6em;
}
.esc-gallery-filter {
	display: inline-flex;
	align-items: center;
	gap: 0.65em;
	margin: 0;
	padding: 0.85em 1.45em;
	border: 1px solid var(--theme-color-bd_color, #E7E7E7);
	border-radius: 0;
	background: transparent;
	color: var(--theme-color-text_dark, #1A1919);
	font-family: var(--theme-font-button_font-family, inherit);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.esc-gallery-filter:hover,
.esc-gallery-filter:focus-visible {
	border-color: var(--theme-color-text_dark, #1A1919);
	background: transparent;
	color: var(--theme-color-text_dark, #1A1919);
}
.esc-gallery-filter:focus-visible { outline: 2px solid var(--theme-color-text_link, #BECB0A); outline-offset: 2px; }
.esc-gallery-filter.is-active {
	border-color: var(--theme-color-text_dark, #1A1919);
	background: var(--theme-color-text_dark, #1A1919);
	color: #fff;
}
.esc-gallery-count {
	min-width: 1.9em;
	padding: 0.2em 0.5em;
	border-radius: 1em;
	background: var(--theme-color-alter_bg_hover, #F3F3F3);
	color: var(--theme-color-text, #5E5E5E);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	transition: inherit;
}
.esc-gallery-filter.is-active .esc-gallery-count {
	background: var(--theme-color-text_link, #BECB0A);
	color: var(--theme-color-text_dark, #1A1919);
}

/* ------------------------------------------------------------------ grid */
.post_content .esc-gallery-grid,
.esc-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.esc-gallery-grid.esc-gallery-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.esc-gallery-grid.esc-gallery-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.post_content .esc-gallery-grid > li,
.esc-gallery-item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}
.post_content .esc-gallery-grid > li::before { content: none; display: none; }
.esc-gallery-item[hidden] { display: none !important; }

.esc-gallery-link {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: var(--theme-color-alter_bg_hover, #F3F3F3);
	color: #fff;
	text-decoration: none;
	isolation: isolate;
}
.esc-gallery-link:focus-visible { outline: 3px solid var(--theme-color-text_link, #BECB0A); outline-offset: 3px; }
.esc-gallery-link img,
.esc-gallery-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.8s cubic-bezier(0.2, 0.65, 0.25, 1);
}
.esc-gallery-link:hover img,
.esc-gallery-link:focus-visible img { transform: scale(1.06); }

.esc-gallery-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 24px 26px;
	background: linear-gradient(to top, rgba(12, 11, 11, 0.86) 0%, rgba(12, 11, 11, 0.35) 45%, rgba(12, 11, 11, 0) 70%);
	opacity: 0;
	transition: opacity 0.4s ease;
}
.esc-gallery-link:hover .esc-gallery-overlay,
.esc-gallery-link:focus-visible .esc-gallery-overlay { opacity: 1; }
.esc-gallery-cat {
	margin-bottom: 6px;
	color: var(--theme-color-text_link, #BECB0A);
	font-family: var(--theme-font-button_font-family, inherit);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	transform: translateY(10px);
	transition: transform 0.45s ease;
}
.esc-gallery-title {
	color: #fff;
	font-family: var(--theme-font-h5_font-family, inherit);
	font-size: 19px;
	font-weight: 500;
	line-height: 1.3;
	transform: translateY(14px);
	transition: transform 0.45s ease 0.03s;
}
.esc-gallery-link:hover .esc-gallery-cat,
.esc-gallery-link:hover .esc-gallery-title,
.esc-gallery-link:focus-visible .esc-gallery-cat,
.esc-gallery-link:focus-visible .esc-gallery-title { transform: none; }
.esc-gallery-zoom {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--theme-color-text_link, #BECB0A);
	transform: scale(0.4) rotate(-90deg);
	opacity: 0;
	transition: transform 0.45s cubic-bezier(0.2, 0.65, 0.25, 1), opacity 0.3s ease;
}
.esc-gallery-zoom::before,
.esc-gallery-zoom::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 2px;
	margin: -1px 0 0 -8px;
	background: var(--theme-color-text_dark, #1A1919);
}
.esc-gallery-zoom::after { transform: rotate(90deg); }
.esc-gallery-link:hover .esc-gallery-zoom,
.esc-gallery-link:focus-visible .esc-gallery-zoom { transform: none; opacity: 1; }

.esc-gallery-caption {
	margin: 0.9em 0 0;
	line-height: 1.45;
}
.esc-gallery-caption strong {
	display: block;
	color: var(--theme-color-text_dark, #1A1919);
	font-family: var(--theme-font-h5_font-family, inherit);
	font-weight: 500;
}
.esc-gallery-caption span {
	display: block;
	margin-top: 0.15em;
	color: var(--theme-color-text_light, #9C9C9C);
	font-size: 0.87em;
}

.esc-gallery-empty {
	margin: 2em 0 0;
	padding: 3em 1em;
	background: var(--theme-color-alter_bg_color, #FAFAFA);
	color: var(--theme-color-text, #5E5E5E);
	text-align: center;
}
.esc-gallery-is-empty .esc-gallery-empty { margin-top: 0; }

/* entrance animation (enabled by the script) */
.esc-gallery-anim .esc-gallery-item {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.65, 0.25, 1);
}
.esc-gallery-anim .esc-gallery-item.is-in { opacity: 1; transform: none; }

@media (max-width: 1279px) {
	.esc-gallery-grid,
	.post_content .esc-gallery-grid { gap: 24px; }
	.esc-gallery-grid.esc-gallery-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
	.esc-gallery-grid.esc-gallery-cols-3,
	.esc-gallery-grid.esc-gallery-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.esc-gallery-grid,
	.post_content .esc-gallery-grid { gap: 20px; }
}
@media (max-width: 767px) {
	.esc-gallery-intro { margin-bottom: 2em; text-align: left; }
	/* filters: one row that scrolls horizontally */
	.esc-gallery-filters {
		flex-wrap: nowrap;
		justify-content: flex-start;
		gap: 8px;
		margin-bottom: 1.6em;
		padding-bottom: 4px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		-webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
		mask-image: linear-gradient(to right, #000 85%, transparent);
	}
	.esc-gallery-filters::-webkit-scrollbar { display: none; }
	.esc-gallery-filters.is-scrolled-end { -webkit-mask-image: none; mask-image: none; }
	.esc-gallery-filter { flex: none; padding: 0.7em 1.05em; font-size: 13px; scroll-snap-align: start; white-space: nowrap; }
	.esc-gallery-grid,
	.post_content .esc-gallery-grid { gap: 12px; }
	.esc-gallery-overlay { padding: 14px 14px 12px; }
	.esc-gallery-title { font-size: 15px; }
	.esc-gallery-cat { font-size: 10.5px; }
	.esc-gallery-zoom { top: 10px; right: 10px; width: 34px; height: 34px; }
	.esc-gallery-zoom::before, .esc-gallery-zoom::after { width: 12px; margin-left: -6px; }
}
@media (max-width: 479px) {
	.esc-gallery-grid.esc-gallery-with-captions,
	.esc-gallery-grid.esc-gallery-cols-2 { grid-template-columns: minmax(0, 1fr); }
}
/* touch screens: titles always visible (no hover) */
@media (hover: none) {
	.esc-gallery-overlay { opacity: 1; background: linear-gradient(to top, rgba(12, 11, 11, 0.78) 0%, rgba(12, 11, 11, 0) 55%); }
	.esc-gallery-cat, .esc-gallery-title { transform: none; }
	.esc-gallery-zoom { display: none; }
	.esc-gallery-with-captions .esc-gallery-overlay { display: none; }
}
@media (hover: none) and (max-width: 767px) {
	.esc-gallery-overlay { padding: 10px 11px; background: linear-gradient(to top, rgba(12, 11, 11, 0.72) 0%, rgba(12, 11, 11, 0) 50%); }
	.esc-gallery-cat { display: none; }
	.esc-gallery-title {
		display: -webkit-box;
		overflow: hidden;
		font-size: 13.5px;
		line-height: 1.3;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
}

/* ------------------------------------------------------------------ lightbox */
body.esc-lb-open { overflow: hidden; }
.esc-lb {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(12, 11, 11, 0.97);
	color: #fff;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0s linear 0.35s;
	-webkit-tap-highlight-color: transparent;
}
.esc-lb.is-open { opacity: 1; visibility: visible; transition: opacity 0.35s ease, visibility 0s linear 0s; }
.esc-lb[hidden] { display: none; }
.esc-lb-stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 76px 104px 120px;
	box-sizing: border-box;
	touch-action: pan-y;
}
.esc-lb-figure {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
}
.esc-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
	opacity: 1;
	transform: none;
	transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.65, 0.25, 1);
	user-select: none;
	-webkit-user-drag: none;
}
.esc-lb.is-loading .esc-lb-img { opacity: 0; transform: scale(0.97); }
.esc-lb-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--theme-color-text_link, #BECB0A);
	border-radius: 50%;
	opacity: 0;
	animation: esc-lb-spin 0.8s linear infinite;
	transition: opacity 0.2s;
	pointer-events: none;
}
.esc-lb.is-loading .esc-lb-spinner { opacity: 1; }
@keyframes esc-lb-spin { to { transform: rotate(360deg); } }

.esc-lb-btn {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.esc-lb-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.esc-lb-btn:hover,
.esc-lb-btn:focus-visible { background: var(--theme-color-text_link, #BECB0A); color: var(--theme-color-text_dark, #1A1919); }
.esc-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.esc-lb-btn[hidden] { display: none; }
.esc-lb-close { top: 18px; right: 20px; }
.esc-lb-prev { top: 50%; left: 24px; transform: translateY(-50%); }
.esc-lb-next { top: 50%; right: 24px; transform: translateY(-50%); }
.esc-lb-counter {
	position: absolute;
	top: 34px;
	left: 30px;
	color: rgba(255, 255, 255, 0.72);
	font-family: var(--theme-font-button_font-family, inherit);
	font-size: 14px;
	letter-spacing: 0.06em;
}
.esc-lb-caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 18px 104px 30px;
	text-align: center;
}
.esc-lb-caption:empty { display: none; }
.esc-lb-caption-cat {
	display: block;
	margin-bottom: 4px;
	color: var(--theme-color-text_link, #BECB0A);
	font-family: var(--theme-font-button_font-family, inherit);
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.esc-lb-caption-title {
	display: block;
	color: #fff;
	font-family: var(--theme-font-h5_font-family, inherit);
	font-size: 20px;
	line-height: 1.35;
}
.esc-lb-caption-desc {
	display: block;
	max-width: 760px;
	margin: 6px auto 0;
	color: rgba(255, 255, 255, 0.75);
	font-size: 15px;
	line-height: 1.5;
}
@media (max-width: 767px) {
	.esc-lb-stage { padding: 64px 10px 128px; }
	.esc-lb-close { top: 10px; right: 10px; width: 46px; height: 46px; }
	.esc-lb-counter { top: 24px; left: 18px; font-size: 13px; }
	.esc-lb-prev,
	.esc-lb-next { top: auto; bottom: 26px; width: 48px; height: 48px; transform: none; }
	.esc-lb-prev { left: 12px; }
	.esc-lb-next { right: 12px; }
	.esc-lb-caption { padding: 14px 70px 24px; min-height: 98px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
	.esc-lb-caption-title { font-size: 16px; }
	.esc-lb-caption-desc { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
	.esc-gallery-anim .esc-gallery-item { opacity: 1; transform: none; transition: none; }
	.esc-gallery-link img, .esc-gallery-overlay, .esc-gallery-zoom, .esc-gallery-cat, .esc-gallery-title,
	.esc-lb, .esc-lb-img { transition: none; }
}

@media print {
	.esc-gallery-anim .esc-gallery-item { opacity: 1; transform: none; }
	.esc-gallery-filters, .esc-lb { display: none !important; }
}
