/*==================================================
NAVBAR
==================================================*/

.header {
  position: fixed;
  top: 0;
  left: 0;

  width: 100%;
  z-index: 1000;

  transition:
    background-color var(--duration-normal) ease,
    backdrop-filter var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease;
}

.header.scrolled {
  background: var(--white-alpha-92);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: var(--shadow-navbar);
}

/*==================================================
NAVBAR LAYOUT
==================================================*/

.navbar {
  height: 88px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 28px;
}

/*==================================================
LOGO
==================================================*/

.logo {
  display: flex;
  align-items: center;

  gap: 14px;

  flex-shrink: 0;
}

.logo img {
  display: block;

  width: 56px;
  height: auto;

  flex-shrink: 0;

  /*
      Sedikit turun agar optical alignment
      dengan judul dan hamburger lebih bagus
    */
  transform: translateY(10px);
}

.logo-text {
  display: flex;
  flex-direction: column;

  justify-content: center;

  min-width: 0;
}

.logo-title {
  font-family: var(--heading-font);

  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;

  color: var(--primary-dark);

  white-space: nowrap;
}

.logo-subtitle {
  margin-top: 3px;

  font-size: 0.82rem;
  line-height: 1.35;

  color: var(--gray-600);

  white-space: nowrap;
}

/*==================================================
DESKTOP NAVIGATION
==================================================*/

.nav-menu {
  display: flex;
  align-items: center;

  gap: 38px;
}

.nav-menu a {
  position: relative;

  min-height: 44px;

  display: flex;
  align-items: center;

  padding: 10px 0;

  font-weight: 600;

  color: var(--gray-700);

  transition: var(--fast);
}

.nav-menu a:hover {
  color: var(--primary);
}

.nav-menu a::after {
  content: "";

  position: absolute;

  left: 0;
  bottom: -8px;

  width: 0;
  height: 2px;

  background: var(--primary);

  transition: var(--duration-fast);
}

.nav-menu a:hover::after {
  width: 100%;
}

/*==================================================
NAV RIGHT
==================================================*/

.nav-right {
  display: flex;
  align-items: center;

  gap: 18px;

  flex-shrink: 0;
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";

  position: absolute;

  left: 0;
  bottom: -6px;

  width: 0;
  height: 2px;

  background: var(--primary);

  transition: var(--duration-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/*==================================================
FOCUS
==================================================*/

.logo:focus-visible,
.nav-menu a:focus-visible,
.nav-link:focus-visible,
.menu-toggle:focus-visible {
  outline: 3px solid var(--secondary-alpha-35);
  outline-offset: 4px;
}

/*==================================================
HAMBURGER
==================================================*/

.menu-toggle {
  display: none;

  position: relative;

  width: 48px;
  height: 48px;

  padding: 0;

  border: 0;
  border-radius: 50%;

  background: transparent;

  align-items: center;
  justify-content: center;

  flex: 0 0 48px;

  cursor: pointer;
}

.menu-toggle span {
  position: relative;

  display: block;

  width: 26px;
  height: 2px;

  background: var(--primary);

  border-radius: var(--radius-round);

  transition:
    background-color var(--duration-normal),
    transform var(--duration-normal);
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";

  position: absolute;

  left: 0;

  width: 26px;
  height: 2px;

  background: var(--primary);

  border-radius: var(--radius-round);

  transition:
    transform var(--duration-normal),
    top var(--duration-normal);
}

.menu-toggle span::before {
  top: -7px;
}

.menu-toggle span::after {
  top: 7px;
}

/* Hamburger → X */

.menu-toggle.active span {
  background: transparent;
}

.menu-toggle.active span::before {
  top: 0;

  transform: rotate(45deg);
}

.menu-toggle.active span::after {
  top: 0;

  transform: rotate(-45deg);
}

/*==================================================
RESPONSIVE NAVIGATION
==================================================*/

@media (max-width: 1150px) {
  .navbar {
    height: 72px;

    display: grid;

    /*
      logo | title | hamburger
    */
    grid-template-columns: 52px minmax(0, 1fr) 48px;

    align-items: center;

    column-gap: 10px;
  }

  /*----------------------------------------------
  LOGO MOBILE
  ----------------------------------------------*/

  .logo {
    display: contents;
  }

  .logo img {
    grid-column: 1;

    width: 48px;
    height: 48px;

    object-fit: contain;

    align-self: center;
    justify-self: center;
  }

  .logo-text {
    grid-column: 2;

    min-width: 0;

    display: flex;
    flex-direction: column;

    justify-content: center;

    align-self: center;
  }

  .logo-title {
    font-size: 1.2rem;
    line-height: 1.2;

    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo-subtitle {
    margin-top: 4px;

    font-size: 0.78rem;
    line-height: 1.3;

    white-space: nowrap;

    overflow: hidden;
    text-overflow: ellipsis;
  }

  /*----------------------------------------------
  RIGHT MOBILE
  ----------------------------------------------*/

  .nav-right {
    grid-column: 3;

    width: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 0;
  }

  .nav-right .btn {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  /*----------------------------------------------
  MOBILE MENU
  ----------------------------------------------*/

  .nav-menu {
    position: fixed;

    top: 82px;

    left: 16px;
    right: 16px;

    width: auto;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    gap: 0;

    padding: 12px;

    background: var(--white);

    border-radius: var(--radius-card);

    box-shadow: var(--shadow-mobile-menu);

    opacity: 0;
    visibility: hidden;

    transform: translateY(-10px);

    pointer-events: none;

    transition:
      opacity var(--duration-normal) ease,
      transform var(--duration-normal) ease,
      visibility var(--duration-normal);
  }

  .nav-menu.show {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);

    pointer-events: auto;
  }

  .nav-menu a {
    width: 100%;

    min-height: 48px;

    padding: 12px 14px;

    border-radius: 10px;
  }

  .nav-menu a::after {
    display: none;
  }

  .nav-menu a:hover {
    background: var(--primary-soft);
  }
}

/*==================================================
SMALL MOBILE
==================================================*/

@media (max-width: 480px) {
  .navbar {
    grid-template-columns: 46px minmax(0, 1fr) 44px;

    column-gap: 8px;
  }

  .logo img {
    width: 44px;
    height: 44px;

    transform: translateY(10px);
  }

  .logo-title {
    font-size: 1.05rem;
  }

  .logo-subtitle {
    font-size: 0.72rem;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;

    flex-basis: 44px;
  }

  .menu-toggle span,
  .menu-toggle span::before,
  .menu-toggle span::after {
    width: 24px;
  }
}
