/* Форма «Обучение для команды» — оформление по брендбуку «Других миров».
   Отступы кратны 4 px. Движение: 160–260 мс, только transform/opacity (GPU),
   при системном «уменьшить движение» анимации отключаются. */

@font-face {
  font-family: 'IgraSans';
  src: url('fonts/IgraSans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0C0C16;
  --panel: #141720;
  --panel-2: #20242F;
  --line: #2A2F3D;
  --line-2: #3A4152;
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, 0.76);
  --muted: #9AA1B2;
  --accent: #1D74CC;
  --accent-soft: rgba(29, 116, 204, 0.18);
  --brand: #0062BA;
  --brand-red: #EA0046;
  --ok: #8FD49B;
  --err: #EE9E9E;
  --radius: 16px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-brand: 'IgraSans', 'Segoe UI', Roboto, Arial, sans-serif;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --page: 900px;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Фон: спокойный градиент + живой слой + плёночное зерно ── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(95% 75% at 8% -10%, rgba(0, 98, 186, 0.16), transparent 62%),
    radial-gradient(80% 75% at 106% 106%, rgba(234, 0, 70, 0.10), transparent 64%),
    radial-gradient(48% 44% at 96% 8%, rgba(234, 0, 70, 0.07), transparent 68%);
}

/* «Жидкий» градиент (WebGL). Включается только если браузер справился сам:
   bg.js добавляет .on после первого удачного кадра и выключает слой,
   если fps низкий. Пока не включён — виден обычный градиент выше. */
.bg-shader {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

.bg-shader.on { opacity: 1; }

/* Плёночное зерно: убирает «ступеньки» на градиенте, даёт глубину.
   Двигается редкими шагами (steps), только transform — работа для видеокарты. */
.bg-grain {
  position: fixed;
  inset: -48px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(6) infinite;
  will-change: transform;
}

@keyframes grain-shift {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-8px, 6px, 0); }
  40%  { transform: translate3d(6px, -10px, 0); }
  60%  { transform: translate3d(-4px, 8px, 0); }
  80%  { transform: translate3d(10px, 4px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* ── Полоска прогресса заполнения ── */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-red));
  transition: width 260ms ease;
}

/* ── Шапка ── */
.head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 28px 24px 8px;
}

.logo { display: block; height: 26px; width: auto; }

.head-name {
  font-family: var(--font-brand);
  font-size: 16px;
  letter-spacing: 0.01em;
}

/* ── Карточка ── */
.wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 16px 24px 32px;
}

