/* Smile Lab USA — окно запроса консультации (assets/sl-consult.js).

   Отдельный файл, а не строки в sl-design.css: этот блок живёт только на тех
   страницах, где стоит кнопка консультации, и подключается ровно там.

   Токены палитры берутся из sl-design.css (он грузится на каждой странице
   последним). Значения продублированы через var() с запасным литералом, чтобы
   окно не поехало, если файл когда-нибудь окажется подключён в одиночку.

   Брейкпоинта у формы нет намеренно: поля — flex-элементы с минимальной
   шириной, в узком окне пара «телефон и почта» складывается сама. Так форма
   верна и на 390px, и на 1440px, без второго набора правил. */

.slcs {
  position: fixed;
  inset: 0;
  z-index: 100000;              /* поверх шапки и плавающей кнопки квоты (99999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(28, 27, 25, .58);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'Assistant', Helvetica, Arial, sans-serif;
}

.slcs[hidden] { display: none; }

.slcs *,
.slcs *::before,
.slcs *::after { box-sizing: border-box; }

/* Страница под окном не прокручивается: иначе на телефоне палец уводит фон,
   а форма остаётся стоять, и это читается как зависшая страница. */
.slcs-open,
.slcs-open body { overflow: hidden; }

.slcs__panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto;
  padding: 26px 24px 22px;
  background: #fff;
  border-radius: var(--radius-card, 12px);
  box-shadow: 0 18px 48px rgba(20, 50, 43, .28);
  color: var(--sl-ink, #1c1b19);
  animation: slcs-in var(--dur-entrance, 500ms) var(--ease-expressive, cubic-bezier(.25, .85, .35, 1)) both;
}

@keyframes slcs-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.slcs__x {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font: 400 26px/1 'Assistant', Helvetica, Arial, sans-serif;
  color: #8d867c;
  cursor: pointer;
}

.slcs__x:hover { color: var(--sl-ink, #1c1b19); background: var(--sl-cream, #faf7f2); }
.slcs__x:focus-visible { outline: 2px solid var(--sl-copper, #b4400f); outline-offset: 2px; }

.slcs__h {
  margin: 0 34px 8px 0;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--sl-forest, #14322b);
  /* Заголовок в одну строку: переносить его нечем и незачем. */
  white-space: nowrap;
}

/* balance, а не pretty: pretty оставляет последнюю строку огрызком в два слова
   (замерено — 47% ширины на 390px), balance разгоняет строки ровно и держит
   последнюю не короче 94% на обоих размерах. Правило заполнения строк. */
.slcs__lead {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
  color: #56514a;
  text-wrap: balance;
}

.slcs__form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
}

/* Телефон и почта стоят рядом: обязателен один из двух, и рядом это видно
   без единого слова объяснения. В узком окне пара складывается сама. */
.slcs__pair {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.slcs__pair .slcs__in { flex: 1 1 165px; min-width: 0; }

.slcs__in {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #e2d9c9;
  border-radius: 11px;
  background: #fdfbf7;
  font: 400 15px/1.25 'Assistant', Helvetica, Arial, sans-serif;
  color: var(--sl-ink, #1c1b19);
  transition-property: border-color, box-shadow;
  transition-duration: var(--dur-fast, 150ms);
  transition-timing-function: var(--ease-productive, cubic-bezier(.25, 0, .35, .95));
}

.slcs__in::placeholder { color: #9b948a; opacity: 1; }

.slcs__in:focus,
.slcs__in:focus-visible {
  outline: none;
  border-color: var(--sl-copper, #b4400f);
  box-shadow: 0 0 0 3px rgba(180, 64, 15, .12);
}

.slcs__in[disabled] { opacity: .6; }

.slcs__in[hidden] { display: none; }

/* «Я уже знаю, что мне нужно». Не кнопка действия, а строка-ссылка: список
   изделий нужен меньшинству, и до нажатия он занимать место не должен. */
.slcs__know {
  align-self: flex-start;
  margin: -2px 0 0;
  padding: 2px 0;
  border: 0;
  background: none;
  font: 400 13.5px/1.35 'Assistant', Helvetica, Arial, sans-serif;
  color: rgba(28, 27, 25, .62);
  text-decoration: underline;
  text-decoration-color: rgba(28, 27, 25, .28);
  text-underline-offset: 3px;
  cursor: pointer;
}

.slcs__know:hover {
  color: var(--sl-forest, #14322b);
  text-decoration-color: currentColor;
}

.slcs__know:focus-visible {
  outline: 2px solid var(--sl-copper, #b4400f);
  outline-offset: 2px;
}

.slcs__know[hidden] { display: none; }

.slcs__know[disabled] { opacity: .6; cursor: default; }

.slcs__sel { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* Пустой первый пункт списка читается серым, выбранный — чернилами:
   так видно, ответил человек или ещё нет. */
.slcs__sel:invalid,
.slcs__sel option[value=""] { color: #9b948a; }

.slcs__area {
  min-height: 78px;
  resize: vertical;
  line-height: 1.45;
}

/* Боты заполняют всё, что найдут; человек сюда не попадает. Прячем геометрией,
   а не display:none: часть ботов пропускает то, что вовсе не разложено. */
.slcs__honey {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.slcs__btn {
  margin: 5px 0 0;
  padding: 15px 20px;
  border: 0;
  border-radius: 11px;
  background: var(--cta-gold, #e8b54a);
  color: var(--cta-ink, #1c1b19);
  box-shadow: var(--cta-ring-shadow, inset 0 0 0 1px #a97c22);
  font: 800 16px/1.2 'Assistant', Helvetica, Arial, sans-serif;
  /* Подпись кнопки в одну строку, всегда. */
  white-space: nowrap;
  cursor: pointer;
  transition-property: background-color, color;
  transition-duration: var(--dur-fast, 150ms);
  transition-timing-function: var(--ease-productive, cubic-bezier(.25, 0, .35, .95));
}

.slcs__btn:hover { background: var(--cta-gold-hover, #d99e34); color: var(--cta-ink, #1c1b19); }
.slcs__btn:focus-visible { outline: 2px solid var(--sl-forest, #14322b); outline-offset: 2px; }
.slcs__btn[disabled] { opacity: .6; cursor: not-allowed; }

.slcs__msg {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #6b6459;
}

.slcs__msg--bad { color: #96350c; font-weight: 600; }

.slcs__msg--done {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--sl-forest, #14322b);
  font-weight: 600;
  text-wrap: balance;
}

.slcs__note {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #8d867c;
  text-align: center;
}

@media (max-width: 420px) {
  .slcs { padding: 10px; }
  .slcs__panel { padding: 22px 18px 18px; max-height: calc(100vh - 20px); }
  .slcs__h { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .slcs__panel { animation: none; }
  .slcs__in,
  .slcs__btn { transition-duration: .001ms !important; }
}
