/* Step2Life воронка v1 — визуальная система юридического сайта (образец legal.css). */

:root {
  --paper: #f8f5ec;
  --ink: #262b1f;
  --ink-soft: #55624e;
  --muted: #78816b;
  --line: rgba(51, 66, 45, 0.14);
  --sheet-border: rgba(51, 66, 45, 0.08);
  --accent: #33422d;
  --accent-pressed: #262b1f;
  --gold: #a98b54;
  --gold-strong: #8c6e3c;
  --error: #9b3a32;
  --success: #4a6a3a;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Literata", Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fade: .42s;
}

* { box-sizing: border-box; }

html {
  background:
    radial-gradient(1100px 620px at 82% -10%, rgba(169, 139, 84, 0.14), transparent 60%),
    radial-gradient(900px 700px at 4% 30%, rgba(51, 66, 45, 0.06), transparent 55%),
    linear-gradient(180deg, #efebe0 0%, #e9e4d6 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* ---------- Шапка (как .doc-header) ---------- */
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 0;
}
.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.doc-brand img { width: 26px; height: 26px; }

/* ---------- Белый лист (как .doc-body, контент по центру) ---------- */
.sheet {
  position: relative;
  flex: 1 0 auto;
  max-width: 760px;
  width: 100%;
  margin: 18px auto 30px;
  padding: 30px 60px;
  background: #ffffff;
  border: 1px solid var(--sheet-border);
  border-radius: 6px;
  box-shadow: 0 30px 70px -45px rgba(38, 43, 31, 0.4), 0 2px 6px -2px rgba(38, 43, 31, 0.08);
  display: grid;
  align-items: center;
  min-height: min(448px, 53vh);
}

/* ---------- Экраны (одно на виду, остальные скрыты) ---------- */
.screen {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--fade) var(--ease),
    transform var(--fade) var(--ease),
    visibility 0s linear var(--fade);
}
.screen.is-active {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--fade) var(--ease),
    transform var(--fade) var(--ease),
    visibility 0s;
}
.screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--gold-strong);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.screen-title {
  margin: 0 0 18px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.12;
}
.lead {
  margin: 0 0 34px;
  max-width: 42ch;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.6;
  font-weight: 300;
}

/* Плавное всплывание содержимого активного экрана (перенос из лендинга) */
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen.is-active .eyebrow      { animation: reveal .6s var(--ease) .06s both; }
.screen.is-active .screen-title { animation: reveal .7s var(--ease) .18s both; }
.screen.is-active .lead         { animation: reveal .7s var(--ease) .32s both; }
.screen.is-active .action,
.screen.is-active .funnel-form  { animation: reveal .7s var(--ease) .46s both; }
.screen.is-active .shot         { animation: reveal .7s var(--ease) .40s both; }

/* ---------- Тур по приложению (экраны со скриншотами) ---------- */
.screen.tour .screen-title { font-size: clamp(25px, 4.2vw, 36px); margin-bottom: 12px; }
.screen.tour .tour-lead { margin-bottom: 22px; max-width: 34ch; font-size: 16px; }
.shot { margin: 0 0 24px; }
.shot img {
  width: auto;
  max-width: 100%;
  max-height: min(38vh, 430px);
  border-radius: 22px;
  box-shadow:
    0 26px 54px -30px rgba(38, 43, 31, 0.5),
    0 3px 10px -4px rgba(38, 43, 31, 0.12);
}

/* ---------- Карамельно-золотая кнопка ---------- */
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 44px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #caa669 0%, #ac8b51 52%, #977639 100%);
  color: #fffaf0;
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow:
    0 12px 26px -12px rgba(140, 110, 60, 0.6),
    0 2px 5px -2px rgba(140, 110, 60, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease), opacity .2s var(--ease);
}
.action:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 16px 32px -12px rgba(140, 110, 60, 0.68),
    0 3px 7px -2px rgba(140, 110, 60, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.action:active { transform: translateY(1px) scale(.99); }
.action:disabled { opacity: .65; cursor: default; filter: saturate(.9); }

/* ---------- Стрелка «назад» ---------- */
.nav-back {
  position: absolute;
  top: 20px;
  left: 22px;
  display: inline-flex;
  padding: 8px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--ease), color .2s var(--ease), background .2s var(--ease), visibility 0s linear .25s;
}
.sheet.can-back .nav-back { opacity: .8; visibility: visible; transition: opacity .25s var(--ease), color .2s var(--ease), background .2s var(--ease), visibility 0s; }
.nav-back:hover { color: var(--accent); background: rgba(51, 66, 45, 0.06); opacity: 1; }

