<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** PARTNERS PAGE — Expects: $partners, $grouped, $testimonials. */
?>
<section class="page-hero">
	<div class="container">
		<div class="page-hero-inner" data-reveal>
			<div class="breadcrumb"><a href="<?= base_url() ?>">Home</a> / <span>Partners</span></div>
			<span class="eyebrow">Trusted By</span>
			<h1>The brands who <span class="serif-italic text-iris">bloom with us</span></h1>
			<p>We're proud to partner with brands and creatives who dare to be unforgettable.</p>
		</div>
	</div>
</section>

<!-- LOGO GRID -->
<section class="section">
	<div class="container">
		<?php if ($partners): ?>
			<div class="card-grid cols-4" style="gap:20px;">
				<?php foreach ($partners as $i => $p):
					$hasFile = ! empty($p['logo']) && is_file(FCPATH.'assets/uploads/'.$p['logo']); ?>
					<div class="service-card" data-reveal data-delay="<?= ($i % 4) + 1 ?>" style="display:flex;align-items:center;justify-content:center;min-height:130px;text-align:center;">
						<?php if ($p['website']): ?><a href="<?= html_escape($p['website']) ?>" target="_blank" rel="noopener"><?php endif; ?>
							<?php if ($hasFile): ?>
								<img src="<?= upload_url($p['logo']) ?>" alt="<?= html_escape($p['name']) ?>" style="max-height:60px;width:auto;margin:0 auto;">
							<?php else: ?>
								<span style="font-family:var(--font-display);font-weight:600;font-size:1.3rem;color:var(--plum);"><?= html_escape($p['name']) ?></span>
							<?php endif; ?>
						<?php if ($p['website']): ?></a><?php endif; ?>
					</div>
				<?php endforeach; ?>
			</div>
		<?php else: ?>
			<?= empty_state('Partner logos will appear here soon.') ?>
		<?php endif; ?>
	</div>
</section>

<!-- TESTIMONIALS -->
<?php if ($testimonials): ?>
<section class="section section--cream">
	<div class="container">
		<div class="section-head center" data-reveal>
			<span class="eyebrow" style="justify-content:center;">In Their Words</span>
			<h2>What our partners say</h2>
		</div>
		<div class="card-grid cols-3">
			<?php foreach ($testimonials as $i => $tm): ?>
				<div class="quote-card" data-reveal data-delay="<?= ($i % 3) + 1 ?>">
					<span class="q-mark"><?= bloom_icon('quote', 38) ?></span>
					<blockquote><?= html_escape($tm['quote']) ?></blockquote>
					<div class="quote-author">
						<?php if ( ! empty($tm['photo']) && is_file(FCPATH.'assets/uploads/'.$tm['photo'])): ?>
							<img class="avatar" src="<?= upload_url($tm['photo']) ?>" alt="<?= html_escape($tm['author_name']) ?>">
						<?php else: ?>
							<span class="avatar"><?= strtoupper(substr($tm['author_name'], 0, 1)) ?></span>
						<?php endif; ?>
						<div>
							<div class="name"><?= html_escape($tm['author_name']) ?></div>
							<div class="role"><?= html_escape($tm['author_role']) ?></div>
						</div>
					</div>
				</div>
			<?php endforeach; ?>
		</div>
	</div>
</section>
<?php endif; ?>

<!-- BECOME A PARTNER -->
<section class="section">
	<div class="container">
		<div class="cta-band" data-reveal>
			<span class="eyebrow" style="justify-content:center;">Partner With Us</span>
			<h2>Let's create something <span class="serif-italic text-iris">together</span></h2>
			<p>Join the brands building unforgettable creative work with Bloom Iris.</p>
			<div class="hero-ctas"><a href="<?= base_url('apply/brand') ?>" class="btn btn-light btn-lg">Start a Collaboration</a></div>
		</div>
	</div>
</section>
