<?php require_once __DIR__ . '/includes/bootstrap.php';
$pageTitle = 'News | Underground FX Radio';
$currentPage = basename(__FILE__);
include __DIR__ . '/includes/header.php';
$newsHero = ugfx_asset('img/brand/ugfx-hero.png');
?>
<section class="ugfx-page-hero">
  <div class="container-xxl">
    <div class="ugfx-kicker"><i class="bi bi-lightning-charge-fill"></i> Underground FX Radio</div>
    <h1 class="page-title">Station news</h1>
    <p class="page-copy">Station news, updates, announcements, and featured posts from Underground FX.</p>
    <div class="ugfx-news-hero-image ugfx-card mt-4">
      <img src="<?= htmlspecialchars($newsHero) ?>" alt="Underground FX Radio news banner">
    </div>
  </div>
</section>

<section class="section-pad pt-3">
  <div class="container-xxl">
    <div class="ugfx-news-grid">
      <?php foreach (ugfx_get_news(12) as $item):
        $itemImage = !empty($item['image']) ? $item['image'] : $newsHero;
      ?>
      <article class="ugfx-card ugfx-listing-card">
        <div class="ugfx-listing-card-media">
          <img src="<?= htmlspecialchars($itemImage) ?>" alt="<?= htmlspecialchars($item['title'] ?? 'News item') ?>">
        </div>
        <div class="ugfx-listing-card-body p-4">
          <div class="ugfx-micro-label mb-2"><?= htmlspecialchars($item['date'] ?? 'Station update') ?></div>
          <h3><?= htmlspecialchars($item['title'] ?? 'News item') ?></h3>
          <p class="text-secondary mb-3"><?= nl2br(htmlspecialchars($item['body'] ?? $item['content'] ?? '')) ?></p>
          <div class="text-secondary small">By <?= htmlspecialchars($item['author'] ?? 'Admin') ?></div>
        </div>
      </article>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<?php include __DIR__ . '/includes/footer.php'; ?>
