/* Centurysoft V24.25 – one mobile navigation for Home and every inner page.
   Loaded last to supersede legacy Home, Service and inner-page mobile overrides.
   Desktop Mega Menu rules are intentionally untouched. */
@media (max-width: 980px) {
  html body .topbar,
  html body.cs-inner-home-menu .topbar { display: none !important; }

  html body .site-header,
  html body.cs-dm-mockup .site-header {
    position: sticky !important;
    top: var(--wp-admin--admin-bar--height, 0px) !important;
    z-index: 1200 !important;
    height: 64px !important;
    min-height: 64px !important;
    background: #fff !important;
  }
  html body .navrow,
  html body.cs-inner-home-menu .navrow,
  html body.cs-dm-mockup .navrow,
  html body.cs-dm-mockup.cs-dm-analytics-update .navrow {
    height: 64px !important;
    min-height: 64px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    position: relative !important;
  }
  html body .brand { flex: 0 1 auto; min-width: 0; }
  html body .brand img,
  html body .custom-logo { max-width: 55vw !important; height: auto !important; }
  html body .header-cta { display: none !important; }

  html body .mobile-toggle,
  html body.cs-dm-mockup .mobile-toggle {
    display: grid !important;
    place-items: center !important;
    order: 3 !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    margin: 0 0 0 auto !important;
    padding: 10px !important;
    color: #123451 !important;
    background: transparent !important;
    border: 0 !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 1202 !important;
    -webkit-tap-highlight-color: transparent;
  }
  html body .mobile-toggle-lines {
    width: 23px !important;
    height: 18px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  html body .mobile-toggle-lines i {
    display: block !important;
    width: 23px !important;
    height: 2px !important;
    margin: 0 !important;
    border-radius: 2px !important;
    background: currentColor !important;
    transition: transform .18s ease, opacity .18s ease;
  }
  html body .mobile-toggle[aria-expanded="true"] .mobile-toggle-lines i:nth-child(1) {
    transform: translateY(8px) rotate(45deg) !important;
  }
  html body .mobile-toggle[aria-expanded="true"] .mobile-toggle-lines i:nth-child(2) {
    opacity: 0 !important;
  }
  html body .mobile-toggle[aria-expanded="true"] .mobile-toggle-lines i:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg) !important;
  }

  /* Fixed drawer below the actual sticky-header bottom, including after scroll. */
  html body .mega-nav,
  html body.cs-inner-home-menu .mega-nav,
  html body.cs-dm-mockup .mega-nav,
  html body.cs-dm-mockup.cs-dm-analytics-update .mega-nav {
    display: none !important;
    position: fixed !important;
    top: var(--cs-mobile-nav-top, 64px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100dvh - var(--cs-mobile-nav-top, 64px)) !important;
    max-height: calc(100dvh - var(--cs-mobile-nav-top, 64px)) !important;
    margin: 0 !important;
    padding: 8px max(18px, 4vw) max(24px, env(safe-area-inset-bottom)) !important;
    background: #fff !important;
    border-top: 1px solid #e3edf3 !important;
    box-shadow: 0 12px 30px rgba(6,29,56,.16) !important;
    border-radius: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 1199 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 0 !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }
  html body .mega-nav.open,
  html body.cs-inner-home-menu .mega-nav.open,
  html body.cs-dm-mockup .mega-nav.open,
  html body.cs-dm-mockup.cs-dm-analytics-update .mega-nav.open {
    display: flex !important;
  }
  html body.cs-mobile-menu-open { overflow: hidden !important; }

  html body .mega-nav > li,
  html body.cs-inner-home-menu .mega-nav > li,
  html body.cs-dm-mockup .mega-nav > li {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #edf2f5 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html body .mega-nav > li > a.top-link,
  html body.cs-inner-home-menu .mega-nav > li > a.top-link,
  html body.cs-dm-mockup .mega-nav > li > a.top-link,
  html body.cs-dm-mockup.cs-dm-analytics-update .mega-nav > li > a.top-link,
  html body .mega-nav > a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-height: 50px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 12px 0 !important;
    color: #123451 !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }
  html body .mega-nav > li.menu-item-has-children > a.top-link { width: calc(100% - 48px) !important; }
  html body .mega-nav .menu-chevron,
  html body .mega-nav li.menu-item-has-children > a::after { display: none !important; }
  html body .mega-nav a { -webkit-tap-highlight-color: transparent; }

  /* Independently tappable arrows at both category and nested Service levels. */
  html body .mega-nav .submenu-toggle,
  html body.cs-dm-mockup .mega-nav .submenu-toggle {
    position: absolute !important;
    top: 4px !important;
    right: 0 !important;
    display: grid !important;
    place-items: center !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #079fcb !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    z-index: 3 !important;
    transform: none !important;
  }
  html body .mega-nav .submenu-toggle span,
  html body.cs-dm-mockup .mega-nav .submenu-toggle span {
    display: block !important;
    width: 9px !important;
    height: 9px !important;
    border: 0 !important;
    border-right: 2px solid currentColor !important;
    border-bottom: 2px solid currentColor !important;
    transform: rotate(45deg) translate(-2px,-2px) !important;
    transition: transform .18s ease !important;
  }
  html body .mega-nav li.mobile-expanded > .submenu-toggle,
  html body .mega-nav .submenu-toggle[aria-expanded="true"] { transform: none !important; }
  html body .mega-nav li.mobile-expanded > .submenu-toggle span,
  html body.cs-dm-mockup .mega-nav li.mobile-expanded > .submenu-toggle span,
  html body .mega-nav .submenu-toggle[aria-expanded="true"] span {
    transform: rotate(225deg) translate(-1px,-1px) !important;
  }

  /* Do not let old desktop hover/focus rules open panels on a touchscreen. */
  html body .mega-nav li > ul.sub-menu,
  html body.cs-dm-mockup .mega-nav li > ul.sub-menu,
  html body .mega-nav li:hover > ul.sub-menu,
  html body .mega-nav li:focus-within > ul.sub-menu,
  html body .mega-nav li.mega-open > ul.sub-menu {
    display: none !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 5px 0 10px 14px !important;
    border: 0 !important;
    border-top: 1px solid #edf4f7 !important;
    border-radius: 0 !important;
    background: #fbfdfe !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  html body .mega-nav li.mobile-expanded > ul.sub-menu,
  html body.cs-dm-mockup .mega-nav li.mobile-expanded > ul.sub-menu,
  html body .mega-nav li.mobile-expanded:hover > ul.sub-menu,
  html body .mega-nav li.mobile-expanded:focus-within > ul.sub-menu {
    display: block !important;
  }
  html body .mega-nav ul.sub-menu > li {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  html body .mega-nav ul.sub-menu a.mega-link,
  html body.cs-dm-mockup .mega-nav ul.sub-menu a.mega-link {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 44px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 9px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #123451 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    transform: none !important;
  }
  html body .mega-nav ul.sub-menu li.menu-item-has-children > a.mega-link { width: calc(100% - 44px) !important; }
  html body .mega-nav ul.sub-menu .menu-description,
  html body.cs-dm-mockup .mega-nav ul.sub-menu .menu-description { display: none !important; }
  html body .mega-nav ul.sub-menu ul.sub-menu { padding: 2px 0 8px 13px !important; background: #fff !important; }
  html body .mega-nav ul.sub-menu .submenu-toggle { top: 1px !important; width: 40px !important; height: 42px !important; }
  html body .mega-nav ul.sub-menu::before,
  html body .mega-nav ul.sub-menu::after { display: none !important; content: none !important; }
  html body .mega-nav a:focus-visible,
  html body .submenu-toggle:focus-visible,
  html body .mobile-toggle:focus-visible { outline: 2px solid #079fcb !important; outline-offset: 2px; }
}

@media (max-width: 600px) {
  html body .site-header,
  html body.cs-dm-mockup .site-header { height: 60px !important; min-height: 60px !important; }
  html body .navrow,
  html body.cs-inner-home-menu .navrow,
  html body.cs-dm-mockup .navrow,
  html body.cs-dm-mockup.cs-dm-analytics-update .navrow {
    height: 60px !important;
    min-height: 60px !important;
    width: 92% !important;
  }
  html body .brand img,
  html body .custom-logo { width: 190px !important; max-width: 56vw !important; }
  html body .mobile-toggle { flex-basis: 42px !important; width: 42px !important; height: 42px !important; }
}

/* No mobile drawer on desktop, even if the viewport changes while open. */
@media (min-width: 981px) {
  html body .mobile-toggle { display: none !important; }
  html body.cs-mobile-menu-open { overflow: auto !important; }
}
