/**
 * HyperSite Vehicle Gallery (Bricks custom element).
 * Main display slider with an overlapping thumbnail strip in front.
 */

.hsl-vgs {
	--hsl-vgs-overlap: 75px;
	--hsl-vgs-accent: #cca841;
	display: flex;
	flex-direction: column;
	width: 100%;
}

/* Clear a fixed/sticky site header (offset measured in JS as --hsl-header-offset). */
.hsl-vgs.has-header-offset,
.hsl-vgrid.has-header-offset {
	margin-top: var( --hsl-header-offset, 0px );
}

/* ---- Main stage ---- */
.hsl-vgs__stage {
	position: relative;
	width: 100%;
	/* Keep the 1920:815 banner ratio so desktop proportions match the design. */
	aspect-ratio: 1920 / 815;
	overflow: hidden;
	border-radius: 12px;
	background: #0a0a0a;
}

.hsl-vgs__main,
.hsl-vgs__main .splide__track,
.hsl-vgs__main .splide__list,
.hsl-vgs__main .splide__slide {
	height: 100%;
}

.hsl-vgs__main {
	width: 100%;
}

.hsl-vgs__main .splide__slide {
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

/* When Splide cover mode hides the <img>, keep a graceful fallback. */
.hsl-vgs__main .hsl-vgs__main-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Bottom-fade gradient like the design banner. */
.hsl-vgs__stage.has-gradient::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 45%;
	pointer-events: none;
	z-index: 2;
	background: linear-gradient( 180deg, rgba( 0, 0, 0, 0 ) 0%, rgba( 0, 0, 0, 0.7 ) 100% );
}

/* Clickable main image (opens lightbox). */
.hsl-vgs__stage.is-clickable .hsl-vgs__main {
	cursor: zoom-in;
}

/* ---- Thumbnail strip (in front of main) ---- */
.hsl-vgs__thumbs {
	position: relative;
	z-index: 4;
	/* 1366 / 1920 of the design width; overridden by the element control. */
	width: var( --hsl-vgs-thumb-width, 71.15% );
	max-width: 1366px;
	margin-top: calc( -1 * var( --hsl-vgs-overlap, 75px ) );
	margin-left: auto;
	margin-right: auto;
}

.hsl-vgs__thumbs .splide__slide {
	height: 150px;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid rgba( 255, 255, 255, 0.5 );
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.hsl-vgs__thumbs .splide__slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hsl-vgs__thumbs .splide__slide:hover {
	opacity: 1;
}

.hsl-vgs__thumbs .splide__slide.is-active {
	opacity: 1;
	border: 1.5px solid #fff;
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.25 );
}

/* Arrows — use the design vector (thin shaft + open chevron). */
.hsl-vgs__arrows .splide__arrow,
.hsl-vgs__thumbs .splide__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	background: transparent;
	border: 0;
	border-radius: 0;
	opacity: 1;
	color: #fff;
	transition: opacity 0.2s ease;
}

.hsl-vgs__thumbs .splide__arrow:disabled {
	opacity: 0.3;
}

.hsl-vgs__thumbs .splide__arrow:hover:not( :disabled ) {
	opacity: 0.7;
}

.hsl-vgs__arrow-svg {
	width: 24px;
	height: auto;
	display: block;
}

/* Deterministic direction: next points right, prev is mirrored. */
.splide__arrow--next .hsl-vgs__arrow-svg {
	transform: none;
}

.splide__arrow--prev .hsl-vgs__arrow-svg {
	transform: scaleX( -1 );
}

/* Position outside the centered strip (design: ~-68px / -70px). */
.hsl-vgs__thumbs .splide__arrow--prev {
	left: -52px;
}

.hsl-vgs__thumbs .splide__arrow--next {
	right: -52px;
}

/* Empty / placeholder state. */
.hsl-vgs__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 240px;
	padding: 32px;
	border-radius: 12px;
	border: 1px dashed rgba( 0, 0, 0, 0.2 );
	background: rgba( 0, 0, 0, 0.03 );
	color: #555;
	text-align: center;
	font-size: 15px;
}

/* Below ~1100px the side gutters are too small for outside arrows: go full width and bring arrows inside. */
@media ( max-width: 1100px ) {
	.hsl-vgs__thumbs {
		width: 100%;
		max-width: none;
		padding: 0 56px;
	}

	.hsl-vgs__thumbs .splide__arrow--prev {
		left: 6px;
	}

	.hsl-vgs__thumbs .splide__arrow--next {
		right: 6px;
	}
}

@media ( max-width: 768px ) {
	.hsl-vgs__stage {
		aspect-ratio: 16 / 11;
	}

	.hsl-vgs__thumbs {
		padding: 0 46px;
		--hsl-vgs-overlap: 40px;
	}

	.hsl-vgs__thumbs .splide__slide {
		height: 90px;
	}

	.hsl-vgs__arrow-svg {
		width: 20px;
	}
}

@media ( max-width: 478px ) {
	.hsl-vgs__thumbs {
		padding: 0 38px;
	}

	.hsl-vgs__thumbs .splide__slide {
		height: 78px;
	}
}

