/* ====================================================================================
 * LOGO STRIP
 * Mobile (< 768px): up to 3 logos per row, every row centered, never one logo alone
 *                   (3 + 1 becomes 2 + 2). Never moves.
 * Desktop (>= 768px): one row. Up to 6 logos: static, centered.
 *                     7+ logos (or a row that does not fit): marquee with faded edges.
 ========================================= */
.ds-logos {
	background-color: var(--background_color, #fff);
}

.ds-logos .ds-logos-title {
	margin-block: 0 1.25rem;
	text-align: center;
	color: var(--title_color);
}

.ds-logos-strip {
	position: relative;
	overflow: hidden;
}

.ds-logos-track {
	display: flex;
	justify-content: center;
}

.ds-logos-list {
	margin: 0;
	padding: 0;
	list-style-type: none;
}

.ds-logos-list.ds-logos-list--clone {
	display: none;
}

/* The slot: one fixed box per logo, the logo is fitted into the safe area */
.ds-logos-item {
	display: flex;
	align-items: center;
	justify-content: center;

	margin: 0;
	padding: 0.375rem 0.4375rem;
	height: 2.5rem;

	pointer-events: none;
	user-select: none;
}

.ds-logos-img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;

	object-fit: contain;
	object-position: center;
}

/* Mobile: centered wrap */
@media (max-width: 767.98px) {
	.ds-logos-list {
		display: grid;
		grid-template-columns: repeat(6, minmax(0, 3.5rem));
		justify-content: center;
		row-gap: 1.5rem;

		width: 100%;
	}

	.ds-logos-item {
		grid-column: span 2;
	}

	/* 1 logo */
	.ds-logos-item:only-child {
		grid-column: 3 / span 2;
	}

	/* Last row of 2 (2, 5, 8 logos) and 3 + 1 -> 2 + 2 (4, 7, 10 logos) */
	.ds-logos-item:nth-last-child(2):nth-child(3n + 1),
	.ds-logos-item:nth-last-child(4):nth-child(3n + 1),
	.ds-logos-item:nth-last-child(2):nth-child(3n) {
		grid-column: 2 / span 2;
	}
}

/* Desktop: one row */
@media (min-width: 768px) {
	.ds-logos .ds-logos-title {
		margin-block-end: 1.5rem;
	}

	.ds-logos-list {
		display: flex;
		flex: none;
		flex-wrap: nowrap;
		align-items: center;
		gap: 2.5rem;

		width: max-content;
	}

	.ds-logos-item {
		flex: 0 0 10rem;

		width: 10rem;
		height: 3.5rem;
		padding: 0.5rem 0.625rem;
	}
}

/* Desktop marquee */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
	.ds-logos-strip.is-marquee {
		-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7.5rem, #000 calc(100% - 7.5rem), transparent 100%);
		mask-image: linear-gradient(90deg, transparent 0, #000 7.5rem, #000 calc(100% - 7.5rem), transparent 100%);
	}

	.ds-logos-strip.is-marquee .ds-logos-track {
		justify-content: flex-start;

		width: max-content;

		animation: ds-logos-marquee var(--ds-logos-duration, 60s) linear infinite;
		will-change: transform;
	}

	.ds-logos-strip.is-marquee .ds-logos-list {
		padding-inline-end: 2.5rem;
	}

	.ds-logos-strip.is-marquee .ds-logos-list--clone {
		display: flex;
	}

	.ds-logos-strip.is-paused .ds-logos-track {
		animation-play-state: paused;
	}
}

/* Reduced motion: static row instead of the marquee */
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
	.ds-logos-list {
		flex-wrap: wrap;
		justify-content: center;
		row-gap: 1.5rem;

		width: auto;
	}
}

@keyframes ds-logos-marquee {
	from {
		transform: translate3d(0, 0, 0);
	}

	to {
		transform: translate3d(calc(-1 * var(--ds-logos-distance, 50%)), 0, 0);
	}
}
