/* Navbar — Premium floating pill */

.navbar {
  position: fixed;
  top: max(1em, env(safe-area-inset-top, 0px));
  width: min(920px, 94%);
  height: 56px;
  padding: 0 0.75em 0 1em;
  color: var(--bexo-text, #f7f8f8);
  z-index: 1000;
  left: 50%;
  transform: translateX(-50%);
}

.navbar:before {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 7, 15, 0.75);
  z-index: -1;
  border-radius: 999px;
  box-shadow:
    0 12px 40px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(47, 107, 255, 0.06);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.navbar:hover:before {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(5, 7, 15, 0.82);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  width: 100%;
  max-width: none;
  padding: 0 !important;
  height: 56px;
}

.hamburger-icon {
  display: none;
  cursor: pointer;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  position: relative;
  z-index: 10002;
  -webkit-tap-highlight-color: transparent;
}

#hamburger-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.navbar-logo .brand-link {
  font-size: 1.05rem;
  position: relative;
  z-index: 10002;
}

.navbar-logo .brand-link img {
  width: 32px;
  height: 32px;
  transition: box-shadow 0.3s ease;
}

.navbar-logo .brand-link:hover img {
  box-shadow: 0 0 28px rgba(47, 107, 255, 0.5);
}

.navbar-items ul {
  display: flex;
  align-items: center;
  gap: 0.15em;
  list-style: none;
}

