/* MOWA Agency — заявка на кредитацию */
:root {
  --purple: #7035ED;
  --purple-dark: #5A27C9;
  --ink: #111111;
  --white: #FFFFFF;
  --surface: #F5F5F7;
  --border: #D8D8E0;
  --muted: #666670;
  --error: #D92D20;
  --success: #0E9F6E;
  --radius: 10px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light;            /* iOS не перекрашивает поля в тёмной теме */
  scroll-behavior: smooth;
}

button, label, a, input, .choice, .filebox {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;     /* без задержки 300мс и двойного тапа-зума */
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: Oswald, Impact, sans-serif; font-weight: 700; margin: 0; }

a { color: var(--purple); }

/* ---------- Шапка ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 16px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  background: var(--white);
  position: relative;
  z-index: 5;
}
.topbar__logo { display: block; height: 30px; width: auto; }

/* ---------- Логотип текстом ---------- */
/* MOWA Agency в одну строку: гротеск + каллиграфия по общей базовой линии */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.18em;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
  font-size: 24px;
  white-space: nowrap;
}
.brand__word {
  font-family: Anton, Oswald, Impact, sans-serif;
  font-size: 1em;
  letter-spacing: 0.012em;
  text-transform: uppercase;
}
.brand__script {
  font-family: Italianno, "Great Vibes", cursive;
  font-size: 1.62em;        /* Italianno мельче в кегле — компенсируем */
  line-height: 1;
}
.topbar__link {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-height: 44px;          /* комфортная зона нажатия на телефоне */
  padding: 0 2px;
}
.topbar__link:hover { color: var(--purple); }

/* ---------- Раскладка ---------- */
.layout { display: block; }

.panel {
  position: relative;
  overflow: hidden;
  background: var(--purple);
  color: var(--white);
  padding: 30px 16px 104px;   /* запас снизу под звезду, чтобы не лезла на текст */
}
.panel__title {
  font-size: clamp(38px, 12.5vw, 60px);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.panel__subtitle {
  margin: 28px 0 0;
  font-size: 19px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  max-width: 24em;
}
.panel__list { list-style: none; margin: 24px 0 0; padding: 0; }
.panel__list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 10px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
}
.panel__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 14px;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
}
.panel__star {
  position: absolute;
  right: -12%;
  bottom: -18px;
  width: min(52%, 190px);
  height: auto;
  opacity: 0.95;
  pointer-events: none;
  user-select: none;
}
.panel__glow {
  position: absolute;
  inset: auto -20% -40% -20%;
  height: 60%;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,255,255,0.28), transparent 65%);
  pointer-events: none;
}

.form-wrap {
  padding: 28px 16px 56px;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.form-inner { max-width: 640px; margin: 0 auto; }

/* Кегли выверены по макету: H1 заполняет колонку, «01 /» ≈0,8 от заголовка блока */
.page-title { font-size: clamp(32px, 8.6vw, 60px); line-height: 1.0; letter-spacing: -0.01em; }
.page-intro { margin: 14px 0 0; color: var(--muted); font-size: 17px; max-width: 34em; }

/* ---------- Блоки формы ---------- */
.block { margin-top: 44px; }
.block__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 20px;
}
.block__num {
  color: var(--purple);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
}
.block__title { font-size: 24px; font-family: Oswald, sans-serif; font-weight: 700; }

.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid--2 { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; }
.field__label { font-size: 16px; font-weight: 600; margin-bottom: 9px; }
.field__label-note { font-weight: 400; color: var(--muted); font-size: 14px; }
.field__hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.field__error { font-size: 13px; color: var(--error); margin-top: 6px; display: none; }
.field.is-invalid .field__error { display: block; }
.field.is-invalid .input,
.field.is-invalid .combo__button,
.field.is-invalid .filebox { border-color: var(--error); }

