/**
 * Оболочка Next для статичных лендингов из public/*.html (и старых из public/legacy).
 * Цвет фона задаёт EmbeddedNewMainHtmlPage (у нового макета #070c09, у legacy — #141414).
 *
 * Next.js: .body-bg с z-index:-1 внутри #__next не виден.
 * Повторяем index_new через body::before — те же числа, что .scale-80 .body-bg + .body-bg--new.
 */
html.embedded-new-main-shell body {
  position: relative;
}

html.embedded-new-main-shell #__next,
html.embedded-new-main-shell #__next > div {
  background-color: transparent !important;
  position: relative;
  z-index: 1;
}

html.embedded-new-main-shell .embedded-new-main-shell-landing-root {
  background-color: transparent !important;
}

html.embedded-new-main-shell.embedded-landing-bg-index-new
  .embedded-new-main-shell-landing-root > picture,
html.embedded-new-main-shell.embedded-landing-bg-legacy
  .embedded-new-main-shell-landing-root > picture,
html.embedded-new-main-shell.embedded-landing-bg-legacy
  .embedded-new-main-shell-landing-root > img.body-bg {
  display: none !important;
}

/* .scale-80 .body-bg */
html.embedded-new-main-shell.embedded-landing-bg-index-new body::before {
  content: '';
  position: absolute;
  top: -160px;
  right: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-height: calc(100% + 160px);
  background-image: url('/legacy/img/new/main-bg-new.webp');
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  mix-blend-mode: hard-light;
  z-index: 0;
  pointer-events: none;
}

/* .scale-80 .body-bg--new (min-width: 1101px) — transform не сбрасывается */
@media screen and (min-width: 1101px) {
  html.embedded-new-main-shell.embedded-landing-bg-index-new body::before {
    top: -320px;
    left: 43%;
    width: 114%;
    max-width: none;
    min-height: calc(100% + 320px);
    transform: translateX(-50%);
  }
}

/* .scale-80 .body-bg @media max-width 1100px + picture mob source */
@media screen and (max-width: 1100px) {
  html.embedded-new-main-shell.embedded-landing-bg-index-new body::before {
    top: 0;
    right: 0;
    bottom: 0;
    left: 50%;
    width: 100%;
    min-height: 100%;
    transform: translateX(-50%);
    background-image: url('/legacy/img/new/main-bg-new-mob.png');
  }
}

html.embedded-new-main-shell.embedded-landing-bg-legacy body::before {
  content: '';
  position: absolute;
  top: -160px;
  right: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-height: calc(100% + 160px);
  background-image: url('/legacy/img/main-bg.webp');
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  mix-blend-mode: hard-light;
  z-index: 0;
  pointer-events: none;
}

@media screen and (max-width: 1100px) {
  html.embedded-new-main-shell.embedded-landing-bg-legacy body::before {
    top: 0;
    right: 0;
    bottom: 0;
    min-height: 100%;
  }
}

/* Bitrix24 site button — поверх лендинга и #__next */
.b24-widget-button-wrapper,
.b24-widget-button-shadow,
.b24-widget-button-inner-container,
.b24-widget-button-position-fixed,
.bx-crm-widget-form-config-sidebar,
.bx-imopenlines-config-sidebar,
div[data-b24-crm-button-cont] {
  z-index: 100000 !important;
}

/*
 * Open Lines live chat (.bx-imopenlines-config-sidebar) — поле .bx-im-textarea-input.
 * .scale-80 textarea { color: inherit } от body (#fff) → белый текст на белом фоне.
 */
.bx-imopenlines-config-sidebar,
[class*="bx-imopenlines"],
.bx-im-textarea {
  color: #141414 !important;
}

.bx-im-textarea-input,
.bx-imopenlines-config-sidebar textarea,
.bx-imopenlines-config-sidebar input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[class*="bx-imopenlines"] textarea,
[class*="bx-imopenlines"] input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.bx-im-textarea textarea,
.bx-im-textarea input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  color: #141414 !important;
  -webkit-text-fill-color: #141414 !important;
  caret-color: #141414 !important;
  background-color: transparent !important;
}

.bx-im-textarea-input::placeholder,
.bx-imopenlines-config-sidebar textarea::placeholder,
.bx-imopenlines-config-sidebar input::placeholder,
[class*="bx-imopenlines"] textarea::placeholder,
[class*="bx-imopenlines"] input::placeholder {
  color: rgba(82, 92, 105, 0.42) !important;
  -webkit-text-fill-color: rgba(82, 92, 105, 0.42) !important;
  opacity: 1 !important;
}

/*
 * CRM-форма открывается в .bx-crm-widget-form-config-sidebar (не в data-b24-crm-button-cont).
 * Лендинг: input { color: inherit } от body (#fff) → белый текст на белом фоне.
 */
.bx-crm-widget-form-config-sidebar,
[class*="bx-crm-widget-form"],
[id^="b24-site-button-form-"],
.crm-webform-header-container {
  color: #141414 !important;
}

div[data-b24-crm-button-cont] input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
div[data-b24-crm-button-cont] textarea,
div[data-b24-crm-button-cont] select,
.b24-widget-button-popup input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.b24-widget-button-popup textarea,
.b24-widget-button-popup select,
.b24-window-popup input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.b24-window-popup textarea,
.b24-window-popup select,
.b24-form input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.b24-form textarea,
.b24-form select,
.bx-crm-widget-form-config-sidebar input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.bx-crm-widget-form-config-sidebar textarea,
.bx-crm-widget-form-config-sidebar select,
[class*="bx-crm-widget"] input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[class*="bx-crm-widget"] textarea,
[class*="bx-crm-widget"] select,
[id^="b24-site-button-form-"] input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="b24-site-button-form-"] textarea,
[id^="b24-site-button-form-"] select,
[class*="b24-"] input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[class*="b24-"] textarea,
[class*="b24-"] select {
  color: #141414 !important;
  -webkit-text-fill-color: #141414 !important;
  caret-color: #141414 !important;
  background-color: #ffffff !important;
}

div[data-b24-crm-button-cont] input::placeholder,
div[data-b24-crm-button-cont] textarea::placeholder,
.b24-widget-button-popup input::placeholder,
.b24-widget-button-popup textarea::placeholder,
.b24-window-popup input::placeholder,
.b24-window-popup textarea::placeholder,
.b24-form input::placeholder,
.b24-form textarea::placeholder,
.bx-crm-widget-form-config-sidebar input::placeholder,
.bx-crm-widget-form-config-sidebar textarea::placeholder,
[class*="bx-crm-widget"] input::placeholder,
[class*="bx-crm-widget"] textarea::placeholder,
[id^="b24-site-button-form-"] input::placeholder,
[id^="b24-site-button-form-"] textarea::placeholder,
[class*="b24-"] input::placeholder,
[class*="b24-"] textarea::placeholder {
  color: #7a7a7a !important;
  -webkit-text-fill-color: #7a7a7a !important;
  opacity: 1 !important;
}

div[data-b24-crm-button-cont] input:-webkit-autofill,
.b24-widget-button-popup input:-webkit-autofill,
.b24-window-popup input:-webkit-autofill,
.b24-form input:-webkit-autofill,
.bx-crm-widget-form-config-sidebar input:-webkit-autofill,
[class*="bx-crm-widget"] input:-webkit-autofill,
[id^="b24-site-button-form-"] input:-webkit-autofill,
[class*="b24-"] input:-webkit-autofill {
  -webkit-text-fill-color: #141414 !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
}
