/* ==========================================================================
   InterSoft Associates — header + mega menu restyle for Divi
   Matches the design in intersoft_new_header.html (.isa-hdr)

   Targets Divi's STANDARD header:
     #main-header  /  #top-menu  /  #mobile_menu
   Pair with intersoft-header.js, which adds the .isa-* hooks and the
   "Our Services / View all services" row inside the mega panel.

   Load the webfont from Divi > Theme Options > Integration > <head>:
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;500;900&display=swap">
   ========================================================================== */

:root {
  --isa-teal: #00b5af;
  --isa-teal-600: #009a95;
  --isa-ink: #0b1a1f;
  --isa-slate: #5c6f77;
  --isa-line: #e4eaec;
  --isa-paper-2: #f5f8f9;
  --isa-orange: #e4572e;
  --isa-orange-600: #c8461f;
  --isa-shadow: 0 18px 48px -24px rgba(11, 26, 31, .35);
  --isa-maxw: 1220px;
  --isa-navh: 74px;

  /* Panel density — every spacing value below reads from these, so tighten
     or loosen the menus by editing here rather than hunting through rules. */
  --isa-panel-pad: 8px;              /* inner padding, narrow dropdown */
  --isa-mega-pad: 16px 18px;         /* inner padding, mega panel */
  --isa-mega-gap: 0 14px;            /* row gap / column gap between groups */
  --isa-group-pad: 7px 9px;          /* padding around one service group */
  --isa-link-pad: 7px 10px;          /* padding on a dropdown link */
  --isa-sub-gap: 3px;                /* space above a nested sub-link */

  /* The open/close delay now lives in intersoft-header.js (CLOSE_DELAY),
     not here — see section 6. */
}


/* --------------------------------------------------------------------------
   1. Kill the pieces the new design doesn't have
   -------------------------------------------------------------------------- */

#top-header,
#et-secondary-menu,
#et-secondary-nav {
  display: none !important;
}

#et_top_search,
#et-top-navigation .et-cart-info {
  display: none !important;
}

/* Divi shifts the header down when the secondary bar exists */
body.et_secondary_nav_enabled #main-header {
  top: 0 !important;
}


/* --------------------------------------------------------------------------
   2. The bar itself — 74px glass, hairline bottom border
   -------------------------------------------------------------------------- */

#main-header,
#main-header.et-fixed-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--isa-navh);
  padding: 0 !important;
  background: rgba(255, 255, 255, .94) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--isa-line);
  box-shadow: none !important;
  font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  color: var(--isa-ink);
  transition: none !important;
}

/* Divi pushes the page down with an inline padding-top; replace it with a
   fixed 74px offset so the bar never overlaps content */
#page-container {
  padding-top: 0 !important;
  margin-top: var(--isa-navh) !important;
}

#main-header .container.et_menu_container {
  position: relative;      /* containing block for the full-width mega panel */
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100% !important;
  max-width: var(--isa-maxw) !important;
  height: var(--isa-navh);
  padding: 0 20px !important;
}

#main-header .container.et_menu_container:before,
#main-header .container.et_menu_container:after {
  display: none !important;
}


/* --------------------------------------------------------------------------
   3. Logo — 44px, same height when the header is "fixed"
   -------------------------------------------------------------------------- */

#main-header .logo_container {
  position: static !important;
  flex: 0 0 auto;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}

#main-header .logo_helper {
  display: none !important;
}

#main-header #logo,
#main-header.et-fixed-header #logo {
  max-height: none !important;
  height: 44px !important;
  width: auto !important;
  margin: 0 !important;
  display: block;
  transition: none !important;
}


/* --------------------------------------------------------------------------
   4. Top-level links
   -------------------------------------------------------------------------- */

#et-top-navigation {
  float: none !important;
  position: static !important;
  display: flex;
  align-items: center;
  padding: 0 !important;
  margin: 0 !important;
}

#top-menu-nav {
  float: none !important;
  position: static !important;
}

