/* Вики во flip — фильм на прокрутке.
   Сцена закреплена на весь экран, история идёт главами: тёмная проблема → холст доски → вики → финал.
   Объекты сцены живут в «мире» 1000×1000 (js/film.js), тексты — в своих колонках поверх него. */

:root {
  --dark: #0E0D13;
  --paper: #F5F5F5;
  --dot: #D2D2D2;
  --ink: #1C1C1C;
  --ink-soft: #1F1B2E;
  --brand: #7E4AEB;
  --brand-hover: #6D3BDA;
  --brand-soft: #A98BF7;
  --on-dark: #EFEDF7;
  --muted-dark: #8E88A6;
  --muted-light: #6E6A7C;
  --line: #B7AFD6;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--dark);
  color: var(--on-dark);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- логотип ---------- */
.logo {
  position: fixed;
  z-index: 30;
  top: 18px;
  left: 50%;
  width: 76px;
  height: 48px;
  margin-left: -38px;
  color: #F2F0F8;
  transition: color .35s ease, opacity .35s ease;
}
.logo svg { display: block; width: 100%; height: 100%; }
body[data-theme='light'] .logo, body[data-theme='wash'] .logo { color: #181818; }

/* ---------- сцена ---------- */
.film { position: relative; }
.js .stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
@supports (height: 100svh) { .js .stage { height: 100svh; } }

.bg { position: absolute; inset: 0; }
.bg-dark {
  background-color: var(--dark);
  background-image:
    linear-gradient(rgba(255, 255, 255, .042) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .042) 1px, transparent 1px);
  background-size: 168px 168px;
  background-position: 50% 50%;
}
.bg-dark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 95% at 50% 46%, transparent 42%, rgba(0, 0, 0, .55) 100%);
}
/* холст доски flip: #F5F5F5 и точки #D2D2D2 (FLIP_BOARD_BACKGROUNDS); шаг и сдвиг точек ведёт камера */
.bg-light {
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 18px 18px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  visibility: hidden;
}
/* фон финального кадра промо-ролика */
.bg-wash {
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(70% 70% at 15% 8%, rgba(150, 100, 255, .45), transparent 60%),
    radial-gradient(65% 70% at 90% 95%, rgba(148, 218, 255, .5), transparent 60%),
    linear-gradient(160deg, #EDE6FF 0%, #E6DEFF 55%, #DCD3FF 100%);
}
.brush {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(1240px, 128vw);
  height: min(720px, 86vh);
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity;
}

/* ---------- мир объектов ---------- */
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 1000px;
  height: 1000px;
  transform-origin: 0 0;
  pointer-events: none;
}
.cam {
  position: absolute;
  left: 0;
  top: 0;
  width: 1000px;
  height: 1000px;
  transform-origin: 0 0;
  will-change: transform;
}
.obj {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  visibility: hidden;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.obj.tl { transform-origin: 0 0; }
.obj > img { display: block; width: 100%; height: auto; }

.page > img {
  filter: drop-shadow(0 16px 26px rgba(31, 27, 46, .14)) drop-shadow(0 1px 3px rgba(31, 27, 46, .08));
}
.card {
  background: #FFF;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(67, 52, 92, .22), 0 0 0 1px rgba(67, 52, 92, .08);
}
.card.round { border-radius: 24px; }
.card > img, .card > video { display: block; width: 100%; height: auto; }
.layers { position: relative; }
.layers > img { position: absolute; left: 0; top: 0; width: 100%; height: auto; }
.layers > img:first-child { position: relative; }

/* кольцо-акцент из ролика: фиолетовая обводка с эхом. Толщина не зависит от масштаба мира (--inv) */
.ring {
  border: calc(3px * var(--inv, 1)) solid var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 calc(6px * var(--inv, 1)) rgba(126, 74, 235, .18), 0 0 calc(26px * var(--inv, 1)) rgba(126, 74, 235, .45);
}
.ring.rect { border-radius: calc(12px * var(--inv, 1)); }
.ring::after {
  content: '';
  position: absolute;
  inset: calc(-3px * var(--inv, 1));
  border: calc(2px * var(--inv, 1)) solid rgba(126, 74, 235, .75);
  border-radius: inherit;
  animation: echo 1.1s ease-out infinite;
}
@keyframes echo {
  from { transform: scale(1); opacity: .9; }
  to { transform: scale(1.32); opacity: 0; }
}
.ring.rect::after { animation-name: echo-rect; }
@keyframes echo-rect {
  from { transform: scale(1); opacity: .9; }
  to { transform: scale(1.08, 1.4); opacity: 0; }
}

.mask { background: #FFF; }
.hl { background: rgba(126, 74, 235, .16); border-radius: 8px; }
.ripple {
  border-radius: 50%;
  background: rgba(126, 74, 235, .28);
  border: calc(2px * var(--inv, 1)) solid rgba(126, 74, 235, .6);
}

/* курсор участника доски (CursorEl): стрелка и плашка с именем, размер экранный */
.cursor { width: 18px; height: 22px; transform-origin: 0 0; }
.cursor svg { display: block; }
.cursor .label {
  position: absolute;
  left: 8.5px;
  top: 20px;
  padding: 3px 10px 5px 8px;
  border-radius: 8px;
  color: #FFF;
  font: 400 14px/17px var(--sans);
  white-space: nowrap;
}

/* стикер доски flip: квадрат без скругления, тень из атласа приложения */
.sticker { position: absolute; }
.sticker .shadow { position: absolute; background-repeat: no-repeat; pointer-events: none; }
.sticker .face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #000;
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.218;
  overflow-wrap: break-word;
}

/* линейная графика тёмных глав: тонкие линии одной толщины при любом масштабе */
.la svg { display: block; overflow: visible; }
.la svg * { fill: none; stroke: var(--line); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.la svg .thick { stroke-width: 2.6; }
.la svg .acc { stroke: var(--brand-soft); }
.la svg .fill-acc { fill: var(--brand-soft); stroke: none; }
/* окна сервисов в тёмной главе: заливка прячет сетку фона, всплывающие окна непрозрачны */
.la svg .bg { fill: rgba(19, 17, 27, .84); }
.la svg .bg-solid { fill: #14121C; }
.la svg .dim { opacity: .45; }
.la svg .dash { stroke-dasharray: 5 6; }
/* провод интеграции прорисовывается по длине пути (pathLength = 1), толщину задаёт film.js */
.la svg .wire { stroke: var(--brand-soft); vector-effect: none; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.la svg .port { fill: #14121C; stroke: var(--brand-soft); }
.la svg .gear * { fill: #14121C; stroke: var(--brand-soft); }
.la-title {
  position: absolute;
  left: 58px;
  top: 0;
  color: var(--line);
  font: 500 15px/34px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.la-head {
  position: absolute;
  left: 20px;
  top: 0;
  color: var(--on-dark);
  font: 500 17px/50px var(--sans);
  white-space: nowrap;
}
.la-tag {
  position: absolute;
  left: 10px;
  top: -11px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: #14121C;
  font: 500 13px/1 var(--mono);
  white-space: nowrap;
}
/* артефакты главы D: мелкая линейная графика над и под фразой, экранного размера */
.swarm { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.swarm .art {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  visibility: hidden;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}
.swarm .acc svg * { stroke: var(--brand-soft); }
.la-hl {
  border: calc(1.4px * var(--inv, 1)) solid var(--brand-soft);
  border-radius: 9px;
  background: rgba(169, 139, 247, .12);
}
.la-label {
  position: absolute;
  left: 22px;
  top: 30px;
  padding: 4px 10px;
  border: 1.4px dashed var(--line);
  border-radius: 9px;
  color: var(--line);
  font: 500 15px/1.2 var(--sans);
  white-space: nowrap;
}
.la-ask {
  padding: 12px 18px;
  border: 1.6px solid var(--brand-soft);
  border-radius: 20px 20px 20px 4px;
  color: var(--on-dark);
  font: 400 19px/1.25 var(--sans);
  white-space: nowrap;
  background: rgba(126, 74, 235, .14);
}
.la-typing { display: flex; gap: 7px; padding: 12px 16px; border: 1.4px solid var(--line); border-radius: 18px; }
.la-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); animation: typing 1.2s ease-in-out infinite; }
.la-typing i:nth-child(2) { animation-delay: .15s; }
.la-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* значок документа flip */
.badge-doc { width: 72px; height: 72px; }
.badge-doc svg { display: block; width: 100%; height: 100%; }

/* ---------- тексты ---------- */
.texts { position: absolute; inset: 0; pointer-events: none; }
.texts a, .texts button { pointer-events: auto; }
.say, .center { margin: 0; opacity: 0; will-change: transform, opacity; }
/* слова реплик проявляются по одному */
.w { display: inline-block; }

.say {
  position: absolute;
  left: 7vw;
  top: 50%;
  width: min(36vw, 540px);
  font-weight: 500;
  font-size: clamp(24px, 2.45vw, 40px);
  line-height: 1.17;
  letter-spacing: -.024em;
  text-wrap: pretty;
}
.say .muted, .center .muted { color: var(--muted-dark); }
.say .accent, .center .accent { color: var(--brand-soft); }
.say.on-light { color: var(--ink-soft); }
.say.on-light .muted { color: var(--muted-light); }

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 1200px);
  text-align: center;
}
.center .line { display: block; }
.hook, .punch {
  font-weight: 500;
  font-size: clamp(44px, 7.4vw, 118px);
  line-height: 1.02;
  letter-spacing: -.048em;
  text-wrap: balance;
}
.punch { font-size: clamp(34px, 6vw, 92px); }
.js .hook .w-load { animation: rise 1.1s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

.hint {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  margin: 0 0 0 -60px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted-dark);
  font: 500 11px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hint-mark { position: relative; width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 50%; }
.hint-mark::after { content: ''; position: absolute; left: 50%; top: 2px; width: 2px; height: 3px; margin-left: -1px; border-radius: 1px; background: currentColor; animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(4px); opacity: 0; } 100% { opacity: 0; } }

.finale { color: var(--ink); }
.finale:not(.live) a, .finale:not(.live) button { pointer-events: none; }
.finale-logo { display: block; width: clamp(116px, 13vw, 196px); height: auto; margin: 0 auto clamp(18px, 3vh, 34px); color: #181818; }
.finale-title {
  margin: 0 auto;
  max-width: 980px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(46px, 7.2vw, 116px);
  line-height: 1;
  letter-spacing: -.035em;
  text-wrap: balance;
  font-optical-sizing: auto;
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: clamp(28px, 5vh, 48px); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 14px;
  font: 600 17px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:focus-visible { outline: 3px solid rgba(126, 74, 235, .45); outline-offset: 3px; }
.btn-primary { background: var(--brand); color: #FFF; box-shadow: 0 12px 30px rgba(126, 74, 235, .35); }
.btn-primary:hover { background: var(--brand-hover); transform: translateY(-1px); }

/* подвал как на flip-chart.ru: документы слева, юрлицо справа, линия сверху */
.foot {
  position: absolute;
  left: clamp(16px, 2.2vw, 30px);
  right: clamp(16px, 2.2vw, 30px);
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(24, 24, 24, .12);
  color: #181818;
  font: 400 14px/1.4 var(--sans);
  opacity: 0;
  visibility: hidden;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: #8B5CED; }
.foot-copy { color: #808080; white-space: nowrap; }
.foot-end { display: flex; align-items: center; gap: 20px; }
.foot-lang { display: inline-flex; align-items: center; gap: 8px; }
.foot-lang svg { width: 20px; height: 20px; flex: none; }

/* ---------- узкие и вертикальные экраны: текст сверху, мир под ним ---------- */
.portrait .say {
  left: 6vw;
  right: 6vw;
  top: calc(env(safe-area-inset-top) + 82px);
  width: auto;
  font-size: clamp(20px, 5.4vw, 30px);
  line-height: 1.2;
}
.portrait .hook { font-size: clamp(38px, 11.4vw, 72px); }
.portrait .punch { font-size: clamp(26px, 7.4vw, 60px); }
.portrait .foot { gap: 8px; font-size: 12px; }
.portrait .foot-links { gap: 6px 12px; }
.portrait .actions { flex-direction: column; align-items: stretch; width: min(100%, 360px); margin-left: auto; margin-right: auto; }

/* ---------- без JS: обычная страница с текстами глав ---------- */
.no-js .world, .no-js .bg, .no-js .brush, .no-js .hint { display: none; }
.no-js .texts { position: static; padding: 120px 24px 140px; }
.no-js .say, .no-js .center {
  position: static;
  width: auto;
  max-width: 760px;
  margin: 0 auto 18vh;
  opacity: 1;
  text-align: left;
}
.no-js .finale { color: var(--on-dark); }
.no-js .foot { position: static; margin: 0 24px; opacity: 1; visibility: visible; padding-bottom: 40px; color: var(--on-dark); }

@media (prefers-reduced-motion: reduce) {
  .ring::after, .la-typing i, .hint-mark::after { animation: none; }
  .js .hook .w-load { animation: none; }
}
