/* =========================================================
   menu-MS-v1.css
   Self-contained Menu System (MS-v1)
   - All selectors scoped under .ms_menu
   - ms_ prefixed classes/ids to avoid collisions
   ========================================================= */


/* =========================================================
   Navigation (MS-v1)  — ported from public Navigation (2026)
   ========================================================= */

#ms_menu_root,
#ms_menu_root a,
#ms_menu_root button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#ms_menu_root {
  background: #fff;
  border-bottom: 1px solid #ddd;
}

#ms_menu_root .ms_menu_inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

#ms_menu_root .ms_brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

#ms_menu_root .ms_logo {
  display: block;
  height: 100px; /* was originally 44px in public */
  width: auto;
}

#ms_menu_root .ms_wordmark {
  display: block;
  height: 70px; /* was originally 28px in public */
  width: auto;
}

#ms_menu_root .ms_nav {
  margin-left: 0;
  display: flex;
  align-items: center;
}

#ms_menu_root .ms_toggle {
  border: 1px solid #ccc;
  background: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

#ms_menu_root .ms_menu_list {
  list-style: none;
  margin: 0;
  padding: 0;

  /* Mobile default: closed */
  display: none;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

#ms_menu_root .ms_link,
#ms_menu_root .ms_menu_list a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #111;
}

#ms_menu_root .ms_menu_list a:hover,
#ms_menu_root .ms_menu_list a:focus {
  background: #f2f2f2;
}

#ms_menu_root .ms_has_sub {
  position: relative;
}

#ms_menu_root .ms_sub {
  list-style: none;
  margin: 0;
  padding: 6px 0 0 14px;
  display: none;
}

#ms_menu_root .ms_has_sub:focus-within > .ms_sub {
  display: block;
}

#ms_menu_root .ms_divider {
  height: 1px;
  background: #ddd;
  margin: 6px 0;
}

/* Mobile open state */
#ms_menu_root.ms_is_open .ms_menu_list {
  display: flex;
}

/* Hide wordmark on tiny screens */
@media (max-width: 700px) {
  #ms_menu_root .ms_wordmark {
    /* height: clamp(18px, 4.5vw, 28px); */
    height: 32px;   /* try 30–34px */
    width: auto;
  }
}

/* Desktop dropdowns */
@media (min-width: 980px) {
  #ms_menu_root .ms_toggle { display: none; }

  #ms_menu_root .ms_menu_list {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 4px;
  }

  /* Invisible hover bridge to prevent submenu flicker */
  #ms_menu_root .ms_has_sub::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
    background: transparent;
  }

  #ms_menu_root .ms_sub {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 12px 20px rgba(0,0,0,0.12);
    display: none;
    z-index: 50;
  }

  #ms_menu_root .ms_has_sub:hover > .ms_sub,
  #ms_menu_root .ms_has_sub:focus-within > .ms_sub {
    display: block;
  }

  #ms_menu_root .ms_sub a {
    padding: 8px 10px;
  }
}

/* Mobile nav: menu must drop below the bar, not render off to the right */
@media (max-width: 979px) {
  #ms_menu_root .ms_menu_inner {
    flex-wrap: wrap;
  }

  /* Make the nav area span the full width so the menu can sit under the toggle */
  #ms_menu_root .ms_nav {
    width: 100%;
    justify-content: flex-start;
  }

  /* When open, the menu is a full-width block under the bar */
  #ms_menu_root.ms_is_open .ms_menu_list {
    display: flex;
    width: 100%;
    margin-top: 10px;
  }

  #ms_menu_root .ms_menu_list {
    width: 100%;
  }

  /* Keep the hamburger button on the right */
  #ms_menu_root .ms_toggle {
    margin-left: 0;
  }
}

/* If nav wraps to two lines, align items at the top */
@media (max-width: 979px) {
  #ms_menu_root .ms_menu_inner {
    align-items: flex-start;
  }
}

/* MS-v1: JS-driven submenu open state (required for iOS) */
#ms_menu_root .ms_has_sub.ms_is_open > .ms_sub {
  display: block;
}

/* Keep desktop hover behavior too */
@media (min-width: 980px) {
  #ms_menu_root .ms_has_sub.ms_is_open > .ms_sub {
    display: block;
  }
}

/* MS-v1: JS-driven submenu open state (required for iOS) */
#ms_menu_root .ms_has_sub.ms_is_open > .ms_sub {
  display: block;
}

/* Indicate dropdown on top-level items */
/* ---------------------------------------------------------
   MS-v1: dropdown caret indicator for top-level items
   --------------------------------------------------------- */

#ms_menu_root .ms_has_sub > a::after {
  content: "▼";
  display: inline-block;
  font-size: 0.7em;
  margin-left: 6px;
  opacity: 0.8;
  position: relative;
  top: -1px;
  transition: transform 120ms ease;
}

/* Mobile + JS-opened state */
#ms_menu_root .ms_has_sub.ms_is_open > a::after {
  transform: rotate(180deg);
}

/* Desktop hover / focus-open state */
@media (min-width: 980px) {
  #ms_menu_root .ms_has_sub:hover > a::after,
  #ms_menu_root .ms_has_sub:focus-within > a::after {
    transform: rotate(180deg);
  }
}

/* ---------------------------------------------------------
   Dropdown separators: no internal rules, but keep grouping + mobile closing rule
   --------------------------------------------------------- */

/* Never show internal divider lines (desktop or mobile) */
#ms_menu_root .ms_sub .ms_divider {
  display: none;
}

/* Keep the visual grouping where dividers used to be */
#ms_menu_root .ms_sub .ms_divider + li {
  margin-top: 10px;
}

/* Mobile: add ONE closing rule at the bottom of every dropdown */
@media (max-width: 979px) {
  #ms_menu_root .ms_sub::after {
    content: "";
    display: block;
    height: 1px;
    background: #ddd;
    margin: 8px 10px 0;
  }
}
