/* Лендинг. Общие токены, шапка, телефон и подвал лежат в style.css.
   Ритм один на все блоки: отступ раздела --section, заголовок раздела, контент. */

:root {
  --section: clamp(80px, 10vw, 136px);
  --radius: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --card: #1c1c1c;
  --card-line: rgba(255, 255, 255, 0.09);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.7);
}

:root[data-theme="light"] {
  --card: #fbfbfa;
  --card-line: rgba(18, 18, 18, 0.08);
  --shadow: 0 1px 2px rgba(18, 18, 18, 0.04), 0 24px 60px -32px rgba(18, 18, 18, 0.22);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --card: #fbfbfa;
    --card-line: rgba(18, 18, 18, 0.08);
    --shadow: 0 1px 2px rgba(18, 18, 18, 0.04), 0 24px 60px -32px rgba(18, 18, 18, 0.22);
  }
}

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  column-gap: clamp(32px, 6vw, 96px);
  align-items: end;
  margin: 0 0 clamp(44px, 5vw, 72px);
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
}

.section-head .eyebrow {
  grid-column: 1 / -1;
}

.section-head h2 {
  max-width: 17ch;
}

.section-head__text {
  margin: 0;
  max-width: 30em;
  padding-bottom: 0.3em;
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
  text-wrap: pretty;
}

.section-head h2,
.mess__title,
.final h2 {
  font-size: clamp(32px, 4.2vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.section-head .eyebrow {
  margin-bottom: 26px;
}

.hero__note {
  display: inline-block;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg-muted);
}

.hero__note.is-poked {
  color: var(--fg);
  animation: poke 0.4s ease;
}

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

.hero {
  overflow-x: clip;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  min-height: min(calc(100svh - 52px), 760px);
  padding-block: 40px;
}

.hero__copy .eyebrow {
  margin-bottom: 20px;
}

.hero__title {
  max-width: 15ch;
  font-size: clamp(40px, 5.2vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero__lead {
  max-width: 28em;
  margin-top: 24px;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.5;
  color: var(--fg-soft);
  text-wrap: pretty;
}

.hero__cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 36px;
}

.hero__stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 560px;
}

.hero__bloom {
  position: absolute;
  top: 50%;
  width: min(420px, 62%);
  height: auto;
  pointer-events: none;
  user-select: none;
  /* кисть в макете белая, экспорт из фигмы серее */
  filter: brightness(1.65) contrast(1.45);
}

:root[data-theme="light"] .hero__bloom {
  filter: brightness(0);
}

.hero__bloom--l {
  right: calc(50% - 60px);
  translate: 0 -54%;
  transform-origin: 100% 50%;
}

.hero__bloom--r {
  left: calc(50% - 46px);
  translate: 0 -50%;
  transform-origin: 0% 50%;
}

.hero__phone {
  position: relative;
  z-index: 2;
}

.hero__phone .phone {
  --w: 230px;
}

.hero__logo {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 14px;
}

.hero__logo .flower {
  width: 40px;
}

.happ {
  position: absolute;
  inset: calc(var(--w) * 0.15) 0 0;
  padding: 0 6.5%;
  font-size: calc(var(--w) * 0.05);
  color: #fff;
  text-align: left;
  opacity: 0;
}

.happ__date {
  margin-top: 0.5em;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ios-gray);
}

.happ__hello {
  margin-top: 0.1em;
  font-size: 1.9em;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* неделя кружками: день светится, если в нём что-то записал */
.happ__week {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-top: 0.75em;
}

.happ__week i {
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.happ__week i.on {
  background: #fff;
  border-color: #fff;
}

.happ__week i.today {
  border-color: rgba(255, 255, 255, 0.9);
}

.happ__week i.future {
  border-color: rgba(255, 255, 255, 0.15);
}

.happ__week small {
  display: grid;
  margin-left: 0.3em;
  font-size: 0.72em;
  color: var(--ios-gray);
}

.happ__week small > span {
  grid-area: 1 / 1;
}

.happ__count4 {
  opacity: 0;
}

.happ__capture {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.9em;
  padding: 0.5em 0.5em 0.5em 0.85em;
  border-radius: 0.95em;
  background: var(--ios-cell);
  font-size: 0.86em;
  color: var(--ios-gray);
}

.happ__capture b {
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-weight: 600;
}

.happ__label {
  margin: 1.05em 0 0.4em 0.25em;
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ios-gray);
}

.happ__group {
  border-radius: 0.85em;
  background: var(--ios-cell);
  overflow: hidden;
}

.happ__row {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.62em 0.75em;
  border-bottom: 0.5px solid var(--ios-sep);
  font-size: 0.86em;
}

.happ__row:last-child {
  border-bottom: 0;
}

.happ__row small {
  margin-left: auto;
  font-size: 0.8em;
  color: var(--ios-gray);
  white-space: nowrap;
}

.happ__task span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  /* зачёркивание рисуется фоном, чтобы его можно было «провести» анимацией */
  background: linear-gradient(currentColor, currentColor) left 55% / 0% 1px no-repeat;
}