/* =========================================================
   Grid (mosaic) gallery — big 2x2 image + 2x2 of smaller tiles
   ========================================================= */
.hsl-vgrid {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	grid-template-rows: repeat( 2, 1fr );
	gap: 12px;
	aspect-ratio: 64 / 25;
	width: 100%;
	box-sizing: border-box;
	padding-left: var( --gutter, 0 );
	padding-right: var( --gutter, 0 );
}

.hsl-vgrid__cell {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #0a0a0a;
	cursor: pointer;
	min-width: 0;
	min-height: 0;
	appearance: none;
	-webkit-appearance: none;
	font: inherit;
	color: inherit;
}

.hsl-vgrid.is-clickable .hsl-vgrid__cell {
	cursor: zoom-in;
}

.hsl-vgrid__cell--main {
	grid-column: 1 / span 2;
	grid-row: 1 / span 2;
}

.hsl-vgrid__cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.hsl-vgrid__cell:hover img {
	transform: scale( 1.04 );
}

.hsl-vgrid__cell:focus-visible {
	outline: 2px solid var( --hsl-vgs-accent, #cca841 );
	outline-offset: 2px;
}

/* Total photos pill (bottom-right of the last tile). */
.hsl-vgrid__count {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 40px;
	border: 1px solid rgba( 255, 255, 255, 0.3 );
	background: linear-gradient( 180deg, rgba( 0, 0, 0, 0.4 ) 0%, rgba( 0, 0, 0, 0.55 ) 100% );
	color: #fff;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: -0.02em;
	backdrop-filter: blur( 4px );
	pointer-events: none;
}

.hsl-vgrid__count-icon {
	display: block;
}

/* Mobile: featured image first, then the smaller tiles as a 2x2 thumbnail grid. */
@media ( max-width: 768px ) {
	.hsl-vgrid {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: none;
		grid-auto-rows: auto;
		aspect-ratio: auto;
	}

	.hsl-vgrid__cell {
		aspect-ratio: 16 / 10;
	}

	.hsl-vgrid__cell--main {
		grid-column: 1 / -1;
		grid-row: auto;
		aspect-ratio: 16 / 10;
	}

	.hsl-vgrid__count {
		padding: 6px 11px;
		font-size: 13px;
	}
}

/* =========================================================
   Lightbox (fullscreen gallery with synced thumbnails)
   ========================================================= */
html.hsl-vgs-lightbox-open {
	overflow: hidden;
}

.hsl-vgs-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hsl-vgs-lightbox[hidden] {
	display: none;
}

.hsl-vgs-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.92 );
	cursor: zoom-out;
}

.hsl-vgs-lightbox__close {
	position: absolute;
	top: 20px;
	right: 24px;
	z-index: 3;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid rgba( 255, 255, 255, 0.3 );
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.4 );
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.hsl-vgs-lightbox__close:hover {
	background: rgba( 0, 0, 0, 0.7 );
	border-color: #fff;
}

.hsl-vgs-lightbox__stage {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: min( 1366px, 92vw );
	height: 92vh;
	padding: 56px 0 0;
}

.hsl-vgs-lightbox__main {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
}

.hsl-vgs-lightbox__main .splide__track,
.hsl-vgs-lightbox__main .splide__list,
.hsl-vgs-lightbox__main .splide__slide {
	height: 100%;
}

.hsl-vgs-lightbox__main .splide__slide {
	display: flex;
	align-items: center;
	justify-content: center;
}

.hsl-vgs-lightbox__main .splide__slide img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
}

.hsl-vgs-lightbox__main .splide__arrow {
	background: rgba( 0, 0, 0, 0.45 );
	border: 1px solid rgba( 255, 255, 255, 0.3 );
	border-radius: 50%;
	width: 48px;
	height: 48px;
	opacity: 1;
	color: #fff;
}

.hsl-vgs-lightbox__main .splide__arrow:hover:not( :disabled ) {
	background: rgba( 0, 0, 0, 0.75 );
}

.hsl-vgs-lightbox__main .splide__arrow--prev {
	left: -8px;
}

.hsl-vgs-lightbox__main .splide__arrow--next {
	right: -8px;
}

.hsl-vgs-lightbox__thumbs {
	flex: 0 0 auto;
	width: 100%;
}

.hsl-vgs-lightbox__thumbs .splide__slide {
	height: 88px;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid rgba( 255, 255, 255, 0.35 );
	background-position: center;
	background-size: cover;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.hsl-vgs-lightbox__thumbs .splide__slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hsl-vgs-lightbox__thumbs .splide__slide:hover {
	opacity: 0.85;
}

.hsl-vgs-lightbox__thumbs .splide__slide.is-active {
	opacity: 1;
	border-color: #fff;
}

@media ( max-width: 768px ) {
	.hsl-vgs-lightbox__stage {
		width: 96vw;
		height: 94vh;
	}

	.hsl-vgs-lightbox__thumbs .splide__slide {
		height: 60px;
	}

	.hsl-vgs-lightbox__main .splide__arrow {
		width: 38px;
		height: 38px;
	}
}
