/* Общая шапка сайта — единственный источник её стилей.
   Подключается на каждой странице ПЕРЕД styles.css (и на самодостаточных лендингах
   вроде etrn-za-vas.html, где styles.css нет). Разметка шапки на всех страницах
   одинаковая, отличается только class="active" у текущего пункта.
   Нужные переменные: --cream, --black, --gray, --sand, --light-sand, --orange, --font —
   на обычных страницах их задаёт styles.css, самодостаточная страница объявляет сама. */

.nav {
  /* база шапки не зависит от body страницы */
  line-height: 1.5;
  color: var(--black);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(252, 248, 242, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(197, 192, 177, 0.2);
  height: 64px;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo {
  font-size: 21px;
  font-weight: 900;
  color: var(--black);
  text-decoration: none;
  letter-spacing: -0.8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-logo span { color: var(--orange); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex: 1;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background 0.15s;
  white-space: nowrap;
}

.nav-links a:hover { background: var(--light-sand); }
.nav-links a.active { font-weight: 700; }

.nav-has-sub { position: relative; }

.nav-sub-toggle {
  line-height: normal; /* страница может задавать button { font: inherit } — высота пункта не должна от этого зависеть */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.nav-sub-toggle:hover { background: var(--light-sand); }
.nav-sub-toggle.active { font-weight: 700; }
.nav-sub-toggle svg { transition: transform 0.15s; }
.nav-sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.nav-sub {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  list-style: none;
  background: var(--cream);
  border: 1px solid var(--sand);
  border-radius: 5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  padding: 6px;
  z-index: 101;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}

/* Мостик через зазор в 6px: без него курсор по дороге от кнопки к списку
   выходит за пределы пункта меню, наведение слетает и список захлопывается */
.nav-sub::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}

/* Раскрытие по наведению, с клавиатуры и по клику — последнее нужно для тач-экранов */
.nav-has-sub:hover .nav-sub,
.nav-has-sub:focus-within .nav-sub,
.nav-sub-toggle[aria-expanded="true"] + .nav-sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}

.nav-sub a { display: block; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-meta {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-right: 18px;
}

.nav-meta-label {
  display: block;
  font-size: 12px;
  color: var(--gray);
  line-height: 1.3;
}

.nav-meta-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  white-space: nowrap;
}

.nav-meta .stars { color: #d8d4ca; letter-spacing: 1px; }
.nav-meta .stars em { color: #FFC53D; font-style: normal; }

@media (max-width: 1120px) {
  .nav-meta { display: none; }
}

.nav-phone {
  font-size: 20px;
  font-weight: 800;
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.nav-phone:hover { color: var(--orange); }

.nav-phone-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.nav-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray);
  margin-top: 2px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc5e;
  animation: navPulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.btn-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: var(--cream);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-nav-cta:hover { background: #d94200; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 8px 10px;
  color: var(--black);
  line-height: 1;
  align-items: center;
  justify-content: center;
}

/* Своя анимация точки «онлайн»: общая pulse живёт в styles.css, которого может не быть */
@keyframes navPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.6); }
}

@media (max-width: 800px) {
  .btn-nav-cta { display: none; }
  .nav-toggle { display: block; }
  .nav-phone { display: none; }
}

@media (max-width: 768px) {
  .nav-inner { padding: 0 20px; }
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-phone { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--sand);
    padding: 12px;
    gap: 2px;
    z-index: 99;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  .nav-links.open a { padding: 12px 16px; border-radius: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .online-dot { animation: none; }
}
