<?php /* Theme Footer */ ?>
</main>

<footer class="mg-footer" role="contentinfo" aria-label="Site Footer">
  <div class="mg-footer__inner">
    <!-- Brand / Location -->
    <div class="mg-foot-brand">
      <a class="mg-brand" href="<?php echo esc_url( home_url('/') ); ?>">MusicGroove</a>
      <p>In-home • Studio • Online<br>Orange County, CA</p>
    </div>

    <!-- Quick Links (uses WP menu if assigned; otherwise hardcoded fallback). Always appends BrazilCares. -->
    <div class="mg-foot-links">
      <h4>Quick links</h4>

      <?php if ( has_nav_menu( 'footer' ) ) : ?>

        <?php
          // Render the registered 'footer' menu and append BrazilCares.org as the last item
          wp_nav_menu([
            'theme_location' => 'footer',
            'menu_class'     => 'mg-foot-nav',
            'container'      => false,
            'fallback_cb'    => false,
            'items_wrap'     => '<ul id="%1$s" class="%2$s">%3$s<li class="menu-item menu-item-brazilcares"><a href="https://brazilcares.org" target="_blank" rel="noopener">BrazilCares.org</a></li></ul>',
          ]);
        ?>

      <?php else : ?>

        <ul class="mg-foot-nav">
          <li><a href="<?php echo esc_url( home_url('/in-home-class/') ); ?>">Programs</a></li>
          <li><a href="<?php echo esc_url( home_url('/pricing/') ); ?>">Pricing</a></li>
          <li><a href="<?php echo esc_url( home_url('/teachers/') ); ?>">Teachers</a></li>
          <li><a href="<?php echo esc_url( home_url('/events/') ); ?>">Events &amp; Recitals</a></li>
          <li><a href="<?php echo esc_url( home_url('/curriculum/') ); ?>">Curriculum</a></li>
          <li><a href="<?php echo esc_url( home_url('/exam-prep/') ); ?>">Exam Preparation</a></li>
          <li><a href="<?php echo esc_url( home_url('/scholarship/') ); ?>">Scholarship</a></li>
          <li><a href="<?php echo esc_url( home_url('/policies/') ); ?>">Policies</a></li>
          <li><a href="<?php echo esc_url( home_url('/contact-us/') ); ?>">Contact Us</a></li>
          <li class="menu-item-brazilcares"><a href="https://brazilcares.org" target="_blank" rel="noopener">BrazilCares.org</a></li>
        </ul>

      <?php endif; ?>
    </div>

    <!-- Contact CTA + Tagline (no direct phone/email) -->
    <div class="mg-foot-contact">
      <h4>Contact</h4>
      <p>
        <a class="btn btn--primary" href="<?php echo esc_url( home_url('/contact-us/') ); ?>">
          Get in Touch
        </a>
      </p>
      <p class="mg-tagline"><strong>Musicogroove — Great Teachers. Real Progress. Right at Home.</strong></p>

      <!-- badges optional; leave commented if you want them later
      <ul class="mg-badges">
        <li>LiveScan cleared</li>
        <li>$1M insured</li>
        <li>OC charter-approved</li>
      </ul>
      -->
    </div>
  </div>

  <div class="mg-subfooter">
    <p>© <?php echo date('Y'); ?> MusicGroove</p>
    <p class="mg-sub-links">
      <a href="<?php echo esc_url( home_url('/policies') ); ?>">Policies</a> ·
      <a href="<?php echo esc_url( home_url('/privacy') ); ?>">Privacy</a>
    </p>
  </div>
</footer>

<?php wp_footer(); ?>

<script>
  // tiny mobile menu toggle (no plugin needed)
  (function () {
    const btn  = document.querySelector('.mg-burger');
    const wrap = document.querySelector('.mg-navwrap');
    if (!btn || !wrap) return;
    btn.addEventListener('click', () => {
      const open = btn.getAttribute('aria-expanded') === 'true';
      btn.setAttribute('aria-expanded', String(!open));
      document.body.classList.toggle('mg-nav-open', !open);
    });
  })();
</script>
</body>
</html>
