/* ==========================================================================
   Texvian IT — HEADER FOUNDATION
   Structural + visual rules for the site header only. Page content and
   homepage sections are out of scope for Phase 0.
   ========================================================================== */

.nx-header {
  position: sticky;
  top: 0;
  z-index: var(--nx-z-header);
  width: 100%;
  height: var(--nx-header-height);
  display: flex;
  align-items: center;
  background: var(--nx-header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: height var(--nx-duration-base) var(--nx-ease-standard),
    border-color var(--nx-duration-base) var(--nx-ease-standard),
    background-color var(--nx-duration-base) var(--nx-ease-standard),
    box-shadow var(--nx-duration-base) var(--nx-ease-standard);
}

/* Toggled by header.js once the user scrolls past a threshold */
.nx-header.is-scrolled {
  height: var(--nx-header-height-scrolled);
  border-bottom-color: var(--nx-border-color);
  box-shadow: var(--nx-shadow-sm);
}

.nx-header__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nx-space-6);
}

/* ---------------- Brand ---------------- */
.nx-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--nx-space-2);
  font-family: var(--nx-font-display);
  font-weight: var(--nx-fw-bold);
  font-size: var(--nx-fs-xl);
  color: var(--nx-text-primary);
  flex-shrink: 0;
}

.nx-header__brand:hover {
  color: var(--nx-text-primary);
}

.nx-header__brand img,
.nx-header__brand svg {
  height: 32px;
  width: auto;
  display: block;
}

.nx-header__brand .nx-header__brand-mark--dark {
  display: none;
}

[data-bs-theme="dark"] .nx-header__brand .nx-header__brand-mark--light {
  display: none;
}

[data-bs-theme="dark"] .nx-header__brand .nx-header__brand-mark--dark {
  display: block;
}

/* ---------------- Primary nav ---------------- */
.nx-nav {
  display: flex;
  align-items: center;
  gap: var(--nx-space-2);
}

.nx-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--nx-space-2) var(--nx-space-4);
  font-family: var(--nx-font-body);
  font-weight: var(--nx-fw-medium);
  font-size: var(--nx-fs-sm);
  color: var(--nx-text-primary);
  border-radius: var(--nx-radius-sm);
  transition: var(--nx-transition-colors);
}

.nx-nav__link:hover,
.nx-nav__link:focus-visible,
.nx-nav__link.is-active {
  color: var(--nx-primary);
}

.nx-nav__link .bi,
.nx-nav__link .nx-icon {
  font-size: 0.75em;
  transition: transform var(--nx-duration-fast) var(--nx-ease-standard);
}

.nx-nav__item:hover>.nx-nav__link .nx-caret {
  transform: rotate(180deg);
}

/* Dropdown menu (Bootstrap dropdown, restyled) */
.nx-nav .dropdown-menu {
  border: 1px solid var(--nx-border-color);
  border-radius: var(--nx-radius-md);
  box-shadow: var(--nx-shadow-lg);
  padding: var(--nx-space-2);
  background: var(--nx-surface);
}

.nx-nav .dropdown-item {
  border-radius: var(--nx-radius-xs);
  padding: var(--nx-space-2) var(--nx-space-3);
  font-size: var(--nx-fs-sm);
  color: var(--nx-text-primary);
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--nx-primary-soft) ! important;
}

.nx-nav .dropdown-item:hover,
.nx-nav .dropdown-item:focus {
  background: var(--nx-primary-soft);
  color: var(--nx-primary);
}

/* ---------------- Action cluster (theme toggle, CTA, burger) ---------------- */
.nx-header__actions {
  display: flex;
  align-items: center;
  gap: var(--nx-space-3);
  flex-shrink: 0;
}

.nx-theme-toggle {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-circle);
  border: 1px solid var(--nx-border-color);
  background: var(--nx-surface);
  color: var(--nx-text-primary);
  font-size: 1rem;
  transition: var(--nx-transition-base);
}

.nx-theme-toggle:hover {
  border-color: var(--nx-primary);
  color: var(--nx-primary);
}

