/* WanderNest Tales Toolkit – Gallery with Thumbnails */

.wnt-gallery {
	--wnt-tpv: 5;
	--wnt-gap: 10px;
	--wnt-thumbs-top: 12px;
	--wnt-thumb-opacity: 0.65;
	position: relative;
	width: 100%;
	max-width: 100%;
}

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

.wnt-gallery__empty {
	padding: 40px 20px;
	text-align: center;
	color: #6b7280;
	background: #f3f4f6;
	border: 2px dashed #d1d5db;
	border-radius: 12px;
}

.wnt-gallery__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Main image ---------- */

.wnt-gallery__stage {
	position: relative;
}

.wnt-gallery .wnt-gallery__viewport {
	position: relative;
	display: grid;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background-color: #f3f1ec;
	border-radius: 16px;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	outline-offset: 3px;
}

/* All slides sit in the same grid cell; the active one is visible. */
.wnt-gallery .wnt-gallery__slide {
	position: relative;
	grid-area: 1 / 1;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	visibility: hidden;
}

.wnt-gallery .wnt-gallery__slide.is-active,
.wnt-gallery .wnt-gallery__slide.is-leaving {
	visibility: visible;
}

.wnt-gallery .wnt-gallery__slide.is-leaving {
	z-index: 1;
}

.wnt-gallery .wnt-gallery__slide.is-active {
	z-index: 2;
}

.wnt-gallery .wnt-gallery__link {
	display: block;
	width: 100%;
	height: 100%;
}

.wnt-gallery .wnt-gallery__slide .wnt-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	pointer-events: none;
	-webkit-user-drag: none;
}

.wnt-gallery .wnt-gallery__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 40px 22px 20px;
	color: #fff;
	text-align: left;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.wnt-gallery .wnt-gallery__caption-title {
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.25;
}

.wnt-gallery .wnt-gallery__caption-text {
	font-size: 0.95em;
	line-height: 1.4;
}

/* ---------- Arrows ---------- */

.wnt-gallery .wnt-gallery__arrow,
.wnt-gallery .wnt-gallery__arrow:focus {
	background-color: var(--wnt-arrow-bg, rgba(255, 255, 255, 0.94));
	color: var(--wnt-arrow-color, #2b2b2b);
}

.wnt-gallery .wnt-gallery__arrow {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	font-size: 20px;
	line-height: 1;
	text-transform: none;
	letter-spacing: 0;
	border: 0;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.wnt-gallery .wnt-gallery__arrow--prev {
	left: 12px;
}

.wnt-gallery .wnt-gallery__arrow--next {
	right: 12px;
}

.wnt-gallery .wnt-gallery__arrow:hover,
.wnt-gallery .wnt-gallery__arrow:focus-visible {
	background-color: var(--wnt-arrow-bg-h, #003681);
	color: var(--wnt-arrow-color-h, #fff);
	transform: translateY(-50%) scale(1.06);
}

.wnt-gallery .wnt-gallery__arrow:active {
	transform: translateY(-50%) scale(0.96);
}

.wnt-gallery .wnt-gallery__arrow:focus-visible {
	outline: 2px solid var(--wnt-arrow-bg-h, #003681);
	outline-offset: 3px;
}

.wnt-gallery .wnt-gallery__arrow i {
	display: block;
	font-size: inherit;
	line-height: 1;
	color: inherit;
}

.wnt-gallery .wnt-gallery__arrow svg {
	display: block;
	width: 1em !important;
	height: 1em !important;
	max-width: none;
	fill: currentColor;
	color: inherit;
}

.wnt-gallery .wnt-gallery__arrow[disabled] {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

@media (hover: hover) {
	.wnt-gallery--arrows-hover .wnt-gallery__arrow {
		opacity: 0;
	}

	.wnt-gallery--arrows-hover .wnt-gallery__stage:hover .wnt-gallery__arrow,
	.wnt-gallery--arrows-hover .wnt-gallery__stage:focus-within .wnt-gallery__arrow {
		opacity: 1;
	}

	.wnt-gallery--arrows-hover .wnt-gallery__stage:hover .wnt-gallery__arrow[disabled],
	.wnt-gallery--arrows-hover .wnt-gallery__stage:focus-within .wnt-gallery__arrow[disabled] {
		opacity: 0.35;
	}
}

/* ---------- Thumbnails ---------- */

.wnt-gallery .wnt-gallery__thumbs {
	position: relative;
	display: flex;
	gap: var(--wnt-gap);
	margin-top: var(--wnt-thumbs-top);
	padding: 3px;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.wnt-gallery .wnt-gallery__thumbs::-webkit-scrollbar {
	display: none;
}

.wnt-gallery .wnt-gallery__thumb,
.wnt-gallery .wnt-gallery__thumb:hover,
.wnt-gallery .wnt-gallery__thumb:focus {
	background: #ece9e2;
	box-shadow: none;
	color: inherit;
}

.wnt-gallery .wnt-gallery__thumb {
	display: block;
	flex: 0 0 calc((100% - (var(--wnt-tpv) - 1) * var(--wnt-gap)) / var(--wnt-tpv));
	width: auto;
	min-width: 0;
	aspect-ratio: 1 / 1;
	margin: 0;
	padding: 0;
	overflow: hidden;
	line-height: 0;
	cursor: pointer;
	border: 2px solid transparent;
	border-radius: 10px;
	opacity: var(--wnt-thumb-opacity);
	transition: opacity 0.2s ease, border-color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.wnt-gallery .wnt-gallery__thumb:hover {
	opacity: 0.9;
}

.wnt-gallery .wnt-gallery__thumb.is-active {
	opacity: 1;
	border-color: #003681;
}

.wnt-gallery .wnt-gallery__thumb:focus-visible {
	outline: 2px solid #003681;
	outline-offset: 2px;
}

.wnt-gallery .wnt-gallery__thumb .wnt-gallery__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.wnt-gallery .wnt-gallery__arrow,
	.wnt-gallery .wnt-gallery__thumb {
		transition: none;
	}
}
