/* =====================================================
   VIS Networks — Header / Navigation styles
   (kept separate from the global stylesheet on purpose)
   ===================================================== */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s ease;
}
.site-header.scrolled { box-shadow: 0 6px 24px rgba(20,20,43,.08); }

/* ---- Top utility bar (Braiin / Nasdaq) — prominent ---- */
.topbar {
  background: linear-gradient(90deg, #1c0e30 0%, #14142b 42%, #4d0a1f 100%);
  color: #fff; font-size: .76rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner {
  max-width: var(--container); margin: 0 auto; padding: 6px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar strong { color: #fff; font-weight: 600; }
.tb-left { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.braiin-mark {
  flex: none; display: inline-flex; align-items: center; justify-content: center; line-height: 0;
  height: 26px; padding: 0 11px; border-radius: 6px; background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.25); transition: transform .2s ease, box-shadow .2s ease;
}
.braiin-mark img { height: 15px; width: auto; display: block; object-fit: contain; }
.braiin-mark:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.tb-sub { color: rgba(255,255,255,.85); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-nasdaq {
  flex: none; display: inline-flex; align-items: center; line-height: 1;
  height: 26px; background: var(--red); color: #fff; font-weight: 700; font-size: .66rem; letter-spacing: .03em;
  padding: 0 11px; border-radius: 6px; box-shadow: 0 2px 7px rgba(217,4,41,.4);
  transition: background .2s ease, transform .2s ease;
}
.tb-nasdaq:hover { background: var(--red-dark); transform: translateY(-1px); }
.tb-right { display: flex; align-items: center; gap: 20px; flex: none; }
.tb-right a { color: rgba(255,255,255,.85); transition: color .2s ease; }
.tb-right a:hover { color: #fff; }
.tb-loc { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.6); white-space: nowrap; }
.tb-pin { width: 12px; height: 12px; flex: none; }
/* full office list only on wide desktop; a compact version everywhere else */
.tb-loc-full { display: none; }
.tb-loc-sm { display: inline; }
@media (min-width: 1300px) { .tb-loc-full { display: inline; } .tb-loc-sm { display: none; } }
/* tablet & mobile: compact, centered topbar — STILL shows the Braiin logo + location pin */
@media (max-width: 1150px) {
  .topbar-inner { justify-content: center; flex-wrap: wrap; gap: 5px 14px; padding: 8px 14px; font-size: .74rem; }
  .tb-sub { display: none; }              /* drop the long subsidiary text, keep the logo + pill */
  .braiin-mark { padding: 5px 10px; }
  .braiin-mark img { height: 19px; }
  .tb-nasdaq { font-size: .68rem; padding: 4px 10px; }
  .tb-right { gap: 12px; }
  .tb-pin { width: 12px; height: 12px; }
}
/* small phones: keep just the Braiin logo + location pin (Contact Us is in the menu/footer) */
@media (max-width: 560px) {
  .tb-right > a { display: none; }
  .topbar-inner { gap: 4px 12px; }
}
@media (max-width: 380px) {
  .topbar-inner { font-size: .66rem; }
  .tb-pin { width: 11px; height: 11px; }
}

.nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo { display: flex; align-items: center; gap: 11px; }
.nav-logo img { height: 40px; width: auto; }
.logo-mark { display: inline-flex; }
.logo-mark svg { display: block; }
.logo-name {
  font-family: 'Space Grotesk', 'Poppins', sans-serif;
  font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; color: var(--ink); line-height: 1;
}
.logo-name span { font-weight: 500; color: var(--muted); font-size: .78rem; margin-left: 5px; letter-spacing: .02em; }
@media (max-width: 480px) { .logo-name span { display: none; } }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-menu a.nav-link {
  position: relative;
  padding: 10px 16px;
  font-weight: 500;
  font-size: 0.96rem;
  color: var(--ink-soft);
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}
.nav-menu a.nav-link:hover { color: var(--red); }
.nav-menu a.nav-link.active { color: var(--red); }
.nav-menu a.nav-link.active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: 4px;
  height: 2px; border-radius: 2px;
  background: var(--red);
}

/* Dropdown (Products) */
.nav-dropdown { position: relative; }
.nav-dropdown > .nav-link { cursor: pointer; }
.nav-dropdown .dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: 318px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20,20,43,.16);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
/* invisible bridge so the menu doesn't close when crossing the gap */
.nav-dropdown .dropdown-menu::before {
  content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px;
}
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a {
  display: block;
  padding: 11px 15px;
  border-radius: 11px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  transition: background .18s ease, color .18s ease, padding-left .18s ease;
}
.dropdown-menu a:hover { background: var(--bg-soft); color: var(--red); padding-left: 19px; }
.dropdown-menu a small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; margin-top: 2px; line-height: 1.35; }
.dropdown-menu a:hover small { color: var(--ink-soft); }
/* nested "sub-menu" group inside a dropdown */
.dropdown-menu .dd-group { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.dropdown-menu .dd-label { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--red); padding: 4px 15px 8px; }
.dropdown-menu .dd-group a { padding-left: 28px; position: relative; }
.dropdown-menu .dd-group a::before { content: ""; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--red); opacity: .5; }
.dropdown-menu .dd-group a:hover::before { opacity: 1; }

