/* ========================================
   Navigation — minimal, responsive, mobile-safe
   ======================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 10, 10, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 20px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.nav.is-scrolled {
  background: rgba(5, 5, 5, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 30px rgba(0, 0, 0, 0.45);
}

.admin-bar .nav {
  top: 32px;
}

.nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(100%, var(--max-width));
  min-height: var(--nav-height);
  margin-inline: auto;
  padding: 1.75rem var(--side-padding);
  transition: padding 0.3s ease, min-height 0.3s ease;
}

.nav.is-scrolled .nav-inner {
  padding: 0.75rem var(--side-padding);
  min-height: calc(var(--nav-height) - 1.25rem);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
}

.nav-brand a,
.nav-brand .custom-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.nav-brand-name {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 900;
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  letter-spacing: 0.01em;
  color: var(--color-text, #fff);
  line-height: 1;
  transition: font-size 0.3s ease;
}

.nav.is-scrolled .nav-brand-name {
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.nav-brand a:focus-visible,
.nav-brand .custom-logo-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.nav-brand .custom-logo,
.nav-logo {
  width: auto;
  height: clamp(2.75rem, 5.6vw, 3.2rem);
  max-width: min(16rem, 54vw);
  border-radius: 8px;
  transition: height 0.3s ease;
}

.nav.is-scrolled .nav-brand .custom-logo,
.nav.is-scrolled .nav-logo {
  height: clamp(2.2rem, 4.4vw, 2.5rem);
}

.nav-menu {
  margin-left: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0;
  position: relative;
}

/* Submenu / dropdown */
.nav-links .sub-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  margin: 0;
  padding: 0.55rem 0;
  list-style: none;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(193, 233, 78, 0.04);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  z-index: 120;
}

.nav-links .menu-item-has-children:hover > .sub-menu,
.nav-links .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-links .sub-menu li {
  margin: 0;
  width: 100%;
}

.nav-links .sub-menu a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

.nav-links .sub-menu a::after {
  display: none;
}

.nav-links .sub-menu a:hover,
.nav-links .sub-menu a:focus-visible {
  background: rgba(193, 233, 78, 0.08);
  color: var(--color-accent);
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 0.1rem;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color var(--transition);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.32rem;
  height: 2px;
  border-radius: 999px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links .current-menu-item > a,
.nav-links .current_page_item > a,
.nav-links .current-menu-ancestor > a,
.nav-links .current_page_parent > a {
  color: var(--color-white);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after,
.nav-links .current-menu-item > a::after,
.nav-links .current_page_item > a::after,
.nav-links .current-menu-ancestor > a::after,
.nav-links .current_page_parent > a::after {
  transform: scaleX(1);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── Contact CTA button ──
   Matches the site-wide CTA pattern used in the production-ready sections:
   lime → emerald horizontal gradient, black text, pill shape, glowing
   box-shadow on idle that intensifies on hover. */
.nav-links .nav-cta > a,
.nav-links li.nav-cta > a,
.nav .nav-links .nav-cta > a {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  padding: 0.7rem 1.4rem !important;
  border: none !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #c1e94e 0%, #10b981 100%) !important;
  color: #050505 !important;
  font-family: var(--font-heading, 'Outfit', sans-serif) !important;
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  letter-spacing: 0.01em !important;
  text-transform: none !important;
  text-decoration: none !important;
  box-shadow: 0 0 30px rgba(193, 233, 78, 0.3) !important;
  transition: transform 280ms ease, box-shadow 280ms ease, filter 280ms ease !important;
}

.nav-links .nav-cta > a::after,
.nav-links li.nav-cta > a::after,
.nav .nav-links .nav-cta > a::after {
  display: none !important;
}

.nav-links .nav-cta > a:hover,
.nav-links .nav-cta > a:focus-visible,
.nav .nav-links .nav-cta > a:hover,
.nav .nav-links .nav-cta > a:focus-visible {
  transform: translateY(-2px) !important;
  filter: brightness(1.05) !important;
  box-shadow: 0 0 45px rgba(193, 233, 78, 0.5), 0 0 80px rgba(16, 185, 129, 0.3) !important;
  color: #050505 !important;
}

.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 52px;
  margin-left: auto;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-white);
  cursor: pointer;
  position: relative;
  z-index: 101;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color var(--transition), border-color var(--transition);
}

.nav-hamburger > * {
  pointer-events: none;
}

.nav-hamburger:hover,
.nav-hamburger:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.26);
}

.nav-hamburger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 4px 0;
  border-radius: 999px;
  background: currentColor;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-hamburger.is-active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.nav-hamburger.is-active span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.is-active span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}


