/*
 * etc-editor-promo.css - промо онлайн-редактора прошивок (etc-tools.ru), 2026-08-18.
 *
 * Два блока: полоса под шапкой (серверный рендер, см. components/header/header.html)
 * и модалка по таймеру (рисует javascript/etc-editor-promo.js).
 *
 * Цвета заданы литералами с подстановкой токенов через var(..., fallback):
 * файл подключается и к витрине на poster-v3, и к 13 статическим SEO-лендингам,
 * где токенов дизайн-системы нет вообще.
 */

:root {
  --etc-editor-amber: #ffa63a;
  --etc-editor-amber-2: #e07b12;
  --etc-editor-ink: #1d1204;
}

/* ======================= КНОПКА РЕДАКТОРА В ШАПКЕ (база) =======================
 * Работает там, где слоя poster-v3 нет: 13 статических SEO-лендингов держат
 * вмороженную копию шапки со старым зелёным правилом в инлайновом <style>.
 * Инлайновый <style> идёт позже по документу, поэтому берём специфичностью:
 * html.etc-shop-redesign + три класса против двух классов у старого правила.
 */
html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--etc-editor-amber), var(--etc-editor-amber-2)) !important;
  border-color: rgba(150, 80, 5, .55) !important;
  color: var(--etc-editor-ink) !important;
  font-weight: 850 !important;
  cursor: pointer;
  text-shadow: none !important;
  box-shadow: 0 10px 22px rgba(210, 120, 20, .3) !important;
}

html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor:hover {
  background: linear-gradient(180deg, #ffb457, #ef8a1d) !important;
  color: var(--etc-editor-ink) !important;
  box-shadow: 0 14px 28px rgba(210, 120, 20, .38) !important;
}

/* Точка-индикатор «онлайн». Пульс - через прозрачность, а не расходящимся
   кольцом: у пилюли overflow:hidden ради блика, кольцо бы обрезалось. */
html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--etc-editor-ink);
  box-shadow: none;
  animation: etcEditorOnline 1.8s ease-in-out infinite;
}

@keyframes etcEditorOnline {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.78); }
}

/* Блик раз в 6 секунд - им кнопка и цепляет взгляд. */
html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 32%;
  pointer-events: none;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: etcEditorShine 6s ease-in-out infinite;
}

@keyframes etcEditorShine {
  0%, 80% { left: -45%; }
  100%    { left: 130%; }
}

@media (prefers-reduced-motion: reduce) {
  html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor::before {
    animation: none;
  }
  html.etc-shop-redesign .navbar-nav .nav-link.etc-online-editor::after {
    display: none;
  }
}

/* ===================== КНОПКА РЕДАКТОРА В ШАПКЕ (poster-v3) =====================
 * Слой etc-poster-v3 перерисовывает меню в плоские «призрачные» пилюли и своим
 * `.nav-item:nth-child(2) .nav-link` красит редактор в тот же зелёный, что и
 * «Каталог прошивок», а пульс у точки гасит (animation: none).
 * Здесь возвращаем кнопке вес: единственная в ряду залитая пилюля, живая точка
 * и блик. Селекторы намеренно повторяют вес poster-v3 - файл подключается после
 * него, поэтому при равной специфичности выигрывает порядок.
 *
 * Базовые (низкоспецифичные) правила той же кнопки живут в инлайновом <style>
 * шапки: они работают там, где poster-v3 нет вообще - на статических лендингах.
 */
html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor {
  position: relative;
  overflow: hidden;
  border-color: rgba(150, 80, 5, .5) !important;
  background: linear-gradient(180deg, var(--etc-editor-amber), var(--etc-editor-amber-2)) !important;
  color: var(--etc-editor-ink) !important;
  font-weight: 850 !important;
  box-shadow: 0 8px 20px rgba(210, 120, 20, .3) !important;
}

html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor:hover {
  border-color: rgba(150, 80, 5, .6) !important;
  background: linear-gradient(180deg, #ffb457, #ef8a1d) !important;
  color: var(--etc-editor-ink) !important;
  box-shadow: 0 12px 26px rgba(210, 120, 20, .38) !important;
}

html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--etc-editor-ink);
  box-shadow: none;
  animation: etcEditorOnline 1.8s ease-in-out infinite;
}

html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 32%;
  pointer-events: none;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: etcEditorShine 6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor::before {
    animation: none;
  }
  html.etc-shop-redesign.etc-poster-v3[data-etc-theme] #navbarCollapse .etc-mainmenu .nav-item .nav-link.etc-online-editor::after {
    display: none;
  }
}

