/* 04.09.2026 - п.30 списка Никиты «токены почти не используются, 3359 хардкодов цвета».
   Точные совпадения канона заменены на var(--токен, #значение); фолбэк оставлен намеренно -
   если переменная потеряется, цвет останется прежним. Соответствие:
   #0E0E12 --ink · #1E1E24 --ink-2 · #3D3D48 --ink-3 · #6E6E76 --muted · #ECECF0 --line ·
   #F0F0F3 --line-2 · #F7F7F9 --bg · #E11D2E --accent · #B8152B --accent-2 · #1E8C4A --success ·
   #FAEDD1 --warn-soft · #FFFFFF --bg-card (фоны) либо --ink-invert (текст, иконки, обводки).
   Намеренно НЕ трогали #5A5A66, #9C9CA8, #C07A00: их токены (--ink-4, --muted-2, --warn)
   new-catalog-after.css переопределяет внутри .how/.faq/.adv/.viewed/.seo/.contacts-section
   на другие значения - подстановка var() там сменила бы цвет. Заменено в файле: 39. */
/* 04.09.2026 — всплывающий квиз подбора (includes/nd-quiz.php, js/nd-quiz.js).
   Стиль взят у страницы /forma/ (.ndf-*) и карточек нового дизайна: те же радиусы, тот же красный,
   Montserrat. На телефоне окно — лист снизу на всю ширину, на компьютере — окно по центру. */

html.ndq-lock, html.ndq-lock body { overflow: hidden; }

