.menu-wrapper {
  width: 100%;
  display: none;
  pointer-events: none;
  opacity: 0;
  margin-left: -2rem;
  animation: fadeIn 1s ease forwards;
  transition: all 0.4s ease;
  overflow: hidden;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.menu-wrapper.open {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

nav {
  font-family: "Typewriter", sans-serif;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

nav .nav-list {
  width: 100%;
  list-style: none;
  display: flex;
  flex-direction: column;
  text-align: left;
  flex-wrap: wrap;
  gap: 16px;
}

.hover-button,
.submenu-item {
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  position: relative;
  font-size: 14px;
}

.hover-button::after,
.submenu-item::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background-color: var(--c-yellow);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.hover-button:hover::after,
.submenu-item:hover::after,
.hover-button.active::after,
.submenu-item.active::after {
  transform: scaleX(1);
}

.submenu-wrapper {
  position: relative;
  display: inline-block;
}

.submenu {
  position: absolute;
  top: -12px;
  left: 85%;
  background: transparent;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
  min-width: 160px;
}

.submenu-item {
  width: fit-content;
  position: relative;
  background: none;
  border: none;
  margin-top: 16px;
  text-align: left;
  font-family: "Typewriter", sans-serif;
  color: var(--c-white);
  cursor: pointer;
  transition: background 0.3s ease;
}

.submenu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .submenu {
    position: static;
    top: auto;
    left: auto;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    margin-left: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    padding-bottom: 4px;
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
  }

  .submenu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 300px;
    margin-top: 5px;
  }
}
