﻿/* ===== Сцена-заглушка (демо-анимация вместо видео) ===== */
.scene {
  --k: 1; --h: 200; --dur: 2.4s; --ps: paused;
  position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: hsl(var(--h) 30% 8%);
  isolation: isolate; contain: paint;
}
.scene.v { aspect-ratio: 9 / 16; }
.scene.play { --ps: running; }
.sc-cam { position: absolute; inset: -10%; transform-origin: 50% 50%; }
.sc-world { position: absolute; inset: 0; }
.sc-sky { position: absolute; inset: 0; background: linear-gradient(180deg, hsl(var(--h) 70% 22%), hsl(calc(var(--h) + 40) 80% 55%) 70%, hsl(calc(var(--h) + 70) 90% 70%)); }
.sc-sun { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; left: 56%; top: 30%; background: hsl(calc(var(--h) + 80) 100% 78%); box-shadow: 0 0 40px hsl(calc(var(--h) + 80) 100% 70% / .6); }
.scene.v .sc-sun { width: 40%; left: 40%; top: 32%; }
.sc-hill { position: absolute; left: -5%; right: -5%; bottom: 0; }
.sc-hill.a { height: 46%; background: hsl(calc(var(--h) + 200) 40% 16%); clip-path: polygon(0 60%, 18% 25%, 34% 55%, 52% 10%, 70% 50%, 86% 30%, 100% 55%, 100% 100%, 0 100%); }
.sc-hill.b { height: 30%; background: hsl(calc(var(--h) + 210) 45% 9%); clip-path: polygon(0 40%, 25% 70%, 45% 30%, 65% 65%, 85% 20%, 100% 45%, 100% 100%, 0 100%); }
.sc-word {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center;
  font: 800 clamp(14px, 4.5cqw, 42px)/1 var(--font); letter-spacing: .04em; color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.5); opacity: 0; white-space: nowrap;
}
.scene { container-type: inline-size; }
.scene[data-text] .sc-word { opacity: 1; font-size: 11cqw; }
.scene.v[data-text] .sc-word { font-size: 16cqw; }
.sc-over { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.scene .sc-cam, .scene .sc-world, .scene .sc-over, .scene .sc-word, .scene .sc-sun {
  animation-duration: var(--dur); animation-iteration-count: infinite; animation-play-state: var(--ps);
}

/* «Склейка»: на середине переходов кадр меняется (цвет) */
.scene[data-cut] .sc-world { animation-name: cut; animation-timing-function: steps(1, end); }
@keyframes cut { 0% { filter: none; } 50% { filter: hue-rotate(150deg) saturate(1.15); } }

/* — Зум — */
[data-fx="zoom"] .sc-cam { animation-name: fx-zoom; animation-timing-function: cubic-bezier(.6,0,.4,1); }
@keyframes fx-zoom {
  0%, 30% { transform: scale(1); filter: blur(0); }
  50% { transform: scale(calc(1 + .5 * var(--k))); filter: blur(calc(var(--k) * 6px)); }
  70%, 100% { transform: scale(1); filter: blur(0); }
}
/* — Вращение — */
[data-fx="spin"] .sc-cam { animation-name: fx-spin; animation-timing-function: cubic-bezier(.6,0,.4,1); }
@keyframes fx-spin {
  0%, 30% { transform: rotate(0) scale(1); filter: blur(0); }
  50% { transform: rotate(calc(var(--k) * 110deg)) scale(calc(1 + .3 * var(--k))); filter: blur(calc(var(--k) * 4px)); }
  70%, 100% { transform: rotate(0) scale(1); filter: blur(0); }
}
/* — Переворот — */
[data-fx="flip"] .sc-cam { animation-name: fx-flip; animation-timing-function: cubic-bezier(.6,0,.4,1); }
@keyframes fx-flip {
  0%, 30% { transform: perspective(700px) rotateX(0); }
  49.9% { transform: perspective(700px) rotateX(calc(var(--k) * 45deg)) scale(calc(1 - .1 * var(--k))); }
  50% { transform: perspective(700px) rotateX(calc(var(--k) * -45deg)) scale(calc(1 - .1 * var(--k))); }
  70%, 100% { transform: perspective(700px) rotateX(0); }
}
/* — Глитч — */
[data-fx="glitch"] .sc-cam { animation-name: fx-glitch; animation-timing-function: steps(1, end); }
[data-fx="glitch"] .sc-over {
  animation-name: fx-glitch-over; animation-timing-function: steps(1, end);
  background: repeating-linear-gradient(0deg, rgba(255,0,200,.55) 0 3px, transparent 3px 11px, rgba(0,230,255,.5) 11px 14px, transparent 14px 23px);
  mix-blend-mode: screen;
}
@keyframes fx-glitch {
  0%, 40% { transform: none; filter: none; }
  42% { transform: translate(calc(var(--k) * -14px), 0) skewX(calc(var(--k) * -8deg)); filter: hue-rotate(calc(var(--k) * 90deg)) saturate(2); }
  45% { transform: translate(calc(var(--k) * 12px), calc(var(--k) * 4px)); filter: invert(calc(var(--k) * .3)); }
  48% { transform: translate(calc(var(--k) * -6px), 0) scaleY(calc(1 + .1 * var(--k))); filter: none; }
  52% { transform: translate(calc(var(--k) * 10px), 0) skewX(calc(var(--k) * 10deg)); filter: hue-rotate(calc(var(--k) * -120deg)); }
  55%, 100% { transform: none; filter: none; }
}
@keyframes fx-glitch-over {
  0%, 40% { opacity: 0; } 42% { opacity: calc(var(--k) * .45); } 46% { opacity: 0; } 50% { opacity: calc(var(--k) * .5); background-position: 0 7px; } 55%, 100% { opacity: 0; }
}
/* — Вспышка — */
[data-fx="flash"] .sc-over { animation-name: fx-flash; background: #fff; }
[data-fx="flash"] .sc-cam { animation-name: fx-flash-cam; }
@keyframes fx-flash { 0%, 42% { opacity: 0; } 50% { opacity: calc(var(--k) * .5); } 68%, 100% { opacity: 0; } }
@keyframes fx-flash-cam { 0%, 42% { transform: scale(1); } 50% { transform: scale(calc(1 + .06 * var(--k))); } 70%, 100% { transform: scale(1); } }
/* — Смаз (whip pan) — */
[data-fx="blur"] .sc-cam { animation-name: fx-blur; animation-timing-function: cubic-bezier(.7,0,.3,1); }
@keyframes fx-blur {
  0%, 32% { transform: translateX(0); filter: blur(0); }
  49.9% { transform: translateX(calc(var(--k) * -10%)); filter: blur(calc(var(--k) * 10px)); }
  50% { transform: translateX(calc(var(--k) * 10%)); filter: blur(calc(var(--k) * 10px)); }
  68%, 100% { transform: translateX(0); filter: blur(0); }
}
/* — Сдвиг — */
[data-fx="slide"] .sc-cam { animation-name: fx-slide; animation-timing-function: cubic-bezier(.7,0,.3,1); }
@keyframes fx-slide {
  0%, 32% { transform: translateY(0); }
  49.9% { transform: translateY(calc(var(--k) * -9%)); }
  50% { transform: translateY(calc(var(--k) * 9%)); }
  68%, 100% { transform: translateY(0); }
}
/* — Искажение — */
[data-fx="warp"] .sc-cam { animation-name: fx-warp; animation-timing-function: ease-in-out; }
@keyframes fx-warp {
  0%, 30% { transform: none; filter: blur(0); }
  40% { transform: skewX(calc(var(--k) * 10deg)) scaleX(calc(1 + .1 * var(--k))); }
  50% { transform: skewX(calc(var(--k) * -12deg)) scale(calc(1 + .15 * var(--k))); filter: blur(calc(var(--k) * 2px)); }
  60% { transform: skewX(calc(var(--k) * 6deg)); filter: blur(0); }
  72%, 100% { transform: none; }
}
/* — Маска — */
[data-fx="mask"] .sc-cam { animation-name: fx-mask; animation-timing-function: cubic-bezier(.5,0,.3,1); }
@keyframes fx-mask {
  0%, 49.9% { clip-path: circle(100% at 50% 50%); }
  50% { clip-path: circle(calc(36% - 17% * var(--k)) at 50% 50%); }
  75%, 100% { clip-path: circle(100% at 50% 50%); }
}
/* — Куб — */
[data-fx="cube"] .sc-cam { animation-name: fx-cube; animation-timing-function: cubic-bezier(.6,0,.4,1); }
@keyframes fx-cube {
  0%, 30% { transform: perspective(800px) rotateY(0); }
  49.9% { transform: perspective(800px) rotateY(calc(var(--k) * -40deg)) scale(calc(1 - .12 * var(--k))); }
  50% { transform: perspective(800px) rotateY(calc(var(--k) * 40deg)) scale(calc(1 - .12 * var(--k))); }
  70%, 100% { transform: perspective(800px) rotateY(0); }
}
/* — Тряска — */
[data-fx="shake"] .sc-cam { animation-name: fx-shake; animation-duration: .9s; animation-timing-function: linear; }
@keyframes fx-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(calc(var(--k) * -10px), calc(var(--k) * 6px)) rotate(calc(var(--k) * -1deg)); }
  20% { transform: translate(calc(var(--k) * 8px), calc(var(--k) * -8px)) rotate(calc(var(--k) * 1deg)); }
  30% { transform: translate(calc(var(--k) * -6px), calc(var(--k) * -4px)); }
  40% { transform: translate(calc(var(--k) * 10px), calc(var(--k) * 4px)) rotate(calc(var(--k) * -.6deg)); }
  50% { transform: translate(calc(var(--k) * -4px), calc(var(--k) * 8px)); }
  60% { transform: translate(calc(var(--k) * 6px), calc(var(--k) * -6px)) rotate(calc(var(--k) * .8deg)); }
  70% { transform: translate(calc(var(--k) * -8px), calc(var(--k) * 2px)); }
  80% { transform: translate(calc(var(--k) * 4px), calc(var(--k) * -4px)); }
  90% { transform: translate(calc(var(--k) * -2px), calc(var(--k) * 2px)); }
}
/* — Удар — */
[data-fx="impact"] .sc-cam { animation-name: fx-impact; animation-duration: 1.2s; }
[data-fx="impact"] .sc-over { animation-name: fx-impact-flash; animation-duration: 1.2s; background: #fff; }
@keyframes fx-impact {
  0%, 30% { transform: scale(1); }
  34% { transform: scale(calc(1 + .22 * var(--k))) translateY(calc(var(--k) * -2%)); }
  42% { transform: scale(calc(1 - .04 * var(--k))) translateY(calc(var(--k) * 1%)); }
  50% { transform: scale(calc(1 + .06 * var(--k))); }
  60%, 100% { transform: scale(1); }
}
@keyframes fx-impact-flash { 0%, 30% { opacity: 0; } 34% { opacity: calc(var(--k) * .25); } 45%, 100% { opacity: 0; } }
/* — Пульс — */
[data-fx="pulse"] .sc-cam { animation-name: fx-pulse; animation-duration: .6s; animation-timing-function: ease-out; }
@keyframes fx-pulse { 0% { transform: scale(1); } 12% { transform: scale(calc(1 + .12 * var(--k))); } 100% { transform: scale(1); } }
/* — Отскок — */
[data-fx="bounce"] .sc-cam { animation-name: fx-bounce; animation-timing-function: ease-out; }
@keyframes fx-bounce {
  0%, 15% { transform: translateY(calc(var(--k) * 25%)) scale(calc(1 - .05 * var(--k))); }
  35% { transform: translateY(calc(var(--k) * -6%)) scale(1); }
  48% { transform: translateY(calc(var(--k) * 2.5%)); }
  58% { transform: translateY(calc(var(--k) * -1%)); }
  66%, 100% { transform: translateY(0); }
}
/* — Текст: подъём — */
[data-fx="text"] .sc-word { animation-name: fx-text; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
@keyframes fx-text {
  0% { opacity: 0; transform: translateY(calc(-50% + var(--k) * 60%)); letter-spacing: calc(var(--k) * .25em); filter: blur(calc(var(--k) * 4px)); }
  30%, 75% { opacity: 1; transform: translateY(-50%); letter-spacing: .04em; filter: blur(0); }
  100% { opacity: 0; transform: translateY(calc(-50% - var(--k) * 30%)); }
}
/* — Текст: печать — */
[data-fx="type"] .sc-word { animation-name: fx-type; animation-timing-function: steps(5, end); clip-path: inset(0 100% 0 0); }
@keyframes fx-type {
  0% { clip-path: inset(0 100% 0 0); transform: translateY(-50%); }
  55%, 90% { clip-path: inset(0 0 0 0); transform: translateY(-50%) translateX(calc(var(--k) * 1px)); }
  92% { transform: translateY(-50%) translate(calc(var(--k) * -4px), calc(var(--k) * 2px)); }
  100% { clip-path: inset(0 0 0 0); transform: translateY(-50%); }
}
/* — Текст: кинетика — */
[data-fx="textzoom"] .sc-word { animation-name: fx-textzoom; animation-timing-function: cubic-bezier(.2,.9,.2,1); }
[data-fx="textzoom"] .sc-cam { animation-name: fx-textzoom-cam; }
@keyframes fx-textzoom {
  0% { opacity: 0; transform: translateY(-50%) scale(calc(1 + 2.5 * var(--k))); }
  18%, 80% { opacity: 1; transform: translateY(-50%) scale(1); }
  100% { opacity: 0; transform: translateY(-50%) scale(.92); }
}
@keyframes fx-textzoom-cam { 0%, 15% { transform: scale(1); } 19% { transform: scale(calc(1 + .05 * var(--k))); } 30%, 100% { transform: scale(1); } }
/* — Свечение — */
[data-fx="glow"] .sc-world { animation-name: fx-glow; animation-timing-function: ease-in-out; }
[data-fx="glow"] .sc-sun { animation-name: fx-glow-sun; animation-timing-function: ease-in-out; }
@keyframes fx-glow {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(calc(1 + .35 * var(--k))) saturate(calc(1 + .4 * var(--k))); }
}
@keyframes fx-glow-sun {
  0%, 100% { box-shadow: 0 0 calc(var(--k) * 20px) hsl(calc(var(--h) + 80) 100% 70% / .6); }
  50% { box-shadow: 0 0 calc(var(--k) * 90px) calc(var(--k) * 20px) hsl(calc(var(--h) + 80) 100% 70% / .8); }
}
/* — Утечка света — */
[data-fx="leak"] .sc-over {
  animation-name: fx-leak; animation-duration: 3.2s; animation-timing-function: ease-in-out;
  background: radial-gradient(60% 80% at 0% 30%, rgba(255,120,40,.95), transparent 70%), radial-gradient(40% 60% at 10% 90%, rgba(255,40,90,.8), transparent 70%);
  mix-blend-mode: screen;
}
@keyframes fx-leak {
  0%, 100% { opacity: 0; transform: translateX(-20%); }
  50% { opacity: calc(var(--k) * .5); transform: translateX(10%); }
}
/* — Цвет — */
[data-fx="color"] .sc-world { animation-name: fx-color; animation-duration: 3s; animation-timing-function: ease-in-out; }
@keyframes fx-color {
  0%, 100% { filter: none; }
  35%, 70% { filter: saturate(calc(1 + .8 * var(--k))) contrast(calc(1 + .2 * var(--k))) hue-rotate(calc(var(--k) * -25deg)) sepia(calc(var(--k) * .15)); }
}
/* — Ч/б — */
[data-fx="bw"] .sc-world { animation-name: fx-bw; animation-duration: 3s; }
@keyframes fx-bw {
  0%, 12% { filter: none; }
  35%, 85% { filter: grayscale(calc(var(--k) * .55)) contrast(calc(1 + .3 * var(--k))); }
  100% { filter: none; }
}
/* — VHS — */
[data-fx="vhs"] .sc-over {
  opacity: calc(var(--k) * .3); animation-name: fx-vhs-over; animation-duration: 1.2s; animation-timing-function: linear;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.6) 0 2px, transparent 2px 4px), linear-gradient(90deg, rgba(255,0,80,.25), transparent 30%, transparent 70%, rgba(0,200,255,.25));
}
[data-fx="vhs"] .sc-cam { animation-name: fx-vhs; animation-duration: 1.2s; animation-timing-function: steps(1, end); }
@keyframes fx-vhs-over { 0% { background-position: 0 0, 0 0; } 100% { background-position: 0 40px, 0 0; } }
@keyframes fx-vhs {
  0%, 60% { transform: none; filter: saturate(1.3); }
  62% { transform: translateX(calc(var(--k) * 5px)) skewX(calc(var(--k) * 2deg)); filter: saturate(1.6) hue-rotate(10deg); }
  66% { transform: translateX(calc(var(--k) * -3px)); }
  70%, 100% { transform: none; filter: saturate(1.3); }
}
/* — Пиксели — */
[data-fx="pixel"] .sc-world { animation-name: fx-pixel; animation-duration: 2.4s; animation-timing-function: steps(1, end); }
[data-fx="pixel"] .sc-over {
  animation-name: fx-pixel-over; animation-timing-function: steps(1, end);
  background-image: linear-gradient(rgba(0,0,0,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.35) 1px, transparent 1px);
}
@keyframes fx-pixel {
  0%, 30% { filter: none; } 38% { filter: blur(calc(var(--k) * 2px)) contrast(1.3); } 46%, 54% { filter: blur(calc(var(--k) * 5px)) contrast(1.6) saturate(1.4); } 62% { filter: blur(calc(var(--k) * 2px)) contrast(1.3); } 70%, 100% { filter: none; }
}
@keyframes fx-pixel-over {
  0%, 30% { opacity: 0; } 38% { opacity: 1; background-size: calc(var(--k) * 6px) calc(var(--k) * 6px); } 46%, 54% { opacity: 1; background-size: calc(var(--k) * 14px) calc(var(--k) * 14px); }
  62% { opacity: 1; background-size: calc(var(--k) * 6px) calc(var(--k) * 6px); } 70%, 100% { opacity: 0; }
}
/* — Зерно — */
[data-fx="grain"] .sc-over {
  opacity: calc(var(--k) * .28); mix-blend-mode: overlay; animation-name: fx-grain; animation-duration: .5s; animation-timing-function: steps(1, end);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-fx="grain"] .sc-world { filter: sepia(calc(var(--k) * .12)) contrast(1.05); }
