/**
 * Nam Việt — Header (v2 industrial).
 *
 * Top utility bar + sticky translucent header + JS-injected mobile drawer.
 * Source: design/v2/homepage-vi.html (.utility / header.site / mobile nav).
 * Nav markup comes from wp_nav_menu (<ul class="nv-menu"><li><a>), so the
 * flex/active rules target that structure rather than bare <a> children.
 *
 * Enqueued via inc/hooks-frontend.php (handle `nv-header`, depends on nv-base).
 */

/* =================== TOP UTILITY BAR =================== */
.utility { background: var(--ink); color: var(--s-300); font-size: 0.8rem; }
.utility .container { display: flex; justify-content: space-between; align-items: center; height: 40px; }
.utility a { color: var(--s-300); transition: color 0.2s; }
.utility a:hover { color: #fff; }
.utility .u-left { display: flex; gap: 26px; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; }
.utility .u-left .dot { color: var(--orange); }
.utility .u-right { display: flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: 0.74rem; }
.utility .u-right a { padding: 2px 8px; }
.utility .u-right a.active { color: var(--ink); background: var(--orange); font-weight: 700; }

/* =================== HEADER =================== */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244,242,238,0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--s-200);
}
header.site .container { display: flex; align-items: center; justify-content: space-between; height: 78px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 58px; width: auto; }

nav.main .nv-menu { display: flex; gap: 34px; list-style: none; margin: 0; padding: 0; align-items: center; }
nav.main .nv-menu li { position: relative; }
/* The legacy "Yêu cầu báo giá" menu item (class nav-cta) duplicates the v2
   header CTA button + mobile-drawer CTA — hide it everywhere the menu renders. */
.nv-menu .nav-cta { display: none; }
nav.main a {
  display: inline-block; white-space: nowrap;
  font-size: 0.93rem; font-weight: 600; color: var(--s-700);
  position: relative; padding: 4px 0; transition: color 0.2s;
}
nav.main a::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px; background: var(--orange); transition: width 0.25s ease;
}
nav.main a:hover,
nav.main .current-menu-item > a,
nav.main .current-menu-parent > a,
nav.main .current-menu-ancestor > a { color: var(--ink); }
nav.main a:hover::after,
nav.main .current-menu-item > a::after,
nav.main .current-menu-parent > a::after,
nav.main .current-menu-ancestor > a::after { width: 100%; }

.head-cta { display: flex; align-items: center; gap: 18px; }
.head-phone {
  font-family: var(--mono); font-weight: 700; font-size: 0.95rem; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.head-phone .pic { color: var(--orange); display: flex; align-items: center; }
.head-phone .pic svg { width: 16px; height: 16px; }

/* =================== MOBILE NAV (hamburger + slide-in drawer) =================== */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px; flex: none;
  width: 46px; height: 46px; padding: 0 11px;
  background: var(--white); border: 1px solid var(--s-200);
  cursor: pointer; transition: border-color 0.2s;
}
.nav-toggle:hover { border-color: var(--ink); }
.nav-toggle span { display: block; width: 100%; height: 2px; background: var(--ink); transition: transform 0.25s ease, opacity 0.2s ease; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-drawer { position: fixed; inset: 0; z-index: 200; visibility: hidden; }
.mobile-drawer.open { visibility: visible; }
.mobile-drawer .md-backdrop { position: absolute; inset: 0; background: rgba(26,28,31,0.55); opacity: 0; transition: opacity 0.3s ease; }
.mobile-drawer.open .md-backdrop { opacity: 1; }
.md-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(84vw, 350px);
  background: var(--paper); box-shadow: var(--sh-lg);
  padding: 66px 30px 40px; display: flex; flex-direction: column; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
}
.mobile-drawer.open .md-panel { transform: translateX(0); }
.md-close {
  position: absolute; top: 16px; right: 20px; width: 42px; height: 42px;
  border: none; background: none; font-size: 2rem; line-height: 1;
  color: var(--s-500); cursor: pointer; transition: color 0.2s;
}
.md-close:hover { color: var(--ink); }
.md-nav, .md-nav ul { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }
.md-nav li { display: block; width: 100%; }
.md-nav a {
  display: block; width: 100%;
  font-family: var(--display); font-weight: 700; font-size: 1.16rem; color: var(--s-700);
  padding: 15px 0; border-bottom: 1px solid var(--s-200); transition: color 0.2s;
}
.md-nav a:hover, .md-nav .current-menu-item > a { color: var(--orange-700); }
.md-phone {
  display: flex; align-items: center; gap: 8px; margin-top: 26px;
  font-family: var(--mono); font-weight: 700; font-size: 1.06rem; color: var(--ink);
}
.md-phone .pic { color: var(--orange); display: flex; align-items: center; }
.md-phone svg { width: 18px; height: 18px; }
.md-cta { margin-top: 20px; width: 100%; justify-content: center; }
.md-lang { display: flex; gap: 8px; margin-top: 22px; font-family: var(--mono); font-size: 0.78rem; }
.md-lang a { padding: 7px 14px; border: 1px solid var(--s-200); color: var(--s-700); letter-spacing: 0.04em; }
.md-lang a.active { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 700; }

@media (max-width: 1080px) {
  header.site nav.main { display: none; }
  header.site .head-cta .head-phone { display: none; }
  .nav-toggle { display: flex; }
}
@media (max-width: 680px) {
  .utility .u-left { display: none; }
  header.site .head-cta .btn-primary { display: none; }
}
