/* =========================================================
   RISEA Group — страница «Послуги»
   Продолжение сцены главной без WebGL: то же чёрное поле, пыль за
   текстом и знак из точек (их рисует assets/js/services.js на 2D-канве).
   У страницы два вида из одной разметки:
   — сцена (html.sv-live): экран закреплён, знак перестраивается в символ
     раздела, текст раздела встаёт карточкой рядом — блок «Сцена» внизу;
   — обычный каталог (reduced-motion, слабое устройство, нет JS): разделы
     идут друг за другом — всё, что выше блока «Сцена».
   Единственная рамка на странице — циановый контур кастомного пункта:
   он же ссылка в Telegram, словарь ghost-кнопки.
   Токены, шапка и кнопки — из style.css.
   ========================================================= */

/* пыль лежит под страницей и не едет при прокрутке; высота — по самому
   высокому окну, чтобы адресная строка телефона не открывала пустой низ */
.dust {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
}
/* clip, а не hidden: канва знака шире своего блока и не должна давать
   горизонтальную прокрутку, но и свой скролл-контейнер тут не нужен */
.sv-page {
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  overflow-x: clip;
}

/* =========================================================
   Первый экран: заголовок, лид, знак и оглавление
   ========================================================= */

.sv-head { padding-top: clamp(48px, 11vh, 120px); }

.sv-head__in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title mark"
    "lede  mark";
  column-gap: clamp(24px, 5vw, 80px);
  align-items: end;
}

.sv-head__title {
  grid-area: title;
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(44px, 8.4vw, 80px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.sv-head__lede {
  grid-area: lede;
  align-self: start;
  margin-top: clamp(18px, 2.6vh, 28px);
  max-width: 36ch;
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--fg-2);
  text-wrap: pretty;
}

/* слова через дефис, которые нельзя рвать переносом */
.sv-nw { white-space: nowrap; }

/* знак: канва с точками; без JS и до первого кадра — тот же SVG, что в
   статичном hero главной */
.sv-head__mark {
  grid-area: mark;
  position: relative;
  width: clamp(240px, 30vw, 400px);
  aspect-ratio: 1100 / 826;
  color: var(--cy);
}
.sv-head__mark svg,
.sv-head__mark canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* канва вдвое больше блока: точки слетаются из-за его краёв */
.sv-head__mark canvas {
  display: none;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
}
.sv-head__mark.is-live canvas { display: block; }
.sv-head__mark.is-live svg { display: none; }

/* телефон: знак встаёт над заголовком, как в статичном hero */
@media (max-width: 767px) {
  .sv-head__in {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "mark"
      "title"
      "lede";
  }
  .sv-head__mark { width: clamp(104px, 34vw, 150px); margin-bottom: 28px; }
}

/* оглавление: шесть якорей одной полосой между волосяными линиями */
.sv-index {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(18px, 2.6vw, 36px);
  margin: clamp(36px, 7vh, 72px) 0 0;
  padding: 4px 0;
  list-style: none;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.sv-index a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg-3);
  transition: color 0.2s var(--ease);
}
.sv-index a:hover { color: var(--fg); }
@media (max-width: 599px) {
  .sv-index a { min-height: 40px; }
}

/* появление первого экрана: заголовок и лид поднимаются по очереди, знак
   в это время собирается из россыпи — единственная анимация по таймеру */
@media (prefers-reduced-motion: no-preference) {
  .sv-head__title,
  .sv-head__lede,
  .sv-index {
    animation: sv-rise 1.1s var(--ease) both;
  }
  .sv-head__lede { animation-delay: 0.12s; }
  .sv-index { animation-delay: 0.24s; }
}
@keyframes sv-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* =========================================================
   Раздел услуг
   Слева заголовок с вводной, справа строки. Раздел агентов (.sv--wide)
   шире остальных: двенадцать ролей встают сеткой в три колонки.
   ========================================================= */

.sv {
  padding-top: clamp(72px, 13vh, 152px);
  /* якорь из оглавления встаёт под шапкой с воздухом, а не впритык */
  scroll-margin-top: -8px;
}

