/* =========================================================
   ImaniCars — Premium vehicle gallery (single car page)
   Mobile-first: stacked main image + horizontal swipe thumbs.
   Desktop: large main image with a vertical thumbnail rail.
   ========================================================= */

.vehicle-gallery { display: block; }

/* ---------- Main stage ---------- */
.vehicle-gallery__stage { position: relative; }

.vehicle-gallery__main-btn {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 1px solid var(--color-border, rgba(255, 255, 255, .08));
	border-radius: var(--radius, 16px);
	overflow: hidden;
	background: var(--color-surface-2, #20242d);
	aspect-ratio: 4 / 3;          /* fixed ratio prevents layout shift */
	cursor: zoom-in;
	position: relative;
}

.vehicle-gallery__main-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	opacity: 0;
	transition: opacity .35s ease, transform .25s ease;
	will-change: opacity, transform;
}
.vehicle-gallery__main-img.is-loaded { opacity: 1; }

/* Zoom-on-hover (desktop pointers only; toggled via JS) */
.vehicle-gallery__main-btn.is-zooming .vehicle-gallery__main-img { transform: scale(1.8); }

/* ---------- Skeleton loader ---------- */
.vehicle-gallery__skeleton {
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, #1f232b 30%, #2b303a 50%, #1f232b 70%);
	background-size: 200% 100%;
	animation: cbz-skeleton 1.3s ease-in-out infinite;
	z-index: 1;
}
.vehicle-gallery__main-btn.is-loaded .vehicle-gallery__skeleton { display: none; }

@keyframes cbz-skeleton {
	0% { background-position: 150% 0; }
	100% { background-position: -50% 0; }
}

/* ---------- Counter ---------- */
.vehicle-gallery__counter {
	position: absolute;
	inset-block-end: 12px;
	inset-inline-end: 12px;
	z-index: 2;
	background: rgba(15, 17, 21, .72);
	color: #fff;
	border: 1px solid var(--color-border, rgba(255, 255, 255, .08));
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	padding: 4px 12px;
	border-radius: 999px;
	font-size: .85rem;
	font-weight: 700;
	pointer-events: none;
}

/* ---------- Main stage arrows ---------- */
.vehicle-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 4;
	width: 44px;
	height: 44px;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 50%;
	background: rgba(15, 17, 21, .72);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.6rem;
	line-height: 1;
	transition: background .2s ease, color .2s ease, border-color .2s ease;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}
