/* ============================================================
   Nivaas Foundations — Premium Mobile Header + Navigation Drawer
   Scoped entirely to max-width: 991.98px (Bootstrap's own lg / hamburger
   breakpoint). Nothing in this file touches desktop layout — the desktop
   navbar, mega menu and #navbarNav collapse are left completely as-is.
   Load order: after premium.css, so these overrides win on equal
   specificity without needing !important everywhere.
   ============================================================ */

/* ---------- 1. Compact premium header (mobile/tablet, <992px) ---------- */
@media (max-width: 991.98px) {

  #mainNavbar {
    background: #FFFFFF !important;
    border-bottom: 1px solid rgba(16, 35, 63, 0.08);
    box-shadow: 0 2px 16px rgba(16, 35, 63, 0.05);
  }

  #mainNavbar .container {
    flex-wrap: nowrap;
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Header height target: ~84-90px total (logo + vertical padding). */
  #mainNavbar .navbar-brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
    padding: 18px 0;
    margin-right: 10px;
  }

  #mainNavbar .nv-logo-frame {
    flex-direction: row;
    flex-shrink: 0;
  }

  #mainNavbar .navbar-logo-img {
    height: 54px !important;
    width: auto;
  }

  /* The "Since <year>" mark and the tagline line are desktop-only —
     the premium mobile header spec calls for logo + name only. */
  #mainNavbar .nv-logo-est,
  #mainNavbar .nv-brand-tagline {
    display: none !important;
  }

  #mainNavbar .nv-brand-text {
    min-width: 0;
  }

  #mainNavbar .nv-brand-name {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: #10233F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: block;
  }

  /* Old Bootstrap toggler is fully replaced by #nvDrawerToggle. */
  #mainNavbar .navbar-toggler {
    display: none !important;
  }

  /* The old inline mobile mega-menu / dropdown collapse is fully replaced
     by the drawer below — force it closed regardless of Bootstrap state. */
  #mainNavbar #navbarNav.collapse {
    display: none !important;
  }
}

@media (max-width: 359px) {
  #mainNavbar .nv-brand-name { font-size: 17px; max-width: 140px; }
  #mainNavbar .navbar-logo-img { height: 46px !important; }
}

/* ---------- 2. Hamburger / close toggle ---------- */
.nv-drawer-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nv-dt-bar {
  position: absolute;
  left: 11px;
  width: 24px;
  height: 2.5px;
  border-radius: 2px;
  background: #10233F;
  transition: transform 0.3s ease, opacity 0.25s ease, top 0.3s ease;
}

.nv-dt-bar:nth-child(1) { top: 17px; }
.nv-dt-bar:nth-child(2) { top: 23px; }
.nv-dt-bar:nth-child(3) { top: 29px; }

.nv-drawer-toggle.is-open .nv-dt-bar:nth-child(1) { top: 23px; transform: rotate(45deg); }
.nv-drawer-toggle.is-open .nv-dt-bar:nth-child(2) { opacity: 0; }
.nv-drawer-toggle.is-open .nv-dt-bar:nth-child(3) { top: 23px; transform: rotate(-45deg); }

/* ---------- 3. Overlay ---------- */
.nv-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1055;
  background: rgba(8, 18, 34, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nv-drawer-overlay.is-open {
  opacity: 1;
}

/* ---------- 4. Drawer panel ---------- */
.nv-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 86vw;
  max-width: 420px;
  z-index: 1060;
  display: flex;
  flex-direction: column;
  background: #FBF8F1;
  box-shadow: -18px 0 60px rgba(9, 20, 38, 0.22);
  transform: translateX(100%);
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.34, 1);
}

.nv-drawer.is-open {
  transform: translateX(0);
}

.nv-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(16, 35, 63, 0.08);
}

.nv-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.nv-drawer-brand img {
  height: 32px;
  width: auto;
  flex-shrink: 0;
}

.nv-drawer-brand span {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 14.5px;
  color: #10233F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nv-drawer-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(16, 35, 63, 0.06);
  color: #10233F;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nv-drawer-close:hover {
  background: rgba(16, 35, 63, 0.12);
}

.nv-drawer-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 6px;
}

.nv-drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- 5. Menu items ---------- */
.nv-drawer-link {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 15px 26px;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  color: #10233F;
  text-decoration: none;
  position: relative;
  cursor: pointer;
}

