/* Scoped to menu items explicitly enabled in Appearance > Menus. */
body #page #masthead .hip-mega-menu-item > .hip-mega-trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
body #page #masthead .hip-mega-menu-item > .hip-mega-trigger::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  flex: none;
}
body #page #masthead .hip-mega-menu-item.is-mega-open > .hip-mega-trigger,
body #page #masthead .hip-mega-menu-item.is-mega-open > .hip-mega-trigger:hover { color: var(--plans-purple, #5b34ff) !important; }
/* The mega-menu parent remains a normal text link, without an active/hover underline. */
body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger,
body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger:hover,
body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger:focus-visible {
  text-decoration: none !important;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger::before {
  content: none !important;
  display: none !important;
}
body #page #masthead .hip-mega-menu[hidden],
body #page #masthead .hip-mega-menu__panel[hidden] { display: none !important; }
body #page #masthead .hip-mega-menu {
  box-sizing: border-box;
  position: fixed;
  z-index: 1010;
  right: max(24px, calc((100vw - 1240px) / 2));
  top: var(--hipmega-top, 80px);
  width: min(900px, calc(100vw - 48px));
  max-height: min(75vh, calc(100dvh - var(--hipmega-top, 80px) - 12px));
  overflow: auto;
  border: 1px solid #ece8f8;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 56px rgba(24, 16, 67, .14);
  color: var(--plans-text, #171522);
  font-family: 'DM Sans', sans-serif;
  text-align: left;
}
body #page #masthead .hip-mega-menu,
body #page #masthead .hip-mega-menu * { box-sizing: border-box; }
body #page #masthead .hip-mega-menu__layout {
  display: grid;
  grid-template-columns: minmax(205px, 32%) minmax(0, 1fr);
}
body #page #masthead .hip-mega-menu__provinces {
  padding: 28px 24px;
  border-right: 1px solid #eeeaf7;
}
body #page #masthead .hip-mega-menu__heading {
  margin: 0 0 18px;
  color: #77758f;
  font: 700 15px/1.4 'DM Sans', sans-serif;
  letter-spacing: 0;
}
body #page #masthead .hip-mega-menu__tabs { display: grid; gap: 2px; }
body #page #masthead .hip-mega-menu__province {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 39px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #55546f;
  font: 600 14.5px/1.4 'DM Sans', sans-serif;
  text-align: left;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__province-link {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 39px;
  padding: 9px 0 9px 14px !important;
  border: 0;
  border-radius: 10px 0 0 10px;
  background: transparent !important;
  color: inherit !important;
  font: 600 14.5px/1.4 'DM Sans', sans-serif;
  text-decoration: none !important;
  overflow-wrap: anywhere;
}
body #page #masthead .hip-mega-menu__province-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  min-height: 39px;
  padding: 0;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