.navbar-items ul li {
  line-height: 56px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.navbar-items ul li a {
  padding: 0.65em 0.85em;
  color: rgba(244, 246, 251, 0.72);
  transition: color 0.2s ease;
  position: relative;
}

.navbar-items ul li a:hover,
.navbar-items ul li.is-active a {
  color: #fff;
}

.navbar-items ul li.is-active a {
  position: relative;
}

.navbar-items ul li.is-active a::after {
  content: "";
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--bexo-accent, #2f6bff);
  box-shadow: 0 0 8px rgba(47, 107, 255, 0.5);
}

.navbar-items .navbar-login a {
  color: var(--bexo-accent-soft, #9bb6ff);
}

.navbar-items .btn {
  line-height: 56px;
  margin-left: 0.35em;
}

.navbar-items .btn a {
  padding: 0.55em 1.1em !important;
  background: var(--bexo-accent, #2f6bff);
  border-radius: 999px;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 8px 24px -10px rgba(47, 107, 255, 0.55);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.navbar-items .btn a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}

.navbar-items .btn a:hover {
  box-shadow:
    0 12px 32px -10px rgba(47, 107, 255, 0.55),
    0 0 0 3px rgba(47, 107, 255, 0.2);
  transform: translateY(-1px);
  background: var(--bexo-accent-hover, #2558e0);
}

@media screen and (max-width: 1000px) {
  /* Floating pill — same identity as desktop, sized for phones */
  .navbar {
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    width: min(calc(100% - 1.5rem), 30rem);
    max-width: none;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 999px;
    box-sizing: border-box;
    padding: 0 0.5rem 0 1rem;
    height: 56px;
    z-index: 10001;
  }

  .navbar:before {
    border-radius: 999px;
    border: 1px solid rgba(155, 182, 255, 0.2);
    background: rgba(9, 13, 24, 0.8);
    box-shadow: 0 16px 40px -20px rgba(5, 7, 15, 0.8);
  }

  .navbar .container {
    height: 56px;
    position: relative;
    z-index: 2;
  }

  /* Full-screen menu — designed as a screen, not floating links */
  .navbar-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: fixed;
    inset: 0;
    width: 100%;
    width: 100dvw;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 100%;
    min-height: 100dvh;
    margin: 0;
    padding:
      calc(56px + max(0.75rem, env(safe-area-inset-top, 0px)) + 1.25rem)
      max(1.5rem, env(safe-area-inset-right, 0px))
      calc(max(1rem, env(safe-area-inset-bottom, 0px)) + 0.5rem)
      max(1.5rem, env(safe-area-inset-left, 0px));
    border: none;
    background:
      radial-gradient(120% 42% at 50% 0%, rgba(47, 107, 255, 0.14), transparent 62%),
      #070b14;
    text-align: left;
    opacity: 0;
    transform: translateY(0.65rem);
    transition:
      opacity 0.22s ease,
      transform 0.3s cubic-bezier(0.23, 1, 0.32, 1),
      visibility 0s linear 0.3s;
    z-index: 10000;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
    visibility: hidden;
    pointer-events: none;
  }

  .hamburger-icon {
    display: inline-flex;
  }

  #hamburger-toggle:checked ~ ul.navbar-links,
  body.nav-open .navbar-links,
  .navbar-links.is-open {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition:
      opacity 0.24s ease,
      transform 0.34s cubic-bezier(0.23, 1, 0.32, 1);
  }

  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }

  body.nav-open .navbar:before {
    background: #0a101d;
    border-color: rgba(155, 182, 255, 0.16);
    box-shadow: none;
  }

  /* Menu rows — large, left-aligned, staggered reveal */
  .navbar-items ul li {
    line-height: 1.2;
    width: 100%;
    max-width: none;
    opacity: 0;
    transform: translateY(14px);
  }

  #hamburger-toggle:checked ~ ul.navbar-links li,
  body.nav-open .navbar-links li,
  .navbar-links.is-open li {
    opacity: 1;
    transform: none;
    transition:
      opacity 0.32s ease,
      transform 0.44s cubic-bezier(0.23, 1, 0.32, 1);
  }

  .navbar-links.is-open li:nth-child(1) { transition-delay: 0.05s; }
  .navbar-links.is-open li:nth-child(2) { transition-delay: 0.09s; }
  .navbar-links.is-open li:nth-child(3) { transition-delay: 0.13s; }
  .navbar-links.is-open li:nth-child(4) { transition-delay: 0.17s; }
  .navbar-links.is-open li:nth-child(5) { transition-delay: 0.21s; }
  .navbar-links.is-open li:nth-child(6) { transition-delay: 0.25s; }
  /* Sign up (8th child) renders above Log in (7th, order: 10) */
  .navbar-links.is-open li:nth-child(8) { transition-delay: 0.29s; }
  .navbar-links.is-open li:nth-child(7) { transition-delay: 0.33s; }

  .navbar-items ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 0.2rem;
    min-height: 56px;
    box-sizing: border-box;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: rgba(244, 246, 251, 0.82);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .navbar-items ul li.is-active a {
    color: #fff;
  }

  .navbar-items ul li.is-active a::after {
    content: "";
    position: static;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    transform: none;
    background: var(--bexo-accent, #2f6bff);
    box-shadow: 0 0 12px rgba(47, 107, 255, 0.8);
  }

  /* Account actions docked in the thumb zone */
  .navbar-items ul li:last-child {
    margin-top: auto;
    padding-top: 1.25rem;
  }

  .navbar-items .btn {
    margin: 0;
    width: 100%;
    line-height: 1.2;
  }

  .navbar-items .btn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    line-height: 1 !important;
    padding: 0 1.25em !important;
    font-size: 1rem;
    border-bottom: none;
  }

  .navbar-items .navbar-login {
    order: 10;
  }

  .navbar-items .navbar-login a {
    justify-content: center;
    min-height: 52px;
    margin-top: 0.7rem;
    padding: 0 1.25em;
    border: 1px solid rgba(155, 182, 255, 0.26);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .navbar-links,
  .navbar-links li {
    transition: none !important;
    transform: none !important;
  }
}

/* Home — ink glass over intro film, brand blue accents */
.page-home .navbar:before {
  background: rgba(11, 18, 32, 0.58);
  border-color: rgba(155, 182, 255, 0.18);
  box-shadow:
    0 12px 40px -20px rgba(5, 7, 15, 0.65),
    0 0 0 1px rgba(47, 107, 255, 0.06);
}

.page-home .navbar:hover:before {
  background: rgba(11, 18, 32, 0.78);
  border-color: rgba(155, 182, 255, 0.28);
}

.page-home .navbar-items ul li.is-active a::after {
  background: var(--bexo-accent, #2f6bff);
  box-shadow: 0 0 8px rgba(47, 107, 255, 0.5);
}

.page-home .navbar-items .navbar-login a {
  color: var(--bexo-accent-soft, #9bb6ff);
}

.page-home .navbar-logo .brand-link:hover img {
  box-shadow: 0 0 28px rgba(47, 107, 255, 0.45);
}

.page-home .navbar-items .btn a {
  background: var(--bexo-accent, #2f6bff);
  box-shadow: 0 8px 24px -10px rgba(47, 107, 255, 0.55);
}

.page-home .navbar-items .btn a:hover {
  background: var(--bexo-accent-hover, #2558e0);
  box-shadow:
    0 12px 32px -10px rgba(47, 107, 255, 0.55),
    0 0 0 3px rgba(47, 107, 255, 0.18);
}

@media screen and (max-width: 1000px) {
  .page-home .navbar:before {
    background: rgba(11, 18, 32, 0.82);
  }

  body.nav-open.page-home .navbar:before {
    background: #0a101d;
  }

  .page-home .navbar-links {
    background:
      radial-gradient(120% 42% at 50% 0%, rgba(47, 107, 255, 0.14), transparent 62%),
      #070b14;
  }
}
