@font-face {
  font-family: "Rubik";
  src: url("/assets/fonts/rubik.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  /* Палитра бренда «Шалфей и персик» */
  --sage: #BFD8C2;
  --sage-deep: #5E8C6E;
  --peach: #F6CDB5;
  --milk: #FBF7F0;
  --ink: #2F3B36;
  /* Производные: только для текста второго плана и состояний */
  --ink-soft: #55625B;
  --error: #A33A2C;

  --radius: 14px;
  --page: min(1240px, 100% - 2 * var(--gutter));
  --gutter: clamp(20px, 4vw, 48px);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--milk);
  color: var(--ink);
  font-family: "Rubik", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-feature-settings: "kern", "liga";
}

:focus-visible {
  outline: 3px solid var(--sage-deep);
  outline-offset: 3px;
}

/* ---------- Шапка ---------- */

.top {
  width: var(--page);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top__logo { display: block; border-radius: 8px; }
.top__logo img { display: block; height: clamp(34px, 4vw, 44px); width: auto; }

.top__note {
  margin: 0;
  font-size: .9375rem;
  color: var(--ink-soft);
}

/* ---------- Первый экран ---------- */

.hero {
  flex: 1;
  width: var(--page);
  margin: 0 auto;
  padding: clamp(8px, 3vw, 40px) 0 clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
}

.hero__title {
  margin: 0 0 .45em;
  font-size: clamp(2.5rem, 1.4rem + 3.6vw, 4.75rem);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -.025em;
  text-wrap: balance;
  max-width: 11ch;
}

.hero__lead {
  margin: 0 0 2.25rem;
  max-width: 34em;
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- Запись на запуск ---------- */

.signup { max-width: 34rem; }
.signup[hidden] { display: none; }

.hero__soon {
  display: inline-block;
  margin: 8px 0 0;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: #EEF4EC;
  font-weight: 500;
}

.signup__label {
  display: block;
  margin-bottom: .6rem;
  font-weight: 500;
}

.signup__row {
  display: flex;
  gap: 8px;
}

.signup__input {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.signup__input::placeholder { color: #8A948E; }
.signup__input:focus-visible { outline-offset: 2px; }
.signup__input[aria-invalid="true"] { border-color: var(--error); }

.signup__button {
  height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--milk);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s;
}

.signup__button:hover { background: #1F2925; }
.signup__button:disabled { opacity: .6; cursor: progress; }

.signup__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  font-size: .9375rem;
  line-height: 1.4;
  color: var(--ink-soft);
  cursor: pointer;
}

.signup__consent input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--sage-deep);
}

.signup__message {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: .9375rem;
}

.signup__message[data-tone="error"] { color: var(--error); }

.signup[data-done] .signup__row,
.signup[data-done] .signup__consent,
.signup[data-done] .signup__label { display: none; }

.signup[data-done] .signup__message {
  margin: 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--sage);
  color: var(--ink);
  font-size: 1.0625rem;
}

/* ---------- Сцена: комната в арке ---------- */

.scene {
  position: relative;
  margin: 0;
  justify-self: end;
  width: min(100%, 560px);
}

/* Две арки одна в другой — как в логотипе */
.scene__arch {
  aspect-ratio: 9 / 10;
  padding: clamp(10px, 2vw, 18px) clamp(10px, 2vw, 18px) 0;
  border-radius: 9999px 9999px 0 0;
  background: var(--peach);
}

.scene__inner {
  height: 100%;
  border-radius: 9999px 9999px 0 0;
  background: var(--sage);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.scene__svg {
  display: block;
  width: 88%;
  height: auto;
  margin-bottom: 9%;
  overflow: visible;
}

.scene__svg text {
  font-family: "Rubik", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  fill: var(--ink);
}

.receipt {
  position: absolute;
  left: clamp(-64px, -4.5vw, -12px);
  bottom: clamp(-60px, -4vw, -12px);
  width: min(260px, 62%);
  padding: 16px 18px 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--milk);
  font-size: .875rem;
  line-height: 1.35;
}

.receipt__title {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: .9375rem;
}

.receipt__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.receipt__items li,
.receipt__total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt__items li { padding: 3px 0; }
.receipt__items span:last-child,
.receipt__total span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

.receipt__total {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1.5px solid var(--ink);
  font-weight: 600;
  font-size: 1rem;
}

