/* Личное пространство.
 *
 * Вся страница — одно пространство. Сцена (space.js, WebGL2) закреплена
 * позади и видна сквозь всё: на первом экране целиком, дальше — через
 * затемнение и стекло разделов. Пока сцена не готова и там, где её нет,
 * на её месте лежит её же кадр (img/poster-*.jpg).
 *
 * Стекло здесь — материал мира, а не украшение: панели в сцене, чипы
 * фраз, шаги и заметные блоки разделов сделаны из одного и того же
 * дымчатого стекла с освещённым краем.
 */

@font-face {
  font-family: "Sofia Sans";
  src: url("fonts/SofiaSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --void: #07060d;
  --haze: #2a2350;
  --ink: #eceaf6;
  --ink-soft: #b0abc8;
  --ink-faint: #8e89aa;
  /* Свет Рины: её ядро в сцене и единственная залитая кнопка. */
  --lavender: #b9a8ff;
  --lavender-high: #d2c7ff;
  --glass: rgb(236 234 246 / 0.055);
  --glass-high: rgb(236 234 246 / 0.1);
  --glass-edge: rgb(217 210 255 / 0.2);
  --glass-edge-high: rgb(217 210 255 / 0.42);
  --hairline: rgb(217 210 255 / 0.14);

  --font: "Sofia Sans", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: clamp(20px, 5vw, 88px);
  --band: clamp(96px, 15vh, 168px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

html {
  background: var(--void);
  color: var(--ink);
  scrollbar-color: #2b2742 var(--void);
  caret-color: var(--lavender);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--void);
  font: 400 17px/1.6 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgb(185 168 255 / 0.32);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 4px;
  border-radius: 12px;
}

a {
  color: inherit;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -80px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--lavender);
  color: var(--void);
  text-decoration: none;
  border-radius: 12px;
}

.skip:focus {
  top: 14px;
}

/* --- пространство позади страницы ------------------------------------- */

/* Кадр сцены, пока WebGL не готов и там, где его нет. Он кроет первый
   экран, как холст, а не всю страницу: ширина не меньше экрана и не
   меньше пропорции кадра (1440 × 900) от его высоты. */
.backdrop {
  position: fixed;
  inset: 0 0 auto;
  height: 100svh;
  background:
    url("img/poster-wide.jpg") 50% 0 / max(100%, 160svh) auto no-repeat,
    var(--void);
  pointer-events: none;
}

.scene {
  position: fixed;
  inset: 0 0 auto;
  width: 100%;
  height: 100svh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1200ms var(--ease-out);
}

html[lang="en"] .backdrop {
  background-image: url("img/poster-wide-en.jpg");
}

.gl-ready .scene {
  opacity: 1;
}

/* Чем дальше от первого экрана, тем темнее пространство под текстом.
   Прозрачность задаёт space.js по прокрутке; без скриптов разделы
   получают свою подложку ниже. */
.dim {
  position: fixed;
  inset: 0;
  background: rgb(7 6 13 / 0.8);
  opacity: var(--dim, 0);
  pointer-events: none;
}

/* --- шапка ------------------------------------------------------------- */

.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter);
}

.mark {
  margin: 0;
  font: 500 18px/1 var(--font);
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px 6px;
}

.top nav a {
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 180ms var(--ease-out);
}

.top nav a:hover {
  color: var(--ink);
}

/* The other language: set apart from the sections by a hairline. */
.top nav .tongue {
  margin-left: 6px;
  padding-left: 16px;
  border-left: 1px solid var(--hairline);
  border-radius: 0;
  letter-spacing: 0.04em;
}

main,
.foot {
  position: relative;
  z-index: 1;
}

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

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100svh;
  padding: 104px var(--gutter) 72px;
  box-sizing: border-box;
}

/* Вуаль гасит сцену под текстом и к низу экрана, а справа сцену не
   трогает. */
.veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgb(7 6 13 / 0.9) 0%,
      rgb(7 6 13 / 0.72) 28%,
      rgb(7 6 13 / 0.2) 50%,
      rgb(7 6 13 / 0) 62%),
    linear-gradient(0deg, rgb(7 6 13 / 0.7), rgb(7 6 13 / 0) 22%);
}

