<?php
/**
 * DiscordBooster — Universal Header Include
 * ─────────────────────────────────────────
 * Usage: Define these variables BEFORE including this file:
 *
 *   $page_title       = "Buy Instagram Followers — Real & Instant | DiscordBooster";
 *   $meta_description = "Buy real Instagram followers from $4...";
 *   $meta_keywords    = "buy instagram followers, ...";
 *   $canonical_url    = "https://discordbooster.com/buy-instagram-followers";
 *   $og_title         = "Buy Instagram Followers | DiscordBooster";  // optional, falls back to $page_title
 *   $og_description   = "...";                                        // optional, falls back to $meta_description
 *   $og_image         = "https://discordbooster.com/og-image.jpg";    // optional
 *   $schema_json      = '{ "@context": "https://schema.org", ... }';  // optional per-page schema
 *
 * Then include:  <?php include 'header.php'; ?>
 *
 * Active nav item detection: set $active_platform to one of:
 *   instagram | tiktok | youtube | twitter | facebook | reddit |
 *   spotify | telegram | twitch | threads | discord
 */

// ── Fallbacks ───────────────────────────────────────────────────────────────
$page_title       = $page_title       ?? 'Social Media Growth Services | DiscordBooster';
$meta_description = $meta_description ?? 'The most trusted social media growth service since 2019. Real followers, likes, views, and more across Instagram, TikTok, YouTube, and 10+ platforms.';
$meta_keywords    = $meta_keywords    ?? 'buy social media followers, buy instagram followers, buy tiktok likes, buy youtube subscribers';
$canonical_url    = $canonical_url    ?? 'https://discordbooster.com';
$og_title         = $og_title         ?? $page_title;
$og_description   = $og_description   ?? $meta_description;
$og_image         = $og_image         ?? 'https://discordbooster.com/og-default.jpg';
$schema_json      = $schema_json      ?? '';
$active_platform  = $active_platform  ?? '';