.input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 52px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9A9AA6; }
.input:focus,
.combo__button:focus-visible,
.filebox:focus-within {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(112, 53, 237, 0.15);
}
textarea.input { min-height: 96px; resize: vertical; }

/* ---------- Выбор страны ---------- */
.combo { position: relative; }
.combo__button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 40px 14px 16px;
  min-height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.combo__button[data-empty="1"] { color: #9A9AA6; }
.combo__button::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.combo__pop {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(17, 17, 17, 0.14);
  display: none;
  overflow: hidden;
}
.combo.is-open .combo__pop { display: block; }
.combo__search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  font: inherit;
  min-height: 46px;
}
.combo__search:focus { outline: none; }
.combo__list { max-height: 260px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; -webkit-overflow-scrolling: touch; }
.combo__opt {
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
}
.combo__opt:hover, .combo__opt.is-active { background: var(--surface); }
.combo__dial { color: var(--muted); font-size: 14px; }
.combo__empty { padding: 14px; color: var(--muted); font-size: 14px; }

/* Шапка списка — нужна только в мобильной «шторке» */
.combo__head { display: none; }

/* ---------- Мобильная шторка выбора страны ---------- */
@media (max-width: 699px) {
  .combo.is-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    z-index: 90;
  }
  .combo.is-open .combo__pop {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    border: none;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(17, 17, 17, 0.28);
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up 0.18s ease-out;
  }
  .combo.is-open .combo__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
  }
  .combo__close {
    border: none;
    background: none;
    color: var(--purple);
    font: inherit;
    font-weight: 600;
    padding: 6px 2px;
    cursor: pointer;
  }
  .combo.is-open .combo__search { min-height: 52px; font-size: 16px; }
  .combo.is-open .combo__list { max-height: 48vh; }
  .combo.is-open .combo__opt { padding: 15px 16px; font-size: 16px; }
}

@keyframes sheet-up {
  from { transform: translateY(18px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

/* ---------- Телефон ---------- */
.phone { display: grid; grid-template-columns: 122px 1fr; gap: 8px; }
.phone .combo__button { padding-right: 32px; }
.phone .combo__button::after { right: 12px; }

/* ---------- Чекбоксы расходов ---------- */
/* Ширина по содержимому, как в макете: Билет — узкий, Личные расходы — широкий */
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choices .choice { flex: 0 1 auto; white-space: nowrap; }
@media (max-width: 420px) { .choices .choice { flex: 1 1 calc(50% - 5px); white-space: normal; } }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 13px 12px;
  cursor: pointer;
  font-size: 15px;
  user-select: none;
  min-height: 48px;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__box {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  position: relative;
}
/* Общие правила: работают и для расходов, и для согласия с условиями */
input:checked + .choice__box {
  background: var(--purple);
  border-color: var(--purple);
}
input:checked + .choice__box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.choice:has(input:checked) { border-color: var(--purple); background: rgba(112, 53, 237, 0.06); }
input:focus-visible + .choice__box { box-shadow: 0 0 0 3px rgba(112, 53, 237, 0.2); }

/* ---------- Файл ---------- */
.filebox {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  display: block;
}
.filebox input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.filebox__body { display: block; }
.filebox__title { display: block; font-weight: 600; font-size: 15px; }
.filebox__sub { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 34em; margin-left: auto; margin-right: auto; }
.filebox.has-file { border-style: solid; border-color: var(--purple); background: rgba(112, 53, 237, 0.06); }
.filebox__name { display: block; font-weight: 600; font-size: 15px; word-break: break-all; }
.filebox__replace { display: block; color: var(--purple); font-size: 13px; margin-top: 4px; }

/* ---------- Согласие и отправка ---------- */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 28px;
  font-size: 15px;
  cursor: pointer;
}
.consent input { position: absolute; opacity: 0; pointer-events: none; }
.consent .choice__box { margin-top: 2px; }
.consent.is-invalid { color: var(--error); }
.consent.is-invalid .choice__box { border-color: var(--error); }

.submit {
  margin-top: 22px;
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: var(--radius);
  background: var(--purple);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .15s;
}
.submit:hover { background: var(--purple-dark); }
.submit[disabled] { opacity: 0.65; cursor: default; }
.submit__arrow { font-size: 18px; line-height: 1; }

.footnote { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }

.alert {
  margin-top: 18px;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  display: none;
}
.alert--error { background: #FDECEA; color: #8C1D18; border: 1px solid #F5C6C2; }
.alert.is-shown { display: block; }

/* ---------- Экран успеха ---------- */
.done { display: none; text-align: center; padding: 28px 0 10px; }
.done.is-shown { display: block; }
.done__icon {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%; background: rgba(112, 53, 237, 0.1);
  display: grid; place-items: center;
}
.done__icon::after {
  content: "";
  width: 14px; height: 26px;
  border-right: 3px solid var(--purple);
  border-bottom: 3px solid var(--purple);
  transform: rotate(45deg) translate(-2px, -2px);
}
.done__title { font-size: 30px; }
.done__text { color: var(--muted); margin-top: 12px; max-width: 30em; margin-left: auto; margin-right: auto; }

/* ---------- Условия поверх анкеты ---------- */
.terms-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: rgba(17, 17, 17, 0.5);
}
.terms-overlay.is-open { display: block; }
.terms-sheet {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(760px, 100%);
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--white);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.2s ease-out;
}
@media (min-width: 760px) {
  .terms-sheet { top: 50%; bottom: auto; transform: translate(-50%, -50%); border-radius: 14px; max-height: 86vh; }
}
.terms-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: Oswald, sans-serif;
  font-weight: 700;
  font-size: 20px;
}
.terms-sheet__close {
  border: none;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-family: Inter, sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}