.nv-dl-num {
  font-family: var(--font-accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(16, 35, 63, 0.35);
  min-width: 22px;
  flex-shrink: 0;
}

.nv-dl-text {
  flex: 1 1 auto;
}

.nv-drawer-link.is-active .nv-dl-num,
.nv-drawer-accordion.is-active > .nv-drawer-acc-toggle .nv-dl-num {
  color: #C8A24D;
}

.nv-drawer-link.is-active .nv-dl-text,
.nv-drawer-accordion.is-active > .nv-drawer-acc-toggle .nv-dl-text {
  font-weight: 800;
}

.nv-drawer-link.is-active::after,
.nv-drawer-accordion.is-active > .nv-drawer-acc-toggle::after {
  content: '';
  position: absolute;
  left: 26px;
  bottom: 8px;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: #C8A24D;
}

/* ---------- 6. Services / Projects accordion ---------- */
.nv-dl-plus {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nv-dl-plus::before,
.nv-dl-plus::after {
  content: '';
  position: absolute;
  background: #10233F;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nv-dl-plus::before {
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.nv-dl-plus::after {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

.nv-drawer-accordion.is-open .nv-dl-plus::after {
  transform: translateX(-50%) scaleY(0);
  opacity: 0;
}

.nv-drawer-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  background: rgba(200, 162, 77, 0.07);
  transition: max-height 0.35s ease;
}

.nv-drawer-accordion.is-open .nv-drawer-sub {
  max-height: 400px;
}

.nv-drawer-sub a {
  display: block;
  padding: 11px 26px 11px 63px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #3C4B60;
  text-decoration: none;
  border-top: 1px solid rgba(16, 35, 63, 0.06);
}

/* ---------- 7. Footer CTA ---------- */
.nv-drawer-footer {
  flex: 0 0 auto;
  padding: 20px 26px 26px;
  background: linear-gradient(160deg, rgba(16, 35, 63, 0.05), rgba(200, 162, 77, 0.09));
  border-top: 1px solid rgba(16, 35, 63, 0.08);
}

.nv-df-eyebrow {
  display: block;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #C8A24D;
  margin-bottom: 6px;
}

.nv-df-text {
  font-size: 13.5px;
  color: #4B5A6E;
  margin: 0 0 14px;
}

.nv-df-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 10px;
  background: #10233F;
  color: #FFFFFF;
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 14px;
}

.nv-df-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nv-df-phone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-accent);
  font-size: 14.5px;
  font-weight: 700;
  color: #10233F;
  text-decoration: none;
}

.nv-df-whatsapp {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 17px;
}

/* ---------- 8. Sequential entrance animation ---------- */
.nv-drawer-item,
.nv-drawer-footer {
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.nv-drawer.is-open .nv-drawer-item,
.nv-drawer.is-open .nv-drawer-footer {
  opacity: 1;
  transform: translateX(0);
}

.nv-drawer.is-open .nv-drawer-item:nth-child(1) { transition-delay: 0.06s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(2) { transition-delay: 0.10s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(3) { transition-delay: 0.14s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(4) { transition-delay: 0.18s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(5) { transition-delay: 0.22s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(6) { transition-delay: 0.26s; }
.nv-drawer.is-open .nv-drawer-item:nth-child(7) { transition-delay: 0.30s; }
.nv-drawer.is-open .nv-drawer-footer { transition-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  .nv-drawer,
  .nv-drawer-overlay,
  .nv-drawer-item,
  .nv-drawer-footer,
  .nv-dt-bar,
  .nv-dl-plus::before,
  .nv-dl-plus::after,
  .nv-drawer-sub {
    transition: none !important;
  }
}

/* ---------- 9. Body scroll lock while drawer is open ---------- */
body.nv-nav-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

/* ---------- 10. Narrow-phone tuning (320-359px) ---------- */
@media (max-width: 359px) {
  .nv-drawer { width: 88vw; }
  .nv-drawer-link { padding-left: 20px; padding-right: 20px; font-size: 18px; }
  .nv-drawer-link.is-active::after,
  .nv-drawer-accordion.is-active > .nv-drawer-acc-toggle::after { left: 20px; }
  .nv-drawer-sub a { padding-left: 57px; }
  .nv-drawer-head { padding: 16px 18px; }
  .nv-drawer-footer { padding: 18px 20px 22px; }
}
