/**
 * Совместимость новой шапки/подвала с legacy CSS на внутренних страницах.
 * Подключается только на !new-main (body.legacy-content-page).
 */

body.legacy-content-page {
  margin: 0;
  padding-top: 0;
}

body.legacy-content-page .site-shell {
  margin: 0;
  padding-top: 0;
}

body.legacy-content-page .header {
  margin: 0;
  padding: 0;
  background-color: transparent;
}

body.legacy-content-page .header__logo,
body.legacy-content-page .header__logo img {
  max-width: none;
}

/* Legacy прячет .header__btn с 900px — в новой вёрстке это обёртка CTA */
body.legacy-content-page .header__btn {
  display: block;
}

body.legacy-content-page .header__btn .yellow-btn,
body.legacy-content-page .header__btn .open-callback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  max-width: none;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 16px 36px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffcf4a 0%, #ff9d00 100%);
  box-shadow: 0 0 9.4px rgba(0, 0, 0, 0.13);
  font-family: "Open Sans", sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  text-indent: 0;
  text-align: center;
  text-decoration: none;
  color: #212121;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

body.legacy-content-page .header__btn .yellow-btn::after {
  content: none;
  display: none;
}

@media screen and (max-width: 1280px) {
  body.legacy-content-page .header__btn .yellow-btn,
  body.legacy-content-page .header__btn .open-callback {
    padding: 12px 20px;
    font-size: 14px;
  }
}

@media screen and (max-width: 1150px) {
  body.legacy-content-page .header__logo {
    max-width: none !important;
  }
}

@media screen and (max-width: 900px) {
  body.legacy-content-page .header__btn {
    display: block;
  }
}

@media screen and (max-width: 1024px) {
  body.legacy-content-page .header {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1301 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    background-color: #fff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14) !important;
  }

  body.legacy-content-page .header > .container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  body.legacy-content-page .header__top {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    margin: 0 !important;
    padding: 10px 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  /* Только лого и бургер — любые legacy-правила на остальные блоки отключаем */
  body.legacy-content-page .header__top > :not(.header__logo):not(.header__burger) {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.legacy-content-page .header__bottom {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.legacy-content-page .header__logo {
    display: block !important;
    flex: 0 1 auto;
    width: 168px !important;
    max-width: 60% !important;
    height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.legacy-content-page .header__logo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: contain;
    object-position: left center;
  }

  body.legacy-content-page .header__burger {
    display: flex !important;
    flex: 0 0 auto;
    margin: 0 0 0 auto !important;
  }

  body.legacy-content-page .header__drawer {
    position: fixed !important;
  }

  body.legacy-content-page.admin-bar .header,
  body.legacy-content-page.admin-bar .site-shell {
    margin-top: 0 !important;
  }
}

@media screen and (max-width: 480px) {
  body.legacy-content-page .header__logo {
    width: 148px !important;
    height: 40px !important;
    max-height: 40px !important;
    max-width: 70% !important;
  }

  body.legacy-content-page .header__top {
    padding: 8px 0 !important;
  }
}