.say {
  position: relative;
  width: min(560px, 100%);
}

h1 {
  margin: 0 0 24px;
  font: 250 clamp(46px, 5.6vw, 84px) / 1.02 var(--font);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lead {
  margin: 0 0 14px;
  max-width: 46ch;
  font-size: 19px;
  line-height: 1.55;
}

.kept {
  margin: 0 0 32px;
  max-width: 46ch;
  font-size: 16px;
  color: var(--ink-soft);
}

.try {
  margin-bottom: 32px;
}

.hint {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--ink-faint);
}

.phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Одно стекло на всё: чипы, стеклянные кнопки, шаги и блоки разделов. */
.chip,
.ghost,
.step,
.stays,
.knows,
.code {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
}

.chip {
  min-height: 44px;
  padding: 10px 16px;
  font: 400 15px/1.2 var(--font);
  color: var(--ink);
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    box-shadow 200ms var(--ease-out);
}

.chip:hover {
  background: var(--glass-high);
  border-color: var(--glass-edge-high);
}

.chip[data-speaking] {
  border-color: var(--lavender);
  box-shadow: 0 0 0 1px rgb(185 168 255 / 0.35), 0 8px 28px -10px rgb(185 168 255 / 0.55);
}

/* Ответ приходит в сцену стеклянной панелью. Здесь он для чтения с
   экрана — и для тех, у кого сцены нет: тогда он виден. */
.reply {
  min-height: 1.6em;
  margin: 14px 0 0;
  font: 300 22px/1.4 var(--font);
  color: var(--lavender-high);
}

.gl-ready .reply {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}

/* Без скриптов фраза не ответит — поэтому ответ написан сразу. */
html:not(.js) .chip {
  cursor: default;
}

html:not(.js) .chip::after {
  content: " — " attr(data-reply);
  color: var(--ink-soft);
}

.act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 28px;
  font: 600 16px/1 var(--font);
  letter-spacing: 0.01em;
  color: #120f22;
  background: var(--lavender);
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 14px 34px -14px rgb(185 168 255 / 0.7);
  transition:
    background-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.cta:hover {
  background: var(--lavender-high);
  box-shadow: 0 16px 40px -12px rgb(185 168 255 / 0.85);
}

.ghost {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 22px;
  font: 500 16px/1 var(--font);
  text-decoration: none;
  color: var(--ink);
  border-radius: 12px;
  transition:
    background-color 200ms var(--ease-out),
    border-color 200ms var(--ease-out);
}

.ghost:hover {
  background: var(--glass-high);
  border-color: var(--glass-edge-high);
}

.facts {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

/* --- разделы ------------------------------------------------------------ */

.band {
  padding: var(--band) var(--gutter) 0;
}

/* Без скриптов затемнения нет, и разделы кладут свою подложку. */
html:not(.js) .band,
html:not(.js) .foot {
  background: rgb(7 6 13 / 0.86);
}

.inner {
  max-width: 1240px;
  margin: 0 auto;
}

h2 {
  margin: 0 0 18px;
  max-width: 20ch;
  font: 250 clamp(34px, 3.8vw, 58px) / 1.06 var(--font);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h3 {
  margin: 0 0 8px;
  font: 500 19px/1.3 var(--font);
  letter-spacing: 0.005em;
}

/* Сильнее правила `.band p`, которое обнуляет отступы абзацев. */
.band .intro {
  margin: 0 0 56px;
  max-width: 52ch;
  font-size: 18px;
  color: var(--ink-soft);
}

.band p {
  margin: 0;
}

.band p + p {
  margin-top: 12px;
}

.band a:not(.ghost) {
  text-decoration-color: rgb(185 168 255 / 0.5);
  text-underline-offset: 4px;
}

/* Путь фразы: пять шагов вдоль одной линии света. */
.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 36px 0 0;
  list-style: none;
}

.steps::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(90deg,
    rgb(185 168 255 / 0), rgb(185 168 255 / 0.55) 12%,
    rgb(185 168 255 / 0.55) 88%, rgb(185 168 255 / 0));
}