@media (max-width: 782px) {
  .admin-bar .nav {
    top: 46px;
  }
}

@media (max-width: 768px) {
  /* Lock the page behind the menu. `position: fixed` on body is the only
     reliable scroll lock on iOS Safari — `overflow: hidden` alone leaks. */
  body.nav-menu-open {
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
  }

  /* When the menu is open, the nav becomes a full-screen overlay. The X
     close button stays glued to the top-right of the viewport no matter
     how much content is in the menu, and the menu list scrolls inside
     the overlay if it overflows. */
  body.nav-menu-open .nav {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #0a0a0a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    overflow: hidden;
    z-index: 1000;
  }

  body.nav-menu-open .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "brand hamburger"
      "menu  menu";
    gap: 0.9rem 1rem;
    width: 100%;
    max-width: none;
    height: 100%;
    padding: 1rem var(--side-padding);
    margin: 0;
  }

  body.nav-menu-open .nav-brand {
    grid-area: brand;
    align-self: center;
  }

  body.nav-menu-open .nav-hamburger {
    grid-area: hamburger;
    align-self: center;
    justify-self: end;
  }

  body.nav-menu-open .nav-menu {
    grid-area: menu;
    width: 100%;
    min-height: 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.nav-menu-open .nav-links.nav-open {
    max-height: none;
    overflow: visible;
    padding: 1.5rem 0.25rem 2.5rem;
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .admin-bar.nav-menu-open .nav {
    top: 46px;
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
  }

  .nav {
    background: rgba(10, 10, 10, 0.96);
  }

  .nav-inner {
    flex-wrap: wrap;
    gap: 0.9rem;
    padding: 0.8rem var(--side-padding);
  }

  .nav-brand-name {
    font-size: 1.05rem;
  }

  .nav-brand .custom-logo,
  .nav-logo {
    height: clamp(2.2rem, 8vw, 2.5rem);
    max-width: min(14rem, 64vw);
  }

  .nav-hamburger {
    display: inline-flex;
    flex-direction: column;
    margin-left: auto;
  }

  .nav-menu {
    width: 100%;
    margin-left: 0;
    order: 3;
  }

  /* Use max-height + opacity for the toggle instead of display:none/flex.
     display:none can't be transitioned and causes layout-recalculation
     race conditions on some mobile browsers that swallow the tap. */
  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    padding: 0;
    margin-top: 0;
    border-top: 1px solid transparent;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                visibility 0.35s,
                padding 0.35s ease,
                margin-top 0.35s ease,
                border-color 0.35s ease;
  }

  .nav-links.nav-open {
    max-height: 80vh;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    padding: 0.75rem 0 1rem;
    margin-top: 0.6rem;
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    width: 100%;
    min-height: 56px;
    padding: 1.1rem 0.1rem;
    justify-content: flex-start;
    text-align: left;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .nav-links a:hover,
  .nav-links a:focus-visible,
  .nav-links .current-menu-item > a,
  .nav-links .current_page_item > a {
    color: var(--color-accent);
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links li:last-child > a {
    border-bottom: 0;
  }

  /* Submenu — flatten inline as indented list on mobile, no absolute dropdown */
  .nav-links .menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: auto;
    border-right: 2px solid var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    transform: rotate(45deg);
    opacity: 0.7;
    position: static;
    background: none;
    border-top: none;
    border-left: none;
    border-radius: 0;
  }

  .nav-links .sub-menu {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 100%;
    min-width: 0;
    margin: 0 0 0.25rem;
    padding: 0.1rem 0 0.35rem 1.25rem !important;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    border-left: 1px solid rgba(193, 233, 78, 0.18);
    margin-left: 0.25rem;
  }

  .nav-links .sub-menu a {
    justify-content: flex-start;
    text-align: left;
    padding: 0.6rem 0.25rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0;
    min-height: 40px;
    border-bottom: none;
    color: rgba(255, 255, 255, 0.55);
    text-transform: none;
  }

  .nav-links .sub-menu a:hover,
  .nav-links .sub-menu a:focus-visible {
    color: var(--color-accent);
  }

  /* CTA button — full-width pill at the bottom of the overlay menu */
  .nav-links .nav-cta {
    display: flex;
    justify-content: stretch;
    margin-top: 1.5rem;
    border-top: 0 !important;
    border-bottom: 0 !important;
  }

  .nav-links .nav-cta > a,
  .nav-links li.nav-cta > a {
    width: 100% !important;
    min-width: 0;
    justify-content: center !important;
    padding: 1.15rem 2rem !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    border-bottom: none !important;
  }
}
