<?php
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
$scriptName = $_SERVER['SCRIPT_NAME'] ?? '';
$isLoginPage = strpos($scriptName, '/login/') !== false;
$isAdminPage = strpos($scriptName, '/admin/') !== false || $isLoginPage;
$pageTitle = $pageTitle ?? 'Almost Heaven Radio';
$metaDescription = $metaDescription ?? 'Almost Heaven Radio — broadcasting from the heart of the hills.';
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?= htmlspecialchars($pageTitle) ?></title>
  <link rel="icon" type="image/png" href="/img/logo.png">
  <link rel="apple-touch-icon" href="/img/logo.png">
  <meta name="description" content="<?= htmlspecialchars($metaDescription) ?>">
  <meta property="og:type" content="website">
  <meta property="og:site_name" content="Almost Heaven Radio">
  <meta property="og:image" content="https://almostheavenradio.com/img/logo.png">
  <meta property="og:title" content="<?= htmlspecialchars($pageTitle) ?>">
  <meta property="og:description" content="<?= htmlspecialchars($metaDescription) ?>">
  <meta property="og:url" content="https://almostheavenradio.com<?= htmlspecialchars($_SERVER['REQUEST_URI'] ?? '/') ?>">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:image" content="https://almostheavenradio.com/img/logo.png">
  <meta name="twitter:title" content="<?= htmlspecialchars($pageTitle) ?>">
  <meta name="twitter:description" content="<?= htmlspecialchars($metaDescription) ?>">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
  <link rel="stylesheet" href="/css/style.css?v=20260324r2">
  <?php if ($isAdminPage): ?>
  <link rel="stylesheet" href="/admin/assets/admin-v2.css?v=20260324r2">
  <?php endif; ?>
</head>
<body class="<?= $isAdminPage ? 'page-admin' : 'page-public' ?><?= !empty($isLoginPage) ? ' page-login' : '' ?>">
  <div class="site-bg" aria-hidden="true"></div>
  <header class="site-header">
    <div class="header-inner shell-wide">
      <a href="/index.php" class="brand-lockup text-decoration-none">
        <img src="/assets/logo.png" alt="Almost Heaven Radio" class="header-logo">
        <div class="header-text">
          <h1 class="station-title">ALMOST HEAVEN RADIO</h1>
          <p class="tagline">Broadcasting from the heart of the hills</p>
        </div>
      </a>
    </div>
  </header>