#top-menu,
#top-menu.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* height: the full bar, not just the text. This makes each trigger's hover
   area reach the bottom edge of the header, so `top: 100%` lands in the same
   place for an .isa-dd panel (measured from its own li) and for the
   .isa-mega-parent panel (measured from the container, since that li has to
   be position: static to span the full width). Without it the mega panel
   sits ~25px below its trigger and the pointer crosses dead space. */
#top-menu > li {
  position: static;        /* lets the mega panel span the whole container */
  display: flex;
  align-items: center;
  height: var(--isa-navh);
  padding: 0 !important;
  margin: 0 !important;
}

/* !important is needed here: Divi's Customizer emits `#top-menu li a` at the
   same specificity but later in the head, which is where the 19px came from */
#top-menu > li > a,
#main-header.et-fixed-header #top-menu > li > a {
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 14px !important;
  font-weight: 400;
  line-height: 1.2;
  color: var(--isa-ink) !important;
  opacity: 1 !important;
  padding: 0 !important;
  text-decoration: none;
  transition: color .2s ease;
}

#top-menu > li > a:hover,
#top-menu > li.isa-open > a {
  color: var(--isa-teal-600) !important;
  opacity: 1 !important;
}

/* Divi's current-page underline / colour treatment */
#top-menu > li.current-menu-item > a,
#top-menu > li.current_page_item > a,
#top-menu > li.current-menu-ancestor > a {
  color: var(--isa-ink) !important;
}

#top-menu > li > a:before {
  display: none !important;
}


/* --------------------------------------------------------------------------
   5. No carets anywhere — Divi inserts an ETmodules glyph via :after on every
   parent item (character '3' at top level, '5' on nested ones)
   -------------------------------------------------------------------------- */

#top-menu li.menu-item-has-children > a:after,
#top-menu li.menu-item-has-children > a:before,
#main-header .et_mobile_menu li.menu-item-has-children > a:after {
  content: none !important;
  display: none !important;
}

#top-menu > li.menu-item-has-children > a {
  position: relative;
  padding-right: 0 !important;
}


/* --------------------------------------------------------------------------
   6. Shared panel chrome (dropdown + mega)
   -------------------------------------------------------------------------- */

#top-menu > li > ul.sub-menu {
  position: absolute;
  top: 100%;
  left: auto;
  margin-top: 12px;
  width: auto !important;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--isa-line);
  border-top: 1px solid var(--isa-line) !important;
  border-radius: 14px;
  box-shadow: var(--isa-shadow);
  padding: var(--isa-panel-pad);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;    /* a fading-out panel must not capture the pointer */
  transform: translateY(8px);
  transition:
    opacity .22s ease,
    transform .22s ease,
    visibility 0s linear .22s;
  z-index: 70;
  text-align: left;
}

/* invisible bridge across the 12px gap so the pointer can travel down */
#top-menu > li > ul.sub-menu:before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 22px;
}

/* Open state is driven ONLY by .isa-open, set by intersoft-header.js.
   Deliberately no :hover and no Divi .et-hover here — two independent
   sources of truth for "is this open" is what caused panels to appear
   under the pointer and to stay open over each other. :focus-within is
   kept so keyboard tabbing still reveals the panel. */
#top-menu > li.isa-open > ul.sub-menu,
#top-menu > li:focus-within > ul.sub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition:
    opacity .22s ease,
    transform .22s ease,
    visibility 0s linear 0s;
}

/* reset Divi's fixed widths / paddings on panel items */
#top-menu li li {
  position: static;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}

#top-menu li li > a {
  display: block;
  width: auto !important;
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--isa-ink) !important;
  padding: var(--isa-link-pad) !important;
  border-radius: 9px;
  opacity: 1 !important;
  transition: color .18s ease, background-color .18s ease;
}

#top-menu li li > a:hover {
  color: var(--isa-teal-600) !important;
  background: var(--isa-paper-2);
  opacity: 1 !important;
}

/* third level lives in the same panel, never flies out */
#top-menu li li > ul.sub-menu {
  position: static !important;
  top: auto !important;
  left: auto !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  transition: none !important;
  width: auto !important;
  min-width: 0 !important;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#top-menu li li > ul.sub-menu:before {
  display: none !important;
}


/* --------------------------------------------------------------------------
   7. Simple dropdown (Expertise) — .isa-dd is added by the JS
   -------------------------------------------------------------------------- */