.step {
  position: relative;
  padding: 24px 22px 26px;
  border-radius: 16px;
  font-size: 15px;
  color: var(--ink-soft);
  transition:
    border-color 400ms var(--ease-out),
    box-shadow 400ms var(--ease-out),
    background-color 400ms var(--ease-out);
}

.step h3 {
  color: var(--ink);
}

/* Точка шага на линии. */
.step::before {
  content: "";
  position: absolute;
  top: -41px;
  left: 22px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--void);
  border: 1px solid var(--lavender);
  transition: background-color 400ms var(--ease-out), box-shadow 400ms var(--ease-out);
}

.step[data-lit] {
  border-color: rgb(185 168 255 / 0.6);
  background: rgb(185 168 255 / 0.08);
  box-shadow: 0 18px 50px -24px rgb(185 168 255 / 0.6);
}

.step[data-lit]::before {
  background: var(--lavender);
  box-shadow: 0 0 14px 2px rgb(185 168 255 / 0.7);
}

/* Что она умеет: заголовок стоит, список идёт. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}

.aside {
  position: sticky;
  top: 96px;
}

.band .aside .intro {
  margin-bottom: 0;
}

.list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 3vw, 48px);
}

.item {
  padding: 26px 0 30px;
  border-top: 1px solid var(--hairline);
  font-size: 16px;
  color: var(--ink-soft);
}

.item h3 {
  color: var(--ink);
}

/* Приватность: что остаётся внутри и что выходит наружу. */
.ways {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}

/* То, что остаётся, лежит на стекле со светом Рины внутри. */
.stays {
  padding: 30px 30px 34px;
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 20% 0%, rgb(185 168 255 / 0.14), transparent 70%),
    var(--glass);
}

.stays ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.stays li {
  position: relative;
  padding: 10px 0 10px 22px;
  font-size: 16px;
  color: var(--ink-soft);
}

.stays li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 19px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lavender);
  box-shadow: 0 0 10px rgb(185 168 255 / 0.7);
}

.leaves {
  padding-top: 30px;
}

.leaves dl {
  margin: 14px 0 0;
}

.leaves dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}

.leaves dt {
  font-size: 16px;
  color: var(--ink);
}

.leaves dd {
  margin: 0;
  font-size: 15px;
  color: var(--ink-faint);
}

.note-line {
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 15px;
  color: var(--ink-soft);
}

.knows {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 40px;
  margin-top: 48px;
  padding: 28px 30px;
  border-radius: 20px;
}

.knows > div {
  flex: 1 1 420px;
  max-width: 72ch;
  font-size: 16px;
  color: var(--ink-soft);
}

.knows h3 {
  color: var(--ink);
}

/* Поставить. */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
}

.half {
  font-size: 16px;
  color: var(--ink-soft);
}

.half h3 {
  color: var(--ink);
}

.code {
  margin: 16px 0;
  padding: 18px 20px;
  border-radius: 14px;
  overflow-x: auto;
  font: 400 14px/1.7 var(--mono);
  color: var(--ink);
}

/* Деньги: четыре обещания. */
.terms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 4vw, 64px);
}

.term {
  padding: 24px 0 28px;
  border-top: 1px solid var(--hairline);
  font-size: 16px;
  color: var(--ink-soft);
}

.term h3 {
  color: var(--ink);
}

/* Что дальше: рубежи вдоль одной линии, нынешний светится. */
.road {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin: 0 0 40px;
  padding: 34px 0 0;
  list-style: none;
}

.road::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hairline);
}

.road li {
  position: relative;
  font-size: 15px;
  color: var(--ink-soft);
}

.road li::before {
  content: "";
  position: absolute;
  top: -34px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--void);
  border: 1px solid var(--ink-faint);
}

.road h3 {
  color: var(--ink);
}

.when {
  display: block;
  margin-bottom: 8px;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.road .done {
  opacity: 0.7;
}

.road .done::before {
  background: var(--ink-faint);
}

.road .now::before {
  background: var(--lavender);
  border-color: var(--lavender);
  box-shadow: 0 0 14px 2px rgb(185 168 255 / 0.7);
}

.road .now .when {
  color: var(--lavender-high);
}

/* --- низ ---------------------------------------------------------------- */

.foot {
  padding: var(--band) var(--gutter) 40px;
}

.foot .inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr);
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
}

