/*
  English Room: раздел «Заявка». Форма с проверкой полей, свой выпадающий список
  «Зачем вам английский», галочка согласия и экран «Что будет дальше».
*/

.apply {
  background: var(--amber);
  color: var(--ink);
}

.apply__in {
  padding-top: 48px;
  padding-bottom: 52px;
}

.apply__title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1.02;
}

.apply__lead {
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--on-amber);
  text-wrap: pretty;
}

.apply__card {
  padding: 24px 20px;
  border-radius: 20px;
  background: var(--paper);
}

.apply__card-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
}

/* Плашка «Пробный урок с Ильёй, мини-группа» */
.pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--amber-light);
}

.pick__text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.pick__reset {
  flex: none;
  min-height: 44px;
  margin: -10px 0;
  padding: 0 4px;
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--amber-deep);
  cursor: pointer;
}

.pick__reset:hover {
  color: var(--ink);
}

/* ---------- Поля ---------- */

.form__fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.field__input {
  display: block;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--field);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: #9A8C7F;
  opacity: 1;
}

.field.has-error .field__input {
  border-color: var(--error);
}

.field .field__input:focus {
  border-color: var(--ink);
}

.field__error {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--error);
}

/* Обычный список остаётся в форме и хранит значение. Если скрипт не загрузился,
   виден он, со скриптом поверх рисуется свой */
.field__native {
  display: block;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--field);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--ink);
  font-size: 16px;
}

.select {
  position: relative;
}

.select__btn {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 54px;
  padding: 0 40px 0 16px;
  border: 1px solid var(--field);
  border-radius: 14px;
  background: #FFFFFF;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.select__btn:focus,
.select.is-open .select__btn {
  border-color: var(--ink);
}

.select__value {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.select__chevron {
  position: absolute;
  top: 50%;
  right: 16px;
  margin-top: -4px;
  transition: transform 0.2s;
}

.select.is-open .select__chevron {
  transform: rotate(180deg);
}

.select__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: min(384px, 55vh);
  margin: 0;
  padding: 5px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--field);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 18px 40px rgba(42, 31, 23, 0.18);
}

.select.is-open .select__list {
  display: block;
}

.select.is-up .select__list {
  top: auto;
  bottom: calc(100% + 6px);
}

.select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
}

.select__option.is-active {
  background: rgba(217, 139, 30, 0.14);
}

.select__option[aria-selected="true"] {
  font-weight: 600;
}

.select__check {
  display: none;
  flex: none;
}

.select__option[aria-selected="true"] .select__check {
  display: block;
}

/* ---------- Кнопка и согласие ---------- */

.form__bottom {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

.form__submit {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--amber-light);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.25s, opacity 0.2s;
}

.form__submit:hover {
  background: var(--ink-2);
}

.form__submit[aria-busy="true"] {
  opacity: 0.65;
  cursor: progress;
}

.consent {
  position: relative;
  order: -1;
}

.consent__label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.consent__box {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.consent__input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.consent__mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: #FFFFFF;
  pointer-events: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.consent__mark svg {
  opacity: 0;
  transition: opacity 0.15s;
}

.consent__input:checked + .consent__mark {
  border-color: var(--ink);
  background: var(--ink);
}

.consent__input:checked + .consent__mark svg {
  opacity: 1;
}

.consent.has-error .consent__mark {
  border-color: var(--error);
}

.consent__input:focus-visible + .consent__mark {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.consent__text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-4);
}

.consent__text a {
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid rgba(42, 31, 23, 0.35);
}

.consent__error {
  margin: 6px 0 0;
  font-size: 12px;
}

.form__fail {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--error);
}

/* ---------- Заявка отправлена ---------- */

.sent:focus {
  outline: none;
}

.sent__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
}

.sent__demo {
  display: table;
  margin: 0 0 16px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--amber-light);
  color: var(--amber-deep);
  font-size: 13px;
  font-weight: 600;
}

.sent__eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber-dark);
}

.sent__steps {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.sent__steps li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
}

.sent__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--amber-dark);
}

.sent__tg {
  display: flex;
  min-height: 56px;
  font-size: 15px;
}

.sent__again {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-4);
  cursor: pointer;
}

.sent__again:hover {
  color: var(--ink);
}

/* ---------- Контакты рядом с формой ---------- */

.apply__side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.contact-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid rgba(42, 31, 23, 0.35);
  border-radius: 16px;
}

a.contact-card:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.contact-card__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--on-amber-2);
}

.contact-card__value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

/* ---------- Планшет ---------- */

@media (min-width: 768px) {
  .apply__in {
    padding-top: max(64px, calc(96 * var(--u)));
    padding-bottom: max(64px, calc(104 * var(--u)));
  }

  .apply__title {
    margin-bottom: 20px;
    font-size: max(48px, calc(76 * var(--u)));
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .apply__lead {
    max-width: 640px;
    margin-bottom: max(36px, calc(52 * var(--u)));
    font-size: 20px;
  }

  .apply__card {
    padding: 34px 36px 32px;
    border-radius: 22px;
  }

  .apply__card-title {
    margin-bottom: 26px;
    font-size: 28px;
  }

  .pick {
    padding: 14px 18px;
  }

  .pick__text {
    font-size: 15px;
  }

  .form__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
  }

  .field--select {
    grid-column: 1 / -1;
  }

  .field__input,
  .field__native,
  .select__btn {
    height: 56px;
    padding-left: 18px;
  }

  .field__input {
    padding-right: 18px;
  }

  .select__chevron {
    right: 18px;
  }

  .form__bottom {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 28px;
    margin-top: 28px;
  }

  .form__submit {
    flex: none;
    width: 300px;
    height: 62px;
  }

  .consent {
    order: 0;
    flex: 1 1 260px;
    max-width: 400px;
  }

  .consent__error {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    margin: 0;
  }

  .form__fail {
    margin-top: 16px;
  }

  .sent {
    max-width: 460px;
  }

  .sent__title {
    margin-bottom: 14px;
    font-size: 24px;
  }

  .sent__tg {
    height: 58px;
  }

  .sent__again {
    min-height: 0;
    margin-top: 14px;
  }

  .apply__side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
  }

  .contact-card {
    padding: 22px 24px;
    border-radius: 18px;
  }

  .contact-card__label {
    margin-bottom: 7px;
  }
}

@media (hover: hover) and (min-width: 768px) {
  .form__submit:hover {
    transform: translateY(-2px);
  }

  .sent__tg:hover {
    transform: translateY(-2px);
  }
}

/* ---------- Десктоп ---------- */

/* Три поля в строку, как в макете */
@media (min-width: 1024px) {
  .form__fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field--select {
    grid-column: auto;
  }
}

/* Контакты встают справа от формы, когда полям хватает места: на экранах уже
   ~1240px в поле списка не помещалась бы даже «Разговорная речь» */
@media (min-width: 1240px) {
  .apply__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 48px;
    align-items: start;
  }

  .apply__side {
    display: flex;
    flex-direction: column;
    margin-top: 0;
  }
}