/* ============================ ПОЛОСА ПОД ШАПКОЙ ============================ */

.etc-editor-bar {
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(255, 166, 58, .22);
  border-bottom: 1px solid rgba(255, 166, 58, .22);
  background:
    linear-gradient(90deg, rgba(255, 166, 58, .17), rgba(255, 166, 58, .06) 58%, rgba(255, 166, 58, .02)),
    var(--etc-panel, #fffdf8);
}

/* Блик: раз в 7 секунд проезжает по полосе, чтобы её замечали в потоке страницы. */
.etc-editor-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -35%;
  width: 28%;
  pointer-events: none;
  transform: skewX(-18deg);
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .22), transparent);
  animation: etcEditorBarShine 7s ease-in-out infinite;
}

@keyframes etcEditorBarShine {
  0%, 78% { left: -35%; }
  100% { left: 125%; }
}

.etc-editor-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  /* только вертикальные отступы: горизонтальные приходят от .container темы */
  padding-top: 9px;
  padding-bottom: 9px;
}

.etc-editor-bar__pulse {
  position: relative;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--etc-editor-amber);
  box-shadow: 0 0 0 0 rgba(255, 166, 58, .7);
  animation: etcEditorPulse 1.8s ease-out infinite;
}

@keyframes etcEditorPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 166, 58, .7); }
  70% { box-shadow: 0 0 0 9px rgba(255, 166, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 166, 58, 0); }
}

.etc-editor-bar__text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--etc-text, #1b211e);
}

.etc-editor-bar__text b {
  font-weight: 800;
  margin-right: 8px;
}

.etc-editor-bar__text span {
  color: var(--etc-muted, #5d6a63);
}

.etc-editor-bar__cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--etc-editor-amber), var(--etc-editor-amber-2));
  color: var(--etc-editor-ink) !important;
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none !important;
  box-shadow: 0 8px 20px rgba(210, 120, 20, .28);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.etc-editor-bar__cta:hover,
.etc-editor-bar__cta:focus {
  transform: translateY(-1px);
  filter: brightness(1.06);
  color: var(--etc-editor-ink) !important;
  box-shadow: 0 12px 26px rgba(210, 120, 20, .34);
}

.etc-editor-bar__close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--etc-muted, #5d6a63);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.etc-editor-bar__close:hover {
  background: rgba(125, 125, 125, .14);
  color: var(--etc-text, #1b211e);
}

@media (max-width: 767.98px) {
  .etc-editor-bar__inner {
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  /* Две строки: «точка - название - крестик», под ними кнопка во всю ширину. */
  .etc-editor-bar__pulse { order: 1; }
  .etc-editor-bar__text {
    order: 2;
    flex: 1 1 auto;
    font-size: 13px;
  }
  /* На узком экране остаётся только суть: название сервиса и кнопка. */
  .etc-editor-bar__text span {
    display: none;
  }
  .etc-editor-bar__close {
    order: 3;
    margin-left: auto;
  }
  .etc-editor-bar__cta {
    order: 4;
    flex: 1 1 100%;
    justify-content: center;
    padding: 11px 16px;
  }
}

/* ================================ МОДАЛКА ================================= */

/* Модалку скрипт кладёт прямым ребёнком <body>, а у редизайна там висит
   `html.etc-shop-redesign body > * { position: relative; z-index: 1 }` - оно
   перебивает position:fixed по специфичности. Возвращаем фиксацию тем же
   приёмом, что etc-custom.css делает для .modal и кнопки «наверх». */
html.etc-shop-redesign body > .etc-editor-modal {
  position: fixed !important;
  z-index: 100050 !important;
}

.etc-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 100050; /* выше Telegram-FAB (99999) и cookie-баннера */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 10, 7, .68);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .22s ease;
  overflow-y: auto;
}

.etc-editor-modal.is-open {
  opacity: 1;
}

/* Фокус ставится на саму карточку (tabindex=-1): кольцо темы поверх янтарной
   кнопки читалось как ошибка вёрстки, а клавиатурный фокус всё равно внутри
   диалога - первый Tab уводит на крестик. Само кольцо у карточки гасим: тема
   рисует его через `html.etc-poster-v3 :focus-visible`, и на всю карточку оно
   выглядит как зелёная рамка вокруг окна. Клавиатурная навигация не страдает -
   у крестика, кнопки и ссылки внутри кольцо остаётся. */
html.etc-poster-v3 .etc-editor-modal__card:focus,
html.etc-poster-v3 .etc-editor-modal__card:focus-visible,
.etc-editor-modal__card:focus,
.etc-editor-modal__card:focus-visible {
  outline: none !important;
  box-shadow: 0 34px 80px rgba(0, 0, 0, .4) !important;
}