.nav-cta { display: flex; align-items: center; gap: 14px; }
.nav-cta-mobile { display: none; }
.nav-extra { display: none; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 26px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1150px) {
  .nav { height: 64px; padding: 0 18px; }
  .nav-logo img { height: 34px; }
  .nav-toggle { display: flex; }
  /* keep the logo + hamburger above the full-screen drawer */
  .nav-logo, .nav-toggle { position: relative; z-index: 1001; }
  .nav-menu {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 100dvh;                 /* explicit height — backdrop-filter ancestor breaks inset:0 */
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    padding: 112px 24px 28px;       /* clears the fixed topbar + nav bar */
    overflow-y: auto;
    /* fade in/out — NOT an off-screen slide (that caused horizontal page overflow) */
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .26s ease, visibility .26s ease;
    z-index: 1000;
  }
  .nav-menu.open { opacity: 1; visibility: visible; pointer-events: auto; }
  .nav-menu li { border-bottom: 1px solid var(--line); }
  .nav-menu li:last-child { border-bottom: 0; }
  .nav-menu a.nav-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 8px; border-radius: 8px;
    color: var(--ink); font-size: 1.05rem; font-weight: 600;
  }
  .nav-menu a.nav-link.active::after { display: none; }
  .nav-menu a.nav-link.active { background: transparent; color: var(--red); }
  .caret { display: inline-block; font-size: .7em; color: var(--muted); transition: transform .3s ease; }
  .nav-dropdown.open > .nav-link .caret { transform: rotate(180deg); color: var(--red); }
  /* accordion: dropdowns collapsed by default, expand when parent is .open */
  .nav-dropdown .dropdown-menu {
    position: static;
    width: auto;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; min-width: 0;
    margin: 0 0 6px 8px; padding: 0;
    border-left: 2px solid var(--line);
    max-height: 0; overflow: hidden;
    transition: max-height .35s ease;
  }
  .nav-dropdown .dropdown-menu::before { display: none; }
  .dropdown-menu a:hover { padding-left: 16px; }
  .nav-dropdown.open .dropdown-menu { max-height: 560px; }
  .nav-dropdown .dropdown-menu a { padding: 12px 16px; font-size: .96rem; font-weight: 500; }
  .nav-dropdown .dropdown-menu a small { font-size: .76rem; }
  .nav-cta { display: none; }
  .nav-cta-mobile { display: block; margin-top: 18px; border-bottom: 0 !important; }
  .nav-cta-mobile .btn { width: 100%; justify-content: center; padding: 15px; }

  /* social + contact block at the bottom of the drawer */
  .nav-extra { display: block; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); border-bottom: 0 !important; }
  .nx-contact { display: grid; gap: 12px; margin-bottom: 20px; }
  .nx-contact a { display: flex; align-items: center; gap: 11px; color: var(--ink-soft); font-size: .95rem; }
  .nx-contact a span { color: var(--red); font-size: 1.05rem; }
  .nx-contact a:hover { color: var(--red); }
  .nx-social { display: flex; gap: 12px; }
  .nx-social a {
    width: 44px; height: 44px; display: grid; place-items: center;
    border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line);
    color: var(--ink-soft); transition: background .2s ease, color .2s ease, transform .2s ease, border-color .2s ease;
  }
  .nx-social a:hover { background: var(--red); color: #fff; border-color: var(--red); transform: translateY(-3px); }
  .nx-social svg { width: 18px; height: 18px; display: block; }
  .nx-note { margin-top: 20px; font-size: .78rem; color: var(--muted); line-height: 1.5; }
  .nx-note strong { color: var(--ink-soft); font-weight: 600; }
}
