/* Two-bar header, matching NetSuite's measured structure (DESIGN-REFERENCE.md §3.4, §9.1):
   topbar 60px / var(--surface-topbar), nav bar ~64px / var(--surface-nav). */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ---- top bar: logo + CTA ---- */

.topbar {
  background: var(--surface-topbar);
  height: 60px;
}

.topbar__row {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.topbar__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.topbar__logo img {
  display: block;
  height: 36px;
  width: auto;
}

.topbar__search {
  position: relative;
  margin-left: auto;
}

.topbar__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: #E2E8F0;
  cursor: pointer;
  border-radius: 50%;
}

.topbar__icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.search-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: var(--surface-white);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  padding: 12px;
}

.search-panel input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font-sans);
  border: 1px solid #CBD5E1;
  border-radius: var(--radius);
  color: var(--text-color);
}

.search-panel input:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

.search-panel__results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.search-panel__results:empty {
  margin: 0;
}

.search-panel__results li a {
  display: block;
  padding: 10px 8px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--radius);
}

.search-panel__results li a:hover,
.search-panel__results li a:focus {
  background: var(--surface-page);
  color: var(--accent-primary);
}

.search-panel__empty {
  padding: 10px 8px;
  font-size: 14px;
  color: var(--text-color-muted);
}

.topbar__phone {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #E2E8F0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar__phone:hover {
  color: #FFFFFF;
}

.topbar__login {
  color: #E2E8F0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar__login:hover {
  color: #FFFFFF;
}

.topbar__cta-short {
  display: none;
}

.site-nav__item--mobile-only {
  display: none;
}

.site-nav__mobile-search {
  display: none;
}

/* ---- nav bar: mega-menu items ---- */

.site-nav {
  background: var(--surface-nav);
}

.site-nav__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.site-nav__item {
  position: relative;
}

.site-nav__link {
  display: block;
  padding: 20px 16px;
  color: #E2E8F0;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.site-nav__link:hover,
.site-nav__link[aria-expanded="true"] {
  color: #FFFFFF;
  border-bottom-color: var(--accent-primary);
}

/* ---- mega-menu dropdown panel ---- */

.mega-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: var(--surface-white);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  padding: 12px 0;
  flex-direction: column;
}

.site-nav__link[aria-expanded="true"] + .mega-menu {
  display: flex;
}

.mega-menu a {
  padding: 10px 20px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 15px;
}

.mega-menu a:hover {
  background: var(--surface-page);
  color: var(--accent-primary);
}

.mega-menu__hub {
  font-weight: 700;
  border-bottom: 1px solid #E2E8F0;
  margin-bottom: 4px;
  padding-bottom: 12px !important;
}

/* ---- mobile hamburger toggle ---- */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  width: 100%;
  background: #FFFFFF;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---- responsive: collapse to hamburger, CTA stays visible ---- */

@media (max-width: 899px) {
  .topbar__row {
    gap: 12px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
  }

  .site-header.nav-open .site-nav {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    gap: 0;
  }

  .mega-menu {
    position: static;
    box-shadow: none;
    border-radius: 0;
    padding-left: 16px;
  }

  /* mobile: contact line becomes a phone icon only, still a real tel: link
     that opens the device's dialler -- text label is dropped, not the link */
  .topbar__phone-text {
    display: none;
  }

  .topbar__phone {
    margin-left: auto;
  }

  /* CTA text shortens so logo + phone icon + CTA + hamburger all fit --
     it must stay visible outside the menu no matter what, per DESIGN-REFERENCE.md */
  .topbar__cta {
    padding: 11px 14px;
  }

  .topbar__cta-full {
    display: none;
  }

  .topbar__cta-short {
    display: inline;
  }

  /* Search moves into the mobile menu instead of competing for topbar space
     with the phone icon, CTA, and hamburger all at once */
  .topbar__search {
    display: none;
  }

  .site-nav__mobile-search {
    display: block;
    padding: 16px;
  }

  .site-nav__mobile-search input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    font-family: var(--font-sans);
    border: 1px solid #475569;
    border-radius: var(--radius);
    background: var(--surface-dark);
    color: #FFFFFF;
  }

  .site-nav__mobile-search .search-panel__results li a {
    color: #E2E8F0;
  }

  .site-nav__mobile-search .search-panel__results li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
  }

  /* Log In moves into the mobile menu instead of competing for topbar space */
  .topbar__login {
    display: none;
  }

  .site-nav__item--mobile-only {
    display: block;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    padding-top: 8px;
  }
}
