/* promoforma.media-sfera.com — одноэкранная страница с лид-формой.
   Стиль взят из гайда «ПромоСтраницы. Ультимативный гайд» (Typst-вёрстка):
   палитра снята замером с растра страниц, шрифты — те же YS Text / YS Compressed.

   Главное требование ТЗ: страница умещается в экран БЕЗ прокрутки
   от 1280x720 до 1920x1080 и на мобильных от 360x640. Поэтому весь кегль
   считается от одной переменной --s, которая зависит и от ширины, и от ВЫСОТЫ
   окна. Плюс страховка в scripts.js: если контент всё же не влез, --s
   уменьшается по факту замера, а не по нашему предсказанию. */

@font-face {
  font-family: 'YS Text';
  src: url('../fonts/ystext-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YS Text';
  src: url('../fonts/ystext-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YS Text';
  src: url('../fonts/ystext-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'YS Compressed';
  src: url('../fonts/yscompressed-heavyitalic.woff2') format('woff2');
  font-weight: 900; font-style: italic; font-display: swap;
}

:root {
  --bg:          #EBEFF5;
  --ink:         #191E28;
  --lime:        #E1FA00;
  --violet:      #7D32FF;
  --violet-deep: #4600AF;
  --grey:        #6A6F77;
  --grey-2:      #8B8F97;
  --line:        #C9D3E4;
  --white:       #FFFFFF;
  --red:         #E31E25;

  /* Базовый кегль. Коэффициенты подобраны так, чтобы дать ~16,5px на 1920x1080,
     ~14,5px на 1280x720 и не опускаться ниже 13px на 360x640. */
  /* Коэффициент общего сжатия. По умолчанию 1; scripts.js уменьшает его,
     если содержимое не влезло в экран. Важно, что на него умножаются И кегль,
     И вертикальная разрядка: если жать только шрифт, отступы съедают экран
     и текст уходит в нечитаемые 10px, а страница всё равно не помещается. */
  --k: 1;
  --s: calc(clamp(13px, 10.5px + 0.314vh + 0.136vw, 16.5px) * var(--k));
  /* Единица вертикальной разрядки: на низких экранах ужимается сама.
     Здесь раньше стоял БЕЗРАЗМЕРНЫЙ множитель clamp(0.62, 0.2 + 0.06vh, 1).
     Это невалидный CSS: число нельзя складывать с длиной. Браузер отбрасывал
     каждое выражение, где множитель использовался, и вертикальные отступы
     становились нулевыми — вёрстка прижималась к краям. На замере это НЕ
     видно (прокрутки нет), поймалось только глазами на скриншоте.
     Поэтому разрядка задана ДЛИНОЙ, а не множителем. */
  --vgap: calc(clamp(8px, 1.7vh, 22px) * var(--k));
}

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

html, body { height: 100%; margin: 0; padding: 0; }
html { overflow: hidden; }

body {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;               /* ТЗ: прокрутки нет ни по одной оси */
  background: var(--bg);
  color: var(--ink);
  font-family: 'YS Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: var(--s);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: subpixel-antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--vgap) * 1.2) 1.4em;
  position: relative;
}

/* --- Декор: плоские фигуры, как на обложке гайда.
   Намеренно БЕЗ градиентов и blur — они дорого растеризуются в слабых
   мобильных браузерах, а выигрыша здесь не дают. --- */
.decor { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.decor i { position: absolute; display: block; }
.decor .d1 {
  top: -14vmin; right: -4vmin; width: 34vmin; height: 34vmin;
  background: var(--lime); transform: rotate(24deg); border-radius: 0 0 0 14vmin;
}
.decor .d2 {
  top: -12vmin; right: -16vmin; width: 40vmin; height: 40vmin;
  background: var(--violet); border-radius: 50% 50% 50% 8vmin;
}
.decor .d3 {
  bottom: -12vmin; left: -12vmin; width: 34vmin; height: 34vmin;
  background: var(--violet-deep); border-radius: 50% 8vmin 50% 50%;
}
.decor .d4 {
  bottom: -9vmin; left: 7vmin; width: 22vmin; height: 22vmin;
  background: var(--lime); border-radius: 8vmin 0 0 0; transform: rotate(-12deg);
}

/* --- Карточка --- */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 72em;
  max-height: 100%;
  background: var(--ink);
  border-radius: 2em;
  color: var(--white);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.2em;
  padding: calc(var(--vgap) * 1.8) 2.4em;
  box-shadow: 0 1.4em 3em rgba(25, 30, 40, .18);
}

/* --- Левая колонка --- */
.col-left { display: flex; flex-direction: column; min-width: 0; }

.logo { display: block; width: 11.2em; height: auto; margin-bottom: calc(var(--vgap) * 1.275); }

h1 {
  font-family: 'YS Compressed', 'YS Text', Impact, sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: 2.85em;
  line-height: 0.98;
  letter-spacing: .005em;
  margin: 0;
  color: var(--white);
}

.rule {                        /* лаймовая черта под заголовком — приём гайда */
  width: 4.6em; height: .28em; background: var(--lime);
  margin: calc(var(--vgap) * 0.637) 0 calc(var(--vgap) * 0.788);
  border-radius: .14em;
}

.lead { margin: 0 0 calc(var(--vgap) * 0.788); font-size: 1.06em; color: #DCE1EA; }

.perks { margin: 0; padding: 0; list-style: none; }
.perks li {
  position: relative;
  padding-left: 1.35em;
  margin-bottom: .42em;
  color: var(--white);
}
.perks li::before {
  content: ""; position: absolute; left: 0; top: .58em;
  width: .72em; height: .16em; background: var(--lime); border-radius: .08em;
}

.note { margin: calc(var(--vgap) * 0.6) 0 auto; font-size: max(12px, .92em); color: var(--grey-2); }
.perks-title { margin: 0 0 .5em; font-size: max(12px, .92em); color: var(--grey-2); }


/* --- Правая колонка: форма на белой карточке --- */
.col-right { display: flex; min-width: 0; }

.form-card {
  background: var(--white);
  color: var(--ink);
  border-radius: 1.4em;
  padding: calc(var(--vgap) * 1.275) 1.6em;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.form-card h2 {
  font-family: 'YS Compressed', 'YS Text', Impact, sans-serif;
  font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: 1.75em; line-height: 1; letter-spacing: .01em;
  margin: 0 0 calc(var(--vgap) * 0.788);
  color: var(--ink);
}

.field { margin-bottom: calc(var(--vgap) * 0.585); }
.field label {
  display: block;
  font-size: max(12px, .88em);
  font-weight: 500;
  color: var(--grey);
  margin-bottom: .3em;
}
.field label .req { color: var(--red); }

.field input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 1em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: .6em;
  padding: .62em .8em;
  outline: none;
  transition: border-color .15s, background-color .15s;
}
.field input::placeholder { color: #9AA2B0; }
.field input:focus {
  border-color: var(--violet);
  background: var(--white);
  box-shadow: 0 0 0 .18em rgba(125, 50, 255, .16);
}
.field.is-error input { border-color: var(--red); background: #FFF4F4; }

.err { display: none; font-size: max(11.5px, .84em); color: var(--red); margin-top: .22em; }
.field.is-error .err { display: block; }

/* Согласие — ДО кнопки (п.6 ТЗ) */
.consent {
  display: flex;
  align-items: flex-start;
  gap: .6em;
  margin: calc(var(--vgap) * 0.375) 0 calc(var(--vgap) * 0.712);
  font-size: max(12px, .87em);
  line-height: 1.4;
  color: var(--grey);
  cursor: pointer;
}
.consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.consent .box {
  flex: 0 0 auto;
  width: 1.25em; height: 1.25em;
  margin-top: .05em;
  border: 1.5px solid #9AA2B0;
  border-radius: .32em;
  background: var(--white);
  position: relative;
  transition: background-color .15s, border-color .15s;
}
.consent .box::after {
  content: ""; position: absolute;
  left: .38em; top: .14em; width: .26em; height: .58em;
  border: solid var(--ink); border-width: 0 .16em .16em 0;
  transform: rotate(45deg) scale(0);
  transition: transform .12s;
}
.consent input:checked + .box { background: var(--lime); border-color: var(--lime); }
.consent input:checked + .box::after { transform: rotate(45deg) scale(1); }
.consent input:focus-visible + .box { box-shadow: 0 0 0 .18em rgba(125, 50, 255, .28); }
.consent a { color: var(--violet-deep); text-decoration: underline; }
.consent.is-error .box { border-color: var(--red); }

.submit {
  font: inherit;
  font-weight: 700;
  font-size: 1.02em;
  width: 100%;
  padding: .82em 1em;
  border: 0;
  border-radius: .7em;
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
  transition: filter .15s, background-color .15s, color .15s;
}
.submit:hover:not(:disabled) { filter: brightness(1.06); }
.submit:disabled { background: #E3E7EE; color: #646C7B; cursor: not-allowed; }
.submit.is-sending { color: transparent; position: relative; }
.submit.is-sending::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 1.1em; height: 1.1em; margin: -.55em 0 0 -.55em;
  border: .16em solid rgba(25,30,40,.25); border-top-color: var(--ink);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.contacts {
  margin-top: auto;
  padding-top: calc(var(--vgap) * 0.675);
  font-size: max(11.5px, .84em);
  color: var(--grey);
}
.contacts a { color: var(--grey); text-decoration: none; white-space: nowrap; }
.contacts a:hover { color: var(--ink); text-decoration: underline; }
/* Разделитель — не декор, а часть строки: цвет светлее текста, но не бледнее 3:1. */
.contacts .sep { color: #6E7684; margin: 0 .45em; }

/* --- Пуш-ап «Заявка отправлена»: накрывает карточку формы --- */
.sent {
  position: absolute; inset: 0;
  background: var(--white);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 1.6em;
  opacity: 0; visibility: hidden;
  transform: translateY(1.4em);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.sent.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.sent .tick {
  width: 3.2em; height: 3.2em; border-radius: 50%;
  background: var(--lime);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .9em;
}
.sent .tick::after {
  content: ""; width: .7em; height: 1.3em;
  border: solid var(--ink); border-width: 0 .26em .26em 0;
  transform: rotate(45deg) translate(-.06em, -.16em);
}
.sent h3 {
  font-family: 'YS Compressed', 'YS Text', Impact, sans-serif;
  font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: 1.6em; line-height: 1; margin: 0 0 .5em; color: var(--ink);
}
.sent p { margin: 0; font-size: .95em; color: var(--grey); max-width: 22em; }

/* Общая ошибка отправки */
.form-error { display: none; margin-top: .6em; font-size: .86em; color: var(--red); }
.form-error.is-open { display: block; }

/* Ханипот: поле-ловушка для ботов. Уводим за экран, а не display:none —
   так его заполнит автозаполнялка бота, но не увидит и не сфокусирует человек. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Планшет и мобильные: одна колонка --- */
@media (max-width: 860px) {
  body { padding: calc(var(--vgap) * 0.75) .9em; }
  .card {
    grid-template-columns: 1fr;
    gap: calc(var(--vgap) * 0.862);
    padding: calc(var(--vgap) * 1.125) 1.3em;
    border-radius: 1.4em;
    align-content: center;
  }
  .logo { width: 9.2em; margin-bottom: calc(var(--vgap) * 0.75); }
  h1 { font-size: 2.1em; }
  .rule { width: 3.4em; height: .24em; margin: calc(var(--vgap) * 0.45) 0 calc(var(--vgap) * 0.562); }
  .lead { font-size: 1em; }
  .form-card { border-radius: 1.1em; padding: calc(var(--vgap) * 0.9) 1.1em; }
  .form-card h2 { font-size: 1.4em; }
  .contacts { margin-top: calc(var(--vgap) * 0.525); }
}

/* Узкие экраны: подпись оставляем только с контактами — фраза про рабочее
   время съедает целую строку, а телефон и почта важнее. */
@media (max-width: 560px) {
  .contacts .when { display: none; }
  h1 { font-size: 1.95em; }
  /* Интерлиньяж 1,45 хорош для длинного чтения, но здесь каждая строка стоит
     высоты экрана. 1,32 отыгрывает ~25px и позволяет держать кегль крупнее —
     на коротком тексте разница в читаемости меньше, чем от мелкого шрифта. */
  body { line-height: 1.32; }
  .logo { width: 7.8em; }
}

/* Очень низкие экраны (360x640 и подобные): режем вертикаль дальше */
@media (max-width: 860px) and (max-height: 700px) {
  .card { gap: calc(var(--vgap) * 0.6); }
  .perks li { margin-bottom: .26em; }
  .logo { margin-bottom: calc(var(--vgap) * 0.525); }
}