body #page #masthead .hip-mega-menu__province:hover,
body #page #masthead .hip-mega-menu__province.is-active {
  color: var(--plans-purple, #5b34ff);
  background: #f0ecff;
}
/* Current-page markers are independent of the temporarily selected/hovered province. */
body #page #masthead .hip-mega-menu__province:is(.is-current-page,.has-current-city) { color: var(--plans-purple, #5b34ff); }
body #page #masthead .hip-mega-menu__province:is(.is-current-page,.has-current-city) .hip-mega-menu__chevron { color: var(--plans-purple, #5b34ff); }
body #page #masthead .hip-mega-menu__province-toggle:hover { color: var(--plans-purple, #5b34ff); }
body #page #masthead .hip-mega-menu__chevron { color: #8c8ba8; font-size: 23px; line-height: .8; font-weight: 400; }
body #page #masthead .hip-mega-menu__province.is-active .hip-mega-menu__chevron { color: var(--plans-purple, #5b34ff); }
body #page #masthead .hip-mega-menu__right { min-width: 0; }
/* A separate compact mobile copy sits directly beneath each province. */
body #page #masthead .hip-mega-menu__mobile-panel { display: none !important; }
body #page #masthead .hip-mega-menu__panel { display: flex; flex-direction: column; padding: 0 !important; margin: 0 !important; }
body #page #masthead .hip-mega-menu__main { flex: 1 1 auto; min-height: 0; padding: 28px 28px 24px; }
body #page #masthead .hip-mega-menu__top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
body #page #masthead .hip-mega-menu__top .hip-mega-menu__heading { margin: 0; }
body #page #masthead .hip-mega-menu__view-all,
body #page #masthead .hip-mega-menu__explore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--plans-purple, #5b34ff) !important;
  font: 700 14px/1.4 'DM Sans', sans-serif;
  text-decoration: none;
}
body #page #masthead .hip-mega-menu__cities { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; row-gap: 0; }
body #page #masthead a.hip-mega-menu__city {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 36px;
  padding: 5px 4px !important;
  border: 0;
  color: var(--plans-text, #171522) !important;
  font: 700 15px/1.4 'DM Sans', sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
}
body #page #masthead a.hip-mega-menu__city:hover { color: var(--plans-purple, #5b34ff) !important; }
body #page #masthead .hip-mega-menu__bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 23px 28px;
  border-top: 1px solid #eeeaf7;
}
body #page #masthead .hip-mega-menu__location-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #f0ecff;
  color: var(--plans-purple, #5b34ff);
}
body #page #masthead .hip-mega-menu__bottom-copy { min-width: 0; flex: 1; }
body #page #masthead .hip-mega-menu__bottom-copy strong { display: block; margin-bottom: 3px; font-size: 13.5px; line-height: 1.35; font-weight: 800; }
body #page #masthead .hip-mega-menu__bottom-copy p { margin: 0; color: #77758f; font-size: 12.5px; line-height: 1.5; }
body #page #masthead a.hip-mega-menu__explore {
  flex: 0 0 auto;
  padding: 13px 16px !important;
  border-radius: 12px;
  background: #f0ecff;
  color: var(--plans-purple, #5b34ff) !important;
}
body #page #masthead a.hip-mega-menu__explore:hover { background: #e5ddff; }
body #page #masthead .hip-mega-menu :is(a,button):focus-visible,
body #page #masthead .hip-mega-trigger:focus-visible { outline: 2px solid var(--plans-purple, #5b34ff); outline-offset: 3px; }
@media (max-width: 820px) {
  body #page #masthead .primary-navigation.is-open:has(.hip-mega-menu-item) { max-height: calc(100dvh - var(--hipmega-top, 70px)); overflow-y: auto; }
  body #page #masthead #primary-menu > li.hip-mega-menu-item { width: 100%; }
  body #page #masthead .hip-mega-menu {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 10px;
    border-radius: 12px;
    box-shadow: none;
    overflow: visible;
  }
  body #page #masthead .hip-mega-menu__layout { grid-template-columns: 1fr; }
  body #page #masthead .hip-mega-menu__provinces { padding: 18px; border-right: 0; border-bottom: 1px solid #eeeaf7; }
  body #page #masthead .hip-mega-menu__right { display: none !important; }
  body #page #masthead .hip-mega-menu__tabs { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  body #page #masthead .hip-mega-menu__province {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: stretch;
    overflow: hidden;
  }
  body #page #masthead .hip-mega-menu__province-link { grid-column: 1; }
  body #page #masthead .hip-mega-menu__province-toggle { grid-column: 2; }
  body #page #masthead .hip-mega-menu__mobile-panel:not([hidden]) {
    display: flex !important;
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #ece8f8;
    border-radius: 0 0 10px 10px;
    color: var(--plans-text, #171522);
  }
  body #page #masthead .hip-mega-menu__mobile-panel .hip-mega-menu__main { padding: 16px 14px 14px; }
  body #page #masthead .hip-mega-menu__mobile-panel .hip-mega-menu__top { margin-bottom: 10px; }
  body #page #masthead .hip-mega-menu__mobile-panel .hip-mega-menu__bottom { padding: 14px; }

  body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__province-link {
    min-height: 44px;
    padding: 10px 12px !important;
  }
  body #page #masthead .hip-mega-menu__province-toggle {
    flex-basis: 44px;
    min-height: 44px;
    border-left: 1px solid #e8e2fa;
    background: #f9f7ff;
  }
  body #page #masthead .hip-mega-menu__province-toggle:hover,
  body #page #masthead .hip-mega-menu__province-toggle:focus-visible { background: #eee8ff; }
  body #page #masthead .hip-mega-menu__province-toggle .hip-mega-menu__chevron {
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    font-size: 0;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .18s ease;
  }
  body #page #masthead .hip-mega-menu__province.is-active .hip-mega-menu__province-toggle .hip-mega-menu__chevron {
    transform: translateY(2px) rotate(225deg);
  }
  body #page #masthead .hip-mega-menu__main { padding: 18px; }
  body #page #masthead a.hip-mega-menu__city { min-height: 40px; padding: 6px 4px !important; }
  body #page #masthead .hip-mega-menu__bottom { padding: 16px 18px; flex-wrap: wrap; }
  body #page #masthead a.hip-mega-menu__explore { margin-left: 54px; }
}
@media (max-width: 550px) {
  body #page #masthead .hip-mega-menu__top { align-items: flex-start; flex-wrap: wrap; }
  body #page #masthead .hip-mega-menu__cities { grid-template-columns: 1fr; }
  body #page #masthead .hip-mega-menu__bottom { gap: 10px; }
  body #page #masthead .hip-mega-menu__location-icon { width: 34px; height: 34px; flex-basis: 34px; }
  body #page #masthead a.hip-mega-menu__explore { width: 100%; margin: 6px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  body #page #masthead .hip-mega-menu * { transition: none !important; }
}

