/* ==========================================
   SITE NAVBAR
   ========================================== */
.site-navbar {
  position: relative;
  z-index: 1000;
  background-color: var(--color-bg-light, #ffffff);
  box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.05);
  width: 100%;

  .nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: clamp(0.75rem, 2vw, 1.25rem) 5vw;
  }

  .nav-brand img {
    height: clamp(2.5rem, 5vw, 3.75rem);
    width: auto;
    display: block;
  }
}

/* --- NAVIGATION MENU --- */
.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);

  .nav-links {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .nav-link {
    text-decoration: none;
    color: var(--color-text-dark, #333333);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    transition: color 0.2s ease;

    &:hover,
    &.active {
      color: var(--color-primary, #6b21a8);
    }

    .caret {
      margin-left: 0.25rem;
      transition: transform 0.3s ease;
    }
  }

  .btn {
    text-decoration: none !important;
  }

  .nav-actions .btn.nav-link {
    background-color: var(--color-primary, #6b21a8);
    color: #ffffff;
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(1rem, 2vw, 1.5rem);
    border-radius: 9999px;
    transition: background-color 0.2s ease;

    &:hover {
      background-color: var(--color-primary-dark, #4c1d95);
      color: #ffffff;
    }
  }
}

/* --- DROPDOWN ARCHITECTURE (DESKTOP) --- */
.has-dropdown {
  position: relative;

  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: clamp(12.5rem, 15vw, 16rem);
    background: var(--color-white, #ffffff);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.625rem);
    transition: all 0.3s ease;
    list-style: none;
    z-index: 1001;

    li a {
      padding: 0.75rem 1.5rem;
      display: block;
      font-weight: 400;
      color: var(--color-text-dark, #333333);

      &:hover {
        background-color: var(--color-bg-alt, #f3f4f6);
      }
    }
  }

  @media (min-width: 55.01em) {
    &:hover {
      .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
      }

      > .nav-link .caret {
        transform: rotate(-180deg);
      }
    }
  }
}

.give-dropdown .dropdown-menu {
  left: auto;
  right: 0;
}

.mobile-menu-toggle {
  display: none;
}

/* --- MOBILE VIEWPORT --- */
@media (max-width: 55em) {
  
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: clamp(1.5rem, 4vw, 2rem);
    height: clamp(1rem, 3vw, 1.25rem);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1002;

    .hamburger-line {
      width: 100%;
      height: 0.1875rem;
      background-color: var(--color-text-dark, #333);
      border-radius: 0.25rem;
      transition: transform 0.3s ease, opacity 0.3s ease;
    }

    &.is-active {
      .hamburger-line:nth-child(1) {
        transform: translateY(clamp(0.35rem, 1vw, 0.45rem)) rotate(45deg);
      }
      .hamburger-line:nth-child(2) {
        opacity: 0;
      }
      .hamburger-line:nth-child(3) {
        transform: translateY(calc(clamp(0.35rem, 1vw, 0.45rem) * -1)) rotate(-45deg);
      }
    }
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    height: 100dvh;
    background: var(--color-white, #ffffff);
    flex-direction: column;
    justify-content: center;
    padding: clamp(1rem, 5vw, 2rem);
    transition: right 0.4s ease-in-out;
    z-index: 1001;

    &.is-active {
      right: 0;
    }

    .nav-links {
      flex-direction: column;
      width: 100%;
      text-align: center;
      gap: 0;
    }

    .nav-link {
      padding: clamp(0.75rem, 2vh, 1rem);
      width: 100%;
      justify-content: center;
      font-size: clamp(1.1rem, 3vw, 1.25rem);
    }

    .nav-actions {
      margin-top: 2rem;
      width: 100%;
      display: flex;
      justify-content: center;
      flex-direction: column;
    }
  }

  /* Mobile accordion overrides */
  .dropdown-menu {
    position: static;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transition: max-height 0.4s ease;
  }

  .has-dropdown {
    &.accordion-open {
      .dropdown-menu {
        max-height: 50dvh;
      }
      
      > .nav-link .caret {
        transform: rotate(-180deg);
      }
    }
  }
}
