/* Navigation Menu - Responsive with Hamburger Toggle */

/* ================================================================
   HAMBURGER BUTTON (hidden on desktop, shown on mobile)
   ================================================================ */
.hamburger-btn {
  display: none; /* Hidden on desktop */
  background: #307cb2;
  color: #fff;
  border: none;
  font-size: 1.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  margin: 0.5rem auto;
  line-height: 1;
}

.hamburger-btn:hover,
.hamburger-btn:focus {
  background: #245d8a;
  outline: 2px solid #baddf6;
}

/* Screen-reader text for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ================================================================
   DESKTOP NAV (default)
   ================================================================ */
nav.main-nav {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

ul.topmenu {
  margin: 0;
  padding: 0.3rem 0.3rem 0.3rem 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  z-index: 999;
  position: relative;
}

ul.topmenu ul {
  display: none;
  position: absolute;
  left: 0;
  top: 90%;
  background-color: #f6f5f6;
  border: 9px solid #307cb2;
  border-radius: 0 11px 11px 11px;
  padding: 0 9px 9px;
  margin: 0;
  list-style: none;
  z-index: 1000;
}

ul.topmenu li {
  position: relative;
}

ul.topmenu li:hover > ul,
ul.topmenu li:focus-within > ul {
  display: block;
}

ul.topmenu > li > a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font: 1.125rem/1 'HPSimplified', Arial, Helvetica, sans-serif;
  color: #00007f;
  text-decoration: underline;
  background-color: transparent;
  border: none;
  border-radius: 9px 9px 0 0;
  white-space: nowrap;
  cursor: pointer;
}

ul.topmenu > li:hover > a,
ul.topmenu > li:focus-within > a {
  background-color: #307cb2;
  color: #baddf6;
}

ul.topmenu > li > a img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

ul.topmenu ul li {
  margin: 9px 0 0;
}

ul.topmenu ul a {
  display: block;
  padding: 0.15rem 0.3rem;
  background-color: #f6f5f6;
  border-radius: 8px;
  font: 1.125rem 'HPSimplified', Arial, Helvetica, sans-serif;
  color: #2c75a3;
  text-decoration: underline;
  white-space: nowrap;
}

ul.topmenu ul li:hover > a,
ul.topmenu ul li:focus-within > a {
  background-color: #fff;
  color: #f00;
}

._css3m { display: none; }

/* ================================================================
   MOBILE NAV (max 768px)
   ================================================================ */
@media (max-width: 768px) {

  /* Show hamburger button */
  .hamburger-btn {
    display: block;
    margin-left: 0.5rem;
    margin-right: auto;
  }

  nav.main-nav {
    display: block;
  }

  /* Hide the menu by default on mobile; show when .is-open is added */
  ul.topmenu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: #f6f5f6;
    border: 2px solid #307cb2;
    border-radius: 8px;
    margin: 0.5rem;
    width: fit-content;
  }

  ul.topmenu.is-open {
    display: flex;
  }

  /* Top-level items: stack vertically */
  ul.topmenu > li {
    border-bottom: 1px solid #ccc;
  }

  ul.topmenu > li:last-child {
    border-bottom: none;
  }

  ul.topmenu > li > a {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 0;
    font-size: 1.1rem;
    width: 100%;
  }

  /* Submenus: display as indented items below parent */
  ul.topmenu ul {
    position: static;
    border: none;
    border-radius: 0;
    padding: 0 0 0.5rem 1.5rem;
    background-color: #e8eef3;
  }

  /* On mobile: always show submenus (they're compact enough stacked) */
  ul.topmenu li > ul {
    display: block;
  }

  ul.topmenu ul li {
    margin: 0.25rem 0;
  }

  ul.topmenu ul a {
    padding: 0.4rem 0.5rem;
    font-size: 1rem;
  }
}
