/* ============================================================
   Unified mobile nav (<=768px)
   Drops in over every page's inline header styles. The mobile menu
   is a single full-width panel that slides down below the header.
   Each Solutions/Industries dropdown becomes a tap-to-expand
   accordion section instead of an absolute-positioned floating box.
   ============================================================ */

@media (max-width: 768px) {
  /* Hide desktop nav by default; show only when toggle is open. */
  .nav { display: none !important; }
  .nav.open {
    display: flex !important;
    flex-direction: column;
    /* The .header has backdrop-filter, which makes it the containing
       block for fixed descendants. Use absolute + top:100% so the panel
       sits directly under the header bar at the full viewport width. */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 72px - var(--promo-banner-h, 0px));
    background: rgba(0,26,38,0.985);
    padding: 12px 16px 32px;
    gap: 4px;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 16px 40px rgba(0,0,0,0.45);
    z-index: 1001;
  }
  .nav-toggle { display: block !important; }

  /* Each top-level nav item gets full row. */
  .nav.open .nav-item,
  .nav.open .nav-link {
    width: 100%;
    margin: 0;
  }

  .nav.open .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    background: transparent;
    border: 1px solid transparent;
  }
  .nav.open .nav-link:hover,
  .nav.open .nav-link.active {
    background: rgba(255,255,255,0.04);
    color: white;
  }

  /* Dropdown trigger row — chevron rotates when expanded. */
  .nav.open .dropdown-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    width: 100%;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.2s ease;
  }
  .nav.open .dropdown-trigger:hover { background: rgba(255,255,255,0.04); color: white; }
  .nav.open .dropdown-trigger svg {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
  }
  .nav.open .nav-item.expanded .dropdown-trigger {
    background: rgba(255,255,255,0.06);
    color: white;
  }
  .nav.open .nav-item.expanded .dropdown-trigger svg {
    transform: rotate(180deg);
  }
  /* Disable desktop hover-to-open on mobile so it doesn't fight the click toggle. */
  .nav.open .nav-item:hover .dropdown { opacity: 0; visibility: hidden; }

  /* Dropdown panel becomes inline accordion, hidden by default. */
  .nav.open .dropdown {
    position: static !important;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    padding: 0 6px;
    min-width: 0;
    width: 100%;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
  }
  .nav.open .dropdown::before { display: none !important; }
  .nav.open .nav-item.expanded .dropdown {
    opacity: 1;
    visibility: visible;
    max-height: 600px;
    padding: 6px;
  }

  /* Dropdown items — dark theme inside the mobile panel. */
  .nav.open .dropdown-item {
    color: rgba(255,255,255,0.78);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    background: transparent;
    gap: 12px;
  }
  .nav.open .dropdown-item:hover {
    background: rgba(0,157,199,0.14);
    color: white;
  }
  .nav.open .dropdown-icon {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
  }
  .nav.open .dropdown-icon img { filter: brightness(0) invert(1); opacity: 0.85; }

  /* CTA button at the bottom of the panel. */
  .nav.open .nav-cta {
    margin: 16px 0 0;
    padding: 14px 22px;
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Nav toggle: animate to "X" when open. */
  .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); }

  /* Lock body scroll when menu is open. */
  body.nav-open { overflow: hidden; }
}
