/* QT Gallery: picks up the Quirky Tours theme colours when present, with safe fallbacks. */
.qtg {
	--qtg-dark: var(--wp--preset--color--primary, #0a3a30);
	--qtg-accent: var(--wp--preset--color--gold, #d9a23b);
	--qtg-cream: var(--wp--preset--color--cream, #f8efdc);
	--qtg-radius: var(--wp--custom--radius--card, 1.25rem);
	width: 100%;
	max-width: 62rem;
	margin: 0 auto;
	font-family: inherit;
}

.qtg *,
.qtg *::before,
.qtg *::after {
	box-sizing: border-box;
}

.qtg__stage {
	position: relative;
	overflow: hidden;
	border-radius: var(--qtg-radius);
	background: var(--qtg-dark);
	box-shadow: 0 4px 10px rgba(10, 58, 48, 0.1), 0 18px 40px rgba(10, 58, 48, 0.18);
}

.qtg__track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.qtg__track::-webkit-scrollbar {
	display: none;
}

.qtg__track:focus-visible {
	outline: 3px solid var(--qtg-accent);
	outline-offset: -3px;
}

.qtg__slide {
	position: relative;
	flex: 0 0 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.qtg__figure {
	position: relative;
	margin: 0;
	aspect-ratio: 16 / 10;
	background: var(--qtg-dark);
}

.qtg__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	box-shadow: none;
}

.qtg--contain .qtg__img {
	object-fit: contain;
}

.qtg__caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 3rem 1.25rem 1rem;
	color: #fff;
	font-size: 1.05rem;
	line-height: 1.4;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
	background: linear-gradient(to top, rgba(5, 30, 24, 0.85), rgba(5, 30, 24, 0));
	pointer-events: none;
}

.qtg__btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(248, 239, 220, 0.92);
	color: var(--qtg-dark);
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.qtg__btn[hidden] {
	display: none;
}

.qtg__btn--prev,
.qtg__btn--next {
	top: calc(50% - 24px);
}

.qtg__btn--prev {
	left: 0.9rem;
}

.qtg__btn--next {
	right: 0.9rem;
}

.qtg__btn--full {
	top: 0.9rem;
	right: 0.9rem;
	width: 42px;
	height: 42px;
}

.qtg__btn:focus-visible,
.qtg__thumb:focus-visible {
	outline: 3px solid var(--qtg-accent);
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.qtg__btn:hover {
		background: var(--qtg-accent);
		transform: translateY(-2px) scale(1.06);
		box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
	}
}

.qtg__count {
	position: absolute;
	top: 0.9rem;
	left: 0.9rem;
	padding: 0.3rem 0.8rem;
	border-radius: 999px;
	background: rgba(10, 58, 48, 0.78);
	color: var(--qtg-cream);
	font-size: 0.9rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.qtg__thumbs {
	display: flex;
	gap: 0.6rem;
	margin: 0.9rem 0 0;
	padding: 0.35rem 0.25rem 0.6rem;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	scrollbar-color: var(--qtg-accent) transparent;
}

.qtg__thumb-item {
	flex: none;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: center;
}

.qtg__thumb {
	display: block;
	width: 96px;
	height: 68px;
	padding: 0;
	overflow: hidden;
	border: 3px solid transparent;
	border-radius: 0.7rem;
	background: var(--qtg-dark);
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.qtg__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	box-shadow: none;
}

.qtg__thumb.is-active {
	opacity: 1;
	border-color: var(--qtg-accent);
	box-shadow: 0 4px 12px rgba(10, 58, 48, 0.3);
}

@media (hover: hover) and (pointer: fine) {
	.qtg__thumb:hover {
		opacity: 1;
		transform: translateY(-3px);
		box-shadow: 0 8px 16px rgba(10, 58, 48, 0.28);
	}
}

.qtg-empty {
	padding: 1rem;
	border: 2px dashed var(--wp--preset--color--gold-dark, #9a6b10);
	border-radius: 0.75rem;
	text-align: center;
}

/* Full screen */
.qtg__stage:fullscreen {
	display: flex;
	align-items: center;
	border-radius: 0;
	background: #000;
}

.qtg__stage:fullscreen .qtg__track,
.qtg__stage:fullscreen .qtg__slide {
	height: 100%;
}

.qtg__stage:fullscreen .qtg__figure {
	height: 100%;
	aspect-ratio: auto;
}

.qtg__stage:fullscreen .qtg__img {
	object-fit: contain;
}

@media (max-width: 640px) {
	.qtg__figure {
		aspect-ratio: 4 / 3;
	}
	.qtg__btn--prev,
	.qtg__btn--next {
		width: 40px;
		height: 40px;
		top: calc(50% - 20px);
	}
	.qtg__btn--prev {
		left: 0.5rem;
	}
	.qtg__btn--next {
		right: 0.5rem;
	}
	.qtg__caption {
		padding: 2rem 0.9rem 0.75rem;
		font-size: 0.95rem;
	}
	.qtg__thumb {
		width: 76px;
		height: 56px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qtg__btn,
	.qtg__thumb {
		transition: none;
	}
}
