@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap');

/* ======== Основное меню ======== */
.top-menu {
  margin-left: 120px;
  height: 50px;
  display: flex;
  align-items: stretch;
  position: relative;
  z-index: 1001;
}

/* Сброс стандартных маркеров */
.top-menu ul,
.top-menu li {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Контейнер меню */
.menu {
  display: flex;
  gap: 15px;
}

/* Пункт меню */
.menu-item {
  position: relative;
}

/* Ссылки меню */
.menu-link {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #000;
  text-decoration: none;
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 12px;
  transition: color .25s ease;
}

.menu-link:hover {
  color: #ff6600;
}

/* Стрелочка для подменю */
.caret {
  display: inline-block;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #000;
  transition: transform .2s ease;
}

.has-children.open > .menu-link .caret {
  transform: rotate(180deg);
}

/* ======== Подменю (десктоп) ======== */
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #f0f0f0;
  box-shadow: 0 6px 12px rgba(0,0,0,.12);
  border-radius: 8px;
  display: none;
  padding: 0;
  white-space: nowrap;
  z-index: 1002;
}

.submenu-item + .submenu-item {
  border-top: 1px solid #f7f7f7;
}

.submenu-link {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: #333;
  font-weight: 600;
  transition: background .2s ease, color .2s ease;
  border-radius: 0; /* по умолчанию без скруглений */
}

/* Первый и последний пункт подменю — скругляем */
.submenu-item:first-child .submenu-link {
  border-radius: 8px 8px 0 0;
}
.submenu-item:last-child .submenu-link {
  border-radius: 0 0 8px 8px;
}

.submenu-link:hover {
  background: #fffae6;
  color: #000;
}

/* Показываем подменю по hover */
@media (min-width: 769px) {
  .has-children:hover > .submenu {
    display: block;
  }
}

/* ======== Мобильная версия ======== */
@media (max-width: 768px) {
  header.top-nav .top-menu {
    display: none;
  }

  header.top-nav .top-menu.is-open {
    display: block;
  }

  .top-menu {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 6px 12px rgba(0,0,0,.12);
    padding: 10px 12px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    margin-left: 0;
  }

  .menu {
    display: block;
  }

  .menu-item {
    border-bottom: 1px solid #f5f5f5;
  }

  .menu-link {
    height: auto;
    padding: 12px 8px;
    color: #000;
  }

  /* Подменю на мобильных */
  .submenu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: #fff;
    padding: 0 0 8px 12px;
  }

  .has-children.open > .submenu {
    display: block;
  }

  .submenu-link {
    padding: 10px 8px;
  }

  /* Бургер */
  .burger-menu {
    display: block;
    font-size: 32px;
    cursor: pointer;
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    z-index: 1003;
    background: none;
    border: none;
  }
}

/* ======== Активный пункт ======== */
.menu-link.is-active,
.submenu-link.is-active {
  color: #ff6600;
  text-decoration: underline;
}
