/* ============================================================
   MOBILE MENU — single source of truth, all devices
   Replace the entire existing MOBILE MENU block in index.php
   with this code (keep the <script> tags that wrap it).
   ============================================================ */
(function() {
  var navToggle  = document.getElementById('navToggle');
  var mobileMenu = document.getElementById('mobileMenu');
  if (!navToggle || !mobileMenu) return;

  /* ── helpers ── */
  function openMenu() {
    mobileMenu.classList.add('open');
    mobileMenu.setAttribute('aria-hidden', 'false');
    navToggle.setAttribute('aria-expanded', 'true');
    document.body.style.overflow = 'hidden';
  }
  function closeMenu() {
    mobileMenu.classList.remove('open');
    mobileMenu.setAttribute('aria-hidden', 'true');
    navToggle.setAttribute('aria-expanded', 'false');
    document.body.style.overflow = '';
  }

  /* ── 1. Hamburger toggle
     stopImmediatePropagation stops the click reaching ANY other
     listener (including document-level ones added by plugins/GTM)
     so menu cannot close itself on the same tick it opened.     ── */
  navToggle.addEventListener('click', function(e) {
    e.preventDefault();
    e.stopImmediatePropagation();
    mobileMenu.classList.contains('open') ? closeMenu() : openMenu();
  });

  /* ── 2. Close on outside CLICK (desktop + tablet) ── */
  document.addEventListener('click', function(e) {
    if (!mobileMenu.classList.contains('open')) return;
    if (mobileMenu.contains(e.target)) return;
    if (navToggle.contains(e.target)) return;
    closeMenu();
  });

  /* ── 3. Close on outside TOUCH (mobile) ── */
  document.addEventListener('touchstart', function(e) {
    if (!mobileMenu.classList.contains('open')) return;
    if (mobileMenu.contains(e.target)) return;
    if (navToggle.contains(e.target)) return;
    closeMenu();
  }, { passive: true });

  /* ── 4. Close via [data-close] links inside menu ── */
  mobileMenu.querySelectorAll('[data-close]').forEach(function(link) {
    link.addEventListener('click', closeMenu);
  });

  /* ── 5. Services sub-menu accordion
     stopPropagation so click doesn't bubble to document
     close listener and close the whole menu.                   ── */
  var servicesToggle = document.getElementById('mobileServicesToggle');
  var servicesSub    = document.getElementById('mobileServicesSub');
  if (servicesToggle && servicesSub) {
    servicesToggle.addEventListener('click', function(e) {
      e.stopPropagation();
      var open = servicesSub.classList.toggle('open');
      servicesToggle.classList.toggle('open', open);
      servicesToggle.setAttribute('aria-expanded', open ? 'true' : 'false');
    });
  }

  /* ── 6. ESC key closes menu ── */
  document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape' && mobileMenu.classList.contains('open')) {
      closeMenu();
      navToggle.focus();
    }
  });

  /* ── 7. ✕ Close button — injected once inside the mobile menu ── */
  if (!document.getElementById('mobileMenuClose')) {
    var closeBtn       = document.createElement('button');
    closeBtn.id        = 'mobileMenuClose';
    closeBtn.type      = 'button';
    closeBtn.setAttribute('aria-label', 'Close menu');
    closeBtn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg>';
    closeBtn.style.cssText = [
      'position:absolute',
      'top:16px',
      'right:16px',
      'width:44px',
      'height:44px',
      'min-height:44px',
      'display:flex',
      'align-items:center',
      'justify-content:center',
      'background:rgba(255,255,255,0.08)',
      'border:1px solid rgba(255,255,255,0.15)',
      'border-radius:50%',
      'color:#fff',
      'cursor:pointer',
      'z-index:10',
      'flex-shrink:0',
      'transition:background .25s ease'
    ].join(';');
    closeBtn.addEventListener('mouseenter', function() {
      closeBtn.style.background = 'rgba(255,255,255,0.2)';
    });
    closeBtn.addEventListener('mouseleave', function() {
      closeBtn.style.background = 'rgba(255,255,255,0.08)';
    });
    closeBtn.addEventListener('click', function(e) {
      e.stopImmediatePropagation();
      closeMenu();
      navToggle.focus();
    });
    /* position:relative on menu so the absolute close btn stays inside */
    mobileMenu.style.position = 'relative';
    mobileMenu.prepend(closeBtn);
  }
})();<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://sellevate.com.au/sitemaps.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap>
							<loc>https://sellevate.com.au/post-sitemap1.xml</loc>
							<lastmod>2026-05-15T09:00:00+00:00</lastmod>
						</sitemap><sitemap>
							<loc>https://sellevate.com.au/page-sitemap1.xml</loc>
							<lastmod>2026-06-26T16:16:23+00:00</lastmod>
						</sitemap><sitemap>	
							<loc>https://sellevate.com.au/category-sitemap1.xml</loc>
							<lastmod>2026-06-27T16:17:07+00:00</lastmod>
						</sitemap></sitemapindex>