/* Лендинг «Не терять нить» (/).
   Один телефон в центре, прокрутка управляет сценами (landing-story.js): экран меняется, телефон поворачивается,
   карточки вылетают из экрана вперёд на разной глубине. Всё на CSS 3D, без WebGL и видео. */

*, *::before, *::after { box-sizing: border-box; }
@property --ambient { syntax: "<color>"; inherits: true; initial-value: #2f3527; }

:root { color-scheme: dark; --pad: clamp(20px, 6vw, 110px); }
:root[data-theme="light"] { color-scheme: light; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-ui, "Jost", sans-serif);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
h1, h2 { font-weight: 400; letter-spacing: -.04em; line-height: .98; text-wrap: balance; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.skip { position: fixed; top: 0; left: var(--pad); transform: translateY(-130%); z-index: 30; background: var(--lime); color: var(--accent-ink); padding: 10px 16px; border-radius: 0 0 12px 12px; }
.skip:focus { transform: translateY(0); }

/* ---------- шапка ---------- */
.masthead {
  position: absolute;
  z-index: 20;
  top: max(22px, env(safe-area-inset-top, 0px));
  inset-inline: var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo img { display: block; width: clamp(120px, 11vw, 170px); height: auto; }
/* в шапке два логотипа, виден один: селекторы через .logo, иначе их перебивает .logo img */
.logo .logo-light, :root[data-theme="light"] .logo .logo-dark { display: none; }
:root[data-theme="light"] .logo .logo-light { display: block; }
.masthead-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { width: 44px; height: 44px; padding: 0; border: 0; cursor: pointer; }
.theme-toggle .icon-moon, :root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.masthead nav { display: flex; gap: clamp(18px, 3vw, 44px); }
.masthead nav a { text-decoration: none; padding-block: 12px; text-shadow: 0 1px 8px #000b; }

/* ---------- сцена ---------- */
.story {
  --n: 10;
  --scene: 92svh;
  position: relative;
  height: calc(100svh + (var(--n) - 1) * var(--scene));
}
.stage {
  --pw: min(calc(74svh * 78 / 163.4), 330px);
  --phone-depth: calc(var(--pw) * .0561);
  --ambient: #2f3527;
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  transition: --ambient .7s;
}
.stage[data-scene="2"] { --ambient: #2b2a3a; }
.stage[data-scene="3"] { --ambient: #332d48; }
.stage[data-scene="4"] { --ambient: #34401f; }
.stage[data-scene="6"], .stage[data-scene="7"] { --ambient: #262a2c; }
.stage[data-scene="8"] { --ambient: #34401f; }
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 40% 52% at calc(50% + var(--ax, 0px)) 52%, var(--ambient), transparent 72%);
  opacity: .85;
}

/* ---------- тексты ---------- */
.cap {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: min(36vw, 540px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  opacity: var(--w, 0);
  visibility: hidden;
  transform: translate3d(0, calc(-50% + var(--cy, 0px)), 0);
  will-change: transform, opacity;
}
.cap.is-on { visibility: visible; }
.cap--l { left: var(--pad); }
.cap--r { right: var(--pad); }
.cap h2 { font-size: clamp(30px, 4.1vw, 68px); }
.cap .wd { display: inline-block; opacity: var(--ww, 1); transform: translate3d(0, calc((1 - var(--ww, 1)) * .55em), 0); }
.lead { font-size: clamp(16px, 1.45vw, 22px); line-height: 1.42; color: var(--text-secondary); max-width: 34ch; }
.more { font-size: clamp(15px, 1.2vw, 18px); line-height: 1.45; color: var(--text-muted); max-width: 38ch; }
.note { font-size: 13px; color: var(--text-muted); }
.cap .ui-button span { margin-left: 4px; }
.cap small { font-size: .8em; }

.cap--hero { left: var(--pad); right: var(--pad); width: auto; gap: 22px; }
.h1-row { display: flex; align-items: center; gap: clamp(14px, 2vw, 34px); width: 100%; font-size: clamp(46px, 6.2vw, 112px); }
.h1-a, .h1-b { white-space: nowrap; animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
.h1-b { animation-delay: .25s; }
.h1-line {
  flex: 1;
  min-width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--lime);
  transform-origin: left;
  animation: draw 1.5s .35s cubic-bezier(.2, .8, .2, 1) both;
}
.hero-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; max-width: min(460px, calc(50vw - var(--pw) / 2 - var(--pad) - 24px)); }
.hero-bottom .ui-button { max-width: 100%; height: auto; min-height: 56px; padding-block: 10px; text-align: left; }
.hint { display: flex; gap: 9px; align-items: center; margin-top: 6px; color: var(--text-secondary); font-size: 16px; }
.hint span { color: var(--lime); display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, .4em, 0); } }
@keyframes draw { from { transform: scaleX(0); } }
@keyframes bob { 50% { transform: translateY(4px); } }

/* ---------- телефон ---------- */
.device {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  perspective: 1400px;
  pointer-events: none;
}
.iphone {
  position: relative;
  width: var(--pw);
  aspect-ratio: 78 / 163.4;
  transform-style: preserve-3d;
  transform: translate3d(var(--px, 0px), var(--py, 0px), var(--pz, 0px))
    rotateX(var(--rx, 3deg)) rotateY(var(--ry, -10deg)) rotateZ(var(--rz, 3deg)) scale(var(--ps, 1));
  will-change: transform;
}
.iphone-front, .iphone-back {
  position: absolute;
  inset: 0;
  border-radius: 14.5% / 6.92%;
}
.iphone-front {
  container-type: inline-size;
  transform: translateZ(var(--phone-depth, 16px));
  padding: 1.85%;
  background: linear-gradient(140deg, #797d79 0%, #202421 32%, #565b55 69%, #262a27 100%);
  box-shadow: inset 0 0 0 1px #bac0b477, 0 24px 60px #0007;
}
.iphone-back {
  transform: translateZ(calc(var(--phone-depth, 16px) * -1));
  background: #242827;
  outline: 1px solid #767b77;
}
.iphone-rail {
  position: absolute;
  top: 7.5%;
  height: 85%;
  width: 11.218%;
  border-radius: 24% / 3%;
  background: linear-gradient(90deg, #606862 0%, #353b36 18%, #545c55 49%, #232823 90%);
  transform-origin: 50% 50%;
}
.iphone-rail-left { left: -5.609%; transform: rotateY(-90deg); }
.iphone-rail-right { right: -5.609%; transform: rotateY(90deg); }
.iphone-rail i {
  position: absolute;
  left: 24%;
  width: 48%;
  height: 9%;
  background: linear-gradient(90deg, #aab3a7, #414842);
  border-radius: 50px;
  box-shadow: 0 0 0 1px #121713b0;
}
.iphone-rail-left i:nth-child(1) { top: 12%; height: 5%; }
.iphone-rail-left i:nth-child(2) { top: 21%; }
.iphone-rail-left i:nth-child(3) { top: 32%; }
.iphone-rail-right i { top: 27%; height: 14%; }
.iphone-glass {
  position: relative;
  width: 100%; height: 100%;
  overflow: clip;
  border-radius: 13% / 6.1%;
  background: var(--bg);
  border: 1px solid #090b0a;
}
.status-bar {
  position: relative;
  z-index: 2;
  height: 8%;
  padding: 0 8%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: clamp(8px, 4cqw, 15px);
  font-weight: 550;
}
.dynamic-island {
  top: 35%;
  position: absolute;
  left: 50%;
  width: 23%;
  height: 35%;
  transform: translateX(-50%);
  border-radius: 40px;
  background: #020302;
}
.dynamic-island::after {
  content: "";
  position: absolute;
  right: 13%;
  top: 29%;
  height: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #283244, #101217 66%);
}
.status-icons { display: flex; align-items: end; gap: .55cqw; height: 19%; }
.status-icons i { display: block; height: 42%; width: .75cqw; border-radius: 1px; background: currentColor; }
.status-icons i:nth-child(2) { height: 59%; }
.status-icons i:nth-child(3) { height: 78%; }
.status-icons i:nth-child(4) { height: 100%; }
.status-icons b { display: block; width: 4.2cqw; height: 100%; margin-left: .65cqw; border: 1px solid currentColor; border-radius: 2px; background: linear-gradient(90deg, currentColor 76%, transparent 76%); }
.phone-screens { position: absolute; inset: 8% 0 11.5%; overflow: clip; }
/* Нижняя панель повторяет состав, значки и выделение из shell-v2.js. */
.screen-tabs {
  --dock-index: 0;
  position: absolute;
  inset: auto 0 0;
  min-height: 9.1%;
  padding: 2.1% 2.4% 3.0%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  color: var(--text-muted);
  background: var(--surface);
  box-shadow: 0 -2cqw 4cqw #090a0a50;
  border: 0;
}
.dock-defs { position: absolute; }
.dock-item {
  display: grid;
  place-items: center;
  gap: .9cqw;
  line-height: 1;
  padding: 0 1px;
  font-size: clamp(6px, 2.95cqw, 11px);
  white-space: nowrap;
  min-width: 0;
}
.dock-item svg, .dock-bubble svg {
  width: 5.9cqw;
  height: 5.9cqw;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dock-item.is-current,
.screen-tabs:not([data-ready]) .dock-item:first-of-type { color: var(--text-primary); }
.dock-item.is-current > svg,
.screen-tabs:not([data-ready]) .dock-item:first-of-type > svg { opacity: 0; }
.dock-bubble {
  position: absolute;
  display: grid;
  place-items: center;
  width: 11.8cqw;
  height: 11.8cqw;
  border: .65cqw solid var(--lime);
  margin-left: -5.9cqw;
  top: -5.8cqw;
  left: calc(11.92% + 19.04% * var(--dock-index));
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  transition: left .38s cubic-bezier(.2,.85,.23,1);
}
.home-indicator { z-index: 1; height: .45%; bottom: .9%; }
@media (prefers-reduced-motion: reduce) { .dock-bubble { transition: none; } }

/* ---------- экраны телефона ----------
   Внутри лежат настоящие компоненты сайта (ui-*, home-*, learn-*) в ширине 375px.
   landing-story.js считает --k и уменьшает их до ширины экрана, так что вид тот же, что в приложении. */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  opacity: var(--screen-opacity, 0);
  visibility: hidden;
  transform: translate3d(var(--screen-x, 8%), 0, 0) scale(var(--screen-scale, 1));
}
.screen.is-active { opacity: var(--screen-opacity, 1); visibility: visible; transform: translate3d(var(--screen-x, 0%), 0, 0) scale(var(--screen-scale, 1)); }
.app {
  width: 375px;
  height: calc(100% / var(--k, 1));
  padding: 10px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.4;
  transform: scale(var(--k, 1));
  transform-origin: 0 0;
}
.app > * { flex: none; }
/* на десктопе приложение прячет профиль (он в боковой панели), а в телефоне он нужен */
.app .home-profile { display: flex; }
.app-title { padding: 6px 4px 0; font-size: 26px; font-weight: 400; line-height: 1.1; letter-spacing: 0; }
.app > .ui-pills { margin-top: -12px; }
.app-note { padding: 0 4px; color: var(--text-muted); font-size: 14px; }
.crm-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.crm-head .app-title { padding: 0 4px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius-panel); background: var(--surface); }
.plan-card strong { font-size: 16px; font-weight: 500; }
.plan-card p { font-size: 46px; font-weight: 300; line-height: 1.1; letter-spacing: -.02em; }
.plan-card span { font-size: 14px; color: var(--text-muted); }
.plan-card--lime { background: var(--lime); color: var(--accent-ink); }
.plan-card--lime span { color: var(--accent-ink); opacity: .78; }
.bubble { background: var(--surface-2); border-radius: var(--radius-card); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.bubble .who { font-size: 13px; font-weight: 500; color: var(--lime); }
.bubble .msg { font-size: 15px; line-height: 1.4; }

/* дерево структуры: те же строки, что в приложении на телефоне */
.sx-list { overflow: hidden; border-radius: var(--radius-card); background: var(--surface); }
.sx-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  min-height: 60px;
  padding: 8px 16px 8px calc(8px + var(--i, 0px));
}
.sx-row + .sx-row { border-top: 1px solid var(--border); }
.sx-t { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: auto; border-radius: 50%; background: var(--surface-2); color: var(--text-secondary); }
.sx-t:empty { visibility: hidden; }
.sx-p { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sx-who { display: flex; flex-direction: column; min-width: 0; }
.sx-name { font-size: var(--font-body); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-sub { color: var(--text-muted); font-size: var(--font-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-chips { display: flex; justify-content: flex-end; gap: 4px; }
.sx-nums { display: flex; grid-column: 2 / -1; gap: 16px; }
.sx-num { display: flex; gap: 6px; align-items: baseline; font-variant-numeric: tabular-nums; }
.sx-num span { color: var(--text-muted); font-size: var(--font-meta); }
.sx-num b { font-size: var(--font-body); font-weight: var(--weight-medium); }
.sx-num--team b { color: var(--text-muted); font-weight: inherit; }

/* ---------- карточки, вылетающие из экрана ----------
   Внутри те же компоненты в ширине 310px; landing-story.js задаёт --fk (масштаб), чтобы текст читался. */
.fl {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  width: 310px;
  transform-origin: 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-primary);
  opacity: var(--w, 0);
  visibility: hidden;
  transform: translate3d(var(--fx, 0px), var(--fy, 0px), calc(var(--phone-depth) + var(--z, 80px)))
    rotate(var(--r, 0deg)) scale(calc(var(--fk, 1) * var(--fs, 1) * (.88 + .12 * var(--w, 0))));
  will-change: transform, opacity;
}
.fl > .ui-list, .fl > .sx-list, .fl > .fl-lav, .fl > .bubble, .fl > .plan-card, .fl .learn-hero {
  box-shadow: 0 26px 50px #000c, inset 0 0 0 1px #f3f5ef24;
}
.fl .learn { gap: 0; }
.fl--tree { width: 400px; }
.fl-lav { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: var(--radius-panel); background: var(--lavender); color: var(--lavender-ink); }
.fl-lav .home-checks { gap: 8px; }

/* ---------- нить прогресса ---------- */
.meter {
  position: absolute;
  z-index: 3;
  inset: auto var(--pad) max(16px, env(safe-area-inset-bottom, 0px));
  height: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}
.meter-line { position: absolute; inset: 0 auto 0 0; width: calc(var(--prog, 0) * 100%); border-radius: 2px; background: var(--lime); }

/* ---------- тарифы: карточки .tf-plan из tariffs-v2.css ---------- */
.plans { padding: clamp(66px, 11vw, 160px) var(--pad) clamp(56px, 8vw, 120px); border-top: 1px solid var(--border); }
.plans-head { display: flex; flex-direction: column; gap: 18px; max-width: 760px; margin-bottom: clamp(32px, 4vw, 56px); }
.plans-head h2 { font-size: clamp(40px, 5.6vw, 92px); }
.plans-lead { font-size: clamp(17px, 1.6vw, 22px); line-height: 1.42; color: var(--text-secondary); max-width: 34em; }
.plans-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; max-width: 1080px; }
.tf-plan__note { margin-top: 12px; font-size: 14px; color: var(--text-muted); }
.tf-plan--featured .tf-plan__note { color: var(--accent-ink); opacity: .72; }

/* ---------- вопросы и подвал ---------- */
.faq, .footer { padding: clamp(66px, 11vw, 160px) var(--pad); }
.faq { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; border-top: 1px solid var(--border); }
.faq h2 { font-size: clamp(40px, 5.6vw, 92px); }
.faq-list { border-top: 1px solid var(--border-strong); }
.faq-list details { border-bottom: 1px solid var(--border-strong); }
.faq-list summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 19px 0; font-size: clamp(19px, 1.9vw, 27px); cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; flex: none; color: var(--lime); font-size: 1.2em; line-height: 1; transition: transform .25s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { margin-bottom: 20px; max-width: 48ch; color: var(--text-secondary); line-height: 1.48; }
.footer { border-top: 1px solid var(--border); padding-bottom: 40px; }
.footer-top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px 30px; }
.footer h2 { font-size: clamp(42px, 6.6vw, 112px); }
/* подвал колонками: канал, поддержка, документы, владелец */
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); justify-content: space-between; gap: 32px 40px; margin-top: clamp(48px, 8vw, 96px); padding-top: 32px; border-top: 1px solid var(--border); }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; color: var(--text-secondary); }
.footer-label { color: var(--text-muted); font-size: 13px; }
.footer-col a { color: var(--text-secondary); text-decoration: none; }
.footer-col a:hover { color: var(--text-primary); }
.footer-docs { display: flex; flex-direction: column; gap: 10px; }
.footer-col p { color: var(--text-primary); }
.footer small { color: var(--text-muted); font-size: 13px; }
/* ссылка на канал той же высоты строки, что почта рядом: иконка не раздвигает строку */
.footer-col .footer-tg { display: inline-flex; align-items: center; gap: 8px; line-height: inherit; }
.footer-tg svg { flex: none; width: 1.15em; height: 1.15em; margin-block: -.2em; color: var(--lime); }

@media (max-width: 1100px) and (min-width: 761px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- телефон в одну колонку ---------- */
@media (max-width: 760px), (max-aspect-ratio: 5/6) {
  .masthead nav { display: none; }
  .story { --scene: 80svh; }
  .stage { --pw: min(calc(56svh * 78 / 163.4), 60vw); }
  .stage::before { background: radial-gradient(ellipse 80% 40% at 50% 68%, var(--ambient), transparent 72%); }
  .device { inset: 34svh 0 calc(env(safe-area-inset-bottom, 0px) + 14px); }
  .cap, .cap--l, .cap--r { top: calc(env(safe-area-inset-top, 0px) + 22px); left: var(--pad); right: var(--pad); width: auto; gap: 12px; transform: translate3d(0, var(--cy, 0px), 0); }
  .cap--hero { top: calc(max(22px, env(safe-area-inset-top, 0px)) + 84px); gap: 14px; }
  .cap h2 { font-size: clamp(30px, 8.6vw, 44px); }
  .lead { font-size: clamp(16px, 4.3vw, 19px); max-width: none; }
  .more, .hint, .more-inline { display: none; }
  .h1-row { display: block; font-size: clamp(38px, 11.4vw, 54px); }
  .h1-b { margin-left: .22em; }
  .h1-line { display: none; }
  .hero-bottom { gap: 12px; max-width: none; }
  .cap .ui-button--lg { height: 52px; font-size: 16px; max-width: 100%; }
  .fl { left: var(--sx, 0px); top: var(--sy, 0px); } /* место считает landing-story.js */
  .fl--d { display: none; }
  .fl--tree { width: 350px; }
  .meter { inset: auto var(--pad) max(10px, env(safe-area-inset-bottom, 0px)); }
  .faq { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .plans-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .plans .tf-plan--featured { order: -1; } /* на телефоне первым идёт «Полный» */
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .footer { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } /* последняя строка не прячется под кнопкой «Наверх» */
}
@media (max-width: 360px) {
  .cap .ui-button--lg, .footer .ui-button--lg { padding-inline: 15px; font-size: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .stage { --pw: min(calc(78svh * 78 / 163.4), 330px); }
  .masthead nav, .fl { display: none; } /* на телефоне боком карточки вышли бы слишком мелкими */
  .cap h2 { font-size: clamp(26px, 3.6vw, 44px); }
  .more { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .h1-a, .h1-b, .h1-line, .hint span { animation: none; }
  .stage { transition: none; }
}

/* Без скрипта (выключен JavaScript или файл не загрузился): история превращается в обычную страницу,
   подписи идут друг под другом, телефон и анимация не показываются */
.no-js .story { height: auto; }
.no-js .stage { position: relative; height: auto; overflow: visible; padding: calc(max(22px, env(safe-area-inset-top, 0px)) + 110px) 0 24px; }
.no-js .caps { position: static; display: flex; flex-direction: column; gap: 64px; padding-inline: var(--pad); }
.no-js .cap { position: relative; inset: auto; width: auto; max-width: 680px; opacity: 1; visibility: visible; transform: none; }
.no-js .cap .wd { opacity: 1; transform: none; }
.no-js .hero-bottom { max-width: 560px; }
.no-js .device, .no-js .meter, .no-js .hint, .no-js .to-top { display: none; }

/* Lenis: плавная прокрутка колесом на компьютере */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* фото создателя на экране телефона */
.photo-screen { background: #181a1a; }
.photo-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(var(--photo-zoom, 1)); }
.photo-screen::after { content: ""; position: absolute; inset: 56% 0 0; background: linear-gradient(transparent, #0e1111e8 78%); }
.photo-screen p { position: absolute; z-index: 1; inset: auto 7% 7%; color: var(--paper); } /* подпись на тёмном низе фото в обеих темах */
.photo-screen b { display: block; font-size: clamp(14px, 8cqw, 27px); font-weight: 450; line-height: 1.1; }
.photo-screen span { display: block; margin-top: 2%; font-size: clamp(9px, 4.1cqw, 15px); color: #c9cdc5; }


.fl--wide { width: 370px; }

/* кнопка «Наверх» */
.to-top {
  position: fixed;
  z-index: 25;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 22px);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--lime);
  box-shadow: 0 14px 30px #000a, inset 0 0 0 1px #f3f5ef2b;
  opacity: 0;
  transform: translateY(14px) scale(.9);
  pointer-events: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .3s, transform .3s, background-color .2s, color .2s;
}
.to-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--lime); color: var(--accent-ink); }
.to-top:active { transform: scale(.94); }

/* ---------- светлая тема: цвета из tokens.css (:root[data-theme="light"]), здесь только то, что задано числами ----------
   Экраны телефона светлеют сами, как приложение в светлой теме. Корпус телефона остаётся тёмным. */
:root[data-theme="light"] .stage { --ambient: #d3dbbd; }
:root[data-theme="light"] .stage[data-scene="2"] { --ambient: #d9d6e8; }
:root[data-theme="light"] .stage[data-scene="3"] { --ambient: #d6cff0; }
:root[data-theme="light"] .stage[data-scene="4"], :root[data-theme="light"] .stage[data-scene="8"] { --ambient: #d2deb8; }
:root[data-theme="light"] .stage[data-scene="6"], :root[data-theme="light"] .stage[data-scene="7"] { --ambient: #d9dcd6; }
:root[data-theme="light"] .masthead nav a { text-shadow: none; }
:root[data-theme="light"] .iphone-front { box-shadow: inset 0 0 0 1px #bac0b477, 0 26px 60px rgba(26, 28, 24, .32); }
:root[data-theme="light"] .fl > .ui-list, :root[data-theme="light"] .fl > .sx-list, :root[data-theme="light"] .fl > .fl-lav,
:root[data-theme="light"] .fl > .bubble, :root[data-theme="light"] .fl > .plan-card, :root[data-theme="light"] .fl .learn-hero {
  box-shadow: 0 22px 44px rgba(26, 28, 24, .2), inset 0 0 0 1px rgba(26, 28, 24, .06);
}
:root[data-theme="light"] .screen-tabs { box-shadow: 0 -2cqw 4cqw rgba(26, 28, 24, .08); }
/* лайм как цвет текста и тонких линий на светлом фоне не читается: берём тёмный лайм из токенов */
:root[data-theme="light"] .h1-line, :root[data-theme="light"] .meter-line { background: var(--lime-text); }
:root[data-theme="light"] .hint span, :root[data-theme="light"] .bubble .who,
:root[data-theme="light"] .faq-list summary::after, :root[data-theme="light"] .footer-tg svg { color: var(--lime-text); }
:root[data-theme="light"] .to-top { color: var(--lime-text); box-shadow: 0 12px 26px rgba(26, 28, 24, .18), inset 0 0 0 1px rgba(26, 28, 24, .08); }
:root[data-theme="light"] .to-top:hover { color: var(--accent-ink); }
