/* ============================================
   NAVIGATION
   Brain & Mind Foundation WordPress Theme
   ============================================
   Fixed navbar with scroll state, nav links,
   donate CTA, mobile hamburger toggle, and
   full-screen mobile overlay.
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 20px 0;
  transition: all 0.5s var(--ease-out-expo);
}

/* Scrolled state — white bg with blur */
.nav.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
  padding: 12px 0;
}

/* Nav inner container */
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Logo — large on initial load, smaller when scrolled */
.nav-logo img {
  height: 85px;
  width: auto;
  transition: height 0.5s var(--ease-out-expo), filter 0.4s ease;
}
.nav.scrolled .nav-logo img {
  height: 46px;
}

/* Per-page option (Page Display Options → Use Light Logo Before Scroll):
   render the logo white while the nav is still transparent, reverting to
   the standard logo once the solid scrolled nav appears. */
body.has-light-logo .nav:not(.scrolled) .nav-logo img {
  filter: brightness(0) invert(1);
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
  transition: color 0.3s ease;
  position: relative;
}

/* Underline hover effect */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--coral);
  transition: width 0.4s var(--ease-out-expo);
}
.nav-links a:hover::after {
  width: 100%;
}

/* Scrolled state — dark text */
.nav.scrolled .nav-links a {
  color: var(--text-dark);
}

/* Donate CTA button */
.nav-donate {
  padding: 11px 28px;
  background: var(--coral);
  color: var(--white) !important;
  border-radius: 60px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 4px 20px var(--coral-glow);
  transition: all 0.4s var(--ease-out-expo);
}
.nav-donate:hover {
  background: var(--coral-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--coral-glow);
}
.nav-donate::after {
  display: none !important;
}

/* ============================================
   MOBILE NAV TOGGLE (hamburger)
   ============================================ */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 1001;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Scrolled state — dark hamburger lines */
.nav.scrolled .nav-toggle span {
  background: var(--navy);
}

/* Active state — rotate into X */
.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   MOBILE NAV OVERLAY (768px breakpoint)
   ============================================ */
/* Overlay-menu extras — mobile only. */
.nav-menu-brand,
.nav-menu-meta {
  display: none;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    /* Track the VISIBLE viewport — plain inset:0 sizes to the layout
       viewport, which clips the bottom behind mobile browser chrome. */
    height: 100dvh;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    background: var(--navy);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s var(--ease-out-expo);
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    font-size: 1.2rem;
    color: var(--white) !important;
  }

  .nav-donate {
    margin-top: 12px;
    padding: 16px 40px;
    font-size: 1rem;
  }

  /* Brand mark centered in the space between the top edge and the menu. */
  .nav-menu-brand {
    display: block;
    position: absolute;
    top: clamp(56px, 16%, 150px);
    left: 50%;
    transform: translateX(-50%);
  }
  .nav-menu-brand img {
    height: 58px;
    width: auto;
    /* White logo: calmer on navy, and leaves coral to the Donate button. */
    filter: brightness(0) invert(1);
    opacity: 0.95;
  }

  /* Contact + charity line pinned to the overlay's bottom edge. */
  .nav-menu-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 24px;
    right: 24px;
    text-align: center;
  }
  /* Quiet, lowercase, small — footnote weight, not navigation weight. */
  .nav-menu-meta a {
    font-size: 0.85rem !important;
    text-transform: none !important;
    letter-spacing: 0.02em !important;
    color: var(--text-light-muted) !important;
  }
  .nav-menu-meta a:hover {
    color: var(--coral) !important;
  }
  .nav-menu-meta span {
    margin-top: 6px;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.38);
  }
}
