<?php

declare(strict_types=1);

/** @var string $fateCounterFooterVariant */
/** @var string $fateFooterLayout */

require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'fate_ui_settings.php';
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'fate_social_links.php';

$b = fate_public_site_branding();
if (empty($b['has_social'])) {
    return;
}

$variant = isset($fateCounterFooterVariant) && $fateCounterFooterVariant === 'light' ? 'light' : 'dark';
$layout = isset($fateFooterLayout) && $fateFooterLayout === 'minimal' ? 'minimal' : 'default';

$esc = static fn (string $s): string => htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
?>
    <section
        class="fate-site-social fate-site-social--variant-<?= htmlspecialchars($variant, ENT_QUOTES, 'UTF-8') ?> fate-site-social--layout-<?= htmlspecialchars($layout, ENT_QUOTES, 'UTF-8') ?>"
        aria-label="社群與連結"
        lang="zh-Hant"
    >
        <h2 class="fate-site-social__title">社群與連結</h2>
        <ul class="fate-site-social__list">
            <?php foreach (fate_social_links_collect($b) as $socialRow): ?>
                <li><?= fate_social_link_render_anchor($socialRow, $esc) ?></li>
            <?php endforeach; ?>
        </ul>
    </section>