.nx-theme-toggle .nx-theme-toggle__icon-dark {
  display: none;
}

[data-bs-theme="dark"] .nx-theme-toggle .nx-theme-toggle__icon-light {
  display: none;
}

[data-bs-theme="dark"] .nx-theme-toggle .nx-theme-toggle__icon-dark {
  display: inline-flex;
}

.nx-header__search-toggle {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-circle);
  border: 1px solid var(--nx-border-color);
  background: var(--nx-surface);
  color: var(--nx-text-primary);
  font-size: 1rem;
  transition: var(--nx-transition-base);
}

.nx-header__search-toggle:hover {
  border-color: var(--nx-primary);
  color: var(--nx-primary);
}

.nx-header__burger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-sm);
  border: 1px solid var(--nx-border-color);
  background: var(--nx-surface);
  color: var(--nx-text-primary);
}

/* ---------------- Mobile offcanvas nav ---------------- */
@media (max-width: 991.98px) {
  .nx-nav-desktop {
    display: none;
  }

  .nx-header__burger {
    display: inline-flex;
  }

  .nx-offcanvas-nav {
    width: min(360px, 86vw);
    background: var(--nx-surface);
    color: var(--nx-text-primary);
  }

  .nx-offcanvas-nav .nx-nav {
    flex-direction: column;
    align-items: stretch;
    gap: var(--nx-space-1);
  }

  .nx-offcanvas-nav .nx-nav__link {
    width: 100%;
    padding: var(--nx-space-3) var(--nx-space-3);
  }

  /* Accordion-style submenus (Services / Solutions / Industries mega
     menu content, condensed to a flat list for mobile) — built on
     Bootstrap's Collapse component, which provides the smooth
     open/close height animation and correct aria-expanded syncing. */
  .nx-offcanvas-toggle {
    width: 100%;
    justify-content: space-between;
    background: transparent;
    border: none;
    text-align: left;
  }

  .nx-offcanvas-toggle .nx-caret {
    transition: transform var(--nx-duration-fast) var(--nx-ease-standard);
  }

  .nx-offcanvas-toggle[aria-expanded="true"] {
    color: var(--nx-primary);
  }

  .nx-offcanvas-toggle[aria-expanded="true"] .nx-caret {
    transform: rotate(180deg);
  }

  .nx-offcanvas-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--nx-space-1) 0 var(--nx-space-2) var(--nx-space-4);
    margin: 0;
  }

  .nx-offcanvas-submenu .dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--nx-space-2);
    border-radius: var(--nx-radius-sm);
  }

  .nx-offcanvas-submenu .dropdown-item .bi {
    color: var(--nx-text-muted);
    font-size: 0.95em;
  }
}

/* NOTE: .nx-header__cta visibility is controlled directly in markup via
   Bootstrap's responsive display utilities (`d-none d-lg-inline-flex`),
   not here — Bootstrap's `.d-none` ships `!important`, so a plain
   `display` rule in this file would never be able to override it. */

/* ==========================================================================
   HEADER STYLE VARIANTS
   The markup in index.html ships "Style 01" (the default rules above:
   logo left / nav+actions right, opaque on load). The modifier classes
   below are complete, ready-to-use alternates — apply one to the
   `.nx-header` element to switch styles; no other markup changes
   required beyond what each variant's comment notes.
   ========================================================================== */

/* ---------------- Transparent (for use over a dark hero section) ----------
   Starts fully transparent with light text/icons; once `.is-scrolled` is
   toggled by header.js it automatically falls back to the standard
   opaque header above — no extra JS needed. */
.nx-header--transparent {
  position: absolute;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nx-header--transparent:not(.is-scrolled) {
  color: var(--nx-white);
}

.nx-header--transparent:not(.is-scrolled) .nx-nav__link,
.nx-header--transparent:not(.is-scrolled) .nx-header__brand {
  color: var(--nx-white);
}

.nx-header--transparent:not(.is-scrolled) .nx-nav__link:hover,
.nx-header--transparent:not(.is-scrolled) .nx-nav__link.is-active {
  color: var(--nx-circuit-400);
}

.nx-header--transparent:not(.is-scrolled) .nx-theme-toggle,
.nx-header--transparent:not(.is-scrolled) .nx-header__search-toggle,
.nx-header--transparent:not(.is-scrolled) .nx-header__burger {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--nx-white);
}