.foot p {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ink-soft);
}

.foot .mark {
  margin-bottom: 14px;
}

.foot .quiet-line {
  max-width: 44ch;
  font-size: 13.5px;
  color: var(--ink-faint);
}

.foot .foot-head {
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

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

.foot li a {
  display: inline-block;
  padding: 5px 0;
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 180ms var(--ease-out);
}

.foot li a:hover {
  color: var(--ink);
}

.lang {
  margin-left: 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* --- узкие окна --------------------------------------------------------- */

@media (max-width: 1040px) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 0 0 0 28px;
  }

  .steps::before {
    top: 8px;
    bottom: 8px;
    left: 4px;
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg,
      rgb(185 168 255 / 0), rgb(185 168 255 / 0.55) 10%,
      rgb(185 168 255 / 0.55) 90%, rgb(185 168 255 / 0));
  }

  .step::before {
    top: 28px;
    left: -29px;
  }

  .split,
  .ways,
  .pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .aside {
    position: static;
  }

  .band .aside .intro {
    margin-bottom: 32px;
  }

  .road {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 0 0 0 28px;
  }

  .road::before {
    top: 6px;
    bottom: 6px;
    left: 4px;
    right: auto;
    width: 1px;
    height: auto;
  }

  .road li::before {
    top: 4px;
    left: -28px;
  }

  .foot .inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .foot-about {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .backdrop {
    background:
      url("img/poster-tall.jpg") 50% 0 / max(100%, 46.18svh) auto no-repeat,
      var(--void);
  }

  html[lang="en"] .backdrop {
    background-image: url("img/poster-tall-en.jpg");
  }

  .hero {
    align-items: flex-end;
    padding-top: 50svh;
    padding-bottom: 40px;
  }

  .veil {
    background:
      linear-gradient(180deg,
        rgb(7 6 13 / 0) 30%,
        rgb(7 6 13 / 0.78) 52%,
        rgb(7 6 13 / 0.94) 66%,
        var(--void) 100%);
  }

  /* By the address's end: the plan page links to the same sections as
     ../#features. */
  .top nav a[href$="#features"],
  .top nav a[href$="#install"] {
    display: none;
  }

  .top nav a {
    padding: 10px 8px;
  }

  h1 {
    font-size: clamp(40px, 11.5vw, 58px);
  }

  .lead {
    font-size: 17px;
  }

  .hero .cta,
  .hero .ghost {
    flex: 1 1 auto;
    justify-content: center;
  }

  .list,
  .terms {
    grid-template-columns: minmax(0, 1fr);
  }

  .leaves dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .stays,
  .knows {
    padding: 24px 22px;
  }

  .foot .inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .top nav a[href$="#privacy"] {
    display: none;
  }
}

/* The header keeps to one line: what leaves it first is what the page
   reaches another way. "Install" has the first screen's button; GitHub
   has the finale and the footer. */
@media (max-width: 900px) {
  .top nav a[href$="#install"] {
    display: none;
  }
}

@media (max-width: 560px) {
  .top nav a[href*="github.com"] {
    display: none;
  }
}

/* --- появление ---------------------------------------------------------
 *
 * Элементы поднимаются на место, когда входят в экран (motion.js ставит
 * им `.shown`). Заголовки и вводные проступают из размытия; стекло только
 * поднимается: размытие на нём сломало бы на время перехода его
 * собственное. Группа приходит по одному. Прячется всё это только под
 * `.moving`, которую ставит скрипт, — без него страница видна сразу.
 */

.moving [data-reveal],
.moving [data-reveal-group] > * {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition-property: opacity, transform, filter;
  transition-duration: 900ms, 1100ms, 1000ms;
  transition-timing-function: var(--ease-out);
}

.moving [data-reveal="text"] {
  filter: blur(8px);
}

/* Пришедшему возвращаются его собственные переходы: наведение и горящий
   шаг пути. Задержка лесенки — только у самого прихода. */