@keyframes fx-grain { 0% { background-position: 0 0; } 25% { background-position: -40px 30px; } 50% { background-position: 50px -20px; } 75% { background-position: -20px -50px; } }
/* — Скорость — */
[data-fx="speed"] .sc-cam { animation-name: fx-speed; }
@keyframes fx-speed {
  0%, 25% { transform: translateX(0) scale(1); filter: blur(0); animation-timing-function: cubic-bezier(.8,0,1,1); }
  49.9% { transform: translateX(calc(var(--k) * -6%)) scale(calc(1 + .12 * var(--k))); filter: blur(calc(var(--k) * 5px)); }
  50% { transform: translateX(calc(var(--k) * 6%)) scale(calc(1 + .12 * var(--k))); filter: blur(calc(var(--k) * 5px)); animation-timing-function: cubic-bezier(0,0,.2,1); }
  85%, 100% { transform: translateX(0) scale(1); filter: blur(0); }
}
/* — Шлейф — */
[data-fx="echo"] .sc-sun {
  animation-name: fx-echo; animation-timing-function: ease-in-out; animation-direction: alternate;
}
@keyframes fx-echo {
  0% { transform: translateX(-120%); box-shadow: 0 0 0 transparent; }
  50% { box-shadow: calc(var(--k) * -30px) 0 0 hsl(calc(var(--h) + 80) 100% 78% / .45), calc(var(--k) * -60px) 0 0 hsl(calc(var(--h) + 80) 100% 78% / .2); }
  100% { transform: translateX(60%); box-shadow: 0 0 0 transparent; }
}
/* — Наезд — */
[data-fx="dolly"] .sc-cam { animation-name: fx-dolly; animation-duration: 4s; animation-timing-function: ease-in-out; animation-direction: alternate; }
@keyframes fx-dolly { 0% { transform: scale(1); } 100% { transform: scale(calc(1 + .14 * var(--k))); } }
/* — Ручная камера — */
[data-fx="handheld"] .sc-cam { animation-name: fx-handheld; animation-duration: 3.2s; animation-timing-function: ease-in-out; }
@keyframes fx-handheld {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(calc(var(--k) * -1.2%), calc(var(--k) * .8%)) rotate(calc(var(--k) * -.6deg)); }
  50% { transform: translate(calc(var(--k) * 1%), calc(var(--k) * -.6%)) rotate(calc(var(--k) * .5deg)); }
  75% { transform: translate(calc(var(--k) * -.6%), calc(var(--k) * -1%)) rotate(calc(var(--k) * -.3deg)); }
}

[data-fx="text"] .sc-word, [data-fx="textzoom"] .sc-word, [data-fx="type"] .sc-word { animation-delay: -1s; }
