/* =========================
   НАВИГАЦИЯ
   ========================= */
.nav {
  flex-grow: 1;
}

/* Десктопное меню */
.nav-menu {
  list-style: none;
  display: flex;
  gap: 25px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: none;
  position: static;
  box-shadow: none;
  padding-bottom: 0;
  align-items: center;
  max-height: none;
  overflow: visible;
}

.nav-menu > li {
  position: relative;
}

.nav-menu a {
  text-decoration: none;
  color: #0047ab;
  padding: 10px 5px;
  display: inline-block;
  position: relative;
  font-weight: 500;
  transition: color 0.3s;
}

/* Анимированное подчеркивание через ::after */
.nav-menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 0%;
  height: 2px;
  background: #0047ab;
  transition: width 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active,
.nav-menu .nav-item.active > a {
  color: #1976d2;
}

.nav-menu a:hover::after,
.nav-menu a.active::after,
.nav-menu .nav-item.active > a::after {
  width: 100%;
}

/* Активный пункт подменю */
.nav-menu .submenu a.active {
  font-weight: bold;
  color: #1976d2;
}

/* =========================
   МОБИЛЬНОЕ МЕНЮ
   ========================= */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 20px;
  z-index: 1200;
}
.burger span {
  display: block;
  height: 4px;
  width: 100%;
  background: #0047ab;
  border-radius: 2px;
  margin: 5px 0;
  transition: 0.3s;
}
.burger.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}
.burger.active span:nth-child(2) {
  opacity: 0;
}
.burger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Мобильное меню */
@media (max-width: 900px) {
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    z-index: 1100;
  }
  .burger {
    display: flex;
  }
  .nav-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #ffd66b;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    padding-bottom: 20px;
    z-index: 1200;
    max-height: 80vh;
    overflow-y: auto;
  }
  .nav-menu.show { display: flex !important; }
  .nav-menu > li { width: 100%; }
  .nav-menu a {
    padding: 16px 30px;
    width: 100%;
    box-sizing: border-box;
    font-size: 1.18rem;
  }
  .submenu {
    position: static;
    box-shadow: none;
    min-width: unset;
    width: 100%;
    display: none;
  }
  .nav-item.open .submenu {
    display: block;
  }
  .nav-item:hover .submenu {
    display: none;
  }
  body.menu-opened #main-content {
    filter: blur(2px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.2s;
  }
}

/* Десктопное меню — всегда flex */
@media (min-width: 901px) {
  .nav-menu {
    display: flex !important;
    position: static;
    background: none;
    flex-direction: row;
    align-items: center;
    gap: 25px;
    box-shadow: none;
    padding-bottom: 0;
    max-height: none;
    overflow: visible;
  }
  .burger {
    display: none;
  }
}

@media (max-width: 900px) {
  .nav-menu a {
    padding: 18px 30px;
    font-size: 1.18rem;
    border-bottom: 1px solid #f5e6a6;
  }
  .nav-menu > li:last-child a {
    border-bottom: none;
  }
}

/* =========================
   ПОДМЕНЮ (десктоп)
   ========================= */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fffbe0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  list-style: none;
  min-width: 150px;
  z-index: 1000;
}

.nav-item:hover .submenu {
  display: block;
}

.submenu li a {
  padding: 10px;
  display: block;
  white-space: nowrap;
  color: #333;
}

.nav-item > a:after {
  content: " ▼";
  font-size: 10px;
}