.vehicle-gallery__arrow:hover {
	background: var(--color-primary, #C9A227);
	color: #1a1300;
	border-color: var(--color-primary, #C9A227);
}
.vehicle-gallery__arrow--prev { inset-inline-end: 14px; }
.vehicle-gallery__arrow--next { inset-inline-start: 14px; }

/* ---------- Thumbnails ---------- */
.vehicle-gallery__thumbs-wrap { position: relative; margin-top: 12px; }

.vehicle-gallery__thumbs {
	list-style: none;
	margin: 0;
	padding: 2px;
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}
.vehicle-gallery__thumbs li { margin: 0; flex: 0 0 auto; scroll-snap-align: start; }

.vehicle-gallery__thumb {
	display: block;
	padding: 0;
	width: 84px;
	aspect-ratio: 1;
	border: 2px solid transparent;
	border-radius: 10px;
	overflow: hidden;
	background: var(--color-surface-2, #20242d);
	cursor: pointer;
	transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.vehicle-gallery__thumb:hover { transform: translateY(-2px); }
.vehicle-gallery__thumb.is-active {
	border-color: var(--color-primary, #C9A227);
	box-shadow: 0 0 0 2px rgba(201, 162, 39, .35);
}
.vehicle-gallery__thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Scroll arrows (shown by JS when overflowing) ---------- */
.vehicle-gallery__nav {
	position: absolute;
	z-index: 3;
	width: 34px;
	height: 34px;
	border: 1px solid var(--color-border, rgba(255, 255, 255, .08));
	border-radius: 50%;
	background: rgba(26, 29, 36, .92);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	line-height: 1;
	transition: background .2s ease, color .2s ease;
}
.vehicle-gallery__nav:hover { background: var(--color-primary, #C9A227); color: #1a1300; }
.vehicle-gallery__nav[hidden] { display: none; }

/* Mobile arrows sit at the horizontal ends, vertically centred. */
.vehicle-gallery__nav--prev { inset-inline-start: -6px; top: 50%; transform: translateY(-50%); }
.vehicle-gallery__nav--next { inset-inline-end: -6px; top: 50%; transform: translateY(-50%); }

/* ---------- Desktop: vertical thumb rail (max 4 visible, scrollable) ---------- */
@media (min-width: 768px) {
	.vehicle-gallery.has-thumbs {
		display: grid;
		grid-template-columns: 92px 1fr;
		grid-template-areas: "thumbs stage";
		column-gap: 14px;
		align-items: start;
	}
	.vehicle-gallery__stage {
		grid-area: stage;
		flex: none;
		min-width: 0;
	}
	.vehicle-gallery__thumbs-wrap {
		grid-area: thumbs;
		order: unset;
		flex: none;
		margin-top: 0;
		display: flex;
		flex-direction: column;
		align-self: start;
		max-height: calc(4 * 84px + 3 * 10px + 24px);
		overflow: hidden;
	}
	.vehicle-gallery__main-btn { aspect-ratio: 4 / 3; }

	.vehicle-gallery__thumbs {
		flex-direction: column;
		overflow-x: hidden;
		overflow-y: auto;
		scroll-snap-type: y proximity;
		flex: 0 0 auto;
		max-height: calc(4 * 84px + 3 * 10px);
		padding-inline: 2px;
	}
	.vehicle-gallery__thumb {
		width: 84px;
		height: 84px;
		aspect-ratio: 1;
		flex-shrink: 0;
	}

	.vehicle-gallery__nav--prev { inset-inline: 0; inset-block-start: -6px; top: auto; transform: none; margin-inline: auto; }
	.vehicle-gallery__nav--next { inset-inline: 0; inset-block-end: -6px; top: auto; transform: none; margin-inline: auto; }
}

/* ---------- Lightbox ---------- */
.vehicle-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 9, 12, .94);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
}
.vehicle-lightbox.is-open { opacity: 1; visibility: visible; }

.vehicle-lightbox__figure {
	margin: 0;
	max-width: min(92vw, 1400px);
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}
.vehicle-lightbox__img {
	max-width: 100%;
	max-height: 86vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	opacity: 0;
	transition: opacity .25s ease;
}
.vehicle-lightbox__img.is-loaded { opacity: 1; }

.vehicle-lightbox__btn {
	position: absolute;
	background: rgba(255, 255, 255, .08);
	border: 1px solid rgba(255, 255, 255, .16);
	color: #fff;
	cursor: pointer;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.8rem;
	line-height: 1;
	transition: background .2s ease, color .2s ease;
}
.vehicle-lightbox__btn:hover { background: var(--color-primary, #C9A227); color: #1a1300; }
.vehicle-lightbox__close { top: 18px; inset-inline-end: 18px; font-size: 1.5rem; }
.vehicle-lightbox__prev { inset-inline-end: 18px; top: 50%; transform: translateY(-50%); }
.vehicle-lightbox__next { inset-inline-start: 18px; top: 50%; transform: translateY(-50%); }
.vehicle-lightbox__counter {
	position: absolute;
	bottom: 20px;
	inset-inline: 0;
	text-align: center;
	color: #fff;
	font-weight: 700;
	letter-spacing: .04em;
}

@media (max-width: 600px) {
	.vehicle-lightbox__btn { width: 44px; height: 44px; font-size: 1.5rem; }
	.vehicle-lightbox__prev { inset-inline-end: 8px; }
	.vehicle-lightbox__next { inset-inline-start: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.vehicle-gallery__skeleton { animation: none; }
	.vehicle-gallery__main-img,
	.vehicle-gallery__thumb,
	.vehicle-lightbox,
	.vehicle-lightbox__img { transition: none; }
	.vehicle-gallery__main-btn.is-zooming .vehicle-gallery__main-img { transform: none; }
}
