<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/** TALENT PROFILE — Expects: $talent, $gallery, $stats, $socials, $related, $categories. */
$t = $talent;
?>
<section class="page-hero" style="padding-bottom:0;">
	<div class="container">
		<div class="breadcrumb" data-reveal>
			<a href="<?= base_url() ?>">Home</a> / <a href="<?= base_url('talent') ?>">Talent</a> / <span><?= html_escape($t['name']) ?></span>
		</div>
	</div>
</section>

<section class="section section--plum" style="padding-top:36px;">
	<div class="container">
		<div class="card-grid cols-2" style="gap:48px;align-items:center;">
			<div data-reveal style="border-radius:var(--radius-lg);overflow:hidden;aspect-ratio:3/4;background:var(--ink);">
				<img src="<?= upload_url($t['photo'], 'img/talent-fallback.jpg') ?>" alt="<?= html_escape($t['name']) ?>" style="width:100%;height:100%;object-fit:cover;">
			</div>
			<div data-reveal data-delay="2">
				<span class="eyebrow"><?= html_escape($categories[$t['category']] ?? $t['category']) ?></span>
				<h1 style="margin:14px 0 8px;color:#fff;"><?= html_escape($t['name']) ?></h1>
				<p style="color:var(--iris-soft);font-size:1.1rem;"><?= html_escape($t['tagline']) ?></p>

				<p style="color:rgba(255,255,255,.82);margin:22px 0;"><?= nl2br(html_escape($t['bio'])) ?></p>

				<?php if ($t['location']): ?>
					<p style="color:rgba(255,255,255,.7);"><?= bloom_icon('pin', 16) ?> <?= html_escape($t['location']) ?></p>
				<?php endif; ?>
				<p style="margin-top:8px;"><?= status_pill($t['availability']) ?></p>

				<!-- STATS -->
				<?php if ($stats): ?>
					<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:24px 0;">
						<?php foreach ($stats as $key => $val): if (empty($val)) continue; ?>
							<div style="padding:14px;border-radius:12px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.12);">
								<span style="font-size:.72rem;letter-spacing:.12em;text-transform:uppercase;color:var(--iris-soft);"><?= html_escape(ucfirst($key)) ?></span><br>
								<strong style="color:#fff;font-size:1.05rem;"><?= html_escape($val) ?></strong>
							</div>
						<?php endforeach; ?>
					</div>
				<?php endif; ?>

				<div style="display:flex;gap:12px;flex-wrap:wrap;margin-top:8px;">
					<a href="<?= base_url('contact') ?>" class="btn btn-light">Book This Talent</a>
					<?php foreach ($socials as $net => $url): if (empty($url)) continue; ?>
						<a href="<?= html_escape($url) ?>" target="_blank" rel="noopener" class="btn btn-outline-light">
							<?= bloom_icon($net === 'instagram' ? 'instagram' : 'sparkle', 18) ?> <?= ucfirst($net) ?>
						</a>
					<?php endforeach; ?>
				</div>
			</div>
		</div>
	</div>
</section>

<!-- PORTFOLIO GALLERY -->
<?php if ($gallery): ?>
<section class="section">
	<div class="container">
		<div class="section-head" data-reveal><span class="eyebrow">Portfolio</span><h2 style="margin-top:14px;">Selected work</h2></div>
		<div class="card-grid cols-3">
			<?php foreach ($gallery as $i => $img): ?>
				<a href="<?= upload_url($img) ?>" data-lightbox="<?= upload_url($img) ?>" class="work-media" data-reveal data-delay="<?= ($i % 3) + 1 ?>" style="border-radius:var(--radius);aspect-ratio:3/4;cursor:zoom-in;">
					<img src="<?= upload_url($img) ?>" alt="Portfolio image" loading="lazy">
				</a>
			<?php endforeach; ?>
		</div>
	</div>
</section>
<?php endif; ?>

<!-- RELATED TALENT -->
<?php if ($related): ?>
<section class="section section--cream">
	<div class="container">
		<div class="section-head" data-reveal><span class="eyebrow">More Talent</span><h2 style="margin-top:14px;">Similar faces</h2></div>
		<div class="card-grid cols-4">
			<?php foreach ($related as $i => $rt): ?>
				<a href="<?= base_url('talent/view/'.$rt['slug']) ?>" class="talent-card" data-reveal data-delay="<?= $i + 1 ?>">
					<div class="talent-media"><img src="<?= upload_url($rt['photo'], 'img/talent-fallback.jpg') ?>" alt="<?= html_escape($rt['name']) ?>"></div>
					<div class="talent-overlay"><h3><?= html_escape($rt['name']) ?></h3><p><?= html_escape($rt['tagline']) ?></p></div>
				</a>
			<?php endforeach; ?>
		</div>
	</div>
</section>
<?php endif; ?>
