/* Вход в панель.
   Палитра и шрифты — те же, что у сайта: это её дом. Но комната другая,
   рабочая: плотнее, тише, без единого декоративного жеста. */

:root {
  --milk: #FBF7F1;
  --ink: #211F1E;
  --ink-soft: #55524F;
  --muted: #66625E;
  --line: #E1DCD5;
  --clay: #A26745;
  --clay-dark: #8A5A3D;
  --clay-l: #F3E5D9;
  --err: #8C4A3F;
  --on-clay: #FFFFFF;
  --field: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root {
    --milk: #181614;
    --ink: #F2EDE6;
    --ink-soft: #CFC7BD;
    --muted: #B4ABA1;
    --line: #3A322B;
    --clay: #D99B72;
    --clay-dark: #EDB68F;
    --clay-l: #2E2620;
    --err: #E0937F;
    --on-clay: #241A12;
    --field: #201C18;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  /* Не по центру: чуть выше — так страница читается как лист, а не как окно. */
  align-content: center;
  justify-items: center;
  padding: 40px 24px 96px;
  background: var(--milk);
  color: var(--ink);
  font: 400 16px/1.55 'Onest', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--clay-l); color: var(--ink); }

/* Лист. Вертикальная линия слева — как поле в тетради: страница про работу,
   а не про витрину. Ни карточки, ни тени: подниматься над фоном нечему. */
.sheet {
  width: 100%;
  max-width: 26rem;
  padding-left: 26px;
  border-left: 1px solid var(--line);
  position: relative;
}

/* Короткий отрезок цвета на линии — единственная краска на странице. */
.sheet::before {
  content: '';
  position: absolute;
  left: -1px; top: 0;
  width: 1px; height: 56px;
  background: var(--clay);
}

.mark {
  margin: 0 0 40px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.mark b { font-weight: 500; }
.mark span { color: var(--clay); }

h1 {
  margin: 0 0 10px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: clamp(34px, 8vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: inherit;
  font: inherit;
  caret-color: var(--clay);
  transition: border-color .18s ease;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:hover { border-color: var(--clay-dark); }
input:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
  border-color: var(--clay);
}

/* Место под ошибку занято всегда: появляясь, она не толкает кнопку вниз. */
.err {
  margin: 8px 0 0;
  min-height: 20px;
  font-size: 13px;
  color: var(--err);
}

button {
  font: inherit;
  cursor: pointer;
}

#btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--clay);
  color: var(--on-clay);
  font-weight: 500;
  transition: background-color .18s ease, transform .18s ease;
}
#btn:hover { background: var(--clay-dark); }
#btn:active { transform: translateY(1px); }
#btn:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }
#btn[disabled] { opacity: .65; cursor: default; transform: none; }

.again {
  margin-top: 20px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  transition: border-color .18s ease, color .18s ease;
}
.again:hover { border-color: var(--clay); color: var(--clay); }
.again:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }

.note p { margin: 0; color: var(--ink-soft); font-size: 16px; }

.foot {
  margin: 36px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Состояния ───
   Показываем только то, что относится к текущему шагу. */
[data-when] { display: none; }
.sheet[data-state='idle']     [data-when='idle'],
.sheet[data-state='sending']  [data-when='idle'],
.sheet[data-state='sent']     [data-when='sent'],
.sheet[data-state='checking'] [data-when='checking'],
.sheet[data-state='expired']  [data-when='expired'],
.sheet[data-state='denied']   [data-when='denied'] { display: block; }

.sheet[data-state='sent'] form,
.sheet[data-state='checking'] form,
.sheet[data-state='expired'] form,
.sheet[data-state='denied'] form { display: none; }

/* Единственное движение на странице: смена шага. Короткое, затухающее. */
.sheet[data-state] > *,
.note { animation: rise .34s cubic-bezier(.16,.84,.44,1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
