/* ─── Global Navigation ─────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  /* border-bottom removed to prevent the "crease" line as requested */
  padding-block: 15px;
}

.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.nav__menu {
  display: contents; /* Let children participate in nav grid */
}

.nav__mobile-header,
.nav__mobile-footer {
  display: none;
}

.nav__logo {
  display: block;
  justify-self: start;
}

.nav__logo-img {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 30px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  height: 2px;
  background-color: var(--color-text);
  transition: transform 0.2s ease;
}

.nav__list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.nav__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  justify-self: end;
}

.nav__link {
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text);
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__chevron {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.nav__item--has-dropdown:hover > .nav__link .nav__chevron {
  transform: rotate(180deg);
}

.nav__link:hover,
.nav__link--active {
  opacity: 1;
  font-weight: 500;
}

.nav__link--active {
  color: var(--color-primary);
}

/* Dropdowns */
.nav__item {
  position: relative;
  list-style: none;
}

.nav__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  flex-direction: column;
  background-color: var(--color-bg-white);
  min-width: 260px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.75rem 0;
  margin-top: 10px;
  z-index: 100;
  list-style: none;
  /* No overflow:hidden — sub-dropdowns are positioned at left:100%, so
     clipping the parent would hide them entirely on hover. */
}

.nav__dropdown::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 20px;
  width: 100%;
  height: 10px;
  background: transparent;
}

.nav__item--has-dropdown:hover > .nav__dropdown {
  display: flex;
}

/* Style links in dropdown */
.nav__dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 400;
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav__dropdown-link:hover {
  background-color: var(--color-bg);
  padding-left: 1.75rem;
  color: var(--color-primary);
}

/* Sub-dropdowns */
.nav__dropdown-item {
  position: relative;
}

.nav__item--has-dropdown-right > .nav__dropdown {
  top: -0.75rem;
  left: 100%;
  margin-top: 0;
  margin-left: 0;
}

/* Right-pointing chevron sits flush at the end of a nested-trigger link
   so the user can see "this opens further". On hover the sub-dropdown
   slides in (handled by the generic .nav__item--has-dropdown:hover rule). */
.nav__dropdown-link--has-children {
  justify-content: space-between;
  gap: 0.75rem;
}

.nav__chevron-right {
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.nav__dropdown-link--has-children:hover .nav__chevron-right {
  transform: translateX(2px);
  color: var(--color-primary);
}

@media (max-width: 1024px) {
  .nav {
    grid-template-columns: 1fr auto;
  }
  
  .nav__menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: var(--color-bg-white);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem 4rem; /* More bottom padding */
    transition: right 0.4s cubic-bezier(0.33, 1, 0.68, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav__menu--open {
    right: 0;
  }

  .nav__mobile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 1rem 0 3rem;
  }

  .nav__close {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text);
  }

  .nav__mobile-header .nav__logo-img {
    height: 60px; /* Larger logo for mobile menu */
    width: auto;
  }

  .nav__list {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: left;
  }

  .nav__item {
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }

  .nav__link {
    padding: 1rem 0;
    font-size: 1.125rem;
    font-weight: 400;
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }

  .nav__chevron {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav__dropdown {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    padding: 0 0 1rem 1rem;
    margin: 0;
    width: 100%;
  }

  .nav__dropdown-link {
    padding: 0.6rem 0;
    font-size: 1rem;
  }

  .nav__mobile-footer {
    padding: 2rem 0;
    margin-top: auto;
  }

  .nav__toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 20px;
    height: 14px;
    z-index: 1001;
    transition: opacity 0.3s ease;
  }

  /* Hide hamburger when menu is open */
  .nav__menu--open ~ .nav__actions .nav__toggle,
  .nav-open .nav__toggle {
    opacity: 0;
    pointer-events: none;
  }

  .nav__toggle span:nth-child(1) { width: 20px; }
  .nav__toggle span:nth-child(2) { width: 12px; }
  .nav__toggle span:nth-child(3) { width: 16px; }
  
  .nav__actions {
    display: flex;
  }

  .nav__btn-desktop {
    display: none;
  }
}