<?php require_once __DIR__ . '/includes/bootstrap.php';
$pageTitle = 'Events | Underground FX Radio';
$currentPage = basename(__FILE__);
include __DIR__ . '/includes/header.php';
$eventsHero = 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">Events and promotions</h1>
    <p class="page-copy"> network events, and Underground Specials.</p>
    <div class="ugfx-news-hero-image ugfx-card mt-4">
      <img src="<?= htmlspecialchars($eventsHero) ?>" alt="Underground FX Radio events banner">
    </div>
  </div>
</section>

<section class="section-pad pt-3">
  <div class="container-xxl">
    <div class="ugfx-event-grid">
      <?php foreach (ugfx_get_events(10) as $event):
        $eventImage = !empty($event['image']) ? $event['image'] : $eventsHero;
      ?>
      <article class="ugfx-card ugfx-listing-card">
        <div class="ugfx-listing-card-media ugfx-listing-card-media-event">
          <img src="<?= htmlspecialchars($eventImage) ?>" alt="<?= htmlspecialchars($event['title'] ?? 'Event') ?>">
        </div>
        <div class="ugfx-listing-card-body p-4">
          <div class="ugfx-micro-label mb-2"><?= htmlspecialchars(($event['start'] ?? '') . ' → ' . ($event['end'] ?? '')) ?></div>
          <h3><?= htmlspecialchars($event['title'] ?? 'Event') ?></h3>
          <p class="text-secondary mb-3"><?= nl2br(htmlspecialchars($event['description'] ?? '')) ?></p>
          <?php if (!empty($event['external_url'])): ?><a class="btn ugfx-btn-outline btn-sm" href="<?= htmlspecialchars($event['external_url']) ?>" target="_blank" rel="noopener"><?= htmlspecialchars($event['external_label'] ?? 'Open event') ?></a><?php endif; ?>
        </div>
      </article>
      <?php endforeach; ?>
    </div>
  </div>
</section>

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