:root {
  --site-header-h: clamp(4.375rem, 4vw + 3rem, 5rem);
  --site-header-z: 100000;
  --site-header-admin-h: 0px;
}

body.admin-bar {
  --site-header-admin-h: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar {
    --site-header-admin-h: 46px;
  }
}

.site-header {
  box-sizing: border-box;
  position: fixed;
  top: var(--site-header-admin-h);
  left: 0;
  right: 0;
  width: 100%;
  z-index: var(--site-header-z);
  height: var(--site-header-h);
  font-family: "Raleway", system-ui, sans-serif;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

body:not(.home) main#content.site-content {
  padding-top: calc(var(--site-header-admin-h) + var(--site-header-h));
}

body.home main#content.site-content {
  padding-top: 0;
}

/* «Макет»: логотип слева, пункты меню по центру (mcp menu.json), телефон справа */

.site-header__bar-inner {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: var(--site-header-h);
  max-width: 1920px;
  margin-inline: auto;
  padding-inline: 10px;
}

@media (min-width: 640px) {
  .site-header__bar-inner {
    padding-inline: 20px;
  }
}

@media (min-width: 1200px) {
  .site-header__bar-inner {
    padding-inline: 210px;
  }
}

.site-header__brand {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.site-header__logo {
  display: block;
  width: auto;
  max-width: min(52vw, 210px);
  height: clamp(2rem, 2.5vw + 1.25rem, 3.0625rem);
}

.site-header img.site-header__logo {
  object-fit: contain;
}

.site-header img.site-header__logo--custom {
  max-height: clamp(2.125rem, 2.75vw + 1.35rem, 3.375rem);
  width: auto;
  max-width: min(260px, 58vw);
  object-fit: contain;
}

/* JPG из uploads (белый/чёрный варианты) — те же пределы, что у кастомного лого */
.site-header img.site-header__logo--uploads {
  max-height: clamp(2.125rem, 2.75vw + 1.35rem, 3.375rem);
  width: auto;
  max-width: min(260px, 58vw);
  object-fit: contain;
}

/* Главная: лёгкое затемнение, усиливается при скролле (JS: --header-scrim 0…1) */
.site-header--home {
  --header-scrim: 0;
  background-color: rgba(5, 12, 18, calc(0.08 + var(--header-scrim) * 0.72));
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, calc(0.08 + var(--header-scrim) * 0.12));
}

/* Инверсия только для запасного лого темы; загруженный в админке — без фильтра */
.site-header--home .site-header__logo--theme {
  filter: brightness(0) invert(1);
}

.site-header--inner {
  background-color: #fff;
  box-shadow: 0 1px 0 rgba(22, 22, 22, 0.08);
}

.site-header__burger {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.site-header__burger-line {
  position: absolute;
  left: 50%;
  width: 1.375rem;
  height: 2px;
  margin-left: -0.6875rem;
  border-radius: 1px;
  background: currentColor;
}

.site-header__burger-line:nth-child(1) {
  transform: translateY(-6px);
}

.site-header__burger-line:nth-child(2) {
  transform: translateY(0);
}

.site-header__burger-line:nth-child(3) {
  transform: translateY(6px);
}

.site-header--home .site-header__burger {
  color: #fff;
}

.site-header--inner .site-header__burger {
  color: #161616;
}

.site-header.is-nav-open .site-header__burger-line:nth-child(1) {
  transform: translateY(0) rotate(45deg);
}

.site-header.is-nav-open .site-header__burger-line:nth-child(2) {
  opacity: 0;
}

.site-header.is-nav-open .site-header__burger-line:nth-child(3) {
  transform: translateY(0) rotate(-45deg);
}

.site-header__panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}

.site-header__nav {
  margin: 0;
  padding: 0;
}

.site-header__menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: clamp(0.75rem, 1.25vw + 0.35rem, 1.375rem);
  row-gap: 0.5rem;
}

.site-header__item {
  margin: 0;
  padding: 0;
}