.receipt__budget {
  margin: 2px 0 0;
  text-align: right;
  color: var(--sage-deep);
  font-weight: 500;
}

/* ---------- Одна анимация при загрузке: замер → мебель → список ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .scene [data-step] { opacity: 0; }

  .js .scene.is-playing [data-step="corners"] {
    animation: pop .35s var(--ease-out) calc(var(--i, 0) * 120ms) both;
    transform-box: fill-box;
    transform-origin: center;
  }

  .js .scene.is-playing [data-step="edges"] {
    opacity: 1;
    stroke-dasharray: 1;
    animation: draw .7s ease-in-out calc(500ms + var(--i, 0) * 150ms) both;
  }

  .js .scene.is-playing [data-step="labels"] { animation: fade .4s ease-out calc(1000ms + var(--i, 0) * 120ms) both; }
  .js .scene.is-playing [data-step="room"] { animation: fade .5s ease-out 1200ms both; }

  .js .scene.is-playing [data-step="item"] {
    animation: drop .55s var(--ease-out) calc(1700ms + var(--i, 0) * 170ms) both;
  }

  .js .scene.is-playing .receipt[data-step] {
    animation: slide .6s var(--ease-out) 2750ms both;
  }
}

@keyframes pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drop { from { opacity: 0; transform: translateY(-28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Документы: политика и согласие ---------- */

.top__back {
  font-size: .9375rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 6px;
}
.top__back:hover { color: var(--ink); text-decoration: underline; }

.doc {
  flex: 1;
  width: min(46rem, 100% - 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(8px, 3vw, 32px) 0 clamp(40px, 6vw, 72px);
}

.doc a, .signup__consent a, .foot a { color: var(--sage-deep); text-underline-offset: 2px; }
.doc a:hover, .signup__consent a:hover, .foot a:hover { color: var(--ink); }

.doc__title {
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.01em;
}

.doc__meta { margin: 10px 0 0; font-size: .9375rem; color: var(--ink-soft); }

.doc__lead {
  margin: 24px 0 8px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: #EEF4EC;
}

.doc h2 {
  margin: 36px 0 10px;
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

.doc p { margin: 10px 0; }
.doc ul { margin: 10px 0; padding-left: 1.25em; }
.doc li { margin: 6px 0; }

.doc__table { overflow-x: auto; margin: 14px 0; border-radius: var(--radius); border: 1px solid #E3DDD2; }
.doc__table table { width: 100%; min-width: 36rem; border-collapse: collapse; font-size: .9375rem; line-height: 1.4; }
.doc__table th, .doc__table td { padding: 12px 14px; text-align: left; vertical-align: top; }
.doc__table th { background: #F3EEE5; font-weight: 500; }
.doc__table tr + tr td, .doc__table tbody tr:first-child td { border-top: 1px solid #E3DDD2; }

.doc__terms { margin: 20px 0; display: grid; grid-template-columns: minmax(9rem, 13rem) 1fr; gap: 0; }
.doc__terms dt, .doc__terms dd { margin: 0; padding: 12px 0; border-top: 1px solid #E3DDD2; }
.doc__terms dt { font-weight: 500; padding-right: 16px; }

/* Место для реквизитов, которые ещё не заполнены. Сборка сайта не пропустит страницу с ним. */
.fill { background: var(--peach); border-radius: 4px; padding: 0 4px; }

/* ---------- Подвал ---------- */

.foot {
  width: var(--page);
  margin: 0 auto;
  padding: 20px 0 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  border-top: 1px solid #E3DDD2;
  font-size: .875rem;
  color: var(--ink-soft);
}
.foot p { margin: 0; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a[aria-current="page"] { color: var(--ink); text-decoration: none; }

/* ---------- Узкие экраны ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .hero__title { max-width: 14ch; }
  .scene {
    justify-self: center;
    width: min(100%, 480px);
    margin-bottom: 32px;
  }
  .receipt { left: -8px; }
}

@media (max-width: 520px) {
  .top__note { display: none; }
  .doc__terms { grid-template-columns: 1fr; }
  .doc__terms dd { border-top: 0; padding-top: 0; }
  .signup__row { flex-direction: column; }
  .signup__input { flex: none; }
  .signup__button { width: 100%; }
  .receipt {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    margin: -40px 12px 0;
  }
}
