/* ============================================================
   Форма заявки (главная, /services). Заявка уходит в /api/lead → Telegram.
   Ширина резиновая; раскладка зависит от ширины самой формы (container query).
   ============================================================ */
.lead-form {
  --lf-ink: #0f0926;
  --lf-purple: #6c2bd9;
  --lf-purple-hover: #5a1fc4;
  --lf-line: rgba(15, 9, 38, 0.12);
  --lf-mute: rgba(15, 9, 38, 0.58);
  --lf-error: #e5484d;
  container-type: inline-size;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px);
  border-radius: clamp(22px, 3vw, 32px);
  background: #f6f5fb;
  color: var(--lf-ink);
  text-align: left;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.6);
}

.lead-form__grid { display: grid; gap: 28px; }

/* Левая колонка: направление и пояснение */
.lead-form__title {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.lead-form__note { margin: 0 0 22px; font-size: 15px; line-height: 1.5; color: var(--lf-mute); }
.lead-form__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.lead-form__legend {
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--lf-mute);
}
.lead-form__group {
  width: 100%;
  margin: 10px 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(15, 9, 38, 0.38);
}
.lead-form__legend + .lead-form__group { margin-top: 0; }
.lead-chip { position: relative; cursor: pointer; }
.lead-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lead-chip span {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 100px;
  border: 1px solid var(--lf-line);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--lf-ink);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lead-chip:hover span { border-color: rgba(15, 9, 38, 0.32); }
.lead-chip input:checked + span { background: var(--lf-ink); border-color: var(--lf-ink); color: #fff; }
.lead-chip input:focus-visible + span { outline: 2px solid var(--lf-purple); outline-offset: 2px; }
.lead-form__alt {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--lf-purple);
  text-decoration: none;
}
.lead-form__alt:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Правая колонка: поля */
.lead-form__row { display: grid; gap: 0 14px; }
.lead-field { display: block; margin-bottom: 14px; }
.lead-field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--lf-mute);
}
.lead-field input,
.lead-field textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid var(--lf-line);
  background: #fff;
  color: var(--lf-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lead-field textarea { min-height: 112px; resize: vertical; }
.lead-field input::placeholder,
.lead-field textarea::placeholder { color: rgba(15, 9, 38, 0.36); }
.lead-field input:focus,
.lead-field textarea:focus {
  outline: none;
  border-color: var(--lf-purple);
  box-shadow: 0 0 0 4px rgba(108, 43, 217, 0.14);
}
.lead-field.is-invalid input { border-color: var(--lf-error); }

/* Ловушка для ботов */
.lead-form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Согласие */
.lead-consent {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 22px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--lf-mute);
  cursor: pointer;
}
.lead-consent input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 7px;
  border: 1.5px solid rgba(15, 9, 38, 0.3);
  background: #fff center / 15px no-repeat;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.lead-consent input:checked {
  background-color: var(--lf-purple);
  border-color: var(--lf-purple);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.lead-consent input:focus-visible { outline: 2px solid var(--lf-purple); outline-offset: 2px; }
.lead-consent.is-invalid input { border-color: var(--lf-error); }
.lead-consent a { color: var(--lf-ink); text-decoration: underline; text-underline-offset: 3px; }

.lead-form__submit {
  width: 100%;
  padding: 18px 28px;
  border: 0;
  border-radius: 100px;
  background: var(--lf-purple);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(108, 43, 217, 0.7);
  transition: transform 0.2s, background 0.2s;
}
.lead-form__submit:hover { background: var(--lf-purple-hover); transform: translateY(-1px); }
.lead-form__submit:disabled { opacity: 0.6; cursor: default; transform: none; }
.lead-form__status { margin: 12px 0 0; font-size: 14px; color: var(--lf-error); }
.lead-form__status:empty { display: none; }

/* Успех */
.lead-form__success { text-align: center; padding: clamp(16px, 4vw, 40px) 8px; outline: none; }
.lead-form__success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--lf-purple);
  color: #fff;
}
.lead-form__success-icon svg { width: 30px; height: 30px; }
.lead-form__success-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.lead-form__success-text { margin: 0; font-size: 15px; color: var(--lf-mute); }
.lead-form.is-sent > :not(.lead-form__success) { display: none; }

/* Раскладка по ширине формы */
@container (min-width: 560px) {
  .lead-form__row { grid-template-columns: 1fr 1fr; }
}
@container (min-width: 860px) {
  .lead-form__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; }
  .lead-form__side { padding-top: 4px; }
}

/* Отдельные поля «Телефон» и «Telegram»: достаточно одного из них */
.lead-field--wide { grid-column: 1 / -1; }
.lead-form__hint { margin: -4px 0 14px; font-size: 13px; line-height: 1.4; opacity: .65; }
.lead-form__hint.is-invalid { opacity: 1; color: #ff6b8b; }