/* ---------- Прогресс (тонкие точки внизу листа) ---------- */
.progress {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: center;
  display: flex;
  gap: 8px;
  margin-bottom: -14px;
}
.progress-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: rgba(51, 66, 45, 0.16);
  transition: width var(--fade) var(--ease), background var(--fade) var(--ease);
}
.progress-dot.is-active { width: 18px; background: var(--gold); }

/* ---------- Формы ---------- */
.funnel-form { width: 100%; max-width: 360px; margin-top: 4px; text-align: left; }
.funnel-form input[type="email"],
.funnel-form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  color: var(--ink);
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.funnel-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(169, 139, 84, 0.18);
}
#codeInput { text-align: center; font-size: 26px; letter-spacing: 0.5em; padding-left: 0.5em; }
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.consent input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.consent-box {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf7;
  position: relative;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.consent input:checked + .consent-box { background: var(--accent); border-color: var(--accent); }
.consent input:checked + .consent-box::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.consent input:focus-visible + .consent-box { box-shadow: 0 0 0 3px rgba(169, 139, 84, 0.25); }
.doc-open {
  padding: 0; border: 0; background: none;
  color: var(--gold-strong);
  border-bottom: 1px solid var(--line);
  font: inherit;
}
.doc-open:hover { color: var(--gold); border-color: var(--gold); }

.form-message { margin: 14px 0; min-height: 20px; font-size: 14px; color: var(--muted); text-align: center; }
.form-message.is-error { color: var(--error); }
.form-message.is-success { color: var(--success); }
.funnel-form .action { display: flex; width: 100%; margin-top: 2px; }
.code-extras { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.link-button {
  padding: 0; border: 0; background: none;
  color: var(--gold-strong); font: inherit;
  border-bottom: 1px solid var(--line);
}
.link-button:hover { color: var(--gold); border-color: var(--gold); }
.email-echo { color: var(--ink); }

/* ---------- Футер (тонкий, еле заметный) ---------- */
.doc-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 24px 26px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.doc-footer a {
  color: var(--muted);
  text-decoration: none;
  opacity: .6;
  transition: opacity .2s var(--ease), color .2s var(--ease);
}
.doc-footer a:hover { opacity: 1; color: var(--gold-strong); }
.doc-footer .sep { opacity: .35; }

/* ---------- Модалка документов ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(38, 43, 31, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  animation: modalFade .28s var(--ease) forwards;
}
.modal-overlay[hidden] { display: none; }
@keyframes modalFade { to { opacity: 1; } }
.modal-card {
  display: flex; flex-direction: column;
  width: min(760px, 100%);
  height: min(80vh, 900px);
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 70px -45px rgba(38, 43, 31, 0.4);
  transform: translateY(10px) scale(.99);
  animation: modalRise .32s var(--ease) forwards;
}
@keyframes modalRise { to { transform: none; } }
.modal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--ink); }
.modal-x {
  display: inline-flex; padding: 6px; border: 0; background: none; color: var(--muted);
  border-radius: 8px; transition: color .2s var(--ease), background .2s var(--ease);
}
.modal-x:hover { color: var(--ink); background: rgba(51, 66, 45, 0.06); }
.modal-frame { flex: 1 0 auto; width: 100%; border: 0; background: var(--paper); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); text-align: right; }
.modal-close-btn { padding: 12px 28px; }
body.modal-open { overflow: hidden; }

.noscript-message {
  position: fixed; bottom: 12px; left: 12px; right: 12px;
  padding: 10px 14px; border-radius: 8px;
  background: rgba(255, 253, 247, 0.95);
  border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 14px; text-align: center;
}

/* ---------- Адаптив ---------- */
@media (max-width: 680px) {
  .doc-header { padding: 18px 20px 0; }
  .sheet { margin: 12px auto 20px; padding: 30px 26px; border-radius: 4px; min-height: min(416px, 56vh); }
  .lead { font-size: 17px; }
  .nav-back { top: 14px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .nav-back, .progress-dot, .action, input { transition: none; }
  .screen.is-active .eyebrow,
  .screen.is-active .screen-title,
  .screen.is-active .lead,
  .screen.is-active .action,
  .screen.is-active .funnel-form,
  .screen.is-active .shot { animation: none; }
  .modal-overlay, .modal-card { animation: none; opacity: 1; transform: none; }
}
