/**
 * CCI Media Carousel
 *
 * Marquee that animates the track by -50%. The companion JS clones the
 * original items at runtime until the track is at least 2× the viewport,
 * so one half always equals the other and the wrap-around at -50% is
 * invisible. Animation starts only after the JS has finished cloning
 * (carousel gets `--ready`).
 */

.cci-media-carousel {
	width: 100%;
	overflow: hidden;
	box-sizing: border-box;
}

.cci-media-carousel__heading {
	margin: 0 0 30px;
	font-family: "Inter", sans-serif;
	font-weight: 700;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 1px;
	/* CCI gold gradient — applied by default, overridden inline when a solid colour is selected */
	background-image: linear-gradient(
		to right,
		#cb9b51 0%,
		#f6e27a 25%,
		#cb9b51 50%,
		#f6e27a 75%,
		#cb9b51 100%
	);
	color: transparent;
	-webkit-text-fill-color: transparent;
	-webkit-background-clip: text;
	background-clip: text;
}

.cci-media-carousel__viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.cci-media-carousel__track {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	width: max-content;
	animation-name: cci-media-carousel-scroll-left;
	animation-duration: 40s;
	animation-timing-function: linear;
	animation-iteration-count: infinite;
	animation-play-state: paused;
	/* Subpixel-rounding on the seam can cause a 1px jitter — backface + 3d transforms keep it smooth. */
	transform: translate3d(0, 0, 0);
	backface-visibility: hidden;
	will-change: transform;
}

.cci-media-carousel--ready .cci-media-carousel__track {
	animation-play-state: running;
}

.cci-media-carousel--direction-right .cci-media-carousel__track {
	animation-name: cci-media-carousel-scroll-right;
}

.cci-media-carousel--pause-on-hover .cci-media-carousel__track:hover {
	animation-play-state: paused;
}

.cci-media-carousel__logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	box-sizing: content-box;
	padding-inline-end: 80px;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.cci-media-carousel__logo img {
	display: block;
	height: 60px;
	width: auto;
	max-width: none;
	object-fit: contain;
}

/* Soft fade-out on the left and right edges. */
.cci-media-carousel--edge-fade .cci-media-carousel__viewport {
	-webkit-mask-image: linear-gradient(
		to right,
		transparent 0,
		#000 80px,
		#000 calc(100% - 80px),
		transparent 100%
	);
	mask-image: linear-gradient(
		to right,
		transparent 0,
		#000 80px,
		#000 calc(100% - 80px),
		transparent 100%
	);
}

@keyframes cci-media-carousel-scroll-left {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		transform: translate3d(-50%, 0, 0);
	}
}

@keyframes cci-media-carousel-scroll-right {
	from {
		transform: translate3d(-50%, 0, 0);
	}
	to {
		transform: translate3d(0, 0, 0);
	}
}

/* Respect users who prefer reduced motion — stop the marquee. */
@media (prefers-reduced-motion: reduce) {
	.cci-media-carousel__track {
		animation: none;
		flex-wrap: wrap;
		justify-content: center;
		width: 100%;
	}
}

@media (max-width: 767px) {
	.cci-media-carousel__heading {
		margin-bottom: 20px;
		font-size: 14px;
	}

	.cci-media-carousel__logo {
		padding-inline-end: 40px;
	}

	.cci-media-carousel__logo img {
		height: 40px;
	}

	.cci-media-carousel--edge-fade .cci-media-carousel__viewport {
		-webkit-mask-image: linear-gradient(
			to right,
			transparent 0,
			#000 30px,
			#000 calc(100% - 30px),
			transparent 100%
		);
		mask-image: linear-gradient(
			to right,
			transparent 0,
			#000 30px,
			#000 calc(100% - 30px),
			transparent 100%
		);
	}
}
