/* =========================================================
   Spiral Networks, Inc. — Mobile / Responsive Fixes
   Shared across all pages. Loaded after each page's <style>.
   ========================================================= */

/* ---- 1. Global overflow guard ----
   Stops the rogue blue bar to the right of the page on mobile. */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
*, *::before, *::after {
  box-sizing: border-box;
}
img, video {
  max-width: 100%;
  height: auto;
}

/* ---- 2. Hamburger button (hidden on desktop) ---- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  margin-left: auto;
  cursor: pointer;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- 3. Footer: flexible grid that wraps cleanly ----
   Replaces the static 5-column grid so columns reflow
   instead of forcing horizontal overflow. */
footer .footer-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  align-items: start;
}
.footer-col {
  min-width: 0; /* allow children to wrap */
}
.footer-col a,
.footer-col li {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.footer-col.footer-logo {
  margin-left: 0 !important;
}

/* =========================================================
   MOBILE BREAKPOINT — collapse desktop nav, show hamburger
   ========================================================= */
@media (max-width: 900px) {

  /* Header layout adjustments */
  header .container {
    padding: 0.5rem 0;
  }
  .navbar {
    flex-wrap: wrap;
    padding: 0.5rem 0;
    position: relative;
  }
  .logo-wrapper {
    margin-right: 0;
  }
  .logo-img {
    height: 42px;
  }

  /* Show hamburger */
  .nav-toggle {
    display: flex;
  }

  /* Convert nav-menu into a stacked drop-down panel */
  .nav-menu {
    display: none;            /* hidden until toggled */
    flex-direction: column;
    width: 100%;
    margin: 0;                /* override desktop margin-left:12rem */
    padding: 0.5rem 0 0.75rem;
    gap: 0;
    background: #003049;
    order: 3;                 /* push below logo + toggle */
    flex-basis: 100%;
    align-items: stretch;
  }
  .nav-menu.is-open {
    display: flex;
  }
  .nav-menu > li {
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .nav-menu > li:first-child {
    border-top: 0;
  }
  .nav-menu li a {
    display: block;
    width: 100%;
    padding: 0.85rem 0.25rem;
    text-align: left;
  }

  /* Services dropdown becomes inline expandable on mobile */
  .services-dropdown {
    position: static;
  }
  .services-dropdown:hover .services-submenu {
    display: none; /* disable hover-open on mobile (touch) */
  }
  .services-dropdown.is-open .services-submenu {
    display: block;
  }
  .services-submenu {
    position: static;
    box-shadow: none;
    background: rgba(0,0,0,0.18);
    padding: 0.25rem 0 0.5rem 0.75rem;
    margin-top: 0.25rem;
    border-radius: 4px;
    min-width: 0;
    width: 100%;
  }
  .services-submenu li a {
    background: transparent;
    padding: 0.6rem 0.5rem;
    white-space: normal;        /* allow long titles to wrap */
    border-radius: 4px;
  }
  .services-submenu li a:hover {
    background: rgba(255,255,255,0.08);
  }

  /* Caret indicator on the Services parent link */
  .services-dropdown > a::after {
    content: "▾";
    margin-left: 0.5rem;
    font-size: 0.85em;
    opacity: 0.85;
    display: inline-block;
    transition: transform 0.2s ease;
  }
  .services-dropdown.is-open > a::after {
    transform: rotate(180deg);
  }

  /* Container padding so content isn't flush to edges */
  .container {
    width: 92%;
  }

  /* Footer on small screens — denser */
  footer {
    padding: 1.75rem 1rem;
  }
  footer .footer-top {
    gap: 1.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .footer-links {
    margin-left: 0 !important;
    position: static !important;
  }
  .footer-links a {
    margin-left: 0;
    margin-right: 1.25rem;
  }
}

/* Very small screens — single column footer */
@media (max-width: 480px) {
  footer .footer-top {
    grid-template-columns: 1fr;
  }
  .nav-menu li a {
    font-size: 0.95rem;
  }
}
