
<?php
session_start();
$pageTitle = 'Fans — Oldies And More Radio';
include __DIR__ . '/includes/header.php';
include __DIR__ . '/includes/sidebar.php';
require_once __DIR__ . '/includes/app_lib.php';
$fans = oldies_read_json(__DIR__ . '/data/fans.json', []);
if (!is_array($fans)) $fans = [];
?>
<div class="main-wrap"><div class="content-panel">
  <div class="content-box center-text"><h1 class="section-title">⭐ Our Fans & Supporters</h1><p class="about-text">The wonderful listeners helping keep the jukebox glowing.</p></div>
  <div class="vinyl-divider center-divider"></div>
  <?php if (empty($fans)): ?>
    <div class="content-box center-text"><p class="about-text">No fan cards added yet.</p></div>
  <?php else: ?>
    <div class="fans-grid">
      <?php foreach ($fans as $fan): $img = trim((string)($fan['image'] ?? '')); if ($img && !preg_match('#^https?://#i',$img) && !str_starts_with($img,'/')) $img = '/img/friends/' . ltrim($img,'/'); ?>
        <div class="neon-card fan-card <?= !empty($fan['top_fan']) ? 'top-fan' : '' ?>">
          <?php if ($img): ?><img src="<?= oldies_h($img) ?>" alt="<?= oldies_h($fan['name'] ?? '') ?>"><?php endif; ?>
          <h2 class="section-title"><?= !empty($fan['top_fan']) ? '⭐ ' : '' ?><?= oldies_h($fan['name'] ?? 'Supporter') ?></h2>
          <p class="about-text"><?= nl2br(oldies_h($fan['description'] ?? '')) ?></p>
          <?php if (!empty($fan['url']) || !empty($fan['link'])): ?><div class="card-actions"><a class="button radio-static" href="<?= oldies_h($fan['url'] ?? $fan['link']) ?>" target="_blank" rel="noopener">Visit</a></div><?php endif; ?>
        </div>
      <?php endforeach; ?>
    </div>
  <?php endif; ?>
<?php include __DIR__ . '/includes/footer.php'; ?>
</div></div>
