/* ==========================================================================
   Texvian IT — MEGA MENU
   Built on Bootstrap's Dropdown component (data-bs-toggle="dropdown"),
   with Popper positioning disabled (data-bs-display="static" on the
   trigger in markup) so our CSS — not Popper — controls placement:
   full-width, anchored to the header's bottom edge. Bootstrap still owns
   all show/hide state, ARIA attributes and keyboard handling; JS in
   mega-menu.js only adds hover-intent opening on desktop pointer devices.
   ========================================================================== */

.nx-nav__item--mega {
  position: static;
}

/* Specificity note: header.css's `.nx-nav .dropdown-menu` rule (two
   classes) would otherwise beat a bare `.nx-mega-menu` (one class)
   regardless of file load order, so every property that rule also sets
   (border/border-radius/padding/background/box-shadow) is redeclared
   here under the equally-specific `.nx-nav .nx-mega-menu` selector. */
.nx-nav .nx-mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  margin-top: 0;
  border: none;
  border-top: 1px solid var(--nx-border-color);
  border-radius: 0 0 var(--nx-radius-lg) var(--nx-radius-lg);
  background: var(--nx-surface);
  box-shadow: var(--nx-shadow-lg);
  padding: var(--nx-space-7) 0;
  max-height: min(72vh, 640px);
  overflow-y: auto;
}

.nx-mega-menu__inner {
  width: 100%;
  max-width: var(--nx-container-max);
  margin-inline: auto;
  padding-inline: var(--nx-container-padding);
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--nx-space-8);
}

/* ---------------- Category grid (Services / Solutions) ---------------- */
.nx-mega-menu__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--nx-space-2) var(--nx-space-6);
  align-content: start;
}

.nx-mega-menu__grid--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.nx-mega-link {
  display: flex;
  align-items: flex-start;
  gap: var(--nx-space-3);
  padding: var(--nx-space-3);
  border-radius: var(--nx-radius-md);
  color: var(--nx-text-primary);
  transition: var(--nx-transition-base);
}

.nx-mega-link:hover,
.nx-mega-link:focus-visible {
  background: var(--nx-surface-alt);
  color: var(--nx-text-primary);
  transform: translateX(2px);
}

.nx-mega-link__icon {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-sm);
  background: var(--nx-primary-soft);
  color: var(--nx-primary);
  font-size: 1.05rem;
  transition: var(--nx-transition-base);
}

.nx-mega-link:hover .nx-mega-link__icon {
  background: var(--nx-primary);
  color: var(--nx-primary-contrast);
}

.nx-mega-link__body {
  min-width: 0;
}

.nx-mega-link__title {
  display: block;
  font-family: var(--nx-font-body);
  font-weight: var(--nx-fw-semibold);
  font-size: var(--nx-fs-sm);
  color: var(--nx-text-primary);
  margin-bottom: 2px;
}

.nx-mega-link__desc {
  display: block;
  font-size: var(--nx-fs-xs);
  color: var(--nx-text-secondary);
  line-height: var(--nx-lh-body);
}

/* ---------------- Compact variant (Industries: icon + label only) ---------------- */
.nx-mega-menu__grid--compact {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--nx-space-2);
}

.nx-mega-link--compact {
  align-items: center;
  padding: var(--nx-space-2) var(--nx-space-3);
}

.nx-mega-link--compact .nx-mega-link__icon {
  --size: 34px;
  font-size: 0.95rem;
}

.nx-mega-link--compact .nx-mega-link__title {
  font-weight: var(--nx-fw-medium);
  margin-bottom: 0;
}

/* ---------------- Right-side featured panel ---------------- */
.nx-mega-menu__panel {
  border-left: 1px solid var(--nx-divider);
  padding-left: var(--nx-space-8);
  display: flex;
  flex-direction: column;
}

.nx-mega-menu__panel-eyebrow {
  margin-bottom: var(--nx-space-3);
}

.nx-mega-menu__panel-title {
  /* Markup uses <p>, not a heading element — this is a nav promo blurb,
     not document content, so it shouldn't sit in the page's heading
     outline. Font styling is set explicitly here since <p> doesn't
     inherit the global h1–h6 display-font rule that a heading tag would. */
  font-family: var(--nx-font-display);
  font-weight: var(--nx-fw-semibold);
  line-height: var(--nx-lh-heading);
  color: var(--nx-text-primary);
  font-size: var(--nx-fs-h6);
  margin-bottom: var(--nx-space-2);
}

.nx-mega-menu__panel-text {
  font-size: var(--nx-fs-sm);
  color: var(--nx-text-secondary);
  margin-bottom: var(--nx-space-5);
}

.nx-mega-menu__panel-media {
  border-radius: var(--nx-radius-md);
  overflow: hidden;
  margin-bottom: var(--nx-space-5);
  aspect-ratio: 16 / 10;
  background: var(--nx-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nx-text-muted);
  font-size: 1.75rem;
}

/* ---------------- Caret rotation on open ---------------- */
.nx-nav__item--mega .dropdown-toggle[aria-expanded="true"] .nx-caret {
  transform: rotate(180deg);
}

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

/* ---------------- Mobile: mega menus become the offcanvas accordion instead ---------------- */
@media (max-width: 991.98px) {
  .nx-mega-menu {
    display: none !important;
  }
}

/* Slight entrance motion, respects reduced-motion via the global rule
   in base/reset.css which zeroes animation/transition durations. */
.nx-mega-menu.show {
  animation: nx-fade-down var(--nx-duration-base) var(--nx-ease-emphasized) both;
}