.terms-sheet__close:hover { background: #ececf1; }
.terms-sheet__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
}
.terms-sheet__body h2 { font-family: Inter, sans-serif; font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.terms-sheet__body h2:first-child { margin-top: 0; }
.terms-sheet__body p { margin: 0 0 10px; font-size: 15px; }
.terms-sheet__body ul { margin: 0 0 10px; padding-left: 20px; font-size: 15px; }
.terms-sheet__body li { margin-bottom: 5px; }

/* ---------- Страница условий ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 72px; }
.doc h1 { font-size: clamp(28px, 8vw, 40px); line-height: 1.05; }
.doc h2 {
  font-family: Inter, sans-serif;
  font-size: 19px;
  font-weight: 600;
  margin: 34px 0 10px;
}
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 20px; }
.doc li { margin-bottom: 6px; }
.doc .back { display: inline-block; margin-top: 32px; font-weight: 500; text-decoration: none; }

/* ---------- Десктоп ---------- */
@media (min-width: 960px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(330px, 36.5%) 1fr;
    min-height: calc(100vh - 64px);
  }
  .panel {
    padding: 68px 32px 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
  }
  .panel__title { font-size: clamp(38px, 4.9vw, 72px); }
  .page-title { font-size: clamp(44px, 5.6vw, 68px); }
  .page-intro { font-size: 18px; }
  .block { margin-top: 48px; }
  .block__num { font-size: 22px; }
  .block__title { font-size: 28px; }
  .panel__subtitle { margin-top: 44px; font-size: 21px; }
  .panel__list { margin-top: 30px; }
  .panel__list li { font-size: 16px; margin-bottom: 12px; }
  /* размер привязан к высоте панели: на невысоких экранах звезда не лезет на текст */
  .panel__star {
    height: min(46%, 430px);
    width: auto;
    left: -14%;
    right: auto;
    bottom: -6%;
    opacity: 1;
  }
  .form-wrap { padding: 64px 40px 88px; }
  .form-inner { margin: 0; max-width: 700px; }
  .topbar { padding: 22px 44px; }
  .topbar__logo { height: 34px; }
}