#top-menu > li.isa-dd {
  position: relative;      /* this one anchors to its own trigger */
}

#top-menu > li.isa-dd > ul.sub-menu {
  left: 0;
}

/* indented sub-items */
#top-menu > li.isa-dd li li > a {
  font-size: 13px;
  color: var(--isa-slate) !important;
  padding: 4px 10px 4px 20px !important;
}

#top-menu > li.isa-dd li li > a:hover {
  color: var(--isa-teal-600) !important;
  background: var(--isa-paper-2);
}


/* --------------------------------------------------------------------------
   8. Mega menu (Services) — .isa-mega-parent is added by the JS
   -------------------------------------------------------------------------- */

#top-menu > li.isa-mega-parent > ul.sub-menu {
  left: 0;
  right: 0;
  min-width: 0;
  padding: var(--isa-mega-pad);
  border-radius: 16px;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--isa-mega-gap);
  /* start, not the default stretch: without this every cell in a row grows
     to match the tallest one, so a service with no sub-links inherits the
     height of a neighbour that has four. This was most of the empty space. */
  align-items: start;
}

/* 4 columns once there's room — the live menu has more items than the mock.
   Delete this block to keep 3 columns at every width. */
@media (min-width: 1100px) {
  #top-menu > li.isa-mega-parent > ul.sub-menu {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* the "OUR SERVICES / View all services" row */
#top-menu li.isa-mega-head {
  grid-column: 1 / -1;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--isa-slate);
  margin-bottom: 10px !important;
  padding: 0 0 9px !important;
  border-bottom: 1px solid var(--isa-line);
}

#top-menu li.isa-mega-head > a {
  display: inline-block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--isa-teal-600) !important;
  background: none !important;
  padding: 0 !important;
  border-radius: 0;
  white-space: nowrap;
}

#top-menu li.isa-mega-head > a:hover {
  color: var(--isa-teal) !important;
  background: none !important;
}

/* each service = one card-ish group */
#top-menu > li.isa-mega-parent > ul.sub-menu > li {
  padding: var(--isa-group-pad) !important;
  border-radius: 9px;
  transition: background-color .18s ease;
}

#top-menu > li.isa-mega-parent > ul.sub-menu > li:not(.isa-mega-head):hover {
  background: var(--isa-paper-2);
}

#top-menu > li.isa-mega-parent > ul.sub-menu > li > a {
  font-size: 14.5px;
  font-weight: 400;
  color: var(--isa-ink) !important;
  padding: 0 !important;
  background: none !important;
  border-radius: 0;
}

#top-menu > li.isa-mega-parent > ul.sub-menu > li > a:hover {
  color: var(--isa-teal-600) !important;
  background: none !important;
}

/* the smaller links stacked under a service */
#top-menu > li.isa-mega-parent ul.sub-menu ul.sub-menu > li > a {
  font-size: 13px;
  color: var(--isa-slate) !important;
  margin-top: var(--isa-sub-gap);
  padding: 0 !important;
  background: none !important;
  border-radius: 0;
}

#top-menu > li.isa-mega-parent ul.sub-menu ul.sub-menu > li > a:hover {
  color: var(--isa-teal-600) !important;
  background: none !important;
}


/* --------------------------------------------------------------------------
   9. The orange CTA — .isa-cta is added by the JS (href contains #lets-talk)
   -------------------------------------------------------------------------- */

#top-menu > li.isa-cta > a,
#main-header.et-fixed-header #top-menu > li.isa-cta > a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: #fff !important;
  background: var(--isa-orange);
  padding: 15px 26px !important;
  border-radius: .65em;
  transition: background-color .25s ease, transform .25s ease;
}

#top-menu > li.isa-cta > a:hover {
  color: #fff !important;
  background: var(--isa-orange-600);
  transform: translateY(-2px);
}

#top-menu > li.isa-cta > a:after {
  display: none !important;
}


/* --------------------------------------------------------------------------
   10. Keyboard focus
   -------------------------------------------------------------------------- */