.moving [data-reveal].shown,
.moving [data-reveal-group].shown > * {
  opacity: 1;
  transform: none;
  filter: none;
  transition-property: opacity, transform, filter, background-color, border-color, box-shadow, color;
  transition-duration: 900ms, 1100ms, 1000ms, 200ms, 200ms, 400ms, 180ms;
  transition-delay:
    calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms),
    0s, 0s, 0s, 0s;
}

/* --- место сферы и её реплика ------------------------------------------
 *
 * В каждом разделе пустой квадрат, куда встанет сфера: её рисует сцена,
 * а место и размер решает эта таблица, для телефона и компьютера своё.
 * Реплику Рины со сценой говорит пузырь рядом со сферой; здесь она для
 * экранного диктора. Без сцены она написана на месте сферы.
 */

.band .inner {
  position: relative;
}

.orb-slot {
  position: absolute;
  top: -28px;
  right: 0;
  width: clamp(150px, 14vw, 200px);
  aspect-ratio: 1;
  pointer-events: none;
}

.orb-seat {
  position: absolute;
  inset: 0;
}

/* В «Что она умеет» место стоит в липкой колонке под вводным: сфера
   остаётся рядом, пока идёт список. */
.aside .orb-slot {
  position: relative;
  top: auto;
  right: auto;
  width: clamp(170px, 15vw, 210px);
  margin-top: 56px;
}

.rina-says {
  margin: 0;
  font: 300 18px/1.45 var(--font);
  color: var(--lavender-high);
}

.gl-ready .rina-says {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html:not(.gl-ready) .orb-slot {
  width: min(320px, 40%);
  aspect-ratio: auto;
}

html:not(.gl-ready) .orb-seat {
  display: none;
}

/* Пузырь с репликой рядом со сферой; ставит его space.js. Хвостик —
   угол, обращённый к сфере. */
.bubble {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3;
  max-width: 280px;
  padding: 12px 16px 13px;
  border-radius: 16px 16px 16px 4px;
  background: rgb(18 15 34 / 0.62);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 18px 40px -20px rgb(185 168 255 / 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms var(--ease-out);
  will-change: transform, opacity;
}

.bubble[data-side="left"] {
  border-radius: 16px 16px 4px 16px;
}

.bubble.on {
  opacity: 1;
}

.bubble-who {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--lavender-high);
}

.bubble-text {
  display: block;
  font: 400 15px/1.45 var(--font);
  color: var(--ink);
}

html:not(.gl-ready) .bubble {
  display: none;
}

/* Сцена сама приглушает комнату и оставляет сферу светлой; затемнение
   поверх нужно только там, где сцены нет. */
.gl-ready .dim {
  display: none;
}

/* --- финал -------------------------------------------------------------
 *
 * Сфера встаёт в центр и лопается: фронт света проходит по экрану,
 * и фоном становится то, что внутри неё. Слова финала приходят вместе
 * со взрывом; без сцены — как обычно.
 *
 * Со сценой в движении (`.staged`, ставит space.js) финал — пространство
 * внутри сферы. Раздел выше экрана, и его сцена стоит, пока камера идёт
 * вперёд сквозь туманность; слова висят в ней на разной глубине. Их
 * глубину и перспективу задаёт скрипт: камера у слов и у туманности
 * одна. Кнопки — в плоскости, которая стоит на месте, в своём размере.
 */

.finale {
  position: relative;
  /* The dark pool under the words is wider than they are; clipped here,
     or on a phone it widens the page and the phone zooms out to fit.
     `clip`, not `hidden`: the stage inside must stay able to stick. */
  overflow-x: clip;
}

.finale-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 100svh;
  padding: var(--band) var(--gutter);
  box-sizing: border-box;
  text-align: center;
}

.finale .orb-slot {
  position: relative;
  top: auto;
  right: auto;
  width: clamp(170px, 18vw, 240px);
}

.finale-inner {
  position: relative;
  max-width: 760px;
}

/* Тёмная заводь под словами: они читаются поверх живой туманности. */
.finale-inner::before {
  content: "";
  position: absolute;
  inset: -64px -140px;
  z-index: -1;
  background: radial-gradient(closest-side, rgb(7 6 13 / 0.72), rgb(7 6 13 / 0));
  pointer-events: none;
}

