<?php

declare(strict_types=1);

/**
 * Footer: Vereinsdaten (NAP aus club.json), Social-Links, Rechtliches.
 */
$club = json_load('club');
$nav = json_load('navigation');

$socialLabels = ['instagram' => 'Instagram', 'facebook' => 'Facebook', 'youtube' => 'YouTube'];
?>
    <footer class="site-footer">
        <div class="container site-footer__grid">
            <div>
                <h2 class="site-footer__heading"><?= e($club['legal_name']) ?></h2>
                <address class="site-footer__address">
                    <?= e($club['address']['venue']) ?><br>
                    <?= e($club['address']['street']) ?><br>
                    <?= e($club['address']['zip']) ?> <?= e($club['address']['city']) ?><br>
                    <a href="mailto:<?= e($club['email']) ?>"><?= e($club['email']) ?></a>
                </address>
            </div>
            <div>
                <h2 class="site-footer__heading">Folge uns</h2>
                <ul class="site-footer__list">
<?php foreach ($club['social'] as $key => $socialUrl): ?>
<?php if ($socialUrl): ?>
                    <li><a href="<?= e($socialUrl) ?>" rel="noopener"><?= e($socialLabels[$key] ?? ucfirst($key)) ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
                </ul>
            </div>
            <div>
                <h2 class="site-footer__heading">Rechtliches</h2>
                <ul class="site-footer__list">
<?php foreach ($nav['legal'] as $item): ?>
                    <li><a href="<?= e(url($item['slug'])) ?>"><?= e($item['label']) ?></a></li>
<?php endforeach; ?>
                </ul>
            </div>
        </div>
        <div class="container site-footer__copyright">
            <p>&copy; <?= e(date('Y')) ?> <?= e($club['legal_name']) ?></p>
        </div>
    </footer>
