/**
 * Navigation - xTools.com
 *
 * Header navigation, mobile menu, and footer navigation.
 */

/* ========================================
   HEADER / MAIN NAVIGATION
   ======================================== */

.nav {
  position: relative; /* anchor the full-width mega panel to the nav bar */
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);

  /* Horizontal inset comes from the inner .nav-container.container so the
     header aligns with page sections (no double padding). */
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-lg);
  margin: 0 auto;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo img {
  height: 37px;
  width: auto;
}

/* Main nav links */
.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
  list-style: none;

  /* Left-align the nav next to the logo; push the CTA to the far right. */
  margin: 0 auto 0 var(--spacing-8);
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  font-family: var(--font-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-decoration: none;
  padding: var(--spacing-2) 0;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-text-light);
  text-decoration: none;
}

.nav-link.active {
  font-weight: var(--font-weight-bold);
}

/* Dropdown arrow icon */
.nav-link-icon {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.nav-item:hover .nav-link-icon {
  transform: rotate(180deg);
}

/* CTA button in nav */
.nav-cta {
  margin-left: var(--spacing-4);
}

.nav-cta .btn {
  padding: 11px 20px;
}

/* Contact item shown inside the mobile slide-in menu only (the bar CTA is
   hidden at that breakpoint so the hamburger sits in the top-right). */
.nav-item-cta-mobile {
  display: none;
}

/* ========================================
   DROPDOWN MENUS
   ======================================== */

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-2) 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  z-index: var(--z-dropdown);
}

.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
}

.nav-dropdown-item {
  display: block;
  padding: var(--spacing-3) var(--spacing-4);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.nav-dropdown-item:hover {
  background-color: var(--color-bg-alt);
  text-decoration: none;
}

/* ========================================
   MEGA MENU (Solutions / Sectors)
   ======================================== */

.nav-item-has-children {
  position: static;
}

.nav-mega {
  display: flex;
  gap: 0;
  width: min(1180px, calc(100vw - 48px));
  min-width: 0;
  padding: 0;
  text-align: left;
  border: none;
  overflow: hidden; /* clip the square dark panel to the rounded white box */
}

.nav-mega-intro {
  flex: 0 0 46%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 360px;
  background-color: var(--color-primary);
  background-image: url("/images/icons/mega/mega-menu-grid.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  color: var(--color-white);
  border-radius: 0;
  padding: var(--spacing-8);
}

.nav-mega-intro-bottom {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
}

.nav-mega-label {
  display: block;
  font-size: var(--font-size-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 60%);
  margin-bottom: var(--spacing-3);
}

.nav-mega-heading {
  font-family: var(--font-primary);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--color-white);
  margin: 0;
}

.nav-mega-desc {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: rgb(255 255 255 / 75%);
  margin: 0;
}

.nav-mega-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-6) var(--spacing-8);
}

.nav-mega-item {
  display: flex;
  gap: var(--spacing-4);
  align-items: flex-start;
  padding: var(--spacing-3) var(--spacing-4);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  transition: background-color var(--transition-fast);
}

.nav-mega-item:hover,
.nav-mega-item.active {
  background-color: var(--color-bg-alt);
  text-decoration: none;
}

.nav-mega-icon {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.nav-mega-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-mega-item-name {
  font-family: var(--font-brand);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.nav-mega-item-desc {
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--color-text-light);
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */

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

.nav-toggle-bar {
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Mobile menu open state */
.nav-toggle.active .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (width <= 1023px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--color-white);
    padding: var(--spacing-4);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
    z-index: var(--z-fixed);
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  .nav-item {
    border-bottom: 1px solid var(--color-border);
  }

  .nav-link {
    padding: var(--spacing-4) 0;
    justify-content: space-between;
  }

  .nav-dropdown {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 var(--spacing-4) var(--spacing-4);
    opacity: 1;
    visibility: visible;
    display: none;
  }

  .nav-item.active .nav-dropdown {
    display: block;
  }

  /* Mega menu collapses to a simple stacked list inside the mobile menu. */
  .nav-mega {
    flex-direction: column;
    width: auto;
    padding: 0;
    gap: var(--spacing-2);
  }

  .nav-mega-intro {
    display: none;
  }

  .nav-mega-item {
    padding: var(--spacing-3) 0;
  }

  .nav-mega-icon {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  /* Hide the bar CTA at mobile so the header is just logo + hamburger,
     pinning the toggle to the top-right. */
  .nav-cta {
    display: none;
  }

  /* Surface Contact inside the slide-in menu instead. */
  .nav-item-cta-mobile {
    display: block;
  }
}

/* ========================================
   FOOTER NAVIGATION
   ======================================== */

.footer {
  padding-top: var(--spacing-16);
  padding-bottom: 0;
}

.footer-top {
  padding-bottom: var(--spacing-10);
  border-bottom: 1px solid rgb(255 255 255 / 10%);
}

.footer-newsletter {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-8);
  flex-wrap: wrap;
}

.footer-newsletter-content {
  max-width: 500px;
}

.footer-newsletter-title {
  font-family: var(--font-primary);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  color: var(--color-white);
  margin-bottom: var(--spacing-2);
}

.footer-newsletter-text {
  font-size: var(--font-size-sm);
  color: rgb(255 255 255 / 86%);
}

.footer-newsletter-form {
  display: flex;
  gap: var(--spacing-3);
  min-width: 460px;
}

.footer-newsletter-form .form-input {
  flex: 1;
  padding: 10px 16px;
  background-color: transparent;
  border-color: rgb(255 255 255 / 30%);
  color: var(--color-white);
}

.footer-newsletter-form .btn {
  padding: 10px 24px;
}

.footer-newsletter-form .form-input::placeholder {
  color: rgb(255 255 255 / 50%);
}

@media (width <= 767px) {
  .footer-newsletter-form {
    min-width: 100%;
    flex-direction: column;
  }
}

/* Footer main content — brand on the left, then 3 spread link columns. */
.footer-main {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr 1fr;
  gap: var(--spacing-16);
  padding: var(--spacing-10) 0;
}

@media (width <= 1023px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-10);
  }
}

@media (width <= 767px) {
  .footer-main {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  margin-bottom: var(--spacing-4);
}

.footer-logo img {
  height: 37px;
  width: auto;
  filter: brightness(0) invert(1);
}

.footer-brand-text {
  font-size: var(--font-size-sm);
  color: rgb(255 255 255 / 82%);
  line-height: var(--line-height-relaxed);
}

/* Footer nav columns */
.footer-nav-title {
  font-family: var(--font-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-white);
  margin-bottom: var(--spacing-4);
}

.footer-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav-list li {
  margin-bottom: var(--spacing-3);
}

.footer-nav-link {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-white);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-nav-link:hover {
  color: var(--color-white);
  text-decoration: none;
}

/* Footer bottom */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-6) 0;
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.footer-copyright {
  font-size: var(--font-size-sm);
  color: rgb(255 255 255 / 86%);
}

.footer-address {
  font-size: var(--font-size-sm);
  color: rgb(255 255 255 / 86%);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-address:hover {
  color: var(--color-white);
}

.footer-social {
  display: flex;
  gap: var(--spacing-6);
}

.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: rgb(255 255 255 / 70%);
  transition: color var(--transition-fast);
}

.footer-social-link:hover {
  color: var(--color-white);
}

.footer-social-link svg {
  width: 20px;
  height: 20px;
  fill: currentcolor;
}

@media (width <= 767px) {
  .footer-bottom {
    flex-direction: column;
    gap: var(--spacing-4);
    text-align: center;
  }

  .footer-address {
    margin-right: 0;
    padding-left: 0;
  }
}
