/* ═══════════════════════════════════════════════════════════
   Сценарий прокрутки «черновая стена → идеальная»: у каждого блока своя механика.
   Заголовки: data-h = level | roll | flap | spray | hang | measure | pour (буквы режет js/motion.js)
   ═══════════════════════════════════════════════════════════ */

/* ── Заголовки ── */
.h2 .wd { display: inline-block; white-space: nowrap; }
.h2 .ch { display: inline-block; will-change: transform; }
.h2 .h-in { display: inline; }

/* level — буквы стоят криво, как неровная стена, и выравниваются по прокрутке (--p 0→1) */
.h2[data-h="level"] .ch { transform: translateY(calc(var(--y) * (1 - var(--p, 1)))) rotate(calc(var(--r) * (1 - var(--p, 1)))); }

/* roll — проявляется за жёлтым валиком */
.h2[data-h="roll"] { position: relative; }
.js .h2[data-h="roll"] .h-in { display: inline-block; clip-path: inset(-10% 100% -10% 0); transition: clip-path 1.3s var(--ease) .1s; }
.h2[data-h="roll"]::after { content: ""; position: absolute; top: -4%; bottom: 2%; left: 0; width: 16px; border-radius: 8px; background: repeating-linear-gradient(180deg, #FFD34D 0 3px, var(--tape) 3px 7px); box-shadow: 0 6px 14px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; }
.h2[data-h="roll"].is-in .h-in { clip-path: inset(-10% -2% -10% 0); }
.h2[data-h="roll"].is-in::after { animation: rollbar 1.3s var(--ease) .1s both; }
@keyframes rollbar { 0% { left: 0; opacity: 1; } 85% { left: calc(100% - 16px); opacity: 1; } 100% { left: calc(100% - 16px); opacity: 0; } }

/* flap — перекидное табло */
.h2[data-h="flap"] { perspective: 700px; }
.js .h2[data-h="flap"] .ch { transform: rotateX(-100deg); transform-origin: 50% 0; opacity: 0; transition: transform .8s cubic-bezier(.3, 1.6, .5, 1), opacity .25s; transition-delay: calc(var(--i) * 40ms); backface-visibility: hidden; }
.h2[data-h="flap"].is-in .ch { transform: none; opacity: 1; }

/* spray — буквы проявляются, как краска из баллончика */
.js .h2[data-h="spray"] .ch { opacity: 0; filter: blur(14px); transform: scale(1.6); transition: opacity .7s, filter .9s, transform .9s var(--ease); transition-delay: calc(var(--k) * 32ms); }
.h2[data-h="spray"].is-in .ch { opacity: 1; filter: none; transform: none; }

/* hang — буквы падают и повисают на гвоздях */
.js .h2[data-h="hang"] .ch { opacity: 0; transform-origin: 50% -40%; }
.h2[data-h="hang"].is-in .ch { animation: hangch 1.2s cubic-bezier(.2, .7, .2, 1) calc(var(--i) * 45ms) both; }
@keyframes hangch { 0% { opacity: 0; transform: translateY(-1.2em) rotate(var(--r)); } 45% { opacity: 1; transform: translateY(.06em) rotate(calc(var(--r) * -.7)); } 70% { transform: rotate(calc(var(--r) * .35)); } 88% { transform: rotate(calc(var(--r) * -.12)); } 100% { opacity: 1; transform: none; } }

/* measure — вытягивается, как лента рулетки */
.h2[data-h="measure"] { position: relative; padding-bottom: 14px; }
.js .h2[data-h="measure"] .ch { opacity: 0; transform: translateX(-.5em); transition: opacity .35s, transform .6s var(--ease); transition-delay: calc(var(--i) * 28ms); }
.h2[data-h="measure"].is-in .ch { opacity: 1; transform: none; }
.h2[data-h="measure"]::after { display: none; content: ""; position: absolute; left: 0; bottom: 0; height: 9px; width: 100%; transform-origin: left; transform: scaleX(0); transition: transform 1.4s var(--ease) .1s;
  background: repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 9px) left top / 100% 4px no-repeat, var(--tape); border-radius: 2px; }
.h2[data-h="measure"].is-in::after { transform: scaleX(1); }

/* pour — буквы всплывают из краски */
.js .h2[data-h="pour"] .wd { overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.js .h2[data-h="pour"] .ch { transform: translateY(115%) skewY(10deg); transition: transform 1s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i) * 30ms); }
.h2[data-h="pour"].is-in .ch { transform: none; }