// ── Platform nav data ────────────────────────────────────────────────────────
$platforms = [
  'discord' => [
    'label'   => 'Discord',
    'color'   => '#5865f2',
    'bg'      => '#eef0ff',
    'icon'    => '💬',
    'hub'     => 'discord-services',
    'services'=> [
      ['Server Members', 'buy-discord-members'],
      ['Server Boost',   'buy-discord-boosts.html'],
    ],
  ],
  'instagram' => [
    'label'   => 'Instagram',
    'color'   => '#c13584',
    'bg'      => '#fce8f3',
    'icon'    => '📸',
    'hub'     => 'instagram-services',
    'services'=> [
      ['Followers',    'buy-instagram-followers'],
      ['Likes',        'buy-instagram-likes'],
      ['Video Views',  'buy-instagram-views'],
      ['Reels Views',  'buy-instagram-reels-views'],
    ],
  ],
  'tiktok' => [
    'label'   => 'TikTok',
    'color'   => '#ee1d52',
    'bg'      => '#fff0f3',
    'icon'    => '🎵',
    'hub'     => 'tiktok-services',
    'services'=> [
      ['Followers', 'buy-tiktok-followers'],
      ['Likes',     'buy-tiktok-likes'],
      ['Views',     'buy-tiktok-views'],
      ['Comments',  'buy-tiktok-comments'],
    ],
  ],
  'youtube' => [
    'label'   => 'YouTube',
    'color'   => '#ff0000',
    'bg'      => '#fff0f0',
    'icon'    => '▶️',
    'hub'     => 'youtube-services',
    'services'=> [
      ['Subscribers', 'buy-youtube-subscribers'],
      ['Views',       'buy-youtube-views'],
      ['Watch Hours', 'buy-youtube-watch-hours'],
      ['Likes',       'buy-youtube-likes'],
    ],
  ],
  'twitter' => [
    'label'   => 'Twitter / X',
    'color'   => '#1d9bf0',
    'bg'      => '#e8f5fe',
    'icon'    => '𝕏',
    'hub'     => 'twitter-services',
    'services'=> [
      ['Followers',   'buy-twitter-followers'],
      ['Likes',       'buy-twitter-likes'],
      ['Retweets',    'buy-twitter-retweets'],
      ['Impressions', 'buy-twitter-impressions'],
      ['Bookmarks',   'buy-twitter-bookmarks'],
      ['Poll Votes',  'buy-twitter-poll-votes'],
    ],
  ],
  'facebook' => [
    'label'   => 'Facebook',
    'color'   => '#1877f2',
    'bg'      => '#e8f0fe',
    'icon'    => '📘',
    'hub'     => 'facebook-services',
    'services'=> [
      ['Page Likes',   'buy-facebook-page-likes'],
      ['Followers',    'buy-facebook-followers'],
      ['Post Likes',   'buy-facebook-post-likes'],
      ['Video Views',  'buy-facebook-video-views'],
      ['Comments',     'buy-facebook-comments'],
      ['Group Members','buy-facebook-group-members'],
    ],
  ],
  'reddit' => [
    'label'   => 'Reddit',
    'color'   => '#ff4500',
    'bg'      => '#fff3ef',
    'icon'    => '🤖',
    'hub'     => 'reddit-services',
    'services'=> [
      ['Upvotes',       'buy-reddit-upvotes'],
      ['Followers',     'buy-reddit-followers'],
      ['Comments',      'buy-reddit-comments'],
      ['Account Karma', 'buy-reddit-account-karma'],
    ],
  ],
  'spotify' => [
    'label'   => 'Spotify',
    'color'   => '#1db954',
    'bg'      => '#eaf6ef',
    'icon'    => '🎧',
    'hub'     => 'spotify-services',
    'services'=> [
      ['Followers',         'buy-spotify-followers'],
      ['Monthly Listeners', 'buy-spotify-monthly-listeners'],
      ['Playlist Plays',    'buy-spotify-playlist-plays'],
      ['Playlist Followers','buy-spotify-playlist-followers'],
    ],
  ],
  'telegram' => [
    'label'   => 'Telegram',
    'color'   => '#2ca5e0',
    'bg'      => '#e8f5fc',
    'icon'    => '✈️',
    'hub'     => 'telegram-services',
    'services'=> [
      ['Members',   'buy-telegram-members'],
      ['Views',     'buy-telegram-views'],
      ['Reactions', 'buy-telegram-reactions'],
    ],
  ],
  'twitch' => [
    'label'   => 'Twitch',
    'color'   => '#9146ff',
    'bg'      => '#f3eeff',
    'icon'    => '🎮',
    'hub'     => 'twitch-services',
    'services'=> [
      ['Followers',      'buy-twitch-followers'],
      ['Live Viewers',   'buy-twitch-viewers'],
      ['Chatters',       'buy-twitch-chatters'],
      ['Clip Views',     'buy-twitch-clip-views'],
      ['Channel Points', 'buy-twitch-channel-points'],
    ],
  ],
  'threads' => [
    'label'   => 'Threads',
    'color'   => '#101010',
    'bg'      => '#f0f0f0',
    'icon'    => '@',
    'hub'     => 'threads-services',
    'services'=> [
      ['Followers', 'buy-threads-followers'],
      ['Likes',     'buy-threads-likes'],
      ['Reposts',   'buy-threads-reposts'],
      ['Views',     'buy-threads-views'],
    ],
  ],
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <!-- ══ FAVICON ══ -->
  <link rel="icon" type="image/png" href="/favicon.png" />
  <link rel="apple-touch-icon" href="/favicon.png" />

  <!-- ══ ANALYTICS ══ -->
  <script defer src="https://cloud.umami.is/script.js" data-website-id="6b8b022f-cbe6-44ad-9d25-320390262b41"></script>

  <!-- ══ REFERRER TRACKING ══ -->
  <script>
  (function(){
    function setCk(n,v,d){var e=new Date();e.setTime(e.getTime()+d*864e5);document.cookie=n+'='+encodeURIComponent(v)+';expires='+e.toUTCString()+';path=/;domain=.discordbooster.com;SameSite=Lax';}
    function getCk(n){var m=document.cookie.match(new RegExp('(?:^|; )'+n+'=([^;]*)'));return m?decodeURIComponent(m[1]):null;}

    // Capture original referrer on FIRST visit only (expires in 30 days)
    if(!getCk('db_ref')){
      var ref=document.referrer;
      // Only store if referrer is NOT our own domain (real external source)
      if(ref && ref.indexOf('discordbooster.com')===-1){
        setCk('db_ref',ref,30);
      } else if(!ref){
        setCk('db_ref','direct',30);
      }
    }

    // Capture UTM parameters if present
    var p=new URLSearchParams(window.location.search);
    var src=p.get('utm_source'),med=p.get('utm_medium'),camp=p.get('utm_campaign');
    if(src && !getCk('db_utm_source')) setCk('db_utm_source',src,30);
    if(med && !getCk('db_utm_medium')) setCk('db_utm_medium',med,30);
    if(camp && !getCk('db_utm_campaign')) setCk('db_utm_campaign',camp,30);

    // Capture landing page
    if(!getCk('db_landing')) setCk('db_landing',window.location.pathname,30);
  })();
  </script>

  <!-- ══ PRIMARY SEO ══ -->
  <title><?= htmlspecialchars($page_title) ?></title>
  <meta name="description" content="<?= htmlspecialchars($meta_description) ?>" />
  <meta name="keywords"    content="<?= htmlspecialchars($meta_keywords) ?>" />
  <meta name="robots"      content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
  <meta name="author"      content="DiscordBooster" />
  <link rel="canonical"    href="<?= htmlspecialchars($canonical_url) ?>" />

  <!-- ══ BING ══ -->
  <meta name="msvalidate.01" content="YOUR_BING_CODE_HERE" />
  <meta name="revisit-after" content="7 days" />
  <meta name="rating"        content="general" />
  <meta name="distribution"  content="global" />

  <!-- ══ OPEN GRAPH ══ -->
  <meta property="og:title"       content="<?= htmlspecialchars($og_title) ?>" />
  <meta property="og:description" content="<?= htmlspecialchars($og_description) ?>" />
  <meta property="og:url"         content="<?= htmlspecialchars($canonical_url) ?>" />
  <meta property="og:type"        content="website" />
  <meta property="og:image"       content="<?= htmlspecialchars($og_image) ?>" />
  <meta property="og:image:width"  content="1200" />
  <meta property="og:image:height" content="630" />
  <meta property="og:site_name"   content="DiscordBooster" />
  <meta property="og:locale"      content="en_US" />

  <!-- ══ TWITTER CARD ══ -->
  <meta name="twitter:card"        content="summary_large_image" />
  <meta name="twitter:title"       content="<?= htmlspecialchars($og_title) ?>" />
  <meta name="twitter:description" content="<?= htmlspecialchars($og_description) ?>" />
  <meta name="twitter:image"       content="<?= htmlspecialchars($og_image) ?>" />

  <!-- ══ PER-PAGE SCHEMA ══ -->
  <?php if ($schema_json): ?>
  <script type="application/ld+json"><?= $schema_json ?></script>
  <?php endif; ?>

  <!-- ══ FONTS ══ -->
  <link rel="preconnect" href="https://fonts.googleapis.com" />
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,700;1,800&family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet" />

  <!-- ══ GLOBAL CSS VARIABLES & NAV STYLES ══ -->
  <style>
    /* ── Design tokens ─────────────────────────────────────────────────── */
    :root {
      --cream:        #faf8f4;
      --bg:           #f5f1ea;
      --surface:      #ffffff;
      --border:       #e8e2d8;
      --border-dark:  #d4cdc0;
      --ink:          #1a1612;
      --ink-2:        #3d3830;
      --muted:        #8c8278;
      --green:        #1a7a4a;
      --green-soft:   #eaf6ef;
      --shadow-sm:    0 1px 3px rgba(26,22,18,0.08);
      --shadow-md:    0 4px 16px rgba(26,22,18,0.10);
      --shadow-lg:    0 12px 40px rgba(26,22,18,0.13);
      --shadow-xl:    0 24px 64px rgba(26,22,18,0.16);
      --nav-h:        66px;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; }
    body {
      background: var(--cream);
      color: var(--ink-2);
      font-family: 'Outfit', sans-serif;
      font-size: 16px;
      line-height: 1.7;
      overflow-x: hidden;
    }
    h1,h2,h3,h4 { font-family: 'Playfair Display', serif; color: var(--ink); line-height: 1.15; }
    a { color: inherit; text-decoration: none; }
    strong { color: var(--ink); font-weight: 600; }
    img { max-width: 100%; }

    /* ── NAV SHELL ──────────────────────────────────────────────────────── */
    #site-nav {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 500;
      height: var(--nav-h);
      background: rgba(250,248,244,0.95);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 4%;
      gap: 1.5rem;
    }

    /* Logo */
    .nav-logo {
      font-family: 'Playfair Display', serif;
      font-weight: 900;
      font-size: 1.3rem;
      color: var(--ink);
      letter-spacing: -0.5px;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .nav-logo em { color: #ff4500; font-style: italic; }

    /* Top-level nav items */
    .nav-items {
      display: flex;
      align-items: center;
      gap: 0.2rem;
      list-style: none;
      flex: 1;
    }
    .nav-item { position: relative; }
    .nav-item > a, .nav-item > button {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.45rem 0.75rem;
      border-radius: 8px;
      font-size: 0.875rem;
      font-weight: 500;
      color: var(--ink-2);
      background: none;
      border: none;
      cursor: pointer;
      font-family: 'Outfit', sans-serif;
      transition: background 0.15s, color 0.15s;
      white-space: nowrap;
    }
    .nav-item > a:hover, .nav-item > button:hover,
    .nav-item > a.active, .nav-item > button.active {
      background: var(--bg);
      color: var(--ink);
    }
    .nav-chevron { font-size: 0.6rem; opacity: 0.5; transition: transform 0.2s; }
    .nav-item.open > button .nav-chevron { transform: rotate(180deg); }

    /* CTA button */
    .nav-cta {
      background: var(--ink) !important;
      color: #fff !important;
      padding: 0.5rem 1.2rem !important;
      border-radius: 8px !important;
      font-weight: 700 !important;
      font-size: 0.82rem !important;
      transition: background 0.18s !important;
      flex-shrink: 0;
    }
    .nav-cta:hover { background: #ff4500 !important; }

    /* ── MEGA DROPDOWN ──────────────────────────────────────────────────── */
    .mega-panel {
      display: none;
      position: absolute;
      top: calc(100% + 10px);
      left: 0;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 18px;
      box-shadow: var(--shadow-xl);
      padding: 1.5rem;
      min-width: 760px;
      max-width: min(920px, calc(100vw - 2rem));
      z-index: 600;
    }
    .mega-panel.open { display: block; animation: panelIn 0.18s ease both; }
    @keyframes panelIn {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .mega-grid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 0.5rem;
    }
    .mega-col { display: flex; flex-direction: column; gap: 0; }
    .mega-col-header {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.5rem 0.7rem 0.35rem;
      border-radius: 8px 8px 0 0;
      font-size: 0.75rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--ink);
      text-decoration: none;
      margin-bottom: 0.1rem;
      transition: background 0.14s;
    }
    .mega-col-header:hover { background: var(--bg); }
    .mega-col-icon { font-size: 1rem; flex-shrink: 0; }
    .mega-col-link {
      display: block;
      padding: 0.32rem 0.7rem;
      border-radius: 6px;
      font-size: 0.82rem;
      color: var(--muted);
      transition: background 0.14s, color 0.14s;
      white-space: nowrap;
    }
    .mega-col-link:hover { color: var(--ink); background: var(--bg); }
    .mega-footer {
      border-top: 1px solid var(--border);
      margin-top: 1.2rem;
      padding-top: 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .mega-footer-text { font-size: 0.8rem; color: var(--muted); }
    .mega-footer-link {
      font-size: 0.8rem;
      font-weight: 600;
      color: #ff4500;
      display: flex;
      align-items: center;
      gap: 0.3rem;
    }
    .mega-footer-link:hover { text-decoration: underline; }

    /* Simple dropdown (non-mega) */
    .simple-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow-lg);
      padding: 0.5rem;
      min-width: 180px;
      z-index: 600;
    }
    .simple-dropdown.open { display: block; animation: panelIn 0.18s ease both; }
    .simple-dropdown a {
      display: block;
      padding: 0.5rem 0.85rem;
      border-radius: 7px;
      font-size: 0.85rem;
      color: var(--ink-2);
      transition: background 0.14s;
    }
    .simple-dropdown a:hover { background: var(--bg); color: var(--ink); }

    /* Hamburger */
    .nav-hamburger {
      display: none;
      background: none;
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.45rem 0.7rem;
      cursor: pointer;
      flex-shrink: 0;
      flex-direction: column;
      gap: 4px;
      align-items: center;
      justify-content: center;
    }
    .nav-hamburger span {
      display: block;
      width: 20px;
      height: 2px;
      background: var(--ink);
      border-radius: 2px;
      transition: transform 0.2s, opacity 0.2s;
    }
    .nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-hamburger.open span:nth-child(2) { opacity: 0; }
    .nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    /* ── MOBILE DRAWER ──────────────────────────────────────────────────── */
    #mobile-drawer {
      display: none;
      position: fixed;
      top: var(--nav-h);
      left: 0; right: 0; bottom: 0;
      background: #fff;
      z-index: 490;
      overflow-y: auto;
      padding: 1.5rem 5%;
      border-top: 1px solid var(--border);
    }
    #mobile-drawer.open { display: block; }
    .mob-section { margin-bottom: 1.5rem; }
    .mob-section-title {
      font-size: 0.72rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: var(--muted);
      padding: 0.5rem 0;
      border-bottom: 1px solid var(--border);
      margin-bottom: 0.5rem;
    }
    .mob-platform-group { margin-bottom: 1.2rem; }
    .mob-platform-header {
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--ink);
      padding: 0.4rem 0;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .mob-service-link {
      display: block;
      padding: 0.38rem 1rem;
      font-size: 0.85rem;
      color: var(--muted);
      border-radius: 6px;
      transition: background 0.12s, color 0.12s;
    }
    .mob-service-link:hover { background: var(--bg); color: var(--ink); }
    .mob-cta-row { display: flex; gap: 0.7rem; margin-top: 1.5rem; }
    .mob-cta {
      flex: 1;
      text-align: center;
      background: var(--ink);
      color: #fff;
      padding: 0.85rem 1rem;
      border-radius: 10px;
      font-weight: 700;
      font-size: 0.9rem;
      transition: background 0.18s;
    }
    .mob-cta:hover { background: #ff4500; }

    /* Page content offset */
    .page-offset { padding-top: var(--nav-h); }

    @media (max-width: 1100px) {
      .nav-items { display: none; }
      .nav-hamburger { display: flex; }
    }
    @media (max-width: 480px) {
      .nav-logo { font-size: 1.1rem; }
    }
  </style>
</head>
<body>

<!-- ══════════════════════════════════════
     NAVIGATION
══════════════════════════════════════ -->
<header id="site-nav" role="banner">

  <!-- Logo -->
  <a href="https://discordbooster.com" class="nav-logo" aria-label="DiscordBooster — Home">
    Discord<em>Booster</em>
  </a>

  <!-- Desktop nav -->
  <ul class="nav-items" role="list" aria-label="Main navigation">

    <!-- ── Discord (primary service — first in nav) ── -->
    <?php $dc = $platforms['discord']; ?>
    <li class="nav-item" id="nav-discord">
      <button
        aria-haspopup="true"
        aria-expanded="false"
        aria-controls="dd-discord"
        class="<?= ($active_platform === 'discord') ? 'active' : '' ?>"
        onclick="toggleSimple('dd-discord','nav-discord')"
        style="font-weight:700;color:var(--ink);"
      >
        <?= $dc['icon'] ?> Discord <span class="nav-chevron">▾</span>
      </button>
      <div class="simple-dropdown" id="dd-discord" role="menu">
        <a href="<?= htmlspecialchars($dc['hub']) ?>" style="font-weight:700;color:var(--ink);">All Discord Services</a>
        <?php foreach ($dc['services'] as [$name, $url]): ?>
        <a href="<?= htmlspecialchars($url) ?>"><?= $name ?></a>
        <?php endforeach; ?>
      </div>
    </li>

    <!-- ── All Services mega dropdown ── -->
    <li class="nav-item" id="nav-services">
      <button
        aria-haspopup="true"
        aria-expanded="false"
        aria-controls="mega-services"
        onclick="toggleMega('mega-services','nav-services')"
      >
        Services <span class="nav-chevron">▾</span>
      </button>

      <div class="mega-panel" id="mega-services" role="menu">
        <div class="mega-grid">
          <?php foreach ($platforms as $key => $p): ?>
          <div class="mega-col">
            <a
              href="<?= htmlspecialchars($p['hub']) ?>"
              class="mega-col-header"
              style="--pl-color:<?= $p['color'] ?>"
              title="All <?= $p['label'] ?> services"
            >
              <span class="mega-col-icon"><?= $p['icon'] ?></span>
              <?= $p['label'] ?>
            </a>
            <?php foreach ($p['services'] as [$name, $url]): ?>
            <a href="<?= htmlspecialchars($url) ?>" class="mega-col-link"><?= $name ?></a>
            <?php endforeach; ?>
          </div>
          <?php endforeach; ?>
        </div>
        <div class="mega-footer">
          <span class="mega-footer-text">120,000+ orders delivered since 2019</span>
          <a href="#order" class="mega-footer-link" onclick="document.querySelector('#site-nav .nav-cta')?.scrollIntoView(); return false;">
            Order now →
          </a>
        </div>
      </div>
    </li>

    <!-- ── Per-platform quick links ── -->
    <?php
    $quick = ['instagram','tiktok','youtube','twitter'];
    foreach ($quick as $key):
      $p = $platforms[$key];
      $isActive = ($active_platform === $key);
      $menuId = "nav-$key";
    ?>
    <li class="nav-item" id="nav-<?= $key ?>">
      <button
        aria-haspopup="true"
        aria-expanded="false"
        aria-controls="dd-<?= $key ?>"
        class="<?= $isActive ? 'active' : '' ?>"
        onclick="toggleSimple('dd-<?= $key ?>','nav-<?= $key ?>')"
      >
        <?= $p['icon'] ?> <?= $p['label'] ?> <span class="nav-chevron">▾</span>
      </button>
      <div class="simple-dropdown" id="dd-<?= $key ?>" role="menu">
        <a href="<?= htmlspecialchars($p['hub']) ?>" style="font-weight:700;color:var(--ink);">All <?= $p['label'] ?> Services</a>
        <?php foreach ($p['services'] as [$name, $url]): ?>
        <a href="<?= htmlspecialchars($url) ?>"><?= $name ?></a>
        <?php endforeach; ?>
      </div>
    </li>
    <?php endforeach; ?>

    <li><a href="https://discordbooster.com/blog" style="padding:0.45rem 0.75rem;border-radius:8px;font-size:0.875rem;font-weight:500;color:var(--ink-2);display:flex;align-items:center;transition:background 0.15s;" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background=''">Blog</a></li>
    <li><a href="/support" style="padding:0.45rem 0.75rem;border-radius:8px;font-size:0.875rem;font-weight:500;color:var(--ink-2);display:flex;align-items:center;transition:background 0.15s;" onmouseover="this.style.background='var(--bg)'" onmouseout="this.style.background=''">Support</a></li>
  </ul>

  <!-- CTA -->
  <a href="#order" class="nav-cta">Order Now</a>

  <!-- Hamburger -->
  <button
    class="nav-hamburger"
    id="nav-hamburger"
    aria-label="Open navigation menu"
    aria-expanded="false"
    aria-controls="mobile-drawer"
    onclick="toggleMobileMenu()"
  >
    <span></span><span></span><span></span>
  </button>
</header>

<!-- ══════════════════════════════════════
     MOBILE DRAWER
══════════════════════════════════════ -->
<nav id="mobile-drawer" aria-label="Mobile navigation">
  <div class="mob-section">
    <div class="mob-section-title">All Services</div>
    <?php foreach ($platforms as $key => $p): ?>
    <div class="mob-platform-group">
      <div class="mob-platform-header">
        <span><?= $p['icon'] ?></span>
        <a href="<?= htmlspecialchars($p['hub']) ?>" style="color:var(--ink);"><?= $p['label'] ?></a>
      </div>
      <?php foreach ($p['services'] as [$name, $url]): ?>
      <a href="<?= htmlspecialchars($url) ?>" class="mob-service-link"><?= $name ?></a>
      <?php endforeach; ?>
    </div>
    <?php endforeach; ?>
  </div>
  <div class="mob-cta-row">
    <a href="https://discordbooster.com/blog" class="mob-cta" style="background:var(--bg);color:var(--ink);">Blog</a>
    <a href="#order" class="mob-cta" onclick="document.getElementById('mobile-drawer').classList.remove('open');document.getElementById('nav-hamburger').classList.remove('open');">Order Now →</a>
  </div>
</nav>

<!-- ══ NAV JS ════════════════════════════════════════════════════════════ -->
<script>
(function() {
  // Close all dropdowns
  function closeAll() {
    document.querySelectorAll('.mega-panel.open, .simple-dropdown.open').forEach(function(el) {
      el.classList.remove('open');
    });
    document.querySelectorAll('[aria-expanded="true"]').forEach(function(btn) {
      btn.setAttribute('aria-expanded', 'false');
    });
    document.querySelectorAll('.nav-item.open').forEach(function(el) {
      el.classList.remove('open');
    });
  }

  window.toggleMega = function(panelId, itemId) {
    var panel = document.getElementById(panelId);
    var item  = document.getElementById(itemId);
    var btn   = item.querySelector('[aria-haspopup]');
    var isOpen = panel.classList.contains('open');
    closeAll();
    if (!isOpen) {
      panel.classList.add('open');
      item.classList.add('open');
      btn.setAttribute('aria-expanded', 'true');
    }
  };

  window.toggleSimple = function(panelId, itemId) {
    var panel = document.getElementById(panelId);
    var item  = document.getElementById(itemId);
    var btn   = item.querySelector('[aria-haspopup]');
    var isOpen = panel.classList.contains('open');
    closeAll();
    if (!isOpen) {
      panel.classList.add('open');
      item.classList.add('open');
      btn.setAttribute('aria-expanded', 'true');
    }
  };

  window.toggleMobileMenu = function() {
    var drawer = document.getElementById('mobile-drawer');
    var burger = document.getElementById('nav-hamburger');
    var isOpen = drawer.classList.contains('open');
    drawer.classList.toggle('open', !isOpen);
    burger.classList.toggle('open', !isOpen);
    burger.setAttribute('aria-expanded', !isOpen);
    document.body.style.overflow = isOpen ? '' : 'hidden';
  };

  // Click outside to close
  document.addEventListener('click', function(e) {
    if (!e.target.closest('#site-nav')) closeAll();
  });

  // Escape key
  document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape') closeAll();
  });
})();
</script>