<section class="section">
    <div class="wrap"><a href="<?= h(('animals')) ?>">← <?= h(t('public_site.back_animals')) ?></a>
        <div class="content-card animal-detail" style="margin-top:20px">
            <div class="gallery"><?php if (!$photos): ?><div class="photo-placeholder">
                    <?= h($animal['species_icon'] ?: '🐾') ?></div><?php else: ?><?php foreach ($photos as $p): ?><img
                    src="/media/animals/<?= (int)$animal['id'] ?>/<?= h(rawurlencode($p['filename'])) ?>"
                    alt="<?= h($p['caption'] ?: $animal['name']) ?>"><?php endforeach; ?><?php endif; ?></div>
            <div>
                <div class="meta"><?= h($animal['species_name'] ?: SpeciesService::label($animal['species'])) ?></div>
                <h1 class="page-title"><?= h($animal['name']) ?></h1>
                <div class="facts">
                    <div class="fact"><strong><?= h(t('public_site.age')) ?></strong><br><?= h(public_age($animal)) ?>
                    </div>
                    <div class="fact">
                        <strong><?= h(t('animal.sex')) ?></strong><br><?= h($animal['sex'] === 'F' ? t('sex.female') : ($animal['sex'] === 'M' ? t('sex.male') : t('common.unknown'))) ?>
                    </div><?php if ($animal['breed']): ?><div class="fact">
                        <strong><?= h(t('public_site.breed')) ?></strong><br><?= h($animal['breed']) ?></div>
                    <?php endif; ?><?php if ($animal['color']): ?><div class="fact">
                        <strong><?= h(t('public_site.coat')) ?></strong><br><?= h($animal['color']) ?></div>
                    <?php endif; ?>
                </div><?php if ($animal['website_description']): ?><p><?= nl2br(h($animal['website_description'])) ?>
                </p><?php endif; ?><div class="chips">
                    <?php foreach (['compatibility_dogs' => ['🐶',t('public_site.dogs')],'compatibility_cats' => ['🐱',t('public_site.cats')],'compatibility_children' => ['🧒',t('public_site.children')],'house_trained' => ['✨',t('public_site.clean')]] as $key => $meta): if (($animal[$key] ?? 'unknown') === 'yes'): ?><span
                        class="chip"><?= $meta[0] . ' ' . h($meta[1]) ?></span><?php endif; endforeach; ?></div>
                <p style="margin-top:28px"><a class="button"
                        href="<?= h(('contact')) ?>"><?= h(t('public_site.ask_adoption')) ?></a></p>
            </div>
        </div>
    </div>
</section>
