/* Wonderstruck – vertical scroll gallery ([ws_scroll_gallery]) */

/* Impreza sets overflow:hidden on .l-canvas (mobile), which breaks position:sticky.
   overflow:clip still clips but is not a scroll container. This file only loads
   on pages that use the gallery. */
.l-canvas {
	overflow: clip !important;
}

.ws-sg {
	/* Pinned frame sits just below the theme's fixed header (Impreza sets --header-sticky-height). */
	--ws-sg-offset: var(--header-sticky-height, 0px);
	--ws-sg-frame: calc(100vh - var(--ws-sg-offset));

	/* One frame of scroll per slide, plus a short hold on the last one. */
	position: relative;
	height: calc((var(--ws-sg-count, 1) + 0.35) * var(--ws-sg-frame));
}

@supports (height: 100svh) {
	.ws-sg {
		--ws-sg-frame: calc(100svh - var(--ws-sg-offset));
	}
}

.ws-sg__sticky {
	position: sticky;
	top: var(--ws-sg-offset);
	height: var(--ws-sg-frame);
	overflow: hidden;
	background: #1d1310;
}

.ws-sg__slide {
	position: absolute;
	inset: 0;
	overflow: hidden;
	will-change: transform;
	transform: translate3d(0, 100%, 0);
}

.ws-sg__slide:first-child {
	transform: none;
}

/* Darkens a slide slightly while the next one covers it. */
.ws-sg__slide::after {
	content: "";
	position: absolute;
	inset: 0;
	background: #000;
	opacity: calc(var(--ws-sg-out, 0) * 0.35);
	pointer-events: none;
}

.ws-sg__media,
.ws-sg__slide img.ws-sg__media {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/* Vimeo: poster as background, iframe scaled to "cover" the frame. */
.ws-sg__slide--vimeo {
	container-type: size;
	background: #1d1310 center / cover no-repeat;
}

.ws-sg__slide--vimeo iframe.ws-sg__media {
	position: absolute;
	top: 50%;
	left: 50%;
	width: max(100cqw, 100cqh * var(--ws-sg-ratio, 1.7778));
	height: max(100cqh, 100cqw / var(--ws-sg-ratio, 1.7778));
	border: 0;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* No JS or reduced motion: plain stacked media, no pinning. */
.ws-sg.is-static {
	height: auto;
}

.ws-sg.is-static .ws-sg__sticky {
	position: static;
	height: auto;
	background: none;
}

.ws-sg.is-static .ws-sg__slide {
	position: relative;
	height: 80vh;
	transform: none;
}
