<?php

declare(strict_types=1);

/**
 * Sponsoren/Partner-Logogrid. Props:
 *   $intro array{title, text, cta?} (aus home.json)
 *   Logos kommen aus data/partners.json (Single Source of Truth).
 */
$partners = json_load('partners')['partners'] ?? [];
?>
        <section class="section partners" id="partner">
            <div class="container">
                <h2><?= e($intro['title']) ?></h2>
                <p><?= e($intro['text']) ?></p>
                <ul class="partners__grid">
<?php foreach ($partners as $partner): ?>
                    <li class="partners__item">
<?php if (!empty($partner['url'])): ?>
                        <a href="<?= e($partner['url']) ?>" rel="noopener">
                            <img src="<?= e(asset($partner['logo'])) ?>" alt="<?= e($partner['name']) ?>" loading="lazy" decoding="async">
                        </a>
<?php else: ?>
                        <img src="<?= e(asset($partner['logo'])) ?>" alt="<?= e($partner['name']) ?>" loading="lazy" decoding="async">
<?php endif; ?>
                    </li>
<?php endforeach; ?>
                </ul>
<?php if (!empty($intro['cta'])): ?>
                <p><?php component('cta', ['cta' => $intro['cta']]); ?></p>
<?php endif; ?>
            </div>
        </section>
