/* ---------------------------------------------------------------------------
   Главная на весь экран (config.yaml: home: immersive). Файл подключается только на ней.
   Без JS и при prefers-reduced-motion — обычная страница: главы истории идут
   друг под другом со снимками, лента экранов листается пальцем или сеткой.
   static/js/story.js ставит на <html>:
     story-live — история закреплена на экране, точки на canvas строят картины;
     strip-live — лента экранов едет вбок при прокрутке вниз (широкий экран);
     fill-live  — заголовки заливаются цветом по мере прокрутки;
     steps-live — узлы шагов закрашиваются, когда до них дошла линия.
   Цвета — только токены; тёмные разделы — класс force-dark (tokens.css).
   ------------------------------------------------------------------------ */

.immersive .utility { display: none; }
.immersive .header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transition: transform .28s var(--ease), background-color .25s var(--ease), border-color .25s var(--ease);
}
.immersive .header.is-clear { background: transparent; border-bottom-color: transparent; }

.v2-wrap { width: 100%; max-width: 1680px; margin-inline: auto; padding-inline: var(--gutter); }
.v2-sec { padding-block: clamp(88px, 11vw, 192px); background: var(--bg); color: var(--ink); }
.v2-h2 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: clamp(2rem, 0.9rem + 3.4vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  max-width: 15em;
  text-wrap: balance;
}
.v2-lead { font-size: var(--fs-lead); line-height: 1.45; color: var(--ink2); max-width: 36em; text-wrap: pretty; }

/* Заливка по прокрутке: строчный элемент, поэтому градиент идёт по строкам подряд —
   сначала первая строка, потом вторая. Без fill-live текст просто цветом --ink. */
.fill-live .fill {
  --f: 0%;
  background: linear-gradient(90deg, var(--ink) calc(var(--f) - 4%), var(--soft) calc(var(--f) + 4%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* В режиме высокой контрастности (forced-colors) — обычный текст. */
@media (forced-colors: active) { .fill-live .fill { background: none; color: CanvasText; } }

/* --- История: первый экран и главы ---------------------------------------- */

.story { position: relative; background: var(--bg); color: var(--ink); }
.story__canvas, .story__scrim, .story__rail { display: none; }
.story__chapters { display: grid; }

.chapter { padding: clamp(72px, 9vw, 140px) var(--gutter) 0; max-width: 1180px; container-type: inline-size; }
.chapter:last-child { padding-bottom: clamp(72px, 9vw, 140px); }
.chapter--hero {
  min-height: 100svh;
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: clamp(48px, 10vh, 120px);
}
.story__h1 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: min(clamp(2.4rem, 0.6rem + 5vw, 7rem), 8.6svh);
  line-height: 0.98;
  letter-spacing: -0.04em;
  max-width: 11.5em;
  text-wrap: balance;
}
.chapter__lead { margin-top: clamp(20px, 2.4vw, 32px); font-size: var(--fs-lead); line-height: 1.45; color: var(--ink2); max-width: 31em; text-wrap: pretty; }
.chapter .btn-row { margin-top: clamp(22px, 2.6vw, 34px); }
.chapter__note { margin-top: 14px; font-size: var(--fs-small); color: var(--muted); max-width: 36em; }
.story__more {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  margin-top: clamp(20px, 3vh, 36px);
  min-height: 44px;
  color: var(--ink);
  font-size: var(--fs-small);
  text-decoration: none;
}
.story__more::before {
  content: "";
  width: 1px;
  height: 28px;
  background: linear-gradient(var(--ink) 50%, var(--line2) 50%) 0 0 / 100% 200%;
  animation: v2-drip 2.4s var(--ease) infinite;
}
.story__more:hover { text-decoration: underline; text-underline-offset: 0.3em; }
@keyframes v2-drip { to { background-position: 0 -100%; } }

.chapter__title {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: clamp(1.75rem, 0.9rem + 2.4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: 13em;
  text-wrap: balance;
}
.chapter__text { margin-top: 20px; font-size: var(--fs-lead); line-height: 1.45; color: var(--ink2); max-width: 32em; text-wrap: pretty; }
/* Название продукта — всегда в одну строку: кегль не больше, чем помещается в колонку
   («АПланнер» при кегле 100 пикс. — 631 пикс., отсюда 15cqi). Более длинные названия
   story.js дополнительно ужимает (fitNames). */
.chapter__name {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: min(clamp(2.75rem, 0.4rem + 5.6vw, 7.25rem), 15cqi);
  line-height: 0.95;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.chapter__name a { color: inherit; text-decoration: none; }
.chapter__name a:hover { color: var(--p); }
.chapter__sub { margin-top: 16px; font-size: var(--fs-lead); line-height: 1.4; color: var(--ink2); max-width: 26em; text-wrap: pretty; }
.chapter__stage { margin-top: 18px; }
.chapter__facts { display: grid; gap: 10px; margin-top: 22px; max-width: 31em; }
.chapter__facts li { position: relative; padding-left: 22px; line-height: 1.45; text-wrap: pretty; }
.chapter__facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  background: var(--p, var(--ink));
}
.chapter__shot { margin-top: 32px; max-width: 820px; }

/* С JS: история закреплена, высота — по экрану на главу и экран на выход. */
.story-live .story { height: calc((var(--n) + 2) * 100svh); }
.story-live .story__stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.story-live .story__canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.story-live .story__scrim {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--bg) 0, transparent calc(var(--header-h) + 36px)),
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 90%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 34%, transparent 56%);
}
.story-live .story__chapters { position: absolute; inset: 0; display: block; pointer-events: none; }
.story-live .chapter {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(44vw, 640px);
  max-width: none;
  margin: 0;
  padding: 0 0 clamp(56px, 10vh, 120px) var(--gutter);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}
