.vg-gallery {
	position: relative;
	max-width: 100%;
	box-sizing: border-box;
}

.vg-gallery * {
	box-sizing: border-box;
}

.vg-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.vg-filter-btn {
	padding: 6px 14px;
	border: 1px solid #767676;
	background: #fff;
	border-radius: 20px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.vg-filter-btn:hover {
	border-color: #999;
}

.vg-filter-btn.active {
	background: #1a1a1a;
	border-color: #1a1a1a;
	color: #fff;
}

.vg-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: 170px;
	grid-auto-flow: dense;
	gap: 10px;
}

.vg-item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: 6px;
	background: #f0f0f1;
	grid-column: span 1;
	grid-row: span 1;
}

.vg-item.vg-size-wide {
	grid-column: span 2;
}

.vg-item.vg-size-tall {
	grid-row: span 2;
}

.vg-item.vg-size-large {
	grid-column: span 2;
	grid-row: span 2;
}

.vg-item-link {
	display: block;
	width: 100%;
	height: 100%;
}

.vg-item-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease, opacity 0.3s ease;
}

.vg-item:hover .vg-item-img {
	transform: scale(1.06);
}

.vg-item-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 8px 10px;
	font-size: 12px;
	color: #fff;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.vg-item:hover .vg-item-caption {
	opacity: 1;
}

.vg-loadmore-wrap {
	text-align: center;
	margin-top: 20px;
}

.vg-loadmore-btn {
	padding: 10px 26px;
	border-radius: 24px;
	border: 1px solid #1a1a1a;
	background: #1a1a1a;
	color: #fff;
	cursor: pointer;
	font-size: 14px;
}

.vg-loadmore-btn:hover {
	opacity: 0.85;
}

.vg-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.vg-page-btn {
	min-width: 34px;
	padding: 6px 10px;
	border: 1px solid #767676;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
}

.vg-page-btn.active {
	background: #1a1a1a;
	border-color: #1a1a1a;
	color: #fff;
}

.vg-sentinel {
	height: 1px;
}

.vg-loading-spinner {
	display: none;
	width: 28px;
	height: 28px;
	margin: 16px auto 0;
	border: 3px solid #ddd;
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: vg-spin 0.7s linear infinite;
}

.vg-loading-spinner.vg-visible {
	display: block;
}

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

body.vg-lb-noscroll {
	overflow: hidden;
}

.vg-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

.vg-lightbox.vg-lb-open {
	display: flex;
}

.vg-lb-stage {
	position: relative;
	max-width: 92vw;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	touch-action: pan-y;
}

.vg-lb-image {
	max-width: 92vw;
	max-height: 80vh;
	object-fit: contain;
	user-select: none;
}

.vg-lb-caption {
	color: #f3f4f6;
	font-size: 14px;
	margin-top: 10px;
	text-align: center;
	max-width: 80vw;
}

.vg-lb-close,
.vg-lb-prev,
.vg-lb-next {
	position: absolute;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 20px;
	line-height: 1;
}

.vg-lb-close:hover,
.vg-lb-prev:hover,
.vg-lb-next:hover {
	background: rgba(255, 255, 255, 0.25);
}

.vg-lb-close {
	top: 16px;
	right: 16px;
}

.vg-lb-prev {
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
}

.vg-lb-next {
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 640px) {
	.vg-lb-prev,
	.vg-lb-next {
		width: 38px;
		height: 38px;
		font-size: 16px;
	}
}

/* ------------------------------------------------------------------ */
/* Accessibilité (RGAA)                                                */
/* ------------------------------------------------------------------ */

/* Texte réservé aux lecteurs d'écran. */
.vg-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Focus clavier toujours visible (contour sombre + liseré blanc, lisible sur photo comme sur fond clair). */
.vg-gallery a:focus-visible,
.vg-gallery button:focus-visible {
	outline: 3px solid #111827;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #fff;
}
/* Photo : le contour est posé sur le cadre (la vignette est rognée), à l'extérieur. */
.vg-gallery .vg-item-link:focus-visible {
	outline: none;
	box-shadow: none;
}
.vg-item:has(.vg-item-link:focus-visible) {
	outline: 3px solid #111827;
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #fff;
	z-index: 1;
}

/* La légende apparaît aussi quand la photo reçoit le focus au clavier. */
.vg-item:focus-within .vg-item-caption {
	opacity: 1;
}

.vg-filter-btn,
.vg-page-btn,
.vg-loadmore-btn {
	font-family: inherit;
	color: #1a1a1a;
}
.vg-filter-btn.active,
.vg-page-btn.active,
.vg-loadmore-btn {
	color: #fff;
}

/* Visionneuse */
.vg-lb-caption {
	margin: 10px 0 0;
}
.vg-lb-caption[hidden] {
	display: none;
}
.vg-lb-counter {
	margin: 6px 0 0;
	color: #f3f4f6;
	font-size: 14px;
	text-align: center;
}
.vg-lb-close,
.vg-lb-prev,
.vg-lb-next {
	border: 2px solid rgba(255, 255, 255, 0.85);
	background: rgba(0, 0, 0, 0.55);
}
.vg-lb-close:focus-visible,
.vg-lb-prev:focus-visible,
.vg-lb-next:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}
.vg-lb-prev[hidden],
.vg-lb-next[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.vg-item-img,
	.vg-item-caption,
	.vg-filter-btn {
		transition: none;
	}
	.vg-item:hover .vg-item-img {
		transform: none;
	}
	.vg-loading-spinner {
		animation-duration: 2s;
	}
}

/* Navigateurs sans :has() : contour à l'intérieur de la vignette. */
@supports not selector(:has(a)) {
	.vg-gallery .vg-item-link:focus-visible {
		outline: 3px solid #111827;
		outline-offset: -3px;
	}
}
