// custom.js
(() => {
    const TAB_CLASS_PREFIX = "tab-";
    const knownTabs = new Set(["glance", "netgrimoire", "wasted-bandwidth", "pncharris", "nucking-futz"]);
  
    function clearTabClasses() {
      document.body.classList.forEach((c) => {
        if (c.startsWith(TAB_CLASS_PREFIX)) document.body.classList.remove(c);
      });
    }
  
    function applyTabClass() {
      // Your URLs look like: https://homepage.netgrimoire.com/#pncharris
      const hash = (window.location.hash || "").replace(/^#/, "").trim().toLowerCase();
      const tab = knownTabs.has(hash) ? hash : "glance";
  
      clearTabClasses();
      document.body.classList.add(`${TAB_CLASS_PREFIX}${tab}`);
    }
  
    window.addEventListener("hashchange", applyTabClass);
    window.addEventListener("load", applyTabClass);
  
    applyTabClass();
  })();
  