.card {
  position: relative;
  isolation: isolate;
  padding: 32px;
  /* Текст карточки не трансформируется — он всегда в плоскости экрана,
     поэтому остаётся резким при любом наведении. Фон, рамка и тень живут
     отдельной подложкой ::before и наклоняются вместо содержимого. */
  transform: none;
  animation: card-in 460ms cubic-bezier(0.22, 0.8, 0.28, 1) backwards;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid var(--line);
  border-top-color: rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: rgba(18, 21, 30, 0.86);
  box-shadow: var(--shadow);
  transform: perspective(2200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 380ms cubic-bezier(0.22, 0.8, 0.28, 1), box-shadow 380ms ease;
  pointer-events: none;
}

/* Под курсором наклоняется подложка — содержимое остаётся плоским. */
.card:hover::before {
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Смена направления: лёгкий «вдох» без масштабирования текста. */
.card.swap { animation: card-swap 320ms cubic-bezier(0.34, 1.2, 0.64, 1); }

@keyframes card-swap {
  0% { transform: translateY(1px); }
  100% { transform: none; }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Шапка карточки: заголовок слева, компактный переключатель справа. */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.card-titles { min-width: 0; }

.title {
  margin: 0 0 8px;
  font-family: var(--font-brand);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
  animation: rise 520ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.lead {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  animation: rise 520ms cubic-bezier(0.22, 0.8, 0.28, 1) 60ms both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── Переключатель Ru / En (направление RU / WORLD) — компактный, в шапке справа ── */
.dir {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 144px;
  padding: 3px;
  margin: 2px 0 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  animation: rise 520ms cubic-bezier(0.22, 0.8, 0.28, 1) 100ms both;
}

.dir-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 98, 186, 0.95), rgba(234, 0, 70, 0.55));
  box-shadow: 0 0 14px rgba(29, 116, 204, 0.28);
  transition: transform 320ms cubic-bezier(0.34, 1.5, 0.64, 1);
}

.dir.world .dir-slider { transform: translateX(100%); }

.dir-btn {
  position: relative;
  z-index: 1;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 200ms ease;
}

.dir-btn.on { color: #FFFFFF; }
.dir-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 999px; }

/* ── Отдельный переключатель языка не нужен: язык следует за Ru / En ── */

/* ── Секции формы ── */
/* Секции проявляются, когда попадают в поле зрения (IntersectionObserver). */
.sect {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 560ms ease, transform 560ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.sect.in { opacity: 1; transform: none; }

.sect legend {
  padding: 0;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.row2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.row2:last-child { margin-bottom: 0; }

/* Одно поле на всю ширину — для длинных значений (адрес арены, телефон). */
.row1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.row1:last-child { margin-bottom: 0; }

.hint-under { margin: 8px 0 0; }
.hint-under:empty { display: none; }

/* ── Поле ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > label {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  min-height: 18px;
  transition: color 180ms ease;
}

/* Пока поле в работе, подпись чуть ярче — видно, где стоишь. */
.field:focus-within > label { color: var(--text-2); }

/* Появление полей — лёгкая волна слева направо. */
.row1 > .field,
.row2 > .field {
  animation: field-in 460ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.row1 > .field:nth-child(2),
.row2 > .field:nth-child(2) { animation-delay: 70ms; }

.row1 > .field:nth-child(3),
.row2 > .field:nth-child(3) { animation-delay: 140ms; }

@keyframes field-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.req { color: var(--brand-red); }

.field select,
.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.field select:disabled,
.field input:disabled { opacity: 0.55; cursor: default; }

.field select:hover:not(:disabled),
.field input:hover:not(:disabled) { border-color: var(--line-2); }

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Подпись всегда над полем; поля одной высоты — контейнеры стоят ровно. */

.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* Ошибка поля */
.err-msg {
  max-height: 0;
  overflow: hidden;
  color: var(--err);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 200ms ease, opacity 200ms ease, transform 200ms ease;
}

.field.err select,
.field.err input {
  border-color: var(--err);
  box-shadow: 0 0 0 3px rgba(238, 158, 158, 0.16);
}

.field.err .err-msg { max-height: 48px; opacity: 1; transform: none; }

/* ── Выбор «Курс / Тренинг» ── */
.learn {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.learn-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 160ms ease;
}

.learn-card:hover { border-color: var(--line-2); transform: translateY(-1px); }

.learn-card input { position: absolute; opacity: 0; width: 0; height: 0; }

.learn-box {
  grid-row: 1 / span 2;
  align-self: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--panel);
  transition: background 180ms ease, border-color 180ms ease;
}

.learn-box::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  margin: 3px auto 0;
  border: solid #0C0C16;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.4);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.learn-card input:checked ~ .learn-box {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), #1D74CC);
}

.learn-card input:checked ~ .learn-box::after {
  opacity: 1;
  animation: tick-pop 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tick-pop {
  0% { opacity: 0; transform: rotate(45deg) scale(0.3); }
  60% { opacity: 1; transform: rotate(45deg) scale(1.3); }
  100% { opacity: 1; transform: rotate(45deg) scale(1); }
}

.learn-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(29, 116, 204, 0.14);
}

.learn-card input:focus-visible ~ .learn-box { outline: 2px solid var(--accent); outline-offset: 2px; }

.learn-title { font-size: 14px; }
.learn-sub { color: var(--muted); font-size: 12px; }

/* Развёрнутая часть (курс или тренинг) */
.sub-block {
  overflow: hidden;
  margin-top: 16px;
  animation: unfold 260ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

@keyframes unfold {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* Ближайшие даты тренинга */
.events { margin-top: 16px; }

.events-title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.events-list { display: flex; flex-wrap: wrap; gap: 8px; }

.events-list > .event-chip { animation: field-in 320ms cubic-bezier(0.22, 0.8, 0.28, 1) both; }
.events-list > .event-chip:nth-child(2) { animation-delay: 40ms; }
.events-list > .event-chip:nth-child(3) { animation-delay: 80ms; }
.events-list > .event-chip:nth-child(4) { animation-delay: 120ms; }
.events-list > .event-chip:nth-child(n+5) { animation-delay: 160ms; }

.event-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.event-chip input { position: absolute; opacity: 0; width: 0; height: 0; }

.event-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #FFFFFF;
}

.event-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Отправка ── */
.send { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 176px;
  height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), #1D74CC);
  color: #FFFFFF;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 190ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 160ms ease,
              width 240ms ease, border-radius 240ms ease, box-shadow 200ms ease;
  box-shadow: 0 4px 14px rgba(0, 98, 186, 0.22);
}

.submit:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px) scale(1.012);
  box-shadow: 0 10px 24px rgba(29, 116, 204, 0.34);
}

.submit:active:not(:disabled) {
  transform: scale(0.965);
  box-shadow: 0 3px 10px rgba(29, 116, 204, 0.22);
  transition-duration: 90ms;
}
.submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.submit:disabled { cursor: default; }

/* Когда всё заполнено — кнопка мягко «дышит», приглашая нажать. */
.submit.ready:not(.sending):not(.done) { animation: ready-pulse 2.6s ease-in-out infinite; }

@keyframes ready-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(29, 116, 204, 0.38); }
  50% { box-shadow: 0 0 0 9px rgba(29, 116, 204, 0); }
}

