/* ==========================================================================
   Discover Dagestan — общие стили шапки и меню.
   Файл подключается на всех страницах: /assets/css/site.css
   ========================================================================== */

/* --- Шапка ---------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;

  /* значения по умолчанию — шапка поверх фотографии (главная) */
  --fg: #ffffff;
  --hover: rgba(255, 255, 255, 0.14);
  --panel-bg: rgba(20, 25, 30, 0.94);
  --panel-border: rgba(255, 255, 255, 0.14);
  --panel-fg: #f3f1ed;
  --panel-hover: rgba(255, 255, 255, 0.1);
  --soon-bg: rgba(255, 255, 255, 0.13);

  color: var(--fg);
}

.site-header--overlay {
  background: linear-gradient(
    180deg,
    rgba(10, 14, 18, 0.66) 0%,
    rgba(10, 14, 18, 0.34) 62%,
    rgba(10, 14, 18, 0) 100%
  );
}

/* Светлая шапка для внутренних страниц */
.site-header:not(.site-header--overlay) {
  --fg: #2c2620;
  --hover: rgba(20, 24, 28, 0.07);
  --panel-bg: #ffffff;
  --panel-border: #e6dccb;
  --panel-fg: #2c2620;
  --panel-hover: #f5efe4;
  --soon-bg: rgba(20, 24, 28, 0.07);

  background: #fbf8f2;
  border-bottom: 1px solid #eee4d4;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(14px, 3vw, 34px);
  max-width: 1440px;
  margin: 0 auto;
}

/* --- Лого ---------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  color: inherit;
}

.brand__text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.012em;
  white-space: nowrap;
}

/* --- Меню ---------------------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__item {
  position: relative;
}

.nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.nav__btn:hover,
.nav__item.is-active .nav__btn {
  background: var(--hover);
}

.nav__chev {
  flex: none;
  opacity: 0.75;
  transition: transform 0.18s ease;
}

.nav__item:hover .nav__chev,
.nav__item:focus-within .nav__chev,
.nav__item.open .nav__chev {
  transform: rotate(180deg);
}

/* Выдвигающаяся панель */
.nav__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 238px;
  padding: 7px;
  border: 1px solid var(--panel-border);
  border-radius: 13px;
  background: var(--panel-bg);
  color: var(--panel-fg);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 60;
}

/* мостик, чтобы курсор не терял панель по дороге вниз */
.nav__panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -11px;
  height: 11px;
}

.nav__item:hover > .nav__panel,
.nav__item:focus-within > .nav__panel,
.nav__item.open > .nav__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav__panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 9px;
  color: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.14s ease;
}

a.nav__link:hover {
  background: var(--panel-hover);
}

.nav__link.is-soon {
  opacity: 0.62;
  cursor: default;
}

.nav__link em {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soon-bg);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* --- Кнопка WhatsApp ------------------------------------------------------ */
.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  background: #128c7e;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.btn-wa:hover {
  background: #0f7367;
}

/* Кнопка Telegram — справа от WhatsApp */
.btn-tg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  background: #229ed9;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.btn-tg:hover {
  background: #1b84b8;
}

.btn-wa:focus-visible,
.btn-tg:focus-visible,
.brand:focus-visible,
.nav__btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* --- Кнопка «бургер» для узких экранов ------------------------------------ */
.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px 0;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --- Светлая страница под фиксированной шапкой ---------------------------- */
.page-solid {
  padding-top: 74px;
}

/* --- Мобильная версия ------------------------------------------------------ */
@media (max-width: 1400px) {
  .brand__text {
    font-size: 18px;
  }

  .nav__btn {
    padding: 8px 9px;
    font-size: 14px;
  }

  .btn-wa,
  .btn-tg {
    padding: 9px 13px;
    font-size: 13.5px;
  }
}

/* С двумя кнопками мессенджеров меню перестаёт влезать — оставляем только иконки */
@media (max-width: 1360px) {
  .btn-wa span,
  .btn-tg span {
    display: none;
  }

  .btn-wa,
  .btn-tg {
    padding: 10px 11px;
  }
}

@media (max-width: 1200px) {
  .nav-toggle {
    display: block;
  }

  .nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 10px;
    right: 10px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--panel-border);
    border-radius: 15px;
    background: var(--panel-bg);
    color: var(--panel-fg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
  }

  .nav-open .nav {
    display: flex;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .nav__btn {
    width: 100%;
    justify-content: space-between;
    padding: 12px 12px;
    font-size: 15px;
  }

  .nav__panel {
    position: static;
    display: none;
    min-width: 0;
    margin: 2px 0 6px;
    padding: 4px;
    border: 0;
    border-radius: 11px;
    background: rgba(127, 127, 127, 0.12);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav__panel::before {
    display: none;
  }

  .nav__item.open > .nav__panel {
    display: block;
  }

  .nav__item:hover > .nav__panel,
  .nav__item:focus-within > .nav__panel {
    opacity: 1;
    visibility: visible;
  }

  .nav__link {
    padding: 10px 11px;
    font-size: 14.5px;
  }

  .btn-wa,
  .btn-tg {
    justify-content: center;
    margin-top: 6px;
    padding: 13px 16px;
  }

  /* в мобильном меню подписи нужны — возвращаем их обратно */
  .btn-wa span,
  .btn-tg span {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav__panel,
  .nav__chev,
  .nav-toggle span {
    transition: none;
  }
}

/* Прозрачная шапка при прокрутке становится светлой — иначе белый текст
   оказывается на кремовом фоне секций. */
.site-header--overlay.site-header--scrolled {
  --fg: #2c2620;
  --hover: rgba(20, 24, 28, 0.07);
  --panel-bg: #ffffff;
  --panel-border: #e6dccb;
  --panel-fg: #2c2620;
  --panel-hover: #f5efe4;
  --soon-bg: rgba(20, 24, 28, 0.07);

  background: rgba(251, 248, 242, 0.97);
  box-shadow: 0 1px 0 rgba(20, 24, 28, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
