/* Ван on screen (js/van.js): Master Wang, Masko's tiger cub. Sizes and frames stay with each page. */

@media (prefers-reduced-motion: reduce) {
  .van, .van * { animation: none !important; }
}

/* Master Wang (van.js clip): Masko's clips are 720 frames of him whole; the circle shows the 420 square at 121, 40,
   his head and chest. A reaction plays over the idle. The idle is a still that breathes, with two strips of 360 frames
   over the parts that move (wang/*.webp): the ear flick of Masko's first «Покой» (box 59,33 to 272,116, 39 frames) and
   the blink of the second (91,84 to 238,152, 12 frames). The still has those parts cut out, so a strip always shows,
   resting on its first frame, which is the still's own; van.js plays one now and then. The poster is that rest frame
   whole: it stands in until the still and the strips are decoded. */
/* always the circle, over the themes' own rules for the picture of old Ван (.mascot without a background or round corners) */
.van-clip { position: relative; display: block; overflow: hidden; aspect-ratio: 1; border-radius: 50% !important; background: var(--brand-soft) !important; }
.van-clip > * { position: absolute; width: 171.43%; height: 171.43%; left: -28.81%; top: -9.52%; max-width: none; }
/* whole (.full, the onboarding's result): no circle, he stands on a soft shadow, his feet at 88% of the frame */
.van-clip.full { aspect-ratio: 1 / 0.9; overflow: visible; border-radius: 0 !important; background: none !important; }
.van-clip.full > * { width: 100%; height: 111.11%; left: 0; top: 0; }
.van-clip.full::before { content: ""; position: absolute; left: 27%; right: 29%; bottom: -1.5%; height: 7%; border-radius: 50%; background: rgba(0, 0, 0, 0.14); }
/* A reaction fades in over the idle and out over it, while the idle stays whole beneath: two half-faded layers would
   let the circle show through him. The idle hides only once the reaction covers him, and is back before it fades. */
.van-clip > video { opacity: 0; transition: opacity .15s; }
.van-clip.reacting > video { opacity: 1; }
.van-clip.reacting .vc-idle { opacity: 0; transition: opacity 0s .15s; }
.vc-idle:not([data-ready]) > :not(.vc-poster), .vc-idle[data-ready] > .vc-poster { visibility: hidden; }
/* he breathes, and a reaction with him: both start with the same markup, so they stay in step and cross-fade
   without a ghost */
.van-clip > .vc-idle, .van-clip > video { transform-origin: 50% 88%; animation: wang-breathe 3s ease-in-out infinite; }  /* 88%: his feet */
@keyframes wang-breathe { 50% { transform: scale(1.008, 1.016); } }
.vc-idle > * { position: absolute; }
.vc-idle > img { inset: 0; width: 100%; height: 100%; }
.vc-idle > i { overflow: hidden; }
.vc-idle > i > img { display: block; width: 100%; max-width: none; }
.vc-ears { left: 16.389%; top: 9.167%; width: 59.167%; height: 23.056%; }
.vc-ears > img { height: 3900%; }
.vc-blink { left: 25.278%; top: 23.333%; width: 40.833%; height: 18.889%; }
.vc-blink > img { height: 1200%; }
/* his mouth as he talks (van.js talk()): a shape's frame of mouth.webp over the still, the still's smile at rest */
.vc-mouth { left: 36.944%; top: 36.667%; width: 16.667%; height: 15%; visibility: hidden; }
.vc-mouth > img { height: 800%; transform: translateY(calc(var(--m, 0) * -12.5%)); }
.vc-idle[data-ready][data-talk] > .vc-mouth { visibility: visible; }
.vc-idle[data-beat="ears"] .vc-ears > img { animation: wang-ears 1.625s steps(39, jump-none); }  /* 24 frames a second */
.vc-idle[data-beat="blink"] .vc-blink > img { animation: wang-blink 0.5s steps(12, jump-none); }
@keyframes wang-ears { to { transform: translateY(-97.436%); } }   /* to the last frame: 38 of 39 strip heights */
@keyframes wang-blink { to { transform: translateY(-91.667%); } }  /* 11 of 12 */

/* Ван as layers that can look anywhere (js/langwheel.js vanRig, content/van_gaze.py): his rest frame with the irises taken
   out, the irises over it behind a mask of the eye openings, his set's blink strip and mouth shapes; his head turns on
   his neck (.vr-in), he breathes (.vr-body) */
.vr { position: absolute; display: block; pointer-events: none; }
.vr-in, .vr-body { position: absolute; inset: 0; }
.vr-in { transform-origin: 50% 58%; will-change: transform; }
.vr-body { transform-origin: 50% 88%; animation: wang-breathe 3s ease-in-out infinite; }
.vr-body > * { position: absolute; display: block; }
.vr-body img { display: block; width: 100%; max-width: none; }
.vr-base { inset: 0; height: 100%; }
.vr-eyes { left: 22.222%; top: 19.444%; width: 47.222%; height: 26.389%;  /* the iris box: 80,70 to 250,165 */
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.vr-eyes img { height: 100%; }
.vr-blink { left: 25.278%; top: 23.333%; width: 40.833%; height: 18.889%; overflow: hidden; visibility: hidden; }
.vr-blink img { height: 1200%; }
.vr.blink .vr-blink { visibility: visible; }
.vr.blink .vr-blink img { animation: wang-blink 0.5s steps(12, jump-none); }
.vr-mouth { left: 36.944%; top: 36.667%; width: 16.667%; height: 15%; overflow: hidden; visibility: hidden; }
.vr-mouth img { height: 800%; transform: translateY(calc(var(--m, 0) * -12.5%)); }
.vr[data-m] .vr-mouth { visibility: visible; }
.vr.still .vr-body { animation: none; }  /* Профиль: his motion off */
@media (prefers-reduced-motion: reduce) {
  .vr-body, .vr.blink .vr-blink img { animation: none; }
}