.etc-editor-modal__card {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: 30px 30px 26px;
  border: 1px solid var(--etc-line-strong, rgba(120, 130, 125, .22));
  border-radius: var(--etc-radius-lg, 22px);
  background: var(--etc-panel, #ffffff);
  color: var(--etc-text, #1b211e);
  box-shadow: 0 34px 80px rgba(0, 0, 0, .4);
  transform: translateY(14px) scale(.985);
  transition: transform .24s cubic-bezier(.22, .8, .3, 1);
}

.etc-editor-modal.is-open .etc-editor-modal__card {
  transform: translateY(0) scale(1);
}

/* Янтарный кант сверху - тот же акцент, что у кнопки в шапке и у полосы. */
.etc-editor-modal__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--etc-editor-amber), transparent);
}

.etc-editor-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--etc-muted, #5d6a63);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.etc-editor-modal__close:hover {
  background: rgba(125, 125, 125, .14);
  color: var(--etc-text, #1b211e);
}

.etc-editor-modal__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--etc-editor-amber-2);
}

.etc-editor-modal__kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--etc-editor-amber);
  animation: etcEditorPulse 1.8s ease-out infinite;
}

.etc-editor-modal__title {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 850;
  color: var(--etc-text, #1b211e);
}

.etc-editor-modal__lead {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--etc-muted, #5d6a63);
}

.etc-editor-modal__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 20px;
}

.etc-editor-modal__stat {
  padding: 12px 10px;
  border: 1px solid var(--etc-line, rgba(120, 130, 125, .16));
  border-radius: var(--etc-radius-md, 15px);
  background: var(--etc-panel-2, rgba(255, 166, 58, .07));
  text-align: center;
}

.etc-editor-modal__stat b {
  display: block;
  font-size: 24px;
  font-weight: 850;
  line-height: 1.1;
  color: var(--etc-editor-amber-2);
}

.etc-editor-modal__stat span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--etc-muted, #5d6a63);
}

.etc-editor-modal__list {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.etc-editor-modal__list li {
  position: relative;
  padding: 0 0 0 26px;
  margin-bottom: 9px;
  font-size: 14.5px;
  line-height: 1.5;
}

.etc-editor-modal__list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--etc-editor-amber);
}

.etc-editor-modal__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.etc-editor-modal__cta {
  flex: 1 1 240px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border-radius: 13px;
  background: linear-gradient(180deg, var(--etc-editor-amber), var(--etc-editor-amber-2));
  color: var(--etc-editor-ink) !important;
  font-size: 15px;
  font-weight: 850;
  text-decoration: none !important;
  box-shadow: 0 12px 26px rgba(210, 120, 20, .3);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.etc-editor-modal__cta:hover,
.etc-editor-modal__cta:focus {
  transform: translateY(-1px);
  filter: brightness(1.06);
  color: var(--etc-editor-ink) !important;
  box-shadow: 0 16px 32px rgba(210, 120, 20, .36);
}

.etc-editor-modal__later {
  flex: 0 0 auto;
  padding: 13px 18px;
  border: 1px solid var(--etc-line-strong, rgba(120, 130, 125, .22));
  border-radius: 13px;
  background: transparent;
  color: var(--etc-muted, #5d6a63);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.etc-editor-modal__later:hover {
  background: rgba(125, 125, 125, .1);
  color: var(--etc-text, #1b211e);
}

.etc-editor-modal__note {
  margin: 16px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--etc-muted, #5d6a63);
}

@media (max-width: 575.98px) {
  .etc-editor-modal {
    padding: 12px;
  }
  .etc-editor-modal__card {
    padding: 26px 20px 22px;
  }
  .etc-editor-modal__title {
    font-size: 21px;
  }
  .etc-editor-modal__stat b {
    font-size: 20px;
  }
  .etc-editor-modal__later {
    flex: 1 1 100%;
  }
}

/* Ничего не мигает и не ездит у тех, кто просил систему не анимировать. */
@media (prefers-reduced-motion: reduce) {
  .etc-editor-bar::after,
  .etc-editor-bar__pulse,
  .etc-editor-modal__kicker i {
    animation: none;
  }
  .etc-editor-bar::after {
    display: none;
  }
  .etc-editor-modal,
  .etc-editor-modal__card,
  .etc-editor-bar__cta,
  .etc-editor-modal__cta {
    transition: none;
  }
  .etc-editor-modal__card {
    transform: none;
  }
}