.sv__in {
  display: grid;
  gap: 28px;
}
@media (min-width: 900px) {
  .sv__in {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(40px, 6vw, 104px);
    align-items: start;
  }
  /* у агентов заголовок длинный: ему отдана вся ширина, вводная — под ним */
  .sv--wide .sv__in { grid-template-columns: minmax(0, 1fr); row-gap: 40px; }
  .sv--wide .sv__title { max-width: 28ch; }
  .sv--wide .sv__lede { max-width: 62ch; }
}

.sv__title {
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(28px, 2.9vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.sv__lede {
  margin-top: 14px;
  max-width: 46ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg-2);
  text-wrap: pretty;
}
/* цена: одна и та же строка в каждом разделе вместо прайса */
.sv__price { margin-top: 18px; }

/* --- строки --- */

.sv__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.sv__item {
  padding: 16px 0 17px;
  border-bottom: 1px solid var(--rule);
}
.sv__name {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--fg);
}
/* уточнение в скобках после названия роли: тем же кеглем, но тише */
.sv__note { font-weight: 400; letter-spacing: 0; color: var(--fg-3); }
.sv__desc {
  display: block;
  margin-top: 5px;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-2);
}

/* агенты: сетка ролей; линия сверху у каждой ячейки, колонки делят
   воздух, а не рамки */
@media (min-width: 640px) {
  .sv--wide .sv__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(24px, 3.4vw, 56px);
    border-top: 0;
  }
  .sv--wide .sv__item {
    border-top: 1px solid var(--rule);
    border-bottom: 0;
    padding: 18px 0 26px;
  }
}
@media (min-width: 1000px) {
  .sv--wide .sv__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- кастомный пункт: последняя строка раздела и дверь в Telegram --- */

.sv__item--custom {
  padding: 0;
  margin-top: 20px;
  border: 0;
}
.sv--wide .sv__item--custom {
  grid-column: 1 / -1;
  padding: 0;
  margin-top: 8px;
  border: 0;
}

.sv-custom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 14px;
  padding: 20px 22px 20px 20px;
  border: 1px solid var(--cy);
  color: var(--fg);
  text-decoration: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.sv-custom__mark {
  width: 24px;
  height: auto;
  aspect-ratio: 1100 / 826;
  margin-top: 3px;
  color: var(--cy);
  transition: color 0.25s var(--ease);
}
.sv-custom .sv__desc { transition: color 0.25s var(--ease); }
.sv-custom__go {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cy);
  transition: color 0.25s var(--ease);
}
.sv-custom__go svg {
  width: 12px;
  height: 12px;
  flex: none;
  transition: transform 0.25s var(--ease);
}
@media (min-width: 640px) {
  .sv-custom { padding: 22px 26px 22px 22px; }
}
/* когда строке хватает ширины, действие уходит вправо, на одну линию с
   названием: у агентов — от планшета, в обычной колонке — от 1200px */
