<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * CLIENT / PARTNER MOVING SLIDER
 * An infinite CSS marquee of client logos. The track is duplicated so the
 * loop is seamless. Logos with no image gracefully fall back to a styled
 * text wordmark.
 * Expects: $partners (array).
 */
$partners = isset($partners) && ! empty($partners) ? $partners : array();
if (empty($partners)) return;

// Duplicate the set so the marquee scrolls seamlessly.
$loop = array_merge($partners, $partners);
?>
<section class="clients-strip" data-reveal>
	<div class="container">
		<p class="clients-label">Trusted by brands &amp; partners who dare to be unforgettable</p>
	</div>
	<div class="marquee">
		<div class="marquee-track">
			<?php foreach ($loop as $p):
				$logo = ! empty($p['logo']) ? upload_url($p['logo'], '') : '';
				$hasFile = ! empty($p['logo']) && is_file(FCPATH.'assets/uploads/'.$p['logo']);
			?>
				<div class="client-logo" title="<?= html_escape($p['name']) ?>">
					<?php if ($hasFile): ?>
						<img src="<?= upload_url($p['logo']) ?>" alt="<?= html_escape($p['name']) ?>" loading="lazy">
					<?php else: ?>
						<span class="logo-fallback"><?= html_escape($p['name']) ?></span>
					<?php endif; ?>
				</div>
			<?php endforeach; ?>
		</div>
	</div>
</section>
