/*
	Reusable gallery: thumbnails + left/right arrows + lightbox
	Max width: parent wrapper. Arrows when overflowing. Click thumb → lightbox. Close button.
*/

.gallery {
	position: relative;
	max-width: 100%;
	margin: 1.5em 0;
}

.gallery-viewport {
	overflow: hidden;
	max-width: 100%;
}

.gallery-track {
	display: flex;
	gap: 0.75em;
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
	padding: 0.25em 0;
}

.gallery-track::-webkit-scrollbar {
	height: 6px;
}

.gallery-thumb {
	flex: 0 0 auto;
	width: 120px;
	height: 80px;
	cursor: pointer;
	border-radius: 4px;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.15);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-thumb:hover {
	border-color: rgba(255, 255, 255, 0.4);
	box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}

.gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2.5em;
	height: 2.5em;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, opacity 0.2s ease;
	z-index: 2;
}

.gallery-arrow:hover {
	background: rgba(255, 255, 255, 0.3);
}

.gallery-arrow:disabled,
.gallery-arrow.hidden {
	opacity: 0;
	pointer-events: none;
}

.gallery-arrow.prev {
	left: -0.5em;
}

.gallery-arrow.next {
	right: -0.5em;
}

.gallery-arrow .icon {
	font-size: 0.9em;
}

/* Lightbox */
.gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.gallery-lightbox-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 90vw;
	max-height: 90vh;
	gap: 1.5em;
}

.gallery-lightbox-inner img {
	max-width: 100%;
	max-height: calc(90vh - 4em);
	width: auto;
	height: auto;
	object-fit: contain;
}

.gallery-lightbox-inner .actions {
	justify-content: center;
	flex-shrink: 0;
}

.gallery-lightbox-close {
	cursor: pointer;
}