/* ── 01 · Строительный уровень ── */
.level { display: flex; align-items: center; gap: 22px; margin: clamp(46px, 6vw, 70px) 0 -18px; }
.level__bar { position: relative; flex: 1; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transform: rotate(var(--tilt, 0deg));
  background: linear-gradient(180deg, #FFD449 0%, #F2B705 55%, #D59E00 100%); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .45), 0 10px 22px -12px rgba(11, 21, 48, .55); }
.level__end { position: absolute; top: 0; bottom: 0; width: 30px; background: var(--ink); }
.level__end:first-child { left: 0; border-radius: 8px 0 0 8px; }
.level__end:last-child { right: 0; border-radius: 0 8px 8px 0; }
.level__vial { position: relative; width: 170px; height: 20px; border-radius: 999px; overflow: hidden; background: linear-gradient(180deg, #E6FFC9, #B6EE8C 60%, #9BDD6C); box-shadow: inset 0 0 0 2px rgba(11, 21, 48, .4), inset 0 3px 5px rgba(255, 255, 255, .7); }
.level__mark { position: absolute; top: 2px; bottom: 2px; left: calc(50% - 22px); width: 2px; background: rgba(11, 21, 48, .6); }
.level__mark--r { left: calc(50% + 20px); }
.level__bubble { position: absolute; top: 4px; left: calc(50% - 16px); width: 32px; height: 12px; border-radius: 999px; transform: translateX(var(--bx, 0px));
  background: radial-gradient(ellipse at 38% 30%, #fff 0 25%, rgba(255, 255, 255, .6) 55%, rgba(255, 255, 255, .25)); box-shadow: inset 0 -1px 2px rgba(11, 21, 48, .15); }
.level__lbl { font-family: var(--f-mono); font-size: 13px; letter-spacing: .16em; color: var(--ink-3); white-space: nowrap; transition: color .4s; min-width: 92px; }
.level.is-level .level__lbl { color: var(--wa-2); }
.level.is-level .level__lbl::before { content: "✓ "; }
.level.is-level .level__vial { animation: levelok .6s var(--ease); }
@keyframes levelok { 40% { box-shadow: inset 0 0 0 2px var(--wa-2), 0 0 0 6px rgba(29, 168, 81, .2); } }

/* ── 02 · Валик красит тёмный блок сверху вниз ── */
.why.is-paint { clip-path: inset(0 0 calc((1 - var(--paint, 1)) * 100%) 0); }
.roller { position: absolute; left: 0; right: 0; top: calc(var(--paint, 1) * 100%); z-index: 4; height: 0; pointer-events: none; opacity: var(--roll-o, 0); }
.roller__drum { position: absolute; left: 1.5%; right: 1.5%; bottom: 0; height: 46px; border-radius: 23px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 2px, transparent 2px 7px), linear-gradient(180deg, #7D8FDA 0%, #3A50B0 38%, #1F36A8 62%, #13256E 100%);
  box-shadow: 0 14px 22px -8px rgba(0, 0, 0, .55), inset 0 2px 0 rgba(255, 255, 255, .18); }
.roller__drum::before, .roller__drum::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 10px; border-radius: 5px; background: #8A93A6; }
.roller__drum::before { left: -6px; }
.roller__drum::after { right: -6px; }
.roller__arm { position: absolute; right: calc(1.5% - 6px); bottom: 22px; width: 150px; height: 110px; border: 6px solid #9AA4B6; border-left: 0; border-bottom: 0; border-radius: 0 26px 0 0; }
.roller__arm::after { content: ""; position: absolute; right: -18px; top: -70px; width: 30px; height: 80px; border-radius: 14px; background: linear-gradient(90deg, #2A44C2, #13256E); box-shadow: 0 6px 12px rgba(0, 0, 0, .3); }

/* ── 03 · До/после: закреплённая сцена, прокрутка ведёт ползунок ── */
.ba__ruler { position: relative; height: 12px; margin-top: 14px; border-radius: 3px; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 12px) left bottom / 100% 6px no-repeat, repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 60px) left bottom / 100% 12px no-repeat, var(--plaster); }
.ba__ruler i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--bp, 50%); background: rgba(242, 183, 5, .55); mix-blend-mode: multiply; transition: width .1s linear; }
.ba.ba--pin { padding: 0; height: calc(100vh + var(--travel, 110vh)); }
.ba--pin .ba__pin { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--hdr) + 8px) 0 18px; }
.ba--pin .sec-head { margin-bottom: 14px; }
.ba--pin .ba__head { margin-bottom: 18px; }
.ba--pin .ba__stage { aspect-ratio: auto; height: calc(100vh - var(--hdr) - 320px); min-height: 280px; }
.ba--pin .ba__meta { margin-top: 14px; }
.ba--pin .demo-note { margin-top: 8px; }

/* ── 04 · Отзывы — записки на малярном скотче ── */
.rv__track { padding-top: 22px; }
.rv__card { --rot: -1.6deg; overflow: visible; transform: rotate(var(--rot)); transition: transform .5s var(--ease), box-shadow .4s; }
.rv__card:nth-child(2n) { --rot: 1.4deg; }
.rv__card:nth-child(3n) { --rot: -.6deg; }
.rv__card:hover { transform: rotate(0) translateY(-6px); box-shadow: var(--shadow-lg); }
.rv__card::before { top: 6px; }
.rv__card::after { content: ""; position: absolute; top: -13px; left: 50%; width: 104px; height: 28px; margin-left: -52px; transform: rotate(calc(var(--rot) * -2.2)); border-radius: 2px; opacity: .88;
  background: linear-gradient(90deg, rgba(255, 255, 255, .25) 0 3px, transparent 3px calc(100% - 3px), rgba(255, 255, 255, .25) calc(100% - 3px)), repeating-linear-gradient(0deg, rgba(0, 0, 0, .03) 0 2px, transparent 2px 5px), var(--tape);
  box-shadow: 0 2px 4px rgba(11, 21, 48, .15); }
.js .rv:not(.is-in) .rv__card { opacity: 0; }
.rv.is-in .rv__card { animation: slap .8s cubic-bezier(.2, 1.4, .4, 1) calc(var(--n, 0) * .13s) backwards; }
@keyframes slap { from { opacity: 0; transform: translateY(-40px) rotate(calc(var(--rot) + 9deg)) scale(1.12); } }

/* ── 05 · Каталог — карточки повисают на гвоздиках ── */
.js .cats:not(.is-in) .catc { opacity: 0; }
.cats.is-in .catc { animation: hangc 1.25s cubic-bezier(.25, .7, .25, 1) calc(var(--n, 0) * .09s) backwards; }
@keyframes hangc { 0% { opacity: 0; transform: translateY(-90px) rotate(0); } 42% { opacity: 1; transform: translateY(8px) rotate(-5deg); } 62% { transform: rotate(3deg); } 80% { transform: rotate(-1.2deg); } 100% { transform: none; } }

/* ── 06 · Подбор — рулетка вдоль шагов ── */
.qsteps { position: relative; }
.qsteps::before, .qsteps::after { content: ""; position: absolute; left: 16.5px; top: 22px; width: 3px; border-radius: 2px; }
.qsteps::before { bottom: 22px; background: var(--line); }
.qsteps::after { height: calc(var(--qp, 0) * (100% - 44px)); background: repeating-linear-gradient(180deg, var(--ink) 0 1px, var(--tape) 1px 7px); width: 7px; left: 14.5px; transition: height .8s var(--ease); box-shadow: 0 0 0 1px rgba(11, 21, 48, .15); }
.qsteps li { position: relative; z-index: 1; }

/* ── 07 · Контакты — тёмная краска поднимается волной ── */
.contacts { overflow: visible; }
.pour { position: absolute; left: 0; right: 0; top: 1px; height: 170px; z-index: 2; pointer-events: none; transform: translateY(-100%) scaleY(var(--pour, 1)); transform-origin: 50% 100%; }
.pour svg { position: absolute; left: -8%; width: 116%; height: 100%; overflow: visible; }
.pour path { fill: var(--navy); }
.pour__w2 { opacity: .55; animation: wave 6s ease-in-out infinite; }
.pour__w1 { animation: wave 8s ease-in-out infinite reverse; }
@keyframes wave { 50% { transform: translateX(-3%); } }
.drip { position: absolute; left: var(--x); bottom: 40px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy); animation: splash 2.8s ease-in-out var(--d) infinite; }
@keyframes splash { 0%, 100% { transform: translateY(0) scale(.6); opacity: 0; } 30% { opacity: 1; } 50% { transform: translateY(calc(var(--h) * -1)) scale(1); } 80% { transform: translateY(0) scale(.8); opacity: .8; } }

@media (max-width: 900px) {
  .level__vial { width: 120px; }
  .level__lbl { min-width: 0; }
  .roller__arm { width: 90px; height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .pour__w1, .pour__w2, .drip { animation: none; }
}
/* режим скриншотов */
.shot .h2 .ch, .shot .h2 .h-in { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
.shot .rv__card, .shot .catc { opacity: 1 !important; }
