/* ===== NAVIGATION - PREMIUM OPAL-INSPIRED DESIGN ===== */

:root {
  --nav-height: 80px;
  --nav-bg: rgba(11, 15, 25, 0.85);
  --nav-text: rgba(255, 255, 255, 0.7);
  --nav-text-hover: #ffffff;
  --nav-accent: #10B981;
  --nav-accent-hover: #34D399;
}

/* ===== Base Navigation (Mobile-first: curved bar like desktop pill) ===== */
.site-nav {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  height: 64px;
  border-radius: 100px;
  /* Fully opaque for clean dark look */
  background: #0B0F19;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1001;  /* Above mobile menu */
}

/* ===== Desktop Actions (Links + Divider + CTA) ===== */
.nav-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 12px;
}

/* ===== Logo ===== */
.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.025em;
}

/* ===== Desktop Menu ===== */
.nav-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 450;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.nav-link:hover {
  color: var(--nav-text-hover);
  background: rgba(255, 255, 255, 0.08);
}

/* ===== Dropdown ===== */
.nav-dropdown-icon {
  width: 12px;
  height: 12px;
  transition: transform 0.25s ease;
  opacity: 0.6;
}

.nav-dropdown.open .nav-dropdown-icon {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 240px;
  padding: 8px;
  background: rgba(30, 41, 59, 0.98);
  border-radius: 16px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  list-style: none;
  margin: 0;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-link {
  display: block;
  padding: 14px 18px;
  font-size: 0.9375rem;
  font-weight: 450;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.15s ease;
  letter-spacing: -0.01em;
}

.nav-dropdown-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--nav-text-hover);
}

/* ===== CTA Button ===== */
.nav-cta {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: 550;
  color: #0F172A;
  background: var(--nav-accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  letter-spacing: -0.01em;
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-cta:hover {
  background: var(--nav-accent-hover);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.3),
    0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Only apply transform on devices with hover capability (mouse/trackpad) */
@media (hover: hover) {
  .nav-cta:hover {
    transform: translateY(-1px);
  }
}

.nav-cta:active {
  transform: translateY(0);
}

/* ===== Hamburger Button ===== */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-hamburger.open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-hamburger.open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Mobile Menu ===== */
.nav-mobile-overlay {
  display: none;  /* Not needed with full-screen menu */
}

.nav-mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* Premium gradient background - fully opaque */
  background: linear-gradient(
    180deg,
    #0B0F19 0%,
    #0F172A 50%,
    #0B0F19 100%
  );
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow-y: auto;
  /* Account for floating pill navbar (64px + 12px top margin + 12px spacing) */
  padding: calc(64px + 12px + 12px) 32px 40px;
  display: flex;
  flex-direction: column;
}

.nav-mobile-menu.open {
  transform: translateY(0);
}

/* Staggered animation for menu items */
.nav-mobile-menu.open .nav-mobile-list li {
  animation: menuItemSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.nav-mobile-menu.open .nav-mobile-list li:nth-child(1) { animation-delay: 0.05s; }
.nav-mobile-menu.open .nav-mobile-list li:nth-child(2) { animation-delay: 0.1s; }
.nav-mobile-menu.open .nav-mobile-list li:nth-child(3) { animation-delay: 0.15s; }
.nav-mobile-menu.open .nav-mobile-list li:nth-child(4) { animation-delay: 0.2s; }
.nav-mobile-menu.open .nav-mobile-list li:nth-child(5) { animation-delay: 0.25s; }

@keyframes menuItemSlide {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* CTA wrapper animation */
.nav-mobile-menu.open .nav-mobile-cta-wrapper {
  animation: menuItemSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
  opacity: 0;
}

.nav-mobile-list {
  list-style: none;
  margin: 0;
  padding: 24px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.nav-mobile-link {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  margin: 0 -20px;
  font-size: 1.375rem;
  font-weight: 450;
  color: var(--nav-text);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.01em;
  border-radius: 14px;
  position: relative;
}

.nav-mobile-link:hover,
.nav-mobile-link:active {
  color: var(--nav-text-hover);
  background: rgba(255, 255, 255, 0.06);
}

/* Subtle accent line on hover */
.nav-mobile-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 20px;
  background: var(--nav-accent);
  border-radius: 2px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-mobile-link:hover::before,
.nav-mobile-link:active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-mobile-sublink {
  padding-left: 44px;
  font-size: 1.125rem;
  color: var(--nav-text);
}

.nav-mobile-sublink::before {
  left: 20px;
  width: 2px;
  height: 16px;
}

.nav-mobile-divider {
  display: none;
}

.nav-mobile-submenu-header {
  padding: 28px 20px 12px;
  margin: 8px -20px 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-mobile-cta-wrapper {
  margin-top: auto;
  padding: 32px 0;
}

.nav-mobile-cta {
  display: block;
  width: 100%;
  padding: 18px 32px;
  font-size: 1rem;
  font-weight: 500;
  color: #0F172A;
  background: #ffffff;
  border-radius: 100px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.01em;
}

.nav-mobile-cta:hover,
.nav-mobile-cta:active {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(0.98);
}

/* ===== Desktop Breakpoint: Floating Pill Design ===== */
@media (min-width: 768px) {
  /* Transform nav into floating pill */
  .site-nav {
    top: 24px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100% - 48px);
    height: 64px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(11, 15, 25, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-container {
    padding: 0 8px 0 24px;
    gap: 8px;
  }

  .nav-actions {
    display: flex;
  }

  .nav-menu {
    display: flex;
  }

  .nav-cta {
    display: inline-flex;
    border-radius: 100px;
    padding: 10px 20px;
  }

  .nav-hamburger {
    display: none !important;
  }

  .nav-mobile-overlay,
  .nav-mobile-menu {
    display: none !important;
  }
}

/* ===== Body States ===== */
body.has-nav {
  /* Account for floating pill (64px) + top margin (12px) + bottom spacing (12px) */
  padding-top: calc(64px + 12px + 12px);
}

/* Dark background opt-in: Add .dark-hero class to body for pages with dark hero sections.
   This prevents white gap showing behind the floating pill navbar.
   Usage: <body class="has-nav dark-hero"> */
body.has-nav.dark-hero {
  background: #0B0F19;
}

@media (min-width: 768px) {
  body.has-nav {
    /* Account for floating pill + margin */
    padding-top: calc(64px + 24px + 24px);
  }
}

body.nav-open {
  overflow: hidden;
}

/* ===== Endocrino Page Overrides ===== */
.dark .site-nav {
  background: rgba(16, 25, 34, 0.97);
}

.dark .nav-mobile-menu {
  background: rgba(16, 25, 34, 0.98);
}
