/* Film strip gallery widget: main image on top, film strip of thumbnails below. */

.fsg-gallery {
	--fsg-active-color: #e2001a;
	--fsg-active-width: 3px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

/* Main image */

.fsg-gallery__main {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f2f2f2;
	touch-action: pan-y;
}

.fsg-gallery__slide {
	display: none;
	height: 100%;
}

.fsg-gallery__slide.is-active {
	display: block;
	animation: fsg-gallery-fade 0.25s ease;
}

.fsg-gallery__slide a {
	display: block;
	height: 100%;
}

.fsg-gallery__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	user-select: none;
	-webkit-user-drag: none;
}

@keyframes fsg-gallery-fade {
	from { opacity: 0.4; }
	to { opacity: 1; }
}

.fsg-gallery__nav,
.fsg-gallery__scroll {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	cursor: pointer;
	line-height: 0;
}

/* Default chevrons. */
.fsg-gallery__nav > svg,
.fsg-gallery__scroll > svg {
	width: 55%;
	height: 55%;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Icons picked in the widget: font icons, Font Awesome SVGs or uploaded SVGs. */
.fsg-gallery__custom-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 55%;
	height: 55%;
	font-size: calc(var(--fsg-icon-box) * 0.5);
	line-height: 1;
}

.fsg-gallery__custom-icon svg {
	width: 100%;
	height: 100%;
}

.fsg-gallery__custom-icon .e-font-icon-svg {
	fill: currentColor;
}

.fsg-gallery__nav {
	--fsg-nav-size: 44px;
	--fsg-icon-box: var(--fsg-nav-size);
	position: absolute;
	top: 50%;
	z-index: 2;
	width: var(--fsg-nav-size);
	height: var(--fsg-nav-size);
	border-radius: 50%;
	color: #fff;
	background: rgba(0, 0, 0, 0.45);
	transform: translateY(-50%);
	transition: color 0.2s, background-color 0.2s, opacity 0.2s;
}

.fsg-gallery__nav:hover,
.fsg-gallery__nav:focus-visible {
	background: rgba(0, 0, 0, 0.7);
}

.fsg-gallery__nav--prev { left: 12px; }
.fsg-gallery__nav--next { right: 12px; }

.fsg-gallery__counter {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	padding: 3px 10px;
	border-radius: 999px;
	color: #fff;
	background: rgba(0, 0, 0, 0.45);
	font-size: 13px;
	line-height: 1.5;
	pointer-events: none;
}

/* Film strip */

.fsg-gallery__strip {
	position: relative;
	display: flex;
	align-items: center;
}

.fsg-gallery__track {
	position: relative;
	display: flex;
	flex: 1;
	gap: 8px;
	min-width: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}

.fsg-gallery__track::-webkit-scrollbar {
	display: none;
}

.fsg-gallery__thumb {
	position: relative;
	flex: 0 0 auto;
	width: 110px;
	aspect-ratio: 4 / 3;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: #ddd;
	cursor: pointer;
	opacity: 0.6;
	scroll-snap-align: start;
	transition: opacity 0.2s;
}

.fsg-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fsg-gallery__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: var(--fsg-active-width) solid transparent;
	border-radius: inherit;
	transition: border-color 0.2s;
	pointer-events: none;
}

.fsg-gallery__thumb:hover,
.fsg-gallery__thumb:focus-visible {
	opacity: 0.9;
}

.fsg-gallery .fsg-gallery__thumb.is-active {
	opacity: 1;
}

.fsg-gallery__thumb.is-active::after {
	border-color: var(--fsg-active-color);
}

.fsg-gallery__scroll {
	--fsg-icon-box: 30px;
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	color: #fff;
	background: rgba(0, 0, 0, 0.6);
	transform: translateY(-50%);
	transition: color 0.2s, background-color 0.2s;
}

.fsg-gallery__scroll:hover,
.fsg-gallery__scroll:focus-visible {
	background: rgba(0, 0, 0, 0.85);
}

.fsg-gallery__scroll[hidden] {
	display: none;
}

.fsg-gallery__scroll--prev { left: 4px; }
.fsg-gallery__scroll--next { right: 4px; }

.fsg-gallery__scroll .fsg-gallery__icon-rewind,
.fsg-gallery__scroll.is-rewind .fsg-gallery__icon-next {
	display: none;
}

.fsg-gallery__scroll.is-rewind .fsg-gallery__icon-rewind {
	display: flex;
}

/* Film look: dark strip with sprocket holes above and below the frames. */

.fsg-film-yes .fsg-gallery__strip {
	padding: 16px 10px;
	background-color: #151515;
}

.fsg-film-yes .fsg-gallery__strip::before,
.fsg-film-yes .fsg-gallery__strip::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 6px;
	background-image: repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 255, 255, 0.75) 7px 15px, transparent 15px 22px);
	pointer-events: none;
}

.fsg-film-yes .fsg-gallery__strip::before { top: 5px; }
.fsg-film-yes .fsg-gallery__strip::after { bottom: 5px; }

.fsg-film-yes .fsg-gallery__thumb {
	border-radius: 2px;
}

@media (max-width: 767px) {
	.fsg-gallery__nav {
		--fsg-nav-size: 36px;
	}

	.fsg-gallery__thumb {
		width: 84px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fsg-gallery__slide.is-active {
		animation: none;
	}
}

/* Text for screen readers only. */
.fsg-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