.story-live .chapter.is-on { pointer-events: auto; }
/* Компьютер: текст главы — посередине высоты, вровень с картиной справа. */
@media (min-width: 900px) {
  .story-live .chapter:not(.chapter--hero) {
    top: var(--header-h);
    bottom: clamp(96px, 15vh, 160px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 0;
  }
  .story-live .chapter:not(.chapter--hero) > * { flex: none; }
}
.story-live .chapter--hero { min-height: 0; width: min(72vw, 1240px); opacity: 1; }
.story-live .chapter__shot { display: none; }

/* Оглавление истории: на компьютере — шкала внизу справа, на телефоне — полоски сверху. */
.story-live .story__rail {
  display: block;
  position: absolute;
  left: 50%;
  right: var(--gutter);
  bottom: clamp(28px, 5vh, 52px);
}
.story__rail ol { display: flex; gap: 6px; }
.story__rail li { flex: 1 1 0; min-width: 0; }
.story__rail a {
  --fill: 0;
  position: relative;
  display: block;
  padding-top: 14px;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}
.story__rail a::before, .story__rail a::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line2);
}
.story__rail a::after { background: var(--ink); transform-origin: left; transform: scaleX(var(--fill)); }
.story__rail a:hover, .story__rail a.is-current { color: var(--ink); }
.story__rail-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; margin-right: 6px; }