#main-header a:focus-visible,
#main-header .mobile_menu_bar:focus-visible {
  outline: 2px solid var(--isa-teal-600);
  outline-offset: 3px;
  border-radius: 4px;
}


/* --------------------------------------------------------------------------
   11. Mobile / tablet — hamburger below 980px

   The hide below is required, not redundant: section 4 sets
   `#top-menu { display: flex }` with no media query, and since this file
   loads after Divi's, it beats Divi's own `#top-menu { display: none }`.
   Without this, the links stay visible next to the hamburger.

   To move the breakpoint, change 980px in this one media query.
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {

  #main-header #top-menu-nav,
  #main-header #top-menu {
    display: none !important;
  }

  #main-header #et_mobile_nav_menu {
    display: flex !important;
    align-items: center;
  }

  #main-header .container.et_menu_container {
    height: var(--isa-navh);
  }

  #et_mobile_nav_menu {
    float: none;
    margin: 0;
    display: flex;
    align-items: center;
  }

  #et_mobile_nav_menu .mobile_nav {
    background: none !important;
    padding: 0 !important;
  }

  #et_mobile_nav_menu .select_page {
    display: none !important;
  }

  #et_mobile_nav_menu .mobile_menu_bar {
    padding: 0 !important;
    display: block;
    line-height: 1;
  }

  #et_mobile_nav_menu .mobile_menu_bar:before {
    position: relative;
    top: 0;
    left: 0;
    margin: 0;
    font-size: 26px;
    color: var(--isa-ink) !important;
  }

  /* the panel */
  #main-header #mobile_menu,
  #main-header .et_mobile_menu {
    position: fixed;
    top: var(--isa-navh);
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100vh - var(--isa-navh));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff !important;
    border: 0 !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--isa-line) !important;
    box-shadow: none !important;
    padding: 20px !important;
    margin: 0;
  }

  #main-header .et_mobile_menu li {
    padding: 0 !important;
    margin: 0 !important;
  }

  #main-header .et_mobile_menu li > a {
    font-family: 'Public Sans', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: var(--isa-ink) !important;
    padding: 12px 2px !important;
    border: 0 !important;
    border-radius: 9px;
  }

  #main-header .et_mobile_menu li > a:hover {
    background: var(--isa-paper-2);
    color: var(--isa-teal-600) !important;
    opacity: 1 !important;
  }

  /* nested levels: always open, tinted card, like the mock */
  #main-header .et_mobile_menu ul.sub-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 8px !important;
    margin: 8px 0 12px !important;
    background: var(--isa-paper-2);
    border: 1px solid var(--isa-line);
    border-radius: 12px;
  }

  #main-header .et_mobile_menu ul.sub-menu ul.sub-menu {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0 0 0 12px !important;
    margin: 2px 0 6px !important;
  }

  #main-header .et_mobile_menu li li > a {
    font-size: 14px;
    padding: 9px 10px !important;
  }

  #main-header .et_mobile_menu li li li > a {
    font-size: 13px;
    color: var(--isa-slate) !important;
  }

  /* Divi's expand toggles — the mock shows everything open */
  #main-header .et_mobile_menu .menu-item-has-children > a:after,
  #main-header .et_mobile_menu span.menu-closed:before {
    display: none !important;
  }

  /* CTA stays a button */
  #main-header .et_mobile_menu li.isa-cta > a {
    display: block;
    text-align: center;
    color: #fff !important;
    background: var(--isa-orange);
    font-size: 16px;
    font-weight: 500;
    padding: 15px 26px !important;
    border-radius: .65em;
    margin-top: 8px !important;
  }

  #main-header .et_mobile_menu li.isa-cta > a:hover {
    background: var(--isa-orange-600);
    color: #fff !important;
  }

  /* the mega-menu header row is desktop-only */
  #main-header .et_mobile_menu li.isa-mega-head {
    display: none !important;
  }
}

@media (max-width: 480px) {
  #main-header #logo,
  #main-header.et-fixed-header #logo {
    height: 38px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #main-header *,
  #main-header *:before,
  #main-header *:after {
    transition-duration: .01ms !important;
  }
  #top-menu > li.isa-cta > a:hover {
    transform: none;
  }
}
