/* Форма заявки в попапе. Каркас (подложка, анимации, крестик, шторка на телефоне) берётся из .contact-dialog в styles.css */

.lead-dialog {
  width: min(600px, calc(100vw - 32px));
}
.lead-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
}
.lead-head {
  position: relative;
  flex: none;
  padding: 32px 32px 20px;
}
.lead-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.lead-form[hidden],
.lead-head[hidden] {
  display: none;
}
.lead-body {
  display: grid;
  gap: 28px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 32px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lead-foot {
  flex: none;
  padding: 16px 32px 28px;
  border-top: 1px solid rgb(var(--obsidian-rgb) / 0.08);
}

.req {
  color: var(--sunset-blaze);
}
.lead-hint {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--graphite-grey);
}

/* ---------- Поля ---------- */
.lead-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.field__label,
.lead-chips legend {
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}
.field__opt {
  font-weight: 400;
  color: var(--graphite-grey);
  opacity: 0.7;
}
.field__input {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 16px; /* радиус карточки 22 минус отступ 6 */
  font: inherit;
  font-size: 16px;
  color: var(--obsidian-black);
  background: var(--mist-sand);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
textarea.field__input {
  height: auto;
  min-height: 96px;
  padding-block: 16px;
  line-height: 1.45;
  resize: vertical;
}
.field__input::placeholder {
  color: rgb(var(--obsidian-rgb) / 0.4);
}
.field__input:hover {
  border-color: rgb(var(--obsidian-rgb) / 0.15);
}
.field__input:focus {
  outline: none;
  border-color: var(--obsidian-black);
  background: var(--pure-white);
}
.field.is-invalid .field__input {
  border-color: var(--alert-red);
  background: rgb(var(--obsidian-rgb) / 0.02);
}
.field__error {
  font-size: 13px;
  line-height: 1.3;
  color: var(--alert-red);
}
.field__error[hidden] {
  display: none;
}

/* Ловушка для ботов: человек её не видит */
.lead-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Выбор «чипсами» (radio внутри) ---------- */
.lead-chips {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.lead-chips legend {
  margin-bottom: 12px;
}
.lead-chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.lead-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.lead-chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.lead-chip span {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--mist-sand);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.lead-chip:hover span {
  border-color: rgb(var(--obsidian-rgb) / 0.25);
}
.lead-chip input:checked + span {
  color: var(--pure-white);
  background: var(--obsidian-black);
  border-color: var(--obsidian-black);
}
.lead-chip input:focus-visible + span {
  outline: 2px solid var(--sunset-blaze);
  outline-offset: 2px;
}
.lead-chips.is-invalid .lead-chip span {
  border-color: var(--alert-red);
}
.lead-chips--sm .lead-chip span {
  height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

/* ---------- Уточнения по направлению ---------- */
.lead-extra {
  display: grid;
  gap: 24px;
  padding-top: 28px;
  border-top: 1px solid rgb(var(--obsidian-rgb) / 0.1);
}
.lead-extra__questions {
  display: grid;
  gap: 24px;
}
.lead-extra__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}
.lead-extra__title span {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 400;
  color: var(--graphite-grey);
}
.lead-extra .lead-chip span {
  background: var(--mist-sand);
}
.lead-extra .lead-chip input:checked + span {
  background: var(--obsidian-black);
}
.lead-extra [data-for] {
  display: grid;
  gap: 24px;
  animation: lead-fade 0.3s ease;
}
.lead-extra[hidden],
.lead-extra [hidden] {
  display: none;
}
@keyframes lead-fade {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---------- Подвал: кнопка и пояснения ---------- */
.lead-submit {
  width: 100%;
  height: 58px;
  border: 0;
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
}
.lead-submit[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.lead-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--graphite-grey);
}
.lead-note a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lead-note a:hover {
  color: var(--sunset-blaze);
}
.lead-alt {
  display: block;
  margin-top: 6px;
}
.lead-alt a {
  color: var(--obsidian-black);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lead-alt a:hover {
  color: var(--sunset-blaze);
}
.lead-error {
  margin-bottom: 12px;
  font-size: 14px;
  text-align: center;
  color: var(--alert-red);
}
.lead-error[hidden] {
  display: none;
}

/* ---------- Успех ---------- */
.lead-success {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 56px 32px 40px;
  text-align: center;
}
.lead-success[hidden] {
  display: none;
}
.lead-success__img {
  display: block;
  width: clamp(150px, 16vw, 190px);
  height: auto;
  margin-bottom: -4px;
  -webkit-user-drag: none;
  user-select: none;
}
.lead-success__title {
  margin-top: 8px;
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}
.lead-success__text {
  max-width: 28em;
  font-size: 16px;
  line-height: 1.5;
  color: var(--graphite-grey);
}
.lead-success .btn {
  margin-top: 16px;
}

/* ---------- Телефон: шторка снизу ---------- */
@media (max-width: 600px) {
  .lead-dialog {
    width: 100%;
  }
  .lead-panel {
    max-height: 94dvh;
    padding: 0;
    border-radius: var(--radius-photo) var(--radius-photo) 0 0;
  }
  .lead-head {
    padding: 24px 20px 16px;
  }
  .lead-body {
    padding: 4px 20px 20px;
    gap: 24px;
  }
  .lead-foot {
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .lead-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .lead-extra {
    padding-top: 24px;
  }
  .lead-chip span {
    padding: 0 16px;
  }
  /* четыре способа связи помещаются в одну строку */
  .lead-chips[data-field="method"] .lead-chips__list {
    gap: 6px;
  }
  .lead-chips[data-field="method"] .lead-chip span {
    padding: 0 13px;
    font-size: 14px;
  }
  .lead-alt {
    display: none;
  }
  .lead-success {
    padding: 48px 20px calc(32px + env(safe-area-inset-bottom, 0px));
  }
}
