/* ==========================================================================
   Block: Image Gallery v2 (bga/gallery-v2)

   Featured image stage + thumbnail row. Per-image crop preference
   (landscape/portrait/square) and focal point control the large slot.
   ========================================================================== */

.bga-gallery-v2 {
	background-color: var(--color-cream);
}

.bga-gallery-v2__container {
	display: flex;
	flex-direction: column;
	gap: var(--sp-24);
}

/* ── Stage (large image) ───────────────────────────────────────────────── */

.bga-gallery-v2__stage {
	position: relative;
	width: 100%;
	background: var(--color-brown-08);
}

.bga-gallery-v2__main {
	display: block;
	width: 100%;
	overflow: hidden;
	background: var(--color-brown-08);
	text-decoration: none;
	transition: aspect-ratio 0.25s ease;
}

.bga-gallery-v2__main--landscape { aspect-ratio: 16 / 10; }
.bga-gallery-v2__main--portrait  { aspect-ratio: 4 / 5; }
.bga-gallery-v2__main--square    { aspect-ratio: 1 / 1; }

.bga-gallery-v2__main-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* object-position is set inline from the focal point (data-fx/data-fy). */
	transition: opacity 0.2s ease;
}

.bga-gallery-v2__main.is-swapping .bga-gallery-v2__main-img {
	opacity: 0.4;
}

.bga-gallery-v2__main:focus-visible {
	outline: 3px solid var(--color-orange);
	outline-offset: -3px;
}

/* ── Stage arrows (prev/next, overlay) ─────────────────────────────────── */

.bga-gallery-v2__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: rgba(41, 19, 5, 0.6);
	color: var(--color-cream);
	border: 1px solid rgba(233, 230, 225, 0.3);
	cursor: pointer;
	padding: 0;
	transition: background-color 0.2s ease, transform 0.2s ease;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.bga-gallery-v2__arrow:hover,
.bga-gallery-v2__arrow:focus-visible {
	background: var(--color-orange);
	transform: translateY(-50%) scale(1.05);
}

.bga-gallery-v2__arrow:focus-visible {
	outline: 2px solid var(--color-cream);
	outline-offset: 2px;
}

.bga-gallery-v2__arrow--prev { left: var(--sp-16); }
.bga-gallery-v2__arrow--next { right: var(--sp-16); }

@media (min-width: 1024px) {
	.bga-gallery-v2__arrow {
		width: 56px;
		height: 56px;
	}
	.bga-gallery-v2__arrow--prev { left: var(--sp-24); }
	.bga-gallery-v2__arrow--next { right: var(--sp-24); }
}

/* ── Thumbnail row ─────────────────────────────────────────────────────── */

.bga-gallery-v2__thumbs {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--sp-8);
}

.bga-gallery-v2__thumb-track {
	display: flex;
	gap: var(--sp-8);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	padding-bottom: var(--sp-4);
	flex: 1 1 auto;
	min-width: 0;
}

/* Hide native scrollbar visually on desktop — arrow buttons take over. */
@media (min-width: 768px) {
	.bga-gallery-v2__thumb-track {
		scrollbar-width: none;
	}
	.bga-gallery-v2__thumb-track::-webkit-scrollbar {
		display: none;
	}
}

.bga-gallery-v2__thumb {
	flex: 0 0 auto;
	width: 96px;
	height: 64px;
	padding: 0;
	margin: 0;
	background: var(--color-brown-08);
	border: 2px solid transparent;
	cursor: pointer;
	overflow: hidden;
	scroll-snap-align: start;
	transition: border-color 0.18s ease, opacity 0.18s ease;
	opacity: 0.7;
}

@media (min-width: 768px) {
	.bga-gallery-v2__thumb {
		width: 120px;
		height: 80px;
	}
}

@media (min-width: 1440px) {
	.bga-gallery-v2__thumb {
		width: 140px;
		height: 92px;
	}
}

.bga-gallery-v2__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bga-gallery-v2__thumb:hover,
.bga-gallery-v2__thumb:focus-visible {
	opacity: 1;
}

.bga-gallery-v2__thumb:focus-visible {
	outline: 2px solid var(--color-orange);
	outline-offset: 2px;
}

.bga-gallery-v2__thumb.is-active {
	border-color: var(--color-orange);
	opacity: 1;
}

/* ── Thumb track scroll arrows ─────────────────────────────────────────── */

.bga-gallery-v2__thumb-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex: 0 0 auto;
	background: var(--color-brown-08);
	color: var(--color-brown);
	border: 1px solid var(--color-brown-15);
	cursor: pointer;
	padding: 0;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.bga-gallery-v2__thumb-arrow:hover,
.bga-gallery-v2__thumb-arrow:focus-visible {
	background: var(--color-orange);
	color: var(--color-cream);
}

.bga-gallery-v2__thumb-arrow:focus-visible {
	outline: 2px solid var(--color-orange);
	outline-offset: 2px;
}

.bga-gallery-v2__thumb-arrow[hidden] {
	display: none;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.bga-gallery-v2__main,
	.bga-gallery-v2__main-img,
	.bga-gallery-v2__thumb,
	.bga-gallery-v2__arrow,
	.bga-gallery-v2__thumb-arrow,
	.bga-gallery-v2__thumb-track {
		transition: none;
		scroll-behavior: auto;
	}
}
