@layer navigation {
  /* ===================================================
     TGK Navigation – Header + Floating Drawer Toggle
     Version: 4.2 – Token consistency + a11y refinements
     =================================================== */

  :root {
    --z-hamburger: 10002;
    --z-drawer:    10001;
    --z-overlay:   10000;
  }

  /* HEADER HAMBURGER */
  .hamburger-icon {
    font-size: var(--font-size-lg);
    cursor: pointer;
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    z-index: var(--z-header, 9000);
    color: var(--text-accent);
    background: none;
    border: none;
    transition: color .3s ease;
  }
  .hamburger-icon:hover { color: var(--highlight); }

  /* FLOATING HAMBURGER */
  .floating-hamburger {
    position: fixed;
    top: max(var(--space-sm), env(safe-area-inset-top));
    left: max(var(--space-sm), env(safe-area-inset-left));
    z-index: var(--z-hamburger, 10002);
    pointer-events: none;
  }
  .floating-hamburger .drawer-toggle-floating { pointer-events: auto; }

  .drawer-toggle-floating {
    width: var(--toggle-size, 3rem);
    height: var(--toggle-size, 3rem);
    border-radius: 9999px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: 0;
    outline: 0;
    background-color: transparent;
    color: var(--text-accent);
    font-size: var(--font-size-toggle, 1.25rem);
    box-shadow: 0 0 12px var(--shadow-glow);
    backdrop-filter: blur(2px);
    transition: transform .2s ease, background-color .2s ease, color .2s ease;
  }
  .drawer-toggle-floating:hover {
    transform: scale(1.1);
    background-color: var(--highlight);
    color: var(--bg-primary);
  }
  .drawer-toggle-floating:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: 2px;
  }
  .drawer-toggle-floating[hidden] { display:none!important; }

  /* DRAWER + OVERLAY */
  #mobileNav {
    position: fixed; top: 0; left: 0;
    height: 100dvh; width: 80%; max-width: 300px;
    background: var(--card-gradient, var(--bg-primary));
    box-shadow: 2px 0 10px var(--shadow-glow);
    transform: translateX(-100%);
    transition: transform .3s ease-in-out;
    z-index: var(--z-drawer, 10001);
    display: flex; flex-direction: column;
    will-change: transform;
  }
  #mobileNav.open { transform: translateX(0)!important; }
  #mobileNav[hidden] { display:none!important; }

  #navOverlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    z-index: var(--z-overlay, 10000);
  }
  #navOverlay, .nav-overlay {
    display:none!important; opacity:0!important; pointer-events:none!important;
  }
  #navOverlay.visible, .nav-overlay.visible {
    display:block!important; opacity:1!important; pointer-events:auto!important;
  }

  body.menu-open { overflow:hidden; }

  /* Drawer inner */
  .drawer-content {
    flex: 1; overflow-y: auto;
    padding: var(--space-lg);
    background: var(--section-bg-bottom);
    display: flex; flex-direction: column;
    -webkit-overflow-pageing: touch;
  }

  .drawer-label, .nolink {
    font-family: var(--font-display);
    font-size: var(--font-size-nav);
    color: var(--text-accent);
    text-transform: uppercase; letter-spacing: .1em;
    pointer-events: none; cursor: default;
    margin-bottom: var(--space-sm);
    padding: var(--space-md) 0 var(--space-xs);
    border-bottom: 1px solid var(--section-border);
  }

  /* =========================================================
   TGK Drawer — Styled Sign-Out Button
   ========================================================= */
  .drawer-content .logout-btn.nav-signout {
    border: none;
    justify-content: flex-start;
    color: var(--text-accent);
    font-weight: 500;
    font-size: var(--font-size-base);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-display);
    background: none;
    padding: var(--space-xs) 0;
    width: auto;
  }
  .drawer-content .logout-btn.nav-signout:hover {
    color: var(--highlight);
    background: none;
    box-shadow: none;
  }

  /* Drawer links */
  #mobileNav ul { list-style: none; margin: 0; padding: var(--space-sm) 0 0 0; }
  #mobileNav li { padding: var(--space-xs) 0; margin: 0; }
  #mobileNav li + li { margin-top: var(--space-xs); }

  #mobileNav a, .mobile-nav-social a {
    font-family: var(--font-display);
    font-size: var(--font-size-base);
    font-weight: 500;
    text-transform: uppercase; letter-spacing: .05em;
    text-decoration: none;
    display: inline-flex; align-items: center;
    color: var(--text-accent);
    transition: color .2s ease;
  }
  #mobileNav a:hover, .mobile-nav-social a:hover { color: var(--highlight); }

  .mobile-nav-social {
    display: flex; flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
  }

  /* pagebars (WebKit + Firefox) */
  body::-webkit-scrollbar { width: 12px; height: 12px; }
  body::-webkit-scrollbar-track {
    background: var(--section-bg-bottom);
    border-radius: var(--border-radius-lg);
  }
  body::-webkit-scrollbar-thumb {
    background-color: var(--accent-page);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--section-bg-bottom);
    transition: background-color .3s ease;
  }
  body::-webkit-scrollbar-thumb:hover { background-color: var(--highlight); }

  .drawer-content::-webkit-scrollbar { width: 8px; height: 8px; }
  .drawer-content::-webkit-scrollbar-track { background: var(--section-bg-bottom); }
  .drawer-content::-webkit-scrollbar-thumb {
    background-color: var(--accent-page);
    border-radius: var(--border-radius-base);
  }
  .drawer-content::-webkit-scrollbar-thumb:hover { background-color: var(--highlight); }

  @-moz-document url-prefix() {
    body, .drawer-content {
      scrollbar-width: thin;
      scrollbar-color: var(--accent-page) var(--section-bg-bottom) !important;
    }
  }

  /* Inline nav underline */
  .site-nav { display:flex; flex-wrap:wrap; gap:.75rem; padding:.75rem 0 1.25rem; }
  .site-nav a { text-decoration:none; font-weight:600; opacity:.9; }
  .site-nav a.active {
    color: var(--text-accent);
    position: relative;
    opacity:1;
  }
  .site-nav a.active::after {
    content:""; position:absolute; left:0; right:0; bottom:-.35rem; height:2px;
    background: var(--text-accent); opacity:.9; border-radius:2px;
  }

  html, body { overflow-x:hidden; }

  /* ===============================================
     Sacred page Nav – Clean & Centered
     =============================================== */
  .page-nav-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-sm) 0 var(--space-md);
    font-family: var(--font-display);
    position: relative;
    text-align: center;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .page-nav-bar::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(80%, 320px);
    height: 2px;
    background: linear-gradient(
      to right,
      transparent 0%,
      var(--text-accent) 20%,
      var(--text-accent) 80%,
      transparent 100%
    );
    pointer-events: none;
  }

  .tab-link {
    all: unset;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-accent);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: normal;
    padding: var(--space-xs) var(--space-sm);
    display: inline-block;
    text-align: center;
  }
  .tab-link:hover:not(.active) {
    color: var(--golden-blaze);
    text-shadow: 0 0 4px var(--accent-soft);
  }
  .tab-link.active {
    color: var(--soft-gold);
    font-weight: 600;
    position: relative;
    padding-bottom: 0.35rem;
    border-radius: 2px;
    box-shadow: 0 0 6px var(--soft-gold);
    transition: all 0.3s ease;
  }

  .tab-content { display: none; }
  .tab-content.active { display: block; }

  @media (max-width: 600px) {
    .page-nav-bar {
      flex-direction: column;
      align-items: center;
      gap: var(--space-sm);
      padding: var(--space-sm) 0;
    }
    .tab-link {
      font-size: var(--font-size-md);
      padding: var(--space-xs) 0;
      width: 100%;
      max-width: 300px;
    }
    .page-nav-bar::after { width: 180px; }
  }

  /* Disabled nav items in drawer */
  #mobileNav li.disabled span {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-display);
    font-size: var(--font-size-base);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted, #888);
    opacity: 0.6;
    cursor: not-allowed;
    text-decoration: none;
}

  .page-part-links.list-emoji {
    --list-emoji-char: "✦"; /* default symbol, override per pillar */
  }

  .page-part-links.list-emoji li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: var(--space-md);
    padding-left: var(--space-xl);
  }

  .page-part-links.list-emoji li::before {
    content: var(--list-emoji-char);
    color: var(--accent);
    font-size: 1rem;
    top: 0.25rem;
  }

  .page-link {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--accent);
    text-decoration: none;
  }

  .page-link:hover {
    text-decoration: underline;
  }

  .page-link.active {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .part-number {
    margin-right: 0.25rem;
    font-weight: 700;
    color: var(--accent);
  }

  .part-desc {
    font-size: 1.1rem;
    color: var(--muted-text);
  }
}