/* Блик, который пробегает по кнопке при наведении. */
.submit::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: skewX(-18deg);
  transition: left 560ms ease;
  pointer-events: none;
}

.submit:hover:not(:disabled)::after { left: 125%; }
.submit.sending::after,
.submit.done::after { display: none; }

.submit-text { transition: opacity 160ms ease; }
.submit .spinner, .submit .check { display: none; }

/* отправка: кнопка сжимается в кружок и крутит спиннер */
.submit.sending { width: 46px; min-width: 46px; padding: 0; border-radius: 50%; }
.submit.sending .submit-text { opacity: 0; }
.submit.sending .spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* успех: кнопка «приземляется» пружинкой и рисует галочку */
.submit.done {
  width: 46px;
  min-width: 46px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #2C805D, #57B98C);
  animation: spring-land 460ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes spring-land {
  0%   { transform: scale(0.86); }
  55%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.submit.done .submit-text,
.submit.done .spinner { display: none; opacity: 0; }

.submit.done .check {
  display: block;
  width: 22px;
  height: 22px;
  color: #0C0C16;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: draw 420ms ease forwards 80ms;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.send-note { color: var(--muted); font-size: 12px; }
.send-note.bad { color: var(--err); }

/* ── Экран «Заявка принята» ── */
.done-card {
  text-align: center;
  animation: card-in 380ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.done-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 8px auto 20px;
  border-radius: 50%;
  background: rgba(44, 128, 93, 0.18);
  color: var(--ok);
}

.done-mark svg {
  width: 32px;
  height: 32px;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: draw 520ms ease forwards 160ms;
}

.done-title {
  margin: 0 0 8px;
  font-family: var(--font-brand);
  font-size: 26px;
  font-weight: 400;
}

.done-text { margin: 0 auto 24px; max-width: 460px; color: var(--text-2); font-size: 14px; }

.again {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease,
              transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.again:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.again:active { transform: scale(0.97); transition-duration: 90ms; }

/* ── Подвал ── */
.foot {
  position: relative;
  z-index: 2;
  padding: 16px 24px 28px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.noscript { padding: 16px; color: var(--err); text-align: center; font-size: 13px; }

/* ── Узкий экран ── */
@media (max-width: 680px) {
  .head { padding: 20px 16px 4px; }
  .wrap { padding: 12px 16px 24px; }
  .card { padding: 24px 18px; }
  .card-head { flex-direction: column; gap: 16px; }
  .title { font-size: 26px; }
  .dir { width: 100%; margin: 0; }
  .dir-btn { height: 28px; font-size: 12px; }
  .row2 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .learn { grid-template-columns: minmax(0, 1fr); }
  .send { gap: 12px; }
  .submit { width: 100%; }
  .submit.sending, .submit.done { width: 46px; }
}

/* ── Системное «уменьшить движение» ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .sect { opacity: 1; transform: none; }
  .card { transform: none; }
  .card::before { transform: none; }
  .bg-grain { animation: none !important; }
  .bg-shader { display: none !important; }
}



