/* WP Simple Logo Slider — front end + editor canvas */

.wp-block-wpsls-logo-slider {
	--wpsls-height: 60px;
	--wpsls-max-width: 180px;
	--wpsls-gap: 48px;
	--wpsls-opacity: 1;
	--wpsls-fade: 10%;
	/* Fallbacks used before JS measures the track (two sets => -50%). */
	--wpsls-distance: 50%;
	--wpsls-duration: 30s;

	position: relative;
	box-sizing: border-box;
	/*
	 * Width is left entirely to the parent/theme (content width, wide, full,
	 * columns, groups...). overflow + min-width:0 make sure the max-content
	 * track never pushes a flex/grid parent wider.
	 */
	min-width: 0;
	overflow: hidden;
	/* If the parent is a flex row (Row block, theme header...), share the
	   available width instead of claiming the full max-content track width. */
	flex: 1 1 0%;
}

.wpsls__viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.wpsls--fade .wpsls__viewport {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--wpsls-fade), #000 calc(100% - var(--wpsls-fade)), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 var(--wpsls-fade), #000 calc(100% - var(--wpsls-fade)), transparent 100%);
}

.wpsls__track {
	display: flex;
	flex-wrap: nowrap;
	width: max-content;
	will-change: transform;
	animation: wpsls-scroll var(--wpsls-duration) linear infinite;
}

.wpsls--dir-right .wpsls__track {
	animation-direction: reverse;
}

.wpsls--pause:hover .wpsls__track,
.wpsls--pause:focus-within .wpsls__track,
.wpsls--paused .wpsls__track {
	animation-play-state: paused;
}

/* Once view.js runs it drives the motion (needed for drag/swipe). */
.wpsls--js .wpsls__track {
	animation: none;
}

/* Drag / swipe */
.wpsls--draggable .wpsls__viewport {
	cursor: grab;
	touch-action: pan-y; /* horizontal gestures slide the logos, vertical still scrolls the page */
	-webkit-user-select: none;
	user-select: none;
}

.wpsls--draggable .wpsls__img {
	-webkit-user-drag: none;
}

.wpsls--dragging .wpsls__viewport,
.wpsls--dragging .wpsls__viewport * {
	cursor: grabbing !important;
}

@keyframes wpsls-scroll {
	from { transform: translate3d(0, 0, 0); }
	to   { transform: translate3d(calc(-1 * var(--wpsls-distance)), 0, 0); }
}

/* Each set carries a trailing gap so consecutive sets tile seamlessly. */
.wp-block-wpsls-logo-slider .wpsls__set {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: var(--wpsls-gap);
	margin: 0;
	padding: 0 var(--wpsls-gap) 0 0;
	list-style: none;
}

.wp-block-wpsls-logo-slider .wpsls__item {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	height: var(--wpsls-height);
	margin: 0;
	padding: 0;
}

.wpsls__item::before,
.wpsls__item::marker {
	content: none;
}

.wpsls__link {
	display: flex;
	align-items: center;
	height: 100%;
	line-height: 0;
}

.wp-block-wpsls-logo-slider .wpsls__img {
	display: block;
	width: auto;
	height: var(--wpsls-height);
	max-width: var(--wpsls-max-width);
	object-fit: contain;
	opacity: var(--wpsls-opacity);
	transition: filter .3s ease, opacity .3s ease;
	box-shadow: none;
	border-radius: 0;
}

.wpsls--grayscale .wpsls__img {
	filter: grayscale(1);
}

.wpsls--color-hover .wpsls__item:hover .wpsls__img,
.wpsls--color-hover .wpsls__link:focus-visible .wpsls__img {
	filter: none;
	opacity: 1;
}

/* No-JS fallback for reduced motion (with JS, auto-scroll stops but drag still works). */
@media (prefers-reduced-motion: reduce) {
	.wpsls__track {
		animation: none;
	}
	.wp-block-wpsls-logo-slider:not(.wpsls--js) .wpsls__viewport {
		overflow-x: auto;
	}
	.wp-block-wpsls-logo-slider:not(.wpsls--js) .wpsls__set[aria-hidden="true"] {
		display: none;
	}
}
