/* tecnt.ru: режим «листов». Колесо вниз: лист уходит влево, по проводу бьёт молния.
   Включается классом html.deck-on (ставит скрипт в <head>); без JS страница читается обычной прокруткой. */
:root {
  --top-h: 68px;
  --wire-h: 86px;
  --dot: 14px;
  --deck-speed: .85s;
  --deck-ease: cubic-bezier(.65, 0, .35, 1);
}

/* ---------- Провод ---------- */
.wire { display: none; }
.deck-on .wire {
  display: block; position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; height: calc(var(--wire-h) + env(safe-area-inset-bottom));
  padding: 0 var(--gutter) env(safe-area-inset-bottom); background: linear-gradient(0deg, rgba(7,7,26,.96), rgba(7,7,26,.82) 70%, rgba(7,7,26,0));
}
.wire-rail { position: relative; height: 100%; max-width: 1400px; margin: 0 auto; }
.wire-line, .wire-charge { position: absolute; left: 0; top: 26px; height: 3px; border-radius: 2px; }
.wire-line { right: 0; background: rgba(176, 92, 255, .2); box-shadow: inset 0 0 0 1px rgba(176, 92, 255, .12); }
/* Заряженная часть провода: от начала до текущей точки */
.wire-charge {
  width: 0; background: linear-gradient(90deg, var(--violet), var(--magenta));
  box-shadow: 0 0 8px rgba(224, 64, 251, .75), 0 0 18px rgba(139, 61, 255, .5);
  transition: width .32s cubic-bezier(.2, .9, .3, 1);
  overflow: hidden;
}
/* Назад: свечение плавно «отползает» */
.wire.is-retreat .wire-charge { transition: width .9s cubic-bezier(.45, 0, .2, 1); }
/* Бегущий блик по заряженному проводу: постоянная лёгкая пульсация */
.wire-charge::after {
  content: ""; position: absolute; top: -2px; bottom: -2px; width: 140px; left: -140px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
  animation: wire-run 2.6s linear infinite;
}
.wire.is-retreat .wire-charge::after { animation-direction: reverse; animation-duration: .9s; }
@keyframes wire-run { to { left: 100%; } }
/* После удара провод несколько раз вспыхивает */
.wire.is-pulse .wire-charge { animation: wire-pulse .45s ease-in-out 3; }
@keyframes wire-pulse {
  50% { box-shadow: 0 0 14px rgba(255, 255, 255, .9), 0 0 30px rgba(224, 64, 251, 1), 0 0 52px rgba(139, 61, 255, .8); }
}

.wire-points { list-style: none; margin: 0; padding: 0; }
.wire-point { position: absolute; top: 0; transform: translateX(-50%); }
.wire-dot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 19px 4px 6px; margin: 0; border: 0; background: none; color: var(--ink-mute); cursor: pointer;
  font: 700 12px/1.1 var(--text); white-space: nowrap;
}
.wire-dot::before {
  content: ""; width: var(--dot); height: var(--dot); border-radius: 50%;
  background: #1b1640; border: 2px solid rgba(176, 92, 255, .55);
  transition: background .3s, border-color .3s, box-shadow .3s, transform .3s;
}
.wire-dot:hover { color: #fff; }
.wire-dot:hover::before { border-color: var(--magenta); }
.wire-dot:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.wire-point.is-done .wire-dot::before { background: var(--violet); border-color: var(--violet-2); box-shadow: 0 0 10px rgba(176, 92, 255, .8); }
.wire-point.is-current .wire-dot { color: #fff; }
.wire-point.is-current .wire-dot::before {
  background: #fff; border-color: var(--magenta); transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(224, 64, 251, .25), 0 0 16px #fff, 0 0 28px var(--magenta);
}
/* Вспышка-кольцо в точке удара */
.wire-dot::after {
  content: ""; position: absolute; top: 19px; left: 50%; width: var(--dot); height: var(--dot); margin-left: calc(var(--dot) / -2);
  border-radius: 50%; border: 2px solid #fff; opacity: 0; pointer-events: none;
}
.wire-point.is-hit .wire-dot::after { animation: wire-hit .7s ease-out; }
@keyframes wire-hit { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(4); } }

/* Молния: SVG поверх провода, выходит вверх в шапку */
.wire-bolt { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wire-bolt path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wire-bolt .bolt-glow { stroke: rgba(224, 64, 251, .85); stroke-width: 7; filter: blur(3px); }
.wire-bolt .bolt-core { stroke: #fff; stroke-width: 2; }
.wire-bolt.is-fading { transition: opacity .3s ease-out; opacity: 0; }

/* Холст удара молнии на весь экран (assets/lightning.js): поверх всего, клики пропускает */
.bolt-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 95; pointer-events: none; display: none; }
.bolt-canvas.is-on { display: block; }

/* ---------- Листы ---------- */
.deck-on body { height: 100dvh; overflow: hidden; }
.deck-on .top { position: fixed; left: 0; right: 0; top: 0; height: var(--top-h); }
.deck-on .deck { position: fixed; left: 0; right: 0; top: var(--top-h); bottom: calc(var(--wire-h) + env(safe-area-inset-bottom)); overflow: hidden; }

/* Кнопка и окно чата над проводом */
.deck-on .ntchat { bottom: calc(var(--wire-h) + env(safe-area-inset-bottom) + 14px); }
.deck-on .ntchat-panel { height: min(640px, calc(100dvh - var(--wire-h) - 40px)); }
.deck-on .deck-track { display: flex; height: 100%; transition: transform var(--deck-speed) var(--deck-ease); will-change: transform; }
.deck-on .sheet {
  flex: 0 0 100%; height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(176, 92, 255, .4) transparent;
}

.sheet-in {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); align-items: center; gap: clamp(28px, 4vw, 64px);
  max-width: 1400px; min-height: 100%; margin: 0 auto; padding: 18px var(--gutter) 48px;
}
.sheet-in.single { grid-template-columns: minmax(0, 1fr); }
.sheet-in.reverse .frame { order: -1; }
.sheet-text { min-width: 0; }
.sheet-text.center { text-align: center; }
.sheet h1 { font-size: clamp(28px, 3.6vw, 54px); }
.sheet h2 { font-size: clamp(24px, 2.9vw, 42px); }

/* Картинка целиком, без обрезки: 16:9 и не выше свободной высоты листа */
.frame {
  margin: 0; justify-self: center; width: 100%;
  max-width: calc((100dvh - var(--top-h) - var(--wire-h) - 90px) * 16 / 9);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04) inset, 0 20px 60px rgba(0,0,0,.5), 0 0 40px rgba(139, 61, 255, .22);
}
.frame img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.frame figcaption { padding: 12px 18px; font-size: 15px; font-weight: 700; color: var(--ink-soft); background: var(--glass); border-top: 1px solid var(--line); }