.ndq { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.ndq[hidden] { display: none !important; }
.ndq-back { position: absolute; inset: 0; background: rgba(14, 14, 18, .55); opacity: 0; transition: opacity .22s; }
.ndq.is-open .ndq-back { opacity: 1; }

.ndq-win {
  /* 07.09.2026, аудит п.13: единица vh на телефоне считает экран БЕЗ учёта адресной строки,
     поэтому лист вылезал за нижний край. dvh считает реально видимую высоту; строка с vh
     оставлена первой как фолбэк для старых браузеров. */
  position: relative; width: 100%; max-width: 560px; overflow-y: auto;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--bg-card, #FFFFFF); border-radius: 22px; padding: 26px 26px 20px;
  box-shadow: 0 24px 70px rgba(14, 14, 18, .28);
  font-family: Montserrat, Inter, system-ui, sans-serif; color: var(--ink, #0E0E12);
  transform: translateY(14px) scale(.985); opacity: 0; transition: transform .22s, opacity .22s;
}
.ndq.is-open .ndq-win { transform: none; opacity: 1; }

.ndq-x {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: #F1F2F5; color: var(--muted, #6E6E76); cursor: pointer; transition: background .15s, color .15s;
}
.ndq-x:hover { background: #E7E8EC; color: var(--ink, #0E0E12); }

.ndq-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent, #E11D2E); }
.ndq-title { font-size: 22px; font-weight: 800; line-height: 1.2; margin: 6px 0 14px; padding-right: 34px; }

.ndq-prog { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.ndq-prog-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--line, #ECECF0); overflow: hidden; }
.ndq-prog-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent, #E11D2E); transition: width .25s; }
.ndq-prog-t { font-size: 12.5px; font-weight: 600; color: var(--muted, #6E6E76); white-space: nowrap; }
.ndq-prog-t b { color: var(--ink, #0E0E12); }

.ndq-step { display: none; }
.ndq-step.is-on { display: block; animation: ndq-in .22s ease both; }
@keyframes ndq-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ndq-step.is-on { animation: none; } .ndq-win, .ndq-back { transition: none; } }

.ndq-q { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 14px; }
.ndq-sub { font-size: 12.5px; font-weight: 700; color: var(--muted, #6E6E76); margin: 16px 0 8px; }
.ndq-hint { font-size: 12.5px; line-height: 1.5; color: var(--muted, #6E6E76); margin-top: 10px; }

/* плитки-варианты */
.ndq-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ndq-tiles-sm { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ndq-tile { position: relative; cursor: pointer; }
.ndq-tile input { position: absolute; opacity: 0; width: 0; height: 0; }
.ndq-tile-b {
  display: block; padding: 13px 14px; border: 1px solid #E3E5EA; border-radius: 14px; background: var(--bg-card, #FFFFFF);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ndq-tile-b b { display: block; font-size: 14px; font-weight: 700; line-height: 1.25; }
.ndq-tile-b i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted, #6E6E76); margin-top: 3px; }
.ndq-tile:hover .ndq-tile-b { border-color: var(--ink, #0E0E12); }
.ndq-tile input:checked + .ndq-tile-b { border-color: var(--accent, #E11D2E); background: rgba(225, 29, 46, .05); box-shadow: inset 0 0 0 1px var(--accent, #E11D2E); }
.ndq-tile input:focus-visible + .ndq-tile-b { outline: 2px solid var(--accent, #E11D2E); outline-offset: 2px; }
.ndq-tile-sm .ndq-tile-b { padding: 10px 12px; }
.ndq-tile-sm .ndq-tile-b b { font-size: 13px; font-weight: 600; }

/* поля */
.ndq-field { position: relative; display: block; margin-top: 10px; }
.ndq-field input, .ndq-field textarea {
  width: 100%; padding: 20px 14px 8px; border: 1px solid #E3E5EA; border-radius: 14px; background: var(--bg-card, #FFFFFF);
  font: 500 15px/1.3 Montserrat, Inter, system-ui, sans-serif; color: var(--ink, #0E0E12); transition: border-color .15s;
}
.ndq-field textarea { padding-top: 22px; resize: vertical; min-height: 84px; }
.ndq-field input:focus, .ndq-field textarea:focus { outline: none; border-color: var(--ink, #0E0E12); }
.ndq-field-l {
  position: absolute; left: 15px; top: 15px; font-size: 14px; color: #8A8A94; pointer-events: none;
  transition: transform .15s, font-size .15s, color .15s; transform-origin: left top;
}
.ndq-field-l i { color: var(--accent, #E11D2E); font-style: normal; }
.ndq-field input:focus + .ndq-field-l,
.ndq-field input:not(:placeholder-shown) + .ndq-field-l,
.ndq-field textarea:focus + .ndq-field-l,
.ndq-field textarea:not(:placeholder-shown) + .ndq-field-l { transform: translateY(-8px) scale(.78); color: var(--muted, #6E6E76); }
.ndq-field input.is-bad, .ndq-field textarea.is-bad { border-color: var(--accent, #E11D2E); animation: ndq-shake .3s; }
@keyframes ndq-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.ndq-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ndq-two .ndq-field { margin-top: 0; }

.ndq-more { margin-top: 14px; }
.ndq-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink, #0E0E12); list-style: none; }
.ndq-more > summary::-webkit-details-marker { display: none; }
.ndq-more > summary::before { content: '+ '; color: var(--accent, #E11D2E); font-weight: 800; }
.ndq-more[open] > summary::before { content: '– '; }
.ndq-more > summary span { font-weight: 400; color: #8A8A94; }

.ndq-policy { display: flex; gap: 9px; align-items: flex-start; margin-top: 16px; font-size: 12px; line-height: 1.45; color: var(--muted, #6E6E76); cursor: pointer; }
.ndq-policy input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent, #E11D2E); flex: none; }
.ndq-policy a { color: var(--ink, #0E0E12); }
.ndq-policy input.is-bad { outline: 2px solid var(--accent, #E11D2E); outline-offset: 2px; }

/* навигация */
/* Форме оставлен класс .request-form-wrapper — его требует общий обработчик отправки,
   но вместе с ним прилетают стили карточки со страницы /forma/ (белый фон, паддинг 34/40,
   радиус 24, тень), и внутри окна получалась вторая карточка. Сбрасываем. */
.ndq .ndq-form { background: none; padding: 0; border-radius: 0; box-shadow: none; border: 0; max-width: none; margin: 0; }

.ndq-nav { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.ndq .ndq-back-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 13px 16px; border: 1px solid #E3E5EA; border-radius: 999px;
  background: var(--bg-card, #FFFFFF); font: 600 14px/1 Montserrat, Inter, system-ui, sans-serif; color: var(--ink, #0E0E12); cursor: pointer; transition: border-color .15s;
}
.ndq .ndq-back-btn:hover { border-color: var(--ink, #0E0E12); }
/* .ndq перед классом кнопки намеренно: у сайта есть общий сброс для button (прозрачный фон,
   нулевой паддинг), одиночного класса не хватало — кнопка выходила текстом без плашки. */
.ndq .ndq-next, .ndq .ndq-submit {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 14px 22px; border: 0; border-radius: 999px; background: var(--accent, #E11D2E); color: var(--ink-invert, #FFFFFF);
  font: 700 15px/1 Montserrat, Inter, system-ui, sans-serif; cursor: pointer; transition: background .15s;
}
.ndq .ndq-next:hover, .ndq .ndq-submit:hover { background: var(--accent-2, #B8152B); }
.ndq .ndq-next[hidden], .ndq .ndq-submit[hidden], .ndq .ndq-back-btn[hidden] { display: none !important; }

.ndq-under { font-size: 11.5px; line-height: 1.5; color: #8A8A94; margin-top: 12px; text-align: center; }
.ndq-wait { padding: 20px 0; text-align: center; font-weight: 600; }

/* подвал окна */
.ndq-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid #F1F2F5; }
.ndq-foot-t { display: block; font-size: 12px; color: var(--muted, #6E6E76); margin-bottom: 8px; }
.ndq-foot-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ndq-ch {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #E3E5EA; border-radius: 10px;
  font: 600 12.5px/1 Montserrat, Inter, system-ui, sans-serif; color: var(--ink, #0E0E12); text-decoration: none; transition: border-color .15s;
}
.ndq-ch:hover { border-color: var(--ink, #0E0E12); }

/* успех: скрываем шаги и навигацию, оставляем сообщение */
.ndq-form.is-sent .ndq-step,
.ndq-form.is-sent .ndq-nav,
.ndq-form.is-sent .ndq-under { display: none; }

@media (max-width: 700px) {
  /* лист снизу: большим пальцем дотягиваешься до кнопок, окно не прыгает при появлении клавиатуры */
  .ndq { padding: 0; align-items: flex-end; }
  .ndq-win {
    max-width: none; border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(30px);
    max-height: 92vh; max-height: 92dvh;   /* 07.09.2026, аудит п.13 — см. комментарий выше */
  }
  .ndq-title { font-size: 19px; margin-bottom: 12px; }
  .ndq-q { font-size: 16px; }
  .ndq-tiles { grid-template-columns: 1fr; }
  .ndq-tiles-sm { grid-template-columns: 1fr 1fr; }
  .ndq-two { grid-template-columns: 1fr; }
  .ndq-nav { position: sticky; bottom: 0; background: var(--bg-card, #FFFFFF); padding-top: 12px; margin-top: 16px; }
  .ndq .ndq-next, .ndq .ndq-submit { min-height: 52px; }
}

/* ---------- п.28 списка Никиты: «форму подбора на телефоне убрать, вместо неё окно» ----------
   На телефоне единственная встроенная форма подбора на главной — в правой панели блока
   «Как проходит заказ» (шаг 1, .ndh-media[data-media="form"], 433 px высоты). Теперь её роль
   играет всплывающий квиз, поэтому на телефоне форму не показываем: остаются пояснения к шагу
   и кнопка «Начать подбор бесплатно» — она этот квиз и открывает. На компьютере всё как было. */
@media (max-width: 700px) {
  body[class*="new-design"] .ndh-media[data-media="form"] { display: none !important; }
}

/* ---------- поверх окна не должно висеть ничего чужого ----------
   Круглая кнопка связи (#enc-fab-callback) и её пузырь-приветствие (#enc-fab-greet) сидят
   на z-index 999999 — выше окна квиза, и на телефоне кнопка попадала ровно в зону шага
   с телефоном и согласиями. Пока окно открыто, прячем оба. */
html.ndq-lock #enc-fab-callback,
html.ndq-lock #enc-fab-greet,
html.ndq-lock #enc-fab-msgs { display: none !important; }

/* ---------- п.28, вторая половина: встроенная форма подбора в каталоге ----------
   На /korea/ на телефоне блок-помощник с формой занимает около 1 400 px — почти два экрана.
   Его роль теперь у всплывающего квиза: кнопки подбора на той же странице открывают окно.
   На компьютере блок остаётся. */
@media (max-width: 700px) {
  body.new-design-catalog .helper-section { display: none !important; }
}

/* ---------- 07.09.2026, аудит п.13: низкие экраны (375x667, 360x780) ----------
   Ряд быстрых контактов (.ndq-foot: 8 800…, MAX, Telegram, WhatsApp) и дисклеймер лежат
   в разметке ПОСЛЕ кнопки «Далее», а кнопка на телефоне липкая (position: sticky; bottom: 0).
   На экране ниже ~740 px содержимое окна не помещается целиком, и прокрученный до конца
   подвал оказывался ровно под липкой кнопкой — до контактов было не добраться.
   На таких экранах кнопку не липним: окно прокручивается обычным порядком, видно всё.
   Выше 740 px содержимое помещается без прокрутки, и липкая кнопка ничего не перекрывает. */
@media (max-width: 700px) and (max-height: 740px) {
  .ndq-nav { position: static; }
  .ndq-win { max-height: calc(100vh - 8px); max-height: calc(100dvh - 8px); }
}
