/* HS Gallery — front */

.hsg {
	--hsg-h: 60vh;
	margin: 1.75rem 0;
}

.hsg-viewport {
	position: relative;
	width: 100%;
	height: var(--hsg-h);
	max-height: 85vh;
	overflow: hidden;
	cursor: grab;
	touch-action: pan-y;              /* le scroll vertical reste au navigateur */
	-webkit-user-select: none;
	user-select: none;
}
.hsg-viewport:active { cursor: grabbing; }

.hsg-track {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 100%;
	width: max-content;
	will-change: transform;
}

.hsg-tile {
	flex: 0 0 auto;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	line-height: 0;
	cursor: zoom-in;
	display: block;
}

/* hauteur identique, largeur selon le ratio, jamais rognée */
.hsg-tile img {
	height: 100%;
	width: auto;
	display: block;
	object-fit: contain;
	border-radius: 4px;
	pointer-events: none;
}

.hsg-gallery-caption {
	margin: 0.6rem 2px 0;
	font-size: 0.85rem;
	line-height: 1.5;
	opacity: 0.7;
	font-style: italic;
}

.hsg-data { display: none; }

.hsg-tile:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------------ */
.hsg-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(12px, 4vw, 48px);
	background: rgba(8, 8, 10, 0.92);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}
.hsg-lb.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.hsg-lb-figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.hsg-lb-img {
	max-width: 90vw;
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 6px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.hsg-lb-img.is-loaded { opacity: 1; transform: none; }

.hsg-lb-cap {
	max-width: 70ch;
	padding: 12px 20px;
	background: #fff;
	color: #333;
	border-radius: 6px;
	font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 0.95rem;
	line-height: 1.5;
	text-align: center;
	letter-spacing: 0.01em;
}

.hsg-lb-close,
.hsg-lb-nav {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	backdrop-filter: blur(4px);
	transition: background 0.2s ease;
}
.hsg-lb-close:hover,
.hsg-lb-nav:hover { background: rgba(255, 255, 255, 0.2); }

.hsg-lb-close { top: 18px; right: 18px; font-size: 30px; }
.hsg-lb-prev  { left: 18px; top: 50%; transform: translateY(-50%); }
.hsg-lb-next  { right: 18px; top: 50%; transform: translateY(-50%); }

.hsg-lb-counter {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.65);
	font-size: 0.8rem;
	letter-spacing: 0.08em;
}

.hsg-lb-close:focus-visible,
.hsg-lb-nav:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.hsg-noscroll { overflow: hidden; }

@media (max-width: 600px) {
	.hsg-lb-nav { width: 40px; height: 40px; font-size: 22px; }
	.hsg-lb-prev { left: 8px; }
	.hsg-lb-next { right: 8px; }
	.hsg-lb-close { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
	.hsg-lb,
	.hsg-lb-img { transition: none; }
}
