<?php require_once __DIR__ . '/config.php'; $settings = get_settings(); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= esc($settings['event_name'] ?? ($settings['site_name'] ?? 'Broadcasturself')) ?></title>
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div class="site-shell">
  <div class="topbar">
    <div class="brand">
      <img src="<?= esc($settings['site_logo'] ?? 'assets/site-logo.png') ?>" alt="Logo">
      <div>
        <h1><?= esc($settings['site_name'] ?? 'Broadcasturself') ?></h1>
        <div class="meta"><?= esc($settings['site_tagline'] ?? 'Live radio event network') ?></div>
      </div>
    </div>
    <div class="live-pill"><span class="live-dot"></span><span><?= strtoupper(esc($settings['site_status'] ?? 'live')) ?></span></div>
  </div>
  <div class="nav">
    <a href="index.php">Home</a>
    <a href="stations.php">Participating Stations</a>
    <a href="schedule.php">Schedule</a>
    <a href="submit.php">Submit Entry</a>
    <a href="poll.php">Live Polls</a>
  </div>
    <?php $stations = get_stations(); ?>
    <div class="hero">
      <h2><?= esc($settings['station_heading'] ?? 'Participating Stations') ?></h2>
      <p><?= esc($settings['community_blurb'] ?? '') ?></p>
    </div>
    <div class="grid cards">
      <?php foreach ($stations as $station): ?>
        <?php if (isset($station['enabled']) && !$station['enabled']) { continue; } ?>
        <div class="card station-card">
          <?php if (!empty($station['logo'])): ?><img src="<?= esc($station['logo']) ?>" alt="<?= esc($station['name'] ?? 'Station') ?>"><?php endif; ?>
          <h3><?= esc($station['name'] ?? 'Station') ?></h3>
          <?php if (!empty($station['note'])): ?><div class="meta"><?= esc($station['note']) ?></div><?php endif; ?>
          <p>
            <?php if (!empty($station['website'])): ?><a href="<?= esc($station['website']) ?>" target="_blank" rel="noopener">Website</a><?php endif; ?>
            <?php if (!empty($station['stream'])): ?> · <a href="<?= esc($station['stream']) ?>" target="_blank" rel="noopener">Listen</a><?php endif; ?>
          </p>
        </div>
      <?php endforeach; ?>
    </div>

  <div class="footer-note"><?= esc($settings['footer_note'] ?? 'Powered by Broadcasturself') ?></div>
</div>
</body>
</html>
