<?php
// AdityaHost public navigation. Guarded so it prints exactly once per request,
// even when pages include it directly after public_header.php.
if (defined('AH_NAV_PRINTED')) return;
define('AH_NAV_PRINTED', 1);
$navActive = $navActive ?? '';
$loggedIn  = function_exists('isLoggedIn') ? isLoggedIn() : false;
?>
<link rel="preload" as="image" href="assets/img/logo.svg">

<div class="announce">🚀 Launch offer: Free access for 12 hours on every new account <a href="register.php">Grab your API now →</a></div>

<header class="nav" id="siteNav">
  <div class="wrap nav-inner">
    <a href="index.php" class="brand" aria-label="AdityaHost home">
      <span class="brand-mark"><img src="assets/img/logo.svg" width="20" height="20" alt="AdityaHost"></span>
      Aditya<b>Host</b>
    </a>

    <nav class="nav-links" aria-label="Main navigation">
      <a href="index.php" class="<?= $navActive === 'index' ? 'active' : '' ?>">Home</a>
      <a href="index.php#features" class="<?= $navActive === 'features' ? 'active' : '' ?>">Features</a>
      <a href="index.php#pricing" class="<?= $navActive === 'pricing' ? 'active' : '' ?>">Pricing</a>
      <a href="blog.php" class="<?= $navActive === 'blog' ? 'active' : '' ?>">Blog</a>
      <a href="docs.php" class="<?= $navActive === 'docs' ? 'active' : '' ?>">Developers</a>
      <a href="contact.php" class="<?= $navActive === 'contact' ? 'active' : '' ?>">Support</a>
    </nav>

    <div class="nav-actions">
      <?php if ($loggedIn): ?>
        <a href="dashboard.php" class="btn btn-primary btn-sm">Dashboard</a>
      <?php else: ?>
        <a href="login.php" class="btn btn-ghost btn-sm">Sign in</a>
        <a href="register.php" class="btn btn-primary btn-sm">Get API Free</a>
      <?php endif; ?>
      <button class="nav-burger" id="navBurger" aria-label="Open menu">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 7h16M4 12h16M4 17h16"/></svg>
      </button>
    </div>
  </div>
  <div class="mobile-menu" id="mobileMenu">
    <a href="index.php">Home</a>
    <a href="index.php#features">Features</a>
    <a href="index.php#pricing">Pricing</a>
    <a href="blog.php">Blog</a>
    <a href="docs.php">Developers</a>
    <a href="contact.php">Support</a>
    <?php if (!$loggedIn): ?>
      <a href="login.php">Sign in</a>
      <a href="register.php" style="color:#0a4bff">Get API Free</a>
    <?php else: ?>
      <a href="dashboard.php" style="color:#0a4bff">Dashboard</a>
    <?php endif; ?>
  </div>
</header>

<script>
(function(){
  var b=document.getElementById('navBurger'),m=document.getElementById('mobileMenu');
  if(!b)return;b.addEventListener('click',function(){m.classList.toggle('open');});
  document.querySelectorAll('#mobileMenu a').forEach(function(a){a.addEventListener('click',function(){m.classList.remove('open');});});
})();
</script>