.happ__task i {
  position: relative;
  flex: none;
  width: 1.1em;
  height: 1.1em;
  border: 1.5px solid #636366;
  border-radius: 50%;
}

.happ__task i::after {
  content: "";
  position: absolute;
  left: 0.3em;
  top: 0.12em;
  width: 0.28em;
  height: 0.52em;
  border: solid #000;
  border-width: 0 0.13em 0.13em 0;
  transform: rotate(45deg) scale(0);
}

/* план из дневника: подпись второй строкой, чтобы ничего не обрезалось */
.happ__task--plan {
  flex-wrap: wrap;
  row-gap: 0.1em;
}

.happ__task--plan small {
  flex-basis: 100%;
  margin-left: 1.7em;
}

.happ__cards {
  display: flex;
  gap: 0.5em;
  margin-right: -7%;
  overflow: hidden;
}

.happ__card {
  display: flex;
  flex: 0 0 62%;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.7em 0.75em;
  border-radius: 0.85em;
  background: var(--ios-cell);
}

.happ__card b {
  font-size: 0.92em;
  font-weight: 600;
}

.happ__card small {
  font-size: 0.74em;
  color: var(--ios-gray);
}

.happ__bar {
  height: 0.25em;
  margin-top: 0.55em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.happ__bar span {
  display: block;
  width: 60%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.happ__bar--2 span {
  width: 25%;
}

.happ__journal b {
  margin-left: auto;
  font-size: 0.92em;
  font-weight: 600;
}

/* без анимаций сразу показываем экран приложения */
@media (prefers-reduced-motion: reduce) {
  .hero__logo { display: none; }
  .happ { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__copy > * {
    animation: appear 0.9s var(--ease) both;
  }

  .hero__copy > :nth-child(1) { animation-delay: 0.6s; }
  .hero__copy > :nth-child(2) { animation-delay: 0.7s; }
  .hero__copy > :nth-child(3) { animation-delay: 0.82s; }

  .hero__phone {
    animation: hero-phone-in 1.3s var(--ease) 0.1s both;
    translate: calc(var(--mx, 0) * 12px) calc(var(--my, 0) * 8px);
    transition: translate 0.7s var(--ease);
  }

  .hero__phone .phone {
    animation: float 7s ease-in-out 2.2s infinite;
  }

  .hero__logo {
    animation: hero-logo-in 1s var(--ease) 0.75s both, hero-logo-out 0.6s ease 2.3s forwards;
  }

  .happ {
    animation: happ-in 0.9s var(--ease) 2.6s forwards;
  }

  /* экран оживает: блоки выезжают лесенкой, сегодняшний кружок загорается,
     задача из «Сегодня» сама отмечается, полоски проектов растут */
  .happ > * {
    animation: appear 0.7s var(--ease) both;
    animation-delay: calc(2.7s + var(--k, 0) * 0.06s);
  }

  .happ > :nth-child(2) { --k: 1; }
  .happ > :nth-child(3) { --k: 2; }
  .happ > :nth-child(4) { --k: 3; }
  .happ > :nth-child(5) { --k: 4; }
  .happ > :nth-child(6) { --k: 5; }
  .happ > :nth-child(7) { --k: 6; }
  .happ > :nth-child(8) { --k: 7; }
  .happ > :nth-child(9) { --k: 8; }
  .happ > :nth-child(10) { --k: 9; }

  .happ__week i.today {
    animation: dot-on 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 4.6s forwards;
  }

  .happ__count3 {
    animation: fade-out 0.3s ease 4.6s forwards;
  }

  .happ__count4 {
    animation: fade-in 0.3s ease 4.7s forwards;
  }

  .happ__task:first-child i {
    animation: tick-fill 0.35s ease 3.9s forwards;
  }

  .happ__task:first-child i::after {
    animation: tick-mark 0.35s cubic-bezier(0.3, 1.6, 0.5, 1) 4s forwards;
  }

  .happ__task:first-child span {
    animation: strike 0.45s ease 4.15s forwards;
  }

  .happ__bar span {
    animation: bar-grow 1.2s var(--ease) 3.3s both;
  }

  .hero__bloom--l {
    animation: hero-bloom-l 1.7s var(--ease) 0.5s both, hero-sway-l 9s ease-in-out 2.4s infinite;
  }

  .hero__bloom--r {
    animation: hero-bloom-r 1.7s var(--ease) 0.58s both, hero-sway-r 9s ease-in-out 2.4s infinite;
  }
}

@keyframes float {
  50% { transform: translateY(-8px); }
}

@keyframes hero-phone-in {
  from {
    opacity: 0;
    transform: translateY(70px) scale(0.94);
    filter: blur(6px);
  }
}

@keyframes dot-on {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { background: #fff; border-color: #fff; transform: scale(1); }
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

@keyframes tick-fill {
  to { background: #fff; border-color: #fff; }
}

@keyframes tick-mark {
  to { transform: rotate(45deg) scale(1); }
}

@keyframes strike {
  to { background-size: 100% 1px; color: var(--ios-gray); }
}

@keyframes bar-grow {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform-origin: left; }
}

@keyframes hero-logo-out {
  to {
    opacity: 0;
    transform: scale(0.9);
    filter: blur(4px);
  }
}

@keyframes happ-in {
  from { transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes hero-logo-in {
  from {
    opacity: 0;
    transform: scale(0.82);
    filter: blur(6px);
  }
}

/* половинки выезжают из-за телефона и разворачиваются, как лепестки */
@keyframes hero-bloom-l {
  from {
    opacity: 0;
    transform: translateX(42%) rotate(22deg) scale(0.5);
  }
  55% { opacity: 1; }
}

@keyframes hero-bloom-r {
  from {
    opacity: 0;
    transform: translateX(-42%) rotate(-22deg) scale(0.5);
  }
  55% { opacity: 1; }
}

@keyframes hero-sway-l {
  50% { rotate: -2deg; }
}

@keyframes hero-sway-r {
  50% { rotate: 2deg; }
}

/* ---------- 3. Боль: бумажки разлетаются ---------- */

.mess {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 680px;
  padding: var(--section) var(--gutter);
  overflow: hidden;
  border-block: 1px solid var(--line);
}

.mess__field {
  position: absolute;
  inset: 0;
  container-type: size;
  pointer-events: none;
}

.scrap {
  --s: var(--spread, 0);
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  border-color: var(--card-line);
  box-shadow: var(--shadow);
  font-family: var(--sans);
  font-size: 14px;
  white-space: nowrap;
  color: var(--fg-soft);
  opacity: calc(0.2 + var(--s) * 0.8);
  transform:
    translate(-50%, -50%)
    translate(calc(var(--x) * var(--s) * 1cqw), calc(var(--y) * var(--s) * 1cqh))
    rotate(calc(var(--r) * var(--s) * 1deg));
  animation: drift 7s ease-in-out infinite alternate;
  animation-delay: calc(var(--d, 0) * -1s);
}

/* где лежит каждая бумажка, когда всё разлетелось: проценты от ширины и высоты блока */
.scrap:nth-child(1) { --x: -33; --y: -30; --r: -7; --d: 1; }
.scrap:nth-child(2) { --x: 30; --y: -33; --r: 5; --d: 3; }
.scrap:nth-child(3) { --x: -38; --y: 4; --r: 4; --d: 5; }
.scrap:nth-child(4) { --x: 36; --y: 2; --r: -4; --d: 2; }
.scrap:nth-child(5) { --x: -27; --y: 35; --r: 6; --d: 4; }
.scrap:nth-child(6) { --x: 27; --y: 34; --r: -6; --d: 6; }
.scrap:nth-child(7) { --x: -4; --y: -41; --r: -2; --d: 0; }
.scrap:nth-child(8) { --x: 4; --y: 42; --r: 3; --d: 3.5; }

.scrap--task::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border: 1.5px solid var(--fg-muted);
  border-radius: 50%;
  vertical-align: -1px;
}

@keyframes drift {
  to { translate: 0 -10px; }
}

.mess__copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
  text-align: center;
}

.mess__text {
  max-width: 30em;
  margin: 22px auto 0;
  font-size: 18px;
  line-height: 1.5;
  color: var(--fg-muted);
  text-wrap: pretty;
}

/* ---------- 4. Решение: три полки ---------- */

.sort {
  padding-block: var(--section);
}

.shelves {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.shelf {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.shelf h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
}

.shelf__icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
}

.shelf__icon .ico {
  width: 17px;
  height: 17px;
}

.shelf > p {
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg-soft);
  text-wrap: pretty;
}

.shelf__list {
  list-style: none;
  margin: auto 0 0;
  padding: 24px 0 0;
  font-family: var(--sans);
  font-size: 14px;
}

.shelf__list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  color: var(--fg-soft);
}

.shelf__list small {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-muted);
}

.tick {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--fg-muted);
  border-radius: 50%;
}

.tick .ico {
  width: 10px;
  height: 10px;
}

.shelf__list .is-done .tick {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.shelf__list .is-done > span:not(.tick) {
  text-decoration: line-through;
  color: var(--fg-muted);
}

/* ---------- 5. Два шага ---------- */

.steps {
  padding-block: var(--section);
}

.steps__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 920px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 28px 36px;
  border: 1px solid var(--card-line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

@media (min-width: 761px) {
  .step:first-child {
    position: relative;
  }

  .step:first-child::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: 50%;
    right: -19px;
    width: 14px;
    height: 14px;
    border-top: 1.5px solid var(--fg-muted);
    border-right: 1.5px solid var(--fg-muted);
    transform: translateY(-50%) rotate(45deg);
  }
}

.step__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  align-self: stretch;
  margin-bottom: 28px;
}

.step__head h3 {
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 500;
}

.step__head p {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--fg-muted);
}