/* Match the original header's high-specificity link rules without affecting other items. */
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__city {
  display: flex;
  color: var(--plans-text, #171522) !important;
  background: transparent !important;
  border-radius: 0;
  font-weight: 700;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__city:hover { color: var(--plans-purple, #5b34ff) !important; }
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__city.is-current-page { color: var(--plans-purple, #5b34ff) !important; }
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__city.is-current-page .hip-mega-menu__chevron { color: var(--plans-purple, #5b34ff); }

body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__view-all,
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__explore {
  display: inline-flex;
  color: var(--plans-purple, #5b34ff) !important;
  font-weight: 700;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__explore {
  background: #f0ecff !important;
  border-radius: 12px;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item .hip-mega-menu a.hip-mega-menu__explore:hover {
  background: #e5ddff !important;
}
body #page #masthead #primary-menu > li.hip-mega-menu-item.is-mega-open > a.hip-mega-trigger,
body #page #masthead #primary-menu > li.hip-mega-menu-item.is-mega-open > a.hip-mega-trigger:hover {
  color: var(--plans-purple, #5b34ff) !important;
}

/* Keep menu item navigation separate from its mobile dropdown control. */
body #page #masthead .hip-mega-menu-item > .hip-mega-toggle { display: none; }
@media (min-width: 821px) and (hover: hover) {
  /* Hover remains available even if a frontend optimizer delays the menu script. */
  html:not(.hipmega-js-ready) body #page #masthead .hip-mega-menu-item:hover > .hip-mega-menu[hidden],
  html:not(.hipmega-js-ready) body #page #masthead .hip-mega-menu-item:focus-within > .hip-mega-menu[hidden] { display: block !important; }
}
@media (max-width: 820px), (hover: none) {
  body #page #masthead #primary-menu > li.hip-mega-menu-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    column-gap: 8px;
  }
  body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger {
    grid-column: 1;
    min-width: 0;
    width: 100%;
  }
  body #page #masthead .hip-mega-menu-item > .hip-mega-trigger::after { display: none; }
  body #page #masthead #primary-menu > li.hip-mega-menu-item > button.hip-mega-toggle {
    grid-column: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e8e2fa;
    border-radius: 10px;
    background: #f3efff;
    color: var(--plans-purple, #5b34ff);
    cursor: pointer;
  }
  body #page #masthead #primary-menu > li.hip-mega-menu-item > button.hip-mega-toggle:hover,
  body #page #masthead #primary-menu > li.hip-mega-menu-item > button.hip-mega-toggle:focus-visible {
    border-color: #c9baff;
    background: #eae2ff;
    outline-offset: 2px;
  }
  body #page #masthead .hip-mega-toggle__chevron {
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .18s ease;
  }
  body #page #masthead .hip-mega-menu-item.is-mega-open > .hip-mega-toggle .hip-mega-toggle__chevron {
    transform: translateY(2px) rotate(225deg);
  }
  body #page #masthead #primary-menu > li.hip-mega-menu-item > .hip-mega-menu {
    grid-column: 1 / -1;
  }
}


/* Active links use the same accent as hover, including mega-menu ancestors. */
body #page #masthead #primary-menu > li:is(
  .current-menu-item,
  .current_page_item,
  .current-menu-parent,
  .current-menu-ancestor,
  .current_page_parent,
  .current_page_ancestor
) > a,
body #page #masthead #primary-menu > li > a[aria-current="page"] {
  color: var(--plans-purple, #5b34ff) !important;
}

/* The original theme hides every current-page link's ::after.
   Restore only the desktop mega-menu chevron and cancel the old
   current-page decorative underline positioning/background. */
@media (min-width: 821px) and (hover: hover) {
  body #page #masthead #primary-menu > li.hip-mega-menu-item:is(
    .current-menu-item,
    .current_page_item,
    .current-menu-parent,
    .current-menu-ancestor,
    .current_page_parent,
    .current_page_ancestor
  ) > a.hip-mega-trigger::after,
  body #page #masthead #primary-menu > li.hip-mega-menu-item > a.hip-mega-trigger[aria-current="page"]::after {
    display: block !important;
    position: static;
    inset: auto;
    background-image: none;
  }
}

/* Active mega-menu parents should not add the legacy decorative underline
   to links inside the dropdown itself. Their real text arrows remain. */
body #page #masthead #primary-menu > li.hip-mega-menu-item.current_page_item .hip-mega-menu a::after {
  content: none !important;
}