.finale-says {
  margin: 0 0 16px;
  font: 300 22px/1.4 var(--font);
  color: var(--lavender-high);
}

.finale-says .who {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.finale h2 {
  margin: 0 auto 18px;
  max-width: 16ch;
  font-size: clamp(46px, 5.6vw, 84px);
  line-height: 1.02;
}

.finale-lead {
  margin: 0 auto 32px;
  max-width: 46ch;
  font-size: 18px;
  color: var(--ink-soft);
}

.finale .act {
  justify-content: center;
  margin-bottom: 0;
}

html:not(.gl-ready) .finale {
  background:
    radial-gradient(55% 45% at 50% 40%, rgb(110 76 255 / 0.28), transparent 70%),
    radial-gradient(35% 30% at 62% 55%, rgb(127 214 255 / 0.1), transparent 70%);
}

/* Слова финала приходят медленнее и из-под размытия: это развязка. */
.moving .finale-inner > * {
  transform: translate3d(0, 44px, 0) scale(0.98);
  filter: blur(10px);
}

.moving .finale-inner.shown > * {
  transition-duration: 1100ms, 1300ms, 1100ms, 200ms, 200ms, 400ms, 180ms;
  transition-delay:
    calc(150ms + var(--i, 0) * 170ms), calc(150ms + var(--i, 0) * 170ms),
    calc(150ms + var(--i, 0) * 170ms), 0s, 0s, 0s, 0s;
}

/* Внутри сферы. Сцена стоит, пока раздел проходит ещё 60 % экрана;
   место сферы — ровно в её центре, и слова приходят туда же. */
.finale.staged {
  height: 160svh;
}

.finale.staged .finale-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 0;
}

.finale.staged .orb-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

/* Движение слов — глубина, прозрачность, размытие в полёте — пишет
   скрипт каждый кадр; переходы таблицы ему бы только мешали. */
.finale.staged .finale-inner > * {
  opacity: 1;
  transform: none;
  filter: none;
  transition: none;
  will-change: transform, opacity;
}

/* Её реплика здесь — такой же пузырь, как в разделах, только висит
   в глубине, над заголовком и в стороне от него. Хвостик — к середине,
   где была сфера. */
.finale.staged .finale-says {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 12px);
  width: max-content;
  max-width: min(360px, 80vw);
  margin: 0 auto;
  padding: 12px 16px 13px;
  text-align: left;
  border-radius: 16px 16px 4px 16px;
  background: rgb(18 15 34 / 0.62);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 18px 40px -20px rgb(185 168 255 / 0.45);
}

/* Подвал после финала уходит из туманности в пустоту. */
.foot {
  background: linear-gradient(180deg, rgb(7 6 13 / 0), var(--void) 160px);
}

@media (max-width: 760px) {
  /* На телефоне место сферы — в потоке раздела, наверху, а реплика
     написана рядом с ним: пузырь поверх текста был бы некуда деть. */
  .orb-slot,
  .aside .orb-slot {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    width: auto;
    aspect-ratio: auto;
    min-height: 104px;
    margin: 0 0 20px;
  }

  .orb-seat {
    position: relative;
    inset: auto;
    flex: 0 0 104px;
    height: 104px;
  }

  .gl-ready .rina-says {
    position: static;
    flex: 1;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    text-align: right;
    font-size: 15px;
  }

  html:not(.gl-ready) .orb-slot {
    width: auto;
    min-height: 0;
  }

  .finale .orb-slot {
    width: 150px;
    min-height: 150px;
    justify-content: center;
  }

  .finale .orb-seat {
    flex-basis: 150px;
    height: 150px;
  }

  .finale-inner::before {
    inset: -48px -24px;
  }

  .bubble {
    display: none;
  }
}

/* Кадр-заглушка снимается с этой же страницы без текста поверх
   (адрес с ?poster). */
.poster .top,
.poster main,
.poster .foot,
.poster .dim {
  visibility: hidden;
}

.poster .backdrop {
  background: var(--void);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .bubble {
    transition: none;
  }

  .scene,
  .chip,
  .cta,
  .ghost,
  .step,
  .step::before,
  .top nav a,
  .foot li a {
    transition: none;
  }
}