.sheet .pains { margin-top: 8px; text-align: left; }
.sheet .chips { margin-top: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.sheet .lead { margin-top: 18px; }
.sheet .timeline { grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet .timeline li { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.sheet .timeline span { flex: none; margin: 0; width: 36px; height: 36px; font-size: 16px; }
.final-btn { margin-top: 22px; }
.legal-links { margin-top: 22px; font-size: 14px; color: var(--ink-mute); }
.legal-links a { color: var(--ink-soft); text-underline-offset: 3px; }
.legal-links a:hover { color: #fff; }

/* Появление содержимого активного листа: сдвиг по направлению листания */
.deck-on .sheet .sheet-text > *, .deck-on .sheet .frame { opacity: 0; transform: translateX(var(--enter, 40px)); }
.deck-on .sheet.is-active .sheet-text > *, .deck-on .sheet.is-active .frame {
  opacity: 1; transform: none; transition: opacity .6s ease, transform .7s cubic-bezier(.2, .8, .2, 1);
}
.deck-on .sheet.is-active .sheet-text > :nth-child(2) { transition-delay: .06s; }
.deck-on .sheet.is-active .sheet-text > :nth-child(3) { transition-delay: .12s; }
.deck-on .sheet.is-active .sheet-text > :nth-child(n+4) { transition-delay: .18s; }
.deck-on .sheet.is-active .frame { transition-delay: .1s; }
.deck-on .deck.go-prev { --enter: -40px; }

/* Подсказка о листании: видна первые секунды */
.deck-hint { display: none; }
.deck-on .deck-hint {
  display: block; position: fixed; z-index: 40; left: 50%; bottom: calc(var(--wire-h) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); margin: 0;
  padding: 10px 18px; border-radius: 12px; background: rgba(20, 16, 48, .92); border: 1px solid var(--line); white-space: nowrap;
  font-size: 14px; font-weight: 700; color: var(--ink-soft); pointer-events: none; transition: opacity .6s;
}
.deck-hint.is-hidden { opacity: 0; }
.hint-touch { display: none; }
@media (hover: none) { .hint-desk { display: none; } .hint-touch { display: inline; } }

/* Подписи крайних точек не уходят за край экрана */
.wire-point:first-child .wire-label { transform: translateX(calc(50% - 8px)); }
.wire-point:last-child .wire-label { transform: translateX(calc(-50% + 8px)); }
.wire-label { display: block; }

/* Без JS (или печать): обычная вертикальная страница */
html:not(.deck-on) .sheet { padding-block: 40px; }
html:not(.deck-on) .top { position: sticky; }

/* ---------- Планшет ---------- */
@media (max-width: 1200px) {
  .wire-point:not(.is-current) .wire-label { display: none; }
  .wire-dot { padding-top: 19px; }
}
@media (max-width: 900px) {
  :root { --wire-h: 70px; }
  .sheet-in, .sheet-in.reverse { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 22px; padding-top: 8px; }
  .sheet-in.reverse .frame, .frame { order: -1; max-width: none; }
  .sheet .timeline { grid-template-columns: 1fr; }
}
/* ---------- Телефон ---------- */
@media (max-width: 600px) {
  :root { --top-h: 60px; --wire-h: 62px; --dot: 11px; }
  .top { padding-block: 8px; }
  .wire-line, .wire-charge { top: 21px; }
  .wire-dot { padding-top: 16px; gap: 7px; font-size: 11px; }
  .wire-dot::after { top: 16px; }
  .sheet h1 { font-size: 28px; }
  .sheet h2 { font-size: 23px; }
  .deck-on .deck-hint { top: calc(var(--top-h) + 6px); bottom: auto; font-size: 13px; }
  .hero-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --deck-speed: .01s; }
  .wire-charge, .wire.is-retreat .wire-charge { transition: none; }
  .wire-charge::after, .wire.is-pulse .wire-charge, .wire-point.is-hit .wire-dot::after { animation: none; }
  .deck-on .sheet .sheet-text > *, .deck-on .sheet .frame { opacity: 1; transform: none; transition: none; }
}
