const ninodemMarquee = {
	init() {
		const marquee = document.querySelector('.ninodem-clients');
		if (!marquee) return;

		const marqueeContent = marquee.querySelector('.marquee-content');
		if (!marqueeContent) return;

		// Clone the marquee content only once
		const clone = marqueeContent.cloneNode(true);
		marquee.appendChild(clone);

		// Function to update the width CSS variable
		const updateWidth = () => {
			const marqueeWidth = Math.round(marqueeContent.scrollWidth);
			marquee.style.setProperty('--ninodem-clients-w', marqueeWidth);
		};

		// Set the width on initialization
		updateWidth();

		// Update the width on window resize
		window.addEventListener('resize', updateWidth);
	}
};

document.addEventListener('DOMContentLoaded', () => ninodemMarquee.init());