.nx-header--transparent:not(.is-scrolled) .nx-header__brand-mark--light {
  display: none;
}

.nx-header--transparent:not(.is-scrolled) .nx-header__brand-mark--dark {
  display: block;
  /* No recolor filter: logo-dark.svg is already designed for dark
     surfaces (light wordmark, blue icon with a dark-navy inner stroke),
     so it reads correctly against the transparent header's dark hero
     backdrop as-is. An earlier brightness(0) invert(1) filter here
     crushed the icon's three internal colors (rect/path/dot) into a
     single flat white shape, destroying the mark's shape — confirmed
     visually once Home 02 became the first page to actually render
     this header variant live. */
}

.nx-header--transparent.is-scrolled {
  position: sticky;
  background: var(--nx-header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------------- Style 02: centered logo, split navigation ----------------
   Markup: move the brand `<a>` to the middle of `.nx-header__inner` and
   split `.nx-nav-desktop` into two `<nav>` groups flanking it
   (`.nx-nav-desktop--start` / `.nx-nav-desktop--end`), each holding half
   the primary links. Actions cluster stays on the far right. */
.nx-header--style-2 .nx-header__inner {
  justify-content: center;
  position: relative;
}

.nx-header--style-2 .nx-header__brand {
  order: 2;
  margin-inline: var(--nx-space-8);
}

.nx-header--style-2 .nx-nav-desktop--start {
  order: 1;
}

.nx-header--style-2 .nx-nav-desktop--end {
  order: 3;
}

.nx-header--style-2 .nx-header__actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------------- Style 03: minimal, CTA-forward ----------------
   Denser link spacing, no icon buttons in the nav row, single prominent
   CTA. Good fit for the .nx-header--transparent combo. */
.nx-header--style-3 .nx-nav__link {
  padding-inline: var(--nx-space-3);
  font-weight: var(--nx-fw-semibold);
}

.nx-header--style-3 .nx-header__actions {
  gap: var(--nx-space-2);
}

.nx-header--style-3 .nx-theme-toggle {
  border-color: transparent;
  background: transparent;
}

.dropdown-toggle::after {
  display: none;
}

/* ==========================================================================
   DESKTOP NAV FIT — eight top-level items (Home, Services, Solutions,
   Industries, Technologies, Company, Pages, Blog) + brand + actions must fit
   the container from 992px up. Padding tightens on narrower desktops and
   the header CTA moves into the offcanvas menu (it is repeated there) below
   1400px so nothing is pushed past the viewport edge.
   ========================================================================== */
@media (min-width: 992px) {
  .nx-header__inner {
    gap: var(--nx-space-3);
  }

  .nx-nav {
    gap: 0;
    margin-bottom: 0;
  }

  .nx-nav__link {
    padding: var(--nx-space-2) 7px;
    font-size: 0.8125rem;
    gap: 4px;
  }

  .nx-header__actions {
    gap: var(--nx-space-2);
    flex-shrink: 0;
  }

  .nx-header__cta {
    display: none !important;
  }
}

@media (min-width: 1200px) {
  .nx-nav__link {
    padding: var(--nx-space-2) 9px;
    font-size: var(--nx-fs-md);
  }
}

@media (min-width: 1400px) {
  .nx-nav__link {
    padding: var(--nx-space-2) var(--nx-space-3);
  }

  .nx-header__cta {
    display: inline-flex !important;
  }
}

@media (min-width: 992px) and (max-width: 1099.98px) {
  .nx-header__inner {
    gap: var(--nx-space-2);
  }

  .nx-nav__link {
    padding-inline: 5px;
    font-size: 0.78rem;
  }

  .nx-nav__link .nx-caret {
    display: none;
  }
}