/**
 * PWD Animations - Logo Marquee widget stylesheet.
 * Loaded together with pwd-animations-core.css.
 *
 * HTML and CSS only. The strip is two identical halves side by side; one
 * transform keyframe moves it by exactly one half, so the loop never jumps.
 *
 * Elementor and themes style bare img, ul, li and a elements (for example
 * ".elementor img { height: auto; max-width: 100% }" and list bullets), and
 * those rules beat a single-class selector. Every rule below is therefore
 * scoped under .pwd-anim--marquee, and the img, list and item rules go one or
 * two classes deeper, so the widget's own controls always win.
 */

.pwd-anim--marquee {
	--pwd-mq-h: 48px;
	--pwd-mq-gap: 56px;
	--pwd-mq-o: 0.7;
	--pwd-mq-fade: 80px;
	--pwd-mq-dur: 30s;
}

.pwd-anim--marquee .pwd-mq__viewport {
	overflow: hidden;
}

.pwd-anim--marquee.pwd-mq--fade .pwd-mq__viewport {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--pwd-mq-fade), #000 calc(100% - var(--pwd-mq-fade)), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 var(--pwd-mq-fade), #000 calc(100% - var(--pwd-mq-fade)), transparent 100%);
}

.pwd-anim--marquee .pwd-mq__viewport .pwd-mq__track {
	display: flex;
	width: max-content;
	/* The strip is made of pictures; keep the loop direction the same on right-to-left pages. */
	direction: ltr;
	animation: pwd-mq-scroll var(--pwd-mq-dur) linear infinite;
	will-change: transform;
}

.pwd-anim--marquee.pwd-mq--right .pwd-mq__viewport .pwd-mq__track {
	animation-direction: reverse;
}

@keyframes pwd-mq-scroll {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

.pwd-anim--marquee .pwd-mq__track .pwd-mq__set {
	display: flex;
	flex: none;
	align-items: center;
	gap: var(--pwd-mq-gap);
	margin: 0;
	/* The trailing gap keeps both halves the same width, so -50% is an exact loop. */
	padding: 4px var(--pwd-mq-gap) 4px 0;
	list-style: none;
}

.pwd-anim--marquee .pwd-mq__track .pwd-mq__set .pwd-mq__item {
	flex: none;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pwd-anim--marquee .pwd-mq__set .pwd-mq__item .pwd-mq__link {
	display: block;
	text-decoration: none;
}

.pwd-anim--marquee .pwd-mq__set .pwd-mq__item .pwd-mq__img {
	display: block;
	width: auto;
	max-width: none;
	height: var(--pwd-mq-h);
	margin: 0;
	object-fit: contain;
	opacity: var(--pwd-mq-o);
	transition: opacity 0.3s ease, filter 0.3s ease;
}

.pwd-anim--marquee.pwd-mq--gray .pwd-mq__set .pwd-mq__item .pwd-mq__img {
	filter: grayscale(1);
}

/* Pause while a logo link has keyboard focus, and on hover where there is one. */
.pwd-anim--marquee.pwd-mq--pause .pwd-mq__viewport .pwd-mq__track:focus-within {
	animation-play-state: paused;
}

.pwd-anim--marquee.pwd-mq--gray .pwd-mq__set .pwd-mq__item .pwd-mq__link:focus-visible .pwd-mq__img {
	filter: none;
	opacity: 1;
}

@media (hover: hover) {
	.pwd-anim--marquee.pwd-mq--pause .pwd-mq__viewport:hover .pwd-mq__track {
		animation-play-state: paused;
	}

	.pwd-anim--marquee .pwd-mq__set .pwd-mq__item:hover .pwd-mq__img {
		opacity: 1;
	}

	.pwd-anim--marquee.pwd-mq--gray .pwd-mq__set .pwd-mq__item:hover .pwd-mq__img {
		filter: none;
	}
}

/* Reduced motion: no loop. Show one plain, wrapped row of the real logos. */
@media (prefers-reduced-motion: reduce) {
	.pwd-anim--marquee .pwd-mq__viewport .pwd-mq__track {
		animation: none;
		width: auto;
	}

	.pwd-anim--marquee .pwd-mq__track .pwd-mq__set[aria-hidden="true"],
	.pwd-anim--marquee .pwd-mq__track .pwd-mq__set .pwd-mq__item[aria-hidden="true"] {
		display: none;
	}

	.pwd-anim--marquee .pwd-mq__track .pwd-mq__set {
		flex-wrap: wrap;
		justify-content: center;
		padding-right: 0;
		row-gap: var(--pwd-mq-gap);
	}

	.pwd-anim--marquee.pwd-mq--fade .pwd-mq__viewport {
		-webkit-mask-image: none;
		mask-image: none;
	}
}