@media (min-width: 760px) {
  .sv--wide .sv-custom {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .sv--wide .sv-custom__mark { align-self: start; }
  .sv--wide .sv-custom__go { grid-column: 3; white-space: nowrap; }
}
@media (min-width: 1200px) {
  .sv-custom {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .sv-custom__mark { align-self: start; }
  .sv-custom__go { grid-column: 3; white-space: nowrap; }
}

/* наведение заливает всю строку — как ghost-кнопка */
@media (hover: hover) {
  .sv-custom:hover { background: var(--cy); color: var(--ink); }
  .sv-custom:hover .sv-custom__mark,
  .sv-custom:hover .sv-custom__go,
  .sv-custom:hover .sv__desc { color: var(--ink); }
  .sv-custom:hover .sv-custom__go svg { transform: translateX(4px); }
}
.sv-custom:active { background: var(--cy-bright); color: var(--ink); }
.sv-custom:active .sv-custom__mark,
.sv-custom:active .sv-custom__go,
.sv-custom:active .sv__desc { color: var(--ink); }
.sv-custom:focus-visible { outline: 2px solid var(--cy-bright); outline-offset: 4px; }

/* =========================================================
   Финал: приглашение в Telegram и копирайт
   ========================================================= */

.sv-cta {
  padding: clamp(96px, 18vh, 208px) var(--gutter) clamp(88px, 15vh, 168px);
  text-align: center;
}
.sv-cta__title {
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(28px, 2.9vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.sv-cta__lede {
  max-width: 44ch;
  margin: 18px auto 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg-2);
  text-wrap: balance;
}
.sv-cta .btn { margin-top: clamp(28px, 4.5vh, 44px); }
.btn--lg { padding: 18px 30px; font-size: 13px; }
.btn--lg svg { width: 16px; height: 16px; }

.sv-foot {
  padding: 0 var(--gutter) 28px;
  text-align: center;
}

/* =========================================================
   Сцена (html.sv-live)
   Трек высотой в N экранов, внутри приклеенная под шапкой сцена. Канва
   с точками лежит под карточками; карточки и символ двигает services.js
   по положению трека, CSS отвечает только за раскладку. Класс sv-live
   ставит проба в <head>, sv-ready — скрипт, когда карточки собраны.
   ========================================================= */

/* пока сцена собирается, каталог не мигает; потом его пустые блоки уходят */
.sv-live:not(.sv-ready) .sv-page { visibility: hidden; }
.sv-ready .sv-head,
.sv-ready .sv,
.sv-ready .sv-cta { display: none; }
/* у сцены нет ничего шире окна, а sticky не терпит обрезающих предков */
.sv-live .sv-page { overflow: visible; }

.sv-scene {
  --hdr: 69px;
  --stage: calc(100vh - var(--hdr));
  --stage: calc(100svh - var(--hdr));
}
.sv-scene__stage {
  position: sticky;
  top: var(--hdr);
  height: var(--stage);
  overflow: hidden;
}
.sv-scene__cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
/* ход по странице: циановая линия под шапкой растёт вместе с прокруткой */
.sv-scene__prog {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 1px;
  background: var(--cy);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.sv-scene__cards { position: relative; height: 100%; }

/* --- карточка: телефон и планшет — под символом, во всю ширину.
   Группу «символ + карточка» скрипт ставит по центру сцены и сам пишет
   карточке top; --zone — запасное место под самым верхним символом --- */

.sv-card {
  position: absolute;
  top: var(--zone);
  left: var(--gutter);
  right: var(--gutter);
  max-width: 560px;
  margin-inline: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, var(--y, 0px), 0);
  will-change: transform, opacity;
}
.sv-card.is-on { pointer-events: auto; }
.sv-card--cta { top: var(--zone-cta); text-align: center; }
/* первый экран на телефоне — титул: заголовок и лид по центру под знаком */
.sv-card--intro { text-align: center; }
.sv-card--intro .sv-head__lede { margin-inline: auto; }
.sv-card--cta .btn { margin-top: clamp(24px, 4vh, 40px); }

.sv-card .sv__title,
.sv-card__short {
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(22px, 6.4vw, 28px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.sv-card .sv__lede { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.sv-card .sv__price { margin-top: 12px; }
/* «2 / 3»: раздел не поместился на один экран и продолжается дальше.
   Счётчик стоит в правом верхнем углу карточки: на первом экране —
   напротив первой строки заголовка, на следующих — напротив имени раздела */
.sv-card__head { position: relative; }
.sv-card__pager {
  position: absolute;
  top: 0.9em;
  right: 0;
  white-space: nowrap;
  color: var(--cy-t2);
}
.sv-card--paged .sv__title,
.sv-card--paged .sv-card__short { padding-right: 56px; }

.sv-card .sv__list { margin-top: 14px; }
.sv-card .sv__item { padding: 9px 0 10px; }
.sv-card .sv__name { font-size: 15px; }
.sv-card .sv__desc { margin-top: 2px; font-size: 13px; line-height: 1.5; }
.sv-card .sv__item--custom { margin-top: 12px; padding: 0; }
.sv-card .sv-custom { padding: 13px 16px 14px 14px; row-gap: 8px; }
/* карточка узкая на любом экране: действие всегда под текстом, а не сбоку */
.sv-card .sv-custom { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.sv-card .sv-custom__go { grid-column: 2; white-space: normal; }

/* --- текст карточки: его ведёт прокрутка через --lp и --p (services.js).
   Без переменных всё стоит на месте: строка видна, линия прочерчена --- */

.sv-card .sv__list { position: relative; border-top-color: transparent; }
.sv-card .sv__item { position: relative; border-bottom-color: transparent; }
.sv-card .sv__list::before,
.sv-card .sv__item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule);
  transform: scaleX(var(--lp, 1));
  transform-origin: 0 50%;
}
.sv-card .sv__list::before { top: -1px; }
.sv-card .sv__item::after { bottom: -1px; }
.sv-card .sv__item--custom::after { display: none; }
.sv-card .sv__item > * {
  opacity: var(--p, 1);
  transform: translateY(calc((1 - var(--p, 1)) * 10px));
}

/* «Послуги» из точек: канва лежит поверх заголовка и в конце уступает
   настоящему тексту; подъём заголовка из каталога здесь не нужен */
.sv-live .sv-head__title { animation: none; }
.sv-pt { position: relative; }
.sv-pt__txt { transition: opacity 0.6s var(--ease); }
.sv-pt.is-run .sv-pt__txt { opacity: 0; transition: none; }
.sv-pt canvas {
  position: absolute;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}
.sv-pt canvas.is-out { opacity: 0; }

/* --- низ сцены: оглавление (только широкий экран) и подсказка «дальше» --- */

.sv-scene__foot { display: none; }
.sv-index a.is-on { color: var(--cy); }

.sv-scene__cue {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  display: grid;
  place-items: center;
  color: var(--fg-3);
  pointer-events: none;
}
.sv-scene__cue svg {
  width: 18px;
  height: 18px;
  transform: rotate(90deg);
  animation: cue 2.2s var(--ease) infinite;
}

/* --- широкий экран: символ и карточка по сторонам --- */

@media (min-width: 900px) {
  .sv-card {
    top: calc((100% - var(--foot, 0px)) / 2);
    left: auto;
    right: auto;
    width: min(46%, 560px);
    margin-inline: 0;
    transform: translate3d(0, calc(-50% + var(--y, 0px)), 0);
  }
  .sv-card--l { left: var(--gutter); }
  .sv-card--r { right: var(--gutter); }
  .sv-card--intro { text-align: left; }
  .sv-card--intro .sv-head__lede { margin-inline: 0; }
  .sv-card--cta {
    left: 50%;
    top: 66%;
    width: min(90%, 640px);
    transform: translate3d(-50%, calc(-50% + var(--y, 0px)), 0);
  }
  .sv-card .sv__title { font-size: clamp(28px, 2.9vw, 42px); }
  .sv-card .sv__lede { margin-top: 14px; font-size: 16px; line-height: 1.55; }
  .sv-card .sv__price { margin-top: 16px; }
  .sv-card__pager { top: 1.6em; }
  .sv-card .sv__list { margin-top: 20px; }
  .sv-card .sv__item { padding: 11px 0 12px; }
  .sv-card .sv__desc { margin-top: 3px; }
  .sv-card .sv__item--custom { margin-top: 16px; padding: 0; }
  .sv-card .sv-custom { padding: 16px 20px 16px 16px; }

  .sv-scene__foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
  }
  .sv-scene__foot .sv-index {
    margin: 0;
    flex-wrap: nowrap;
    border-bottom: 0;
    animation: none;
  }
  .sv-scene__cue {
    left: auto;
    right: max(var(--gutter), calc((100% - var(--maxw)) / 2 + var(--gutter)));
    bottom: 5px;
    margin: 0 -13px 0 0;
  }
}
