/* Interface Marine: header mobile menu animations (tablet and phone menu only). */

/* Hamburger: three bars that turn into an X */
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon {
  position: relative; width: 26px; height: 18px; padding: 0; border: 0;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
  transition: background-size 0.25s ease, color 0.25s ease;
}
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon svg { display: none; }
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon::before,
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon::after {
  content: ""; position: absolute; left: 0; width: 100%; height: 2px; background: currentColor;
  transition: transform 0.3s ease, top 0.3s ease;
}
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon::before { top: 0; }
#masthead .hfe-nav-menu__toggle .hfe-nav-menu-icon::after { top: 16px; }
#masthead .hfe-active-menu .hfe-nav-menu-icon { background-size: 0 2px; }
#masthead .hfe-active-menu .hfe-nav-menu-icon::before { top: 8px; transform: rotate(45deg); }
#masthead .hfe-active-menu .hfe-nav-menu-icon::after { top: 8px; transform: rotate(-45deg); }

/* Menu panel (phone) and dropdowns (desktop): reveal top-to-bottom when opened, the same wipe in reverse when closed.
   They don't fade, because a blurred glass panel loses its blur while its opacity is animating. */
#masthead nav.hfe-dropdown {
  opacity: 1 !important;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.35s ease, visibility 0s linear 0.35s !important;
}
#masthead nav.hfe-dropdown.menu-is-active {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.35s ease, visibility 0s linear 0s !important;
}
#masthead nav:not(.hfe-dropdown) .sub-menu {
  opacity: 1 !important;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.3s ease, visibility 0s linear 0.3s !important;
}
#masthead nav:not(.hfe-dropdown) .menu-item-has-children:hover > .sub-menu,
#masthead nav:not(.hfe-dropdown) .menu-item-has-children.focus > .sub-menu,
#masthead nav:not(.hfe-dropdown) .menu-item-has-children:focus-within > .sub-menu {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.3s ease, visibility 0s linear 0s !important;
}

/* Services and Media: expand smoothly, lighter blue background for the sub-pages */
#masthead nav.hfe-dropdown .sub-menu {
  max-height: 0; overflow: hidden;
  height: auto !important; opacity: 1 !important; visibility: hidden !important;
  transition: max-height 0.4s ease, visibility 0s linear 0.4s !important;
}
#masthead nav.hfe-dropdown .sub-menu.sub-menu-open {
  max-height: 300px; visibility: visible !important;
  transition: max-height 0.4s ease, visibility 0s linear 0s !important;
}

/* No dotted box around the sub-menu arrows or the menu button when tapped */
#masthead nav.hfe-dropdown .hfe-menu-toggle,
#masthead nav.hfe-dropdown .hfe-menu-toggle:hover,
#masthead nav.hfe-dropdown .hfe-menu-toggle:focus { border-color: transparent !important; outline: none; }
#masthead .hfe-nav-menu__toggle:focus:not(:focus-visible) { outline: none; }
#masthead nav.hfe-dropdown .sub-arrow i,
#masthead nav.hfe-dropdown .sub-arrow svg { transition: transform 0.3s ease; }
#masthead nav.hfe-dropdown li:has(> .sub-menu-open) > a .sub-arrow i,
#masthead nav.hfe-dropdown li:has(> .sub-menu-open) > a .sub-arrow svg { transform: rotate(180deg); }

/* Glass: the header's blur sits on a layer behind its content (so the dropdowns inside it can blur the page too).
   The layer also covers the 1px border, and dims what is behind so white sections don't wash the header out. */
#masthead .glass { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background-color: transparent !important; border-width: 0 !important; }
#masthead .glass::before {
  content: ""; position: absolute; inset: 0; width: auto !important; height: auto !important; z-index: -1; pointer-events: none;
  background-color: rgba(15, 21, 62, 0.75); /* the glass tint, drawn on top of the dimmed blur */
  backdrop-filter: blur(10.1px) brightness(0.25); -webkit-backdrop-filter: blur(10.1px) brightness(0.25);
}

/* Glass dropdowns: the blur is on the whole panel (phone) and the whole dropdown box (desktop),
   so it fades in and out with the open/close animations. */
#masthead nav.hfe-dropdown,
#masthead nav:not(.hfe-dropdown) .sub-menu {
  background-color: transparent !important;
  backdrop-filter: blur(10.1px) brightness(0.12); -webkit-backdrop-filter: blur(10.1px) brightness(0.12);
}
/* A faint light layer under the sub-pages gives them the lighter glass look of the reference */
#masthead nav.hfe-dropdown .sub-menu,
#masthead nav:not(.hfe-dropdown) .sub-menu { background-color: rgba(255, 255, 255, 0.06) !important; }

/* Mobile main items: header glass colour; page you're on: dark navy highlight */
#masthead nav.hfe-dropdown li a.hfe-menu-item { background-color: rgba(15, 21, 62, 0.75) !important; }
#masthead nav.hfe-dropdown li a.hfe-menu-item:hover { background-color: rgba(2, 51, 101, 0.75) !important; }
#masthead nav.hfe-dropdown li.current-menu-item > a.hfe-menu-item,
#masthead nav.hfe-dropdown li.current-menu-item > .hfe-has-submenu-container > a.hfe-menu-item,
#masthead nav.hfe-dropdown li.current-menu-ancestor > .hfe-has-submenu-container > a.hfe-menu-item,
#masthead nav.hfe-dropdown li.current-menu-parent > .hfe-has-submenu-container > a.hfe-menu-item { background-color: rgba(2, 51, 101, 0.75) !important; }

/* Sub-pages (Services, Media): lighter blue; hover a touch lighter; page you're on: dark navy highlight */
#masthead .sub-menu li > a.hfe-sub-menu-item { background-color: rgba(18, 103, 154, 0.6) !important; color: #ffffff; }
#masthead .sub-menu li > a.hfe-sub-menu-item:hover { background-color: rgba(22, 118, 168, 0.7) !important; color: #ffffff; }
#masthead .sub-menu li.current-menu-item > a.hfe-sub-menu-item { background-color: rgba(2, 51, 101, 0.75) !important; color: #45c0ee; }

/* Phone menu: cyan divider lines between items (design sky colour) */
#masthead nav.hfe-dropdown li.menu-item:not(:last-child),
#masthead nav:not(.hfe-dropdown) .sub-menu li.menu-item:not(:last-child) { border-bottom: 1px solid #45c0ee !important; }

/* Closed Services/Media lists: no hidden border, so no transparent strip shows through */
#masthead nav.hfe-dropdown .sub-menu:not(.sub-menu-open) { border-top-width: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  #masthead .hfe-nav-menu-icon, #masthead .hfe-nav-menu-icon::before, #masthead .hfe-nav-menu-icon::after,
  #masthead nav.hfe-dropdown, #masthead nav.hfe-dropdown .sub-menu, #masthead nav:not(.hfe-dropdown) .sub-menu { transition: none !important; }
}