/**
 * Dapin47 v2 — Header & Navigation
 * Responsive 3-Track Navigation (Desktop ≥992px, Tablet 768-991px, Mobile <768px).
 */

.header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  padding: 12px 0;
}

.header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.09);
  padding: 8px 0;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Logo Branding
   ========================================================================== */
.header .logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.header .logo img {
  max-height: 46px;
  width: auto;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 576px) {
  .header .logo img {
    max-height: 38px;
  }
}

/* ==========================================================================
   Desktop Navigation (≥ 992px)
   ========================================================================== */
.navmenu {
  display: flex;
  align-items: center;
}

.navmenu ul {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 0;
}

.navmenu a {
  font-family: var(--nav-font);
  font-size: 0.92rem;
  font-weight: 500;
  color: #555562;
  position: relative;
  padding: 8px 0;
  display: block;
  transition: var(--transition-fast);
}

.navmenu a:hover,
.navmenu a.active {
  color: var(--primary-color);
}

.navmenu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: width 0.25s ease;
}

.navmenu a:hover::after,
.navmenu a.active::after {
  width: 100%;
}

/* Mobile Nav Toggle Icon */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--heading-color);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* Tablet & Mobile Navigation (< 992px) */
@media (max-width: 991px) {
  body.mobile-nav-active .header {
    z-index: 10000;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    order: 3;
    z-index: 10002;
  }

  .header-cta-wrap {
    order: 2;
    margin-left: auto;
    margin-right: 12px;
  }

  .navmenu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.22);
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px 30px;
    transition: right 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10005;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navmenu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 16px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
  }

  .navmenu-close-btn {
    background: var(--surface-alt);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--heading-color);
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .navmenu-close-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
  }

  .navmenu ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }

  .navmenu ul li {
    width: 100%;
    border-bottom: 1px solid var(--border-light);
  }

  .navmenu a {
    width: 100%;
    padding: 14px 4px;
    font-size: 1.05rem;
    font-weight: 600;
  }

  .navmenu a::after {
    display: none;
  }

  /* Overlay / Backdrop */
  .mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
  }

  /* Active Drawer State */
  body.mobile-nav-active .navmenu {
    right: 0;
    pointer-events: auto;
  }

  body.mobile-nav-active .mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.mobile-nav-active {
    overflow: hidden;
  }
}

@media (min-width: 992px) {
  .navmenu-header {
    display: none !important;
  }
}
