/* === Base Menu Styles === */
nav ul {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  background-color: #1b8a8a;
  border-radius: 12px 12px 0 0;
}

nav ul li {
  display: inline-block;
  position: relative;
}

nav ul li a {
  display: block;
  padding: 10px 20px;
  text-decoration: none;
  color: #e6e49d;
  font-style: italic;
  font-weight: bold;
}

/* === Submenu (Desktop Hover) === */
nav ul li ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background-color: #1b8a8a;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  z-index: 1000;
}

nav ul li:hover ul {
  display: block;
  opacity: 1;
  visibility: visible;
}

nav ul li ul li {
  display: block;
}

nav ul li ul li a {
  display: block;
  padding: 10px;
  color: #e6e49d;
  background-color: #1b8a8a;
  text-align: left;
}

/* === Hamburger Button (Hidden on Desktop) === */
.menu-toggle {
  display: none;
}

.menu-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  cursor: pointer;
}

.menu-parent a {
  flex-grow: 1;
  text-decoration: none;
  color: #e6e49d;
  font-style: italic;
  font-weight: bold;
}

.submenu-toggle {
  font-size: 1.2em;
  color: #e6e49d;
  margin-left: 10px;
  user-select: none;
}

.nav-logo {
  position: absolute;
  top: 30px;
  right: 20px;
  height: 40px;
  width: auto;
  z-index: 2000;
}


/* ################ Media Styling ################## */
@media screen and (max-width: 768px) {
  /* Toggle icon visibility on mobile */
  .submenu-toggle {
    display: block;
    font-size: 2.0em;
  }

  /* === Layout Shift === */
  nav ul {
    display: none;
    flex-direction: column;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #1b8a8a;
    opacity: 1; /* ensure full opacity */
    backdrop-filter: none; /* remove blur if present */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); /* optional depth */
  }

  nav.active ul {
    display: flex;
    max-height: 550px; /* adjust as needed 750 */
  }

  nav ul li {
    display: block;
    text-align: center;
    position: relative;
  }

  nav ul li a {
    padding: 12px;
    font-size: 2.0em;
    font-weight: bold;
  }

  /* === Hamburger Button === */
  .menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 2em;
    color: #e6e49d;
    padding: 10px;
    cursor: pointer;
  }

  /* === Submenu (Click-to-Expand) === */
  nav ul li ul {
    display: none;
    position: absolute; /* take it out of the flow */
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #1b8a8a;
    box-shadow: none;
    z-index: 1000;

    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, visibility 0.3s ease;
  }

  nav ul li ul.open {
    display: flex;
    flex-direction: column;
    position: static; /* re-enter flow when open */
    max-height: 500px;
    opacity: 1;
    visibility: visible;
  }

  nav ul li ul li {
    display: block;
    width: 100%;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  nav ul li ul li a {
    display: block;
    padding: 10px;
    color: #e6e49d;
    text-decoration: none;
    background-color: #1b8a8a;
    font-size: 1.8em;
  }


  .nav-logo {
    position: absolute;
    top: 15px;
    right: 10px;
    height: 40px;
    width: auto;
    z-index: 2000;
  }
}

