/* ════════════════════════════════════════════════════════════════════════
   D BADAMI — SITE NAV (single source for the WHOLE site)

   Loaded by BOTH:
     • React pages  → <link rel="stylesheet" href="/nav.css"> in each entry HTML
     • static pages → @import url("/nav.css") at the top of guides.css

   Edit the menu's look HERE, once — it changes everywhere. The logo is an inline
   SVG (currentColor) on every page, so the transparent-at-top blend works
   identically on light and dark heroes.

   One fixed bar holds the logo + the menu. At the top it's transparent and uses
   mix-blend-mode:difference so the logo + links stay legible over any hero.
   Once scrolled it settles into a frosted pill. On phones the menu collapses to
   a tap-to-open dropdown.
   ════════════════════════════════════════════════════════════════════════ */
.sitenav {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(94%, 940px);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.7rem 0.5rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 100px;
  color: var(--ink-soft);
  transition: background 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
  animation: navIn 0.9s var(--ease) 0.2s both;
}

/* opacity-only so `transform` stays free for the show/hide-on-scroll on phones */
@keyframes navIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Transparent (top): dark ink by default (works on the light heroes of every
   sub-page). No mix-blend-mode — on iOS Safari it renders fixed elements as a
   black box. Pages with a DARK hero (home) add .is-dark for light text. */
.sitenav.is-dark:not(.scrolled):not(.is-open) {
  color: #fff;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.4);
}

/* Frosted (scrolled) */
.sitenav.scrolled {
  background: rgba(246, 245, 243, 0.72);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-color: rgba(12, 11, 10, 0.1);
  box-shadow: 0 10px 30px rgba(12, 11, 10, 0.12);
}

.brandmark {
  display: flex;
  align-items: center;
  margin-right: auto;
  color: inherit;
}

.brandmark__logo {
  height: 18px;
  width: auto;
  display: block;
}

.pillnav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.pillnav__item {
  position: relative;
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.72;
  border-radius: 100px;
  text-decoration: none;
  transition: opacity 0.3s var(--ease), background 0.3s var(--ease);
}

.pillnav__item:hover,
.pillnav__item.is-active {
  opacity: 1;
}

.sitenav.scrolled .pillnav__item.is-active {
  background: rgba(12, 11, 10, 0.06);
}

.pillnav__lamp {
  display: none;
}

.sitenav.scrolled .pillnav__lamp {
  display: block;
  position: absolute;
  top: -0.35rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.2rem;
  height: 3px;
  background: var(--ink);
  border-radius: 0 0 3px 3px;
}

/* Phone-only toggle (hidden on tablet/desktop) */
.navtoggle {
  display: none;
}

@media (max-width: 860px) {
  /* Smart-sticky on phones: hides when scrolling down, slides back in when
     scrolling up (the .nav-hidden class is toggled by JS). */
  .sitenav {
    position: fixed;
    width: calc(100% - 1.6rem);
    padding: 0.55rem 0.7rem 0.55rem 1.2rem;
    transition: background 0.35s var(--ease), box-shadow 0.35s var(--ease),
      border-color 0.35s var(--ease), transform 0.4s var(--ease);
  }
  .sitenav.nav-hidden:not(.is-open) {
    transform: translate(-50%, -150%);
  }
  /* Open state: solid bar so the dropdown reads cleanly */
  .sitenav.is-open,
  .sitenav.is-open:not(.scrolled) {
    color: var(--ink-soft);
    background: rgba(246, 245, 243, 0.78);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border-color: rgba(12, 11, 10, 0.1);
  }
  .navtoggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    order: 3;
  }
  .navtoggle__bars {
    position: relative;
    width: 18px;
    height: 11px;
  }
  .navtoggle__bars span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.3s var(--ease), top 0.3s var(--ease);
  }
  .navtoggle__bars span:first-child { top: 1px; }
  .navtoggle__bars span:last-child { top: 9px; }
  .navtoggle.is-open .navtoggle__bars span:first-child,
  .sitenav.is-open .navtoggle__bars span:first-child { top: 5px; transform: rotate(45deg); }
  .navtoggle.is-open .navtoggle__bars span:last-child,
  .sitenav.is-open .navtoggle__bars span:last-child { top: 5px; transform: rotate(-45deg); }

  /* Menu becomes a dropdown panel under the bar */
  .pillnav {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    padding: 0.5rem;
    border-radius: 20px;
    background: rgba(246, 245, 243, 0.97);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(12, 11, 10, 0.1);
    box-shadow: 0 18px 44px rgba(12, 11, 10, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
  }
  .sitenav.is-open .pillnav {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .pillnav__item {
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    opacity: 1;
    color: var(--ink-soft);
    border-radius: 12px;
  }
  .pillnav__item.is-active {
    color: var(--ink);
    background: rgba(12, 11, 10, 0.06);
  }
  /* No lamp/underline in the mobile dropdown — it reads as a stray black line. */
  .pillnav__lamp,
  .sitenav.scrolled .pillnav__lamp {
    display: none;
  }
}
