/* Logo Marquee: each row holds its logos twice and slides left by half its width, so the loop is seamless. */
.logo-marquee {
	overflow: hidden;
	display: flex;
	flex-direction: column;
	gap: var(--lm-row-gap, 40px);
	padding: 8px 0;
}

.logo-marquee.lm-fade {
	-webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
	mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
}

.logo-marquee .lm-row {
	display: flex;
	align-items: center;
	width: max-content;
	animation: lm-scroll var(--lm-dur, 40s) linear infinite;
}

.logo-marquee .lm-row.lm-rev {
	animation-direction: reverse;
}

/* Pause only the row under the mouse. */
.logo-marquee.lm-pause .lm-row:hover {
	animation-play-state: paused;
}

/* Full screen width: break out of the column, centred on the screen. */
.logo-marquee.lm-full {
	position: relative;
	left: 50%;
	width: 100vw;
	max-width: none;
	transform: translateX(-50%);
}

/* 100vw includes the scrollbar; clip the few extra pixels instead of adding a sideways scrollbar. */
html:has(.logo-marquee.lm-full),
body:has(.logo-marquee.lm-full) {
	overflow-x: clip;
}

.logo-marquee .lm-item {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	padding: 0 calc(var(--lm-gap, 60px) / 2);
}

/* !important because many themes force img { height: auto; max-width: 100% }. */
.logo-marquee .lm-item img {
	display: block;
	height: var(--lm-h, 80px) !important;
	width: auto !important;
	max-width: none !important;
	object-fit: contain;
	transition: transform 0.2s ease, filter 0.2s ease;
}

/* Phones: "Logo height on mobile" and "Space between logos on mobile", when set. */
@media (max-width: 767px) {
	.logo-marquee .lm-item {
		padding: 0 calc(var(--lm-gap-m, var(--lm-gap, 60px)) / 2);
	}

	.logo-marquee .lm-item img {
		height: var(--lm-h-m, var(--lm-h, 80px)) !important;
	}
}

.logo-marquee .lm-item img:hover {
	transform: scale(1.1);
}

.logo-marquee.lm-color-grayscale .lm-item img,
.logo-marquee.lm-color-grayscale-hover .lm-item img {
	filter: grayscale(1);
}

.logo-marquee.lm-color-grayscale-hover .lm-item img:hover {
	filter: none;
}

.logo-marquee.lm-color-white .lm-item img {
	filter: brightness(0) invert(1);
}

/* "Logos across" per screen size: each logo gets an equal share of the marquee's width.
   Breakpoints match Bootstrap/WPBakery: mobile <= 767px, tablet 768-992px, desktop >= 993px. */
.logo-marquee[class*="lm-count-"] {
	container-type: inline-size;
}

/* The space between logos is capped at a fifth of each logo's share, so logos stay big on narrow screens. */
@media (min-width: 993px) {
	.logo-marquee.lm-count-d .lm-item {
		width: calc(100cqw / var(--lm-n-d));
		padding: 0 min(calc(var(--lm-gap, 60px) / 2), calc(100cqw / var(--lm-n-d) / 10));
	}
}

@media (min-width: 768px) and (max-width: 992px) {
	.logo-marquee.lm-count-t .lm-item {
		width: calc(100cqw / var(--lm-n-t));
		padding: 0 min(calc(var(--lm-gap, 60px) / 2), calc(100cqw / var(--lm-n-t) / 10));
	}
}

@media (max-width: 767px) {
	.logo-marquee.lm-count-m .lm-item {
		width: calc(100cqw / var(--lm-n-m));
		padding: 0 min(calc(var(--lm-gap-m, var(--lm-gap, 60px)) / 2), calc(100cqw / var(--lm-n-m) / 10));
	}
}

@media (min-width: 993px) {
	.logo-marquee.lm-count-d .lm-item img { width: 100% !important; height: auto !important; }
}

@media (min-width: 768px) and (max-width: 992px) {
	.logo-marquee.lm-count-t .lm-item img { width: 100% !important; height: auto !important; }
}

@media (max-width: 767px) {
	.logo-marquee.lm-count-m .lm-item img { width: 100% !important; height: auto !important; }
}

.logo-marquee .lm-item {
	box-sizing: border-box;
	justify-content: center;
}

.logo-marquee .lm-item a {
	display: block;
	width: 100%;
}

@keyframes lm-scroll {
	to {
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.logo-marquee .lm-row {
		animation: none;
	}
}