.site-header__link {
  display: inline-block;
  margin: 0;
  padding: 0.25rem 0;
  font-weight: 500;
  font-size: clamp(0.9375rem, 0.3vw + 0.82rem, 1.375rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.site-header--home .site-header__link {
  color: rgba(255, 255, 255, 0.98);
}

.site-header--home .site-header__link:hover,
.site-header--home .site-header__link:focus-visible {
  opacity: 0.85;
}

.site-header--inner .site-header__link {
  color: #161616;
}

.site-header--inner .site-header__link:hover,
.site-header--inner .site-header__link:focus-visible {
  opacity: 0.75;
}

.site-header__phone {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  font-family: Inter, Arial, system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(0.875rem, 0.25vw + 0.8rem, 1rem);
  line-height: 1.35;
  letter-spacing: normal;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
}

.site-header--home .site-header__phone--bar {
  color: #fff;
}

.site-header--inner .site-header__phone--bar {
  color: #161616;
}

.site-header__phone:hover,
.site-header__phone:focus-visible {
  opacity: 0.85;
}

@media (max-width: 1023px) {
  .site-header__burger {
    display: inline-flex;
  }

  /* Выезжающее меню: высота на весь экран под строкой шапки (dvh/svh — корректно в моб. браузерах) */
  .site-header__panel {
    position: fixed;
    display: flex;
    flex-direction: column;
    top: calc(var(--site-header-admin-h) + var(--site-header-h));
    left: 0 !important;
    width: 100%;
    z-index: calc(var(--site-header-z) - 1);
    height: calc(100vh - var(--site-header-admin-h) - var(--site-header-h));
    height: calc(100dvh - var(--site-header-admin-h) - var(--site-header-h));
    max-height: calc(100dvh - var(--site-header-admin-h) - var(--site-header-h));
    overflow: hidden;
    padding: 0;
    align-items: stretch;
    box-sizing: border-box;
    background: #fff;
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, -10px, 0);
    transition:
      visibility 0.2s ease,
      opacity 0.2s ease,
      transform 0.22s ease;
  }

  @supports (height: 100svh) {
    .site-header__panel {
      height: calc(100svh - var(--site-header-admin-h) - var(--site-header-h));
      max-height: calc(100svh - var(--site-header-admin-h) - var(--site-header-h));
    }
  }

  .site-header.is-nav-open .site-header__panel {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transform: translate3d(0, 0, 0);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  }

  .site-header__panel-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: clamp(1.25rem, 4vw, 1.75rem) clamp(10px, 4vw, 20px)
      clamp(0.75rem, 3vw, 1.25rem);
  }

  .site-header__menu {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    column-gap: 0;
    row-gap: 0.25rem;
  }

  .site-header__link {
    padding: 0.6rem 0;
    font-size: 1.125rem;
    color: #161616 !important;
  }

  .site-header__drawer-extras {
    flex: 0 0 auto;
    padding: 0.75rem clamp(10px, 4vw, 20px)
      calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, #f8f8f8, #fff);
    border-top: 1px solid rgba(22, 22, 22, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
  }

  .site-header__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .site-header__chip {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.7rem;
    font-family: Inter, Arial, system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    color: #222;
    background: #fff;
    border: 1px solid rgba(22, 22, 22, 0.12);
    border-radius: 0.375rem;
    transition:
      background 0.15s ease,
      border-color 0.15s ease;
  }

  .site-header__chip:hover,
  .site-header__chip:focus-visible {
    background: #f2f7f7;
    border-color: rgba(20, 128, 93, 0.35);
  }

  .site-header__phone--bar {
    display: none;
  }
}

@media (min-width: 1024px) {
  .site-header__panel-inner {
    display: contents;
  }

  .site-header__drawer-extras {
    display: none !important;
  }

  .site-header__phone--bar {
    display: inline-block;
  }
}

body.site-nav-open {
  overflow: hidden;
}

@media (min-width: 1024px) {
  body.site-nav-open {
    overflow: auto;
  }
}