@media (max-width: 899px) {
  .story-live .story__scrim {
    background:
      linear-gradient(180deg, var(--bg) 0, transparent calc(var(--header-h) + 28px)),
      linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 86%, transparent) 40%, transparent 64%);
  }
  .story-live .chapter, .story-live .chapter--hero {
    right: 0;
    width: auto;
    padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom));
  }
  .story-live .story__rail { left: var(--gutter); right: var(--gutter); top: calc(var(--header-h) + 4px); bottom: auto; }
  .story__rail ol { gap: 4px; }
  .story__rail a { padding-top: 0; min-height: 24px; }
  .story__rail a::before, .story__rail a::after { top: 10px; }
  .story__rail-num, .story__rail-label {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .chapter__facts { gap: 6px; margin-top: 16px; font-size: 0.9375rem; }
  .chapter__sub { margin-top: 10px; font-size: 1.0625rem; }
  .chapter__stage { margin-top: 12px; }
  .chapter__text { font-size: 1.0625rem; margin-top: 14px; }
  .chapter .btn-row { margin-top: 18px; }
  .story-live .chapter__note { display: none; }
  .story-live .chapter--hero .chapter__note { display: block; }
}
/* Низкий широкий экран (ноутбук 1280×720): первый экран и главы плотнее. */
@media (min-width: 900px) and (max-height: 800px) {
  .chapter__lead { margin-top: 16px; }
  .chapter .btn-row { margin-top: 20px; }
  .story__more { margin-top: 8px; }
  .chapter__name { font-size: min(clamp(2.75rem, 0.4rem + 5.6vw, 7.25rem), 11svh, 15cqi); }
  .chapter__facts { margin-top: 16px; gap: 6px; }
}
/* Низкий телефон: в главе продукта остаются название, строка о нём и кнопки. */
@media (max-width: 899px) and (max-height: 760px) {
  .story-live .chapter__facts, .story-live .chapter__stage { display: none; }
  .story-live .chapter--hero .chapter__note { display: none; }
}

/* --- Экраны программ: лента ----------------------------------------------- */

.strip { position: relative; background: var(--bg); color: var(--ink); }
.strip__stage { position: relative; overflow: hidden; padding-block: clamp(88px, 10vw, 160px); }
.strip__move { position: relative; }
.strip__head { display: grid; gap: 20px; align-content: center; padding-inline: var(--gutter); max-width: 1680px; margin-inline: auto; }
.strip__list { display: grid; gap: clamp(28px, 3vw, 48px); margin-top: clamp(36px, 4vw, 64px); padding-inline: var(--gutter); }
.strip__cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin-top: 14px; color: var(--ink2); max-width: 46em; }
.strip__prod { text-decoration: none; }
.strip__prod:hover .pbadge { text-decoration: underline; }
.strip__item .shot { background: var(--surface); }

/* Телефон и планшет: снимки листаются пальцем. */
@media (max-width: 899px) {
  .strip__list {
    grid-auto-flow: column;
    grid-auto-columns: min(86vw, 560px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    padding-bottom: 12px;
  }
  .strip__item { scroll-snap-align: start; }
}
/* Широкий экран без strip-live (prefers-reduced-motion): сетка в две колонки. */
@media (min-width: 900px) {
  .strip__list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 1680px; margin-inline: auto; }
}
.strip-live .strip__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  align-items: center;
  padding-block: calc(var(--header-h) + 24px) 32px;
}
.strip-live .strip__move {
  display: flex;
  align-items: center;
  gap: clamp(32px, 4vw, 72px);
  width: max-content;
  padding-inline: var(--gutter);
  will-change: transform;
}
.strip-live .strip__head { width: min(36vw, 600px); flex: none; margin: 0; padding: 0; }
.strip-live .strip__head .v2-h2 { font-size: clamp(2rem, 0.9rem + 2.6vw, 4.25rem); }
.strip-live .strip__list { display: flex; align-items: center; gap: clamp(32px, 4vw, 72px); margin: 0; padding: 0; max-width: none; }
.strip-live .strip__item {
  --k: 0;
  flex: none;
  width: min(60vw, calc((100svh - var(--header-h) - 190px) * 1.6));
  transform: scale(calc(1 - var(--k) * 0.07));
  transform-origin: center;
}

/* --- Кому подходит ---------------------------------------------------------- */