.step__num {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

.step.is-done .step__num {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

/* Первый шаг — просто разметка пунктиром, последний — «финиш»: светлая поверхность,
   контур и мягкий свет за телефоном. Так он отличается, но телефон не тонет в чёрном. */
.step:not(.step--final) {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
  border-color: var(--line-strong);
}

.step--final {
  position: relative;
  border-color: var(--fg);
  border-width: 1.5px;
  background:
    radial-gradient(60% 45% at 50% 62%, color-mix(in srgb, var(--fg) 9%, transparent), transparent 70%),
    var(--card);
}

.step--final .step__num {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.step--final::before {
  content: attr(data-badge);
  position: absolute;
  top: -12px;
  right: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.step--final.is-active {
  box-shadow: var(--shadow), 0 0 0 6px color-mix(in srgb, var(--fg) 10%, transparent);
}

.step__phone {
  --w: 230px;
}

.midcta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-top: 56px;
  text-align: center;
}

.midcta p {
  font-size: 18px;
  color: var(--fg-soft);
}

/* экраны внутри демо-телефонов; размеры от ширины телефона */
.demo__view {
  position: absolute;
  inset: calc(var(--w) * 0.15) 0 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 7% 12%;
  font-size: calc(var(--w) * 0.05);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(24px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s 0.35s;
}

.demo__view.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.demo__view.is-left {
  transform: translateX(-24px);
}

.demo__view .flower {
  width: 2.8em;
  margin: 0 auto 0.9em;
  color: #fff;
}

.demo__title {
  margin-bottom: 0.7em;
  font-size: 1.35em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.demo__field {
  display: block;
  width: 100%;
  margin-top: 0.5em;
  padding: 0.65em 0.8em;
  border: 1px solid transparent;
  border-radius: 0.7em;
  background: var(--ios-cell);
  font-family: var(--ios);
  font-size: 0.92em;
  color: #fff;
}

.demo__field:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
}

.demo__field::placeholder {
  color: #636366;
}

textarea.demo__field {
  height: 7.5em;
  resize: none;
  line-height: 1.35;
}

.demo__error {
  min-height: 1.3em;
  margin-top: 0.35em;
  font-size: 0.8em;
  color: #ff453a;
  text-align: left;
}

.demo__btn {
  display: block;
  padding: 0.65em 1em;
  border-radius: 0.7em;
  background: var(--ios-fill);
  color: #fff;
  font-size: 0.9em;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
}

.demo__btn:hover {
  background: rgba(118, 118, 128, 0.36);
}

.demo__btn:active {
  transform: scale(0.97);
}

.demo__btn--solid {
  background: #fff;
  color: #000;
}

.demo__btn--solid:hover {
  background: #d9d9d9;
}

.demo__btn--wide {
  width: 100%;
  margin-top: 0.6em;
}

.demo__note {
  margin-top: 0.5em;
  font-size: 0.75em;
  color: var(--ios-gray);
}

button.demo__note:hover {
  color: #fff;
}

.demo__done {
  display: grid;
  place-items: center;
  width: 3.4em;
  height: 3.4em;
  margin: 0 auto 0.9em;
  border-radius: 50%;
  background: #fff;
  color: #000;
}

.demo__done .ico {
  width: 1.7em;
  height: 1.7em;
}

.demo__view[data-view="ready"].is-shown .demo__done {
  animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes pop {
  from { transform: scale(0.6); }
}

.seg {
  display: flex;
  padding: 0.15em;
  margin-bottom: 0.2em;
  border-radius: 0.65em;
  background: var(--ios-fill);
}

.seg button {
  flex: 1;
  padding: 0.45em 0;
  border-radius: 0.55em;
  font-size: 0.82em;
  font-weight: 600;
  color: #fff;
  transition: background 0.25s, box-shadow 0.25s;
}

.seg button[aria-pressed="true"] {
  background: #636366;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* после сохранения поле ввода уступает место карточке и кнопке в приложение */
.is-saved textarea,
.is-saved [type="submit"],
.is-saved .seg {
  display: none;
}

.saved {
  margin-top: 0.4em;
  padding: 0.75em 0.85em;
  border-radius: 0.8em;
  background: var(--ios-cell);
  text-align: left;
  animation: appear 0.4s ease both;
}

.saved small {
  display: block;
  margin-bottom: 0.2em;
  font-size: 0.72em;
  color: var(--ios-gray);
}

.saved p {
  font-size: 0.95em;
  overflow-wrap: anywhere;
}

.demo__get[hidden],
.demo__reset[hidden] {
  display: none;
}

/* ---------- 6. Почему мы ---------- */

.why {
  padding-block: var(--section);
}

.perks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 980px;
  margin: 0 auto;
}

.perk {
  padding: 24px 24px 30px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.perk__art {
  display: grid;
  place-items: center;
  gap: 8px;
  height: 140px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
}

.perk h3 {
  font-size: 23px;
  line-height: 1.2;
}

.perk p {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg-soft);
  text-wrap: pretty;
}

.mini-task,
.mini-note,
.mini-sync,
.mini-sec {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(260px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.35);
}

.mini-task small {
  margin-left: auto;
  color: var(--fg-muted);
}

/* заметка прицеплена к задаче: уступ и линия */
.mini-note {
  position: relative;
  width: min(232px, 90%);
  justify-self: end;
  margin-right: max(0px, calc(50% - 130px));
  color: var(--fg-muted);
}

.mini-note::before {
  content: "";
  position: absolute;
  left: -14px;
  top: -10px;
  width: 12px;
  height: 28px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-bottom-left-radius: 8px;
}

.mini-map {
  width: 200px;
  color: var(--fg);
}

.mini-sync b,
.mini-sec__on {
  margin-left: auto;
}

.mini-sync b {
  font-weight: 500;
}

.mini-sync span,
.mini-sync b,
.mini-sec span {
  white-space: nowrap;
}

.mini-sync span {
  color: var(--fg-muted);
}

.mini-sec__on {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--fg);
}

.mini-sec__on::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
}

.perk__art .ico {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ---------- 6½. Цены ---------- */

.pricing {
  padding-block: var(--section);
}

.period {
  display: flex;
  width: max-content;
  margin: 0 auto 36px;
  padding: 4px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--sans);
  font-size: 14px;
}

.period button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  color: var(--fg-muted);
  transition: background 0.25s, color 0.25s;
}

.period button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.period b {
  font-weight: 600;
  font-size: 12px;
}

/* что показывать, решает data-period у раздела; без JS виден год */
.pricing[data-period="year"] .is-month,
.pricing[data-period="month"] .is-year {
  display: none;
}

.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 880px;
  margin: 0 auto;
  align-items: stretch;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 32px 30px 30px;
  border: 1px solid var(--card-line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.plan h3 {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
}

.plan__price {
  margin-top: 18px;
  font-size: clamp(44px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.plan__price small {
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
  color: var(--fg-muted);
}

.plan__note {
  min-height: 2.9em;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg-muted);
}

.plan__list {
  display: grid;
  gap: 12px;
  margin: 22px 0 30px;
  padding: 22px 0 0;
  border-top: 1px solid var(--card-line);
  list-style: none;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.4;
}

.plan__list li {
  position: relative;
  padding-left: 26px;
}

/* галочка из двух линий, как в остальных иконках */
.plan__list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.32em;
  width: 9px;
  height: 5px;
  border-left: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
}

.plan__list .plan__lead {
  padding-left: 0;
  font-weight: 500;
}

.plan__list .plan__lead::before {
  display: none;
}

.plan__cta {
  justify-content: center;
  margin-top: auto;
}

.plan__cta--ghost {
  background: transparent;
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* Pro инвертирован: на тёмной теме светлая карточка, на светлой — тёмная */
.plan--pro {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.plan--pro .plan__price small,
.plan--pro .plan__note {
  color: color-mix(in srgb, var(--bg) 62%, transparent);
}

.plan--pro .plan__list {
  border-color: color-mix(in srgb, var(--bg) 16%, transparent);
}

.plan--pro .plan__cta {
  background: var(--bg);
  color: var(--fg);
  box-shadow: none;
}

.plan__badge {
  position: absolute;
  top: 28px;
  right: 26px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bg) 30%, transparent);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.pricing__local {
  margin-top: 22px;
  text-align: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---------- 7. Главная кнопка ---------- */

.final {
  position: relative;
  padding-block: calc(var(--section) * 1.2);
  overflow: hidden;
  border-block: 1px solid var(--line);
}

/* те же половинки цветка, что на первом экране: страница начинается и заканчивается им */
.final__bloom {
  position: absolute;
  top: 50%;
  width: clamp(220px, 24vw, 340px);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
  filter: brightness(1.65) contrast(1.45);
}

:root[data-theme="light"] .final__bloom {
  filter: brightness(0);
}

.final__bloom--l {
  right: calc(50% + clamp(190px, 19vw, 290px));
  translate: 0 -50%;
  rotate: -8deg;
}

.final__bloom--r {
  left: calc(50% + clamp(190px, 19vw, 290px));
  translate: 0 -46%;
  rotate: 8deg;
}

@media (prefers-reduced-motion: no-preference) {
  .final__bloom--l { animation: hero-sway-l 9s ease-in-out infinite; }
  .final__bloom--r { animation: hero-sway-r 9s ease-in-out infinite; }
}

.final__inner {
  position: relative;
  z-index: 1;
}

.final__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.final h2 {
  max-width: 13ch;
  font-size: clamp(38px, 5.4vw, 72px);
}

.final__cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
}

/* ---------- 8. Команда: в тех же чёрно-белых тонах ---------- */

.team {
  padding-block: var(--section);
}

.team__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.dev__pic {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.dev__pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
  transition: transform 0.8s var(--ease), filter 0.6s ease;
}

.dev:hover .dev__pic img {
  transform: scale(1.04);
  filter: grayscale(1) contrast(1.15);
}

.dev h3 {
  margin-top: 16px;
  font-size: 20px;
}

.dev p {
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg-muted);
}

/* ---------- Нить через страницу (рисует motion.js) ---------- */

.has-thread {
  position: relative;
}

/* разделы над нитью: она уходит под карточки и телефоны, а в пустых местах видна */
.has-thread > section {
  position: relative;
  z-index: 1;
}

.thread {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  color: var(--fg);
}

.thread path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.thread circle {
  fill: currentColor;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.4s ease;
}

.thread.is-done circle {
  opacity: 0.9;
  animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* на узком экране полей нет — нить резала бы текст */
@media (max-width: 860px) {
  .thread {
    display: none;
  }
}

/* ---------- Маскот: цветок с глазами ---------- */

.buddy {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: calc(100vw - 40px);
  pointer-events: none;
  transition: opacity 0.3s ease, translate 0.4s var(--ease);
}

.buddy.is-away {
  opacity: 0;
  translate: 0 12px;
  pointer-events: none;
}

.buddy.is-away > * {
  pointer-events: none;
}

.buddy[hidden] {
  display: none;
}

.buddy > * {
  pointer-events: auto;
}

.buddy__face {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 54px;
  height: 54px;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: appear 0.6s var(--ease) both;
}

.buddy__face .flower {
  width: 38px;
}

@media (prefers-reduced-motion: no-preference) {
  .buddy__face .flower {
    animation: sway 6s ease-in-out infinite;
  }

  .buddy.is-talking .buddy__face .flower {
    animation: nod 0.9s ease-in-out 2;
  }
}

/* глаза — две точки в центре цветка, иногда моргают */
.buddy__eyes::before,
.buddy__eyes::after {
  content: "";
  position: absolute;
  top: 46%;
  width: 4px;
  height: 5px;
  border-radius: 50%;
  background: var(--card);
  animation: blink 5s infinite;
}

.buddy__eyes::before { left: calc(50% - 6px); }
.buddy__eyes::after { left: calc(50% + 2px); }

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
}

@keyframes sway {
  50% { rotate: 8deg; }
}

@keyframes nod {
  50% { rotate: -12deg; scale: 1.08; }
}

.buddy__say {
  max-width: 260px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  translate: -6px 6px;
  transition: opacity 0.3s ease, translate 0.4s var(--ease);
  pointer-events: none;
}

.buddy.is-talking .buddy__say {
  opacity: 1;
  translate: 0 0;
}

.buddy__close {
  position: absolute;
  left: 40px;
  top: -6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg-muted);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
}

.buddy:hover .buddy__close,
.buddy__close:focus-visible,
.buddy.is-talking .buddy__close {
  opacity: 1;
}

/* ---------- Адаптив ---------- */

@media (max-width: 960px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    padding-block: 36px 24px;
  }

  .hero__stage {
    height: 470px;
  }

  .hero__phone .phone {
    --w: 200px;
  }

  .shelves {
    grid-template-columns: 1fr;
    max-width: 560px;
    margin: 0 auto;
  }

  .team__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .section-head {
    grid-template-columns: 1fr;
    row-gap: 16px;
  }

  .final__bloom {
    width: 200px;
    opacity: 0.35;
  }

  .final__bloom--l { right: calc(50% + 60px); }
  .final__bloom--r { left: calc(50% + 60px); }
}

@media (max-width: 760px) {
  .plans {
    grid-template-columns: 1fr;
    max-width: 440px;
  }

  .plan--pro {
    order: -1;
  }

  .steps__list,
  .perks {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
}

/* на узком экране бумажки не разлетаются по полю, а лежат кучкой над текстом */
@media (max-width: 720px) {
  .mess {
    display: flex;
    flex-direction: column;
    gap: 36px;
    min-height: 0;
  }

  .mess__field {
    position: relative;
    inset: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 8px;
    container-type: normal;
  }

  .scrap {
    position: relative;
    left: auto;
    top: auto;
    font-size: 13px;
    opacity: calc(0.3 + var(--s) * 0.7);
    transform: rotate(calc(var(--r) * var(--s) * 1deg)) translateY(calc((1 - var(--s)) * 30px));
  }

  .scrap:nth-child(n + 7) {
    display: none;
  }

  .hero__title {
    font-size: clamp(36px, 10vw, 46px);
  }

  .buddy {
    left: 12px;
    bottom: 12px;
  }

  .buddy__face {
    width: 46px;
    height: 46px;
  }

  .buddy__face .flower {
    width: 32px;
  }

  .buddy__say {
    max-width: min(240px, calc(100vw - 90px));
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .team__list {
    gap: 14px;
  }

  .dev h3 {
    font-size: 17px;
  }
}

@media print {
  .buddy {
    display: none;
  }
}