.aud { margin-top: clamp(40px, 5vw, 80px); border-top: 1px solid var(--line2); }
.aud__row { display: grid; gap: 10px 40px; padding-block: clamp(22px, 2.6vw, 40px); border-bottom: 1px solid var(--line2); }
.aud__who {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: clamp(1.375rem, 0.9rem + 1.3vw, 2.375rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.aud__pain { color: var(--ink2); max-width: 34em; text-wrap: pretty; }
.aud__prod { display: flex; flex-wrap: wrap; gap: 8px; }
.aud__link { text-decoration: none; }
.aud__link:hover .pbadge { text-decoration: underline; }
@media (min-width: 900px) {
  .aud__row { grid-template-columns: 5fr 6fr 3fr; align-items: baseline; }
  .aud__prod { justify-content: flex-end; }
}

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

.why2 { margin-top: clamp(48px, 6vw, 96px); }
.why2__item { display: grid; gap: 12px 48px; padding-block: clamp(28px, 3.4vw, 56px); border-top: 1px solid var(--line2); }
.why2__item:last-child { border-bottom: 1px solid var(--line2); }
.why2__title {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: clamp(1.625rem, 0.8rem + 2.5vw, 3.75rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.why2__text { font-size: var(--fs-lead); line-height: 1.45; color: var(--ink2); max-width: 30em; text-wrap: pretty; }
@media (min-width: 900px) { .why2__item { grid-template-columns: 7fr 5fr; align-items: start; } }

/* --- Как начать: линия идёт по прокрутке -------------------------------------- */

.steps2 { --p: 1; position: relative; display: grid; gap: 32px; margin-top: clamp(48px, 6vw, 96px); padding-left: 40px; }
.steps2::before, .steps2::after { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line2); }
.steps2::after { background: var(--ink); transform-origin: top; transform: scaleY(var(--p)); }
.steps2__item { position: relative; }
.steps2__item::before {
  content: "";
  position: absolute;
  left: -40px;
  top: 4px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  background: var(--ink);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
/* С JS узел закрашивается, когда до него дошла линия; без JS закрашены все. */
.steps-live .steps2__item:not(.is-on)::before { border-color: var(--line2); background: var(--bg); }
.steps2__num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-mono); color: var(--muted); }
.steps2__title {
  margin-top: 8px;
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  font-size: clamp(1.125rem, 0.95rem + 0.5vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.steps2__text { margin-top: 10px; color: var(--ink2); text-wrap: pretty; }
@media (min-width: 900px) {
  .steps2 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px; padding: 48px 0 0; }
  .steps2::before, .steps2::after { left: 0; right: 0; top: 7px; bottom: auto; width: auto; height: 2px; }
  .steps2::after { transform-origin: left; transform: scaleX(var(--p)); }
  .steps2__item::before { left: 0; top: -48px; }
}

/* --- Вопросы ----------------------------------------------------------------- */

.v2-faq__grid { display: grid; gap: 40px; }
.v2-faq .faq-head { gap: 28px; }
@media (min-width: 1024px) { .v2-faq__grid { grid-template-columns: 5fr 7fr; gap: 72px; } }

/* --- Финальный призыв ---------------------------------------------------------- */

.v2-cta {
  --r: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100svh;
  padding-block: clamp(96px, 12vw, 180px);
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
}
.v2-cta__rings {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(130vw, 130vh);
  height: max(130vw, 130vh);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.v2-cta__rings circle {
  fill: none;
  stroke: var(--line2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform: scale(calc(0.62 + var(--r) * 0.38 + var(--i) * var(--r) * 0.02)) rotate(calc(var(--r) * var(--i) * 9deg));
}
.v2-cta__in { position: relative; display: grid; justify-items: center; gap: 24px; }
.v2-cta .v2-h2 { max-width: 16em; }
.v2-cta .v2-lead { max-width: 34em; }
.v2-cta .btn-row { justify-content: center; margin-top: 8px; }

/* --- Знак из точек в подвале -------------------------------------------------------- */

.footer__mark.is-dots { position: relative; }
.footer__mark.is-dots .wm { visibility: hidden; }
.footer__dots { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }