/* ---------- intro style "cartoon": SVG buckets on a sofa (shared bits live in intro.css) ---------- */
.intro-svg { width: 100%; height: 100%; display: block; overflow: hidden; }
/* portrait phones: crop the empty sides so the sofa fills the width */
@media (max-aspect-ratio: 4/5) { .intro-svg { position: absolute; left: 50%; top: 46%; width: 150vw; height: auto; max-width: none; transform: translate(-50%, -50%); } }
.intro svg * { transform-box: fill-box; transform-origin: center; }
/* camera: zoom into the excited bucket, then pull back after the boom */
#cam { transform-box: view-box; transform-origin: 310px 225px; transition: transform 1.2s cubic-bezier(.5, 0, .9, .45); }
.ph-build #cam { transform: translate(90px, 30px) scale(2); }
.ph-boom #cam { transform: translate(90px, 30px) scale(2.35); transition-duration: .18s; }
.ph-after #cam { transform: none; transition: transform .4s cubic-bezier(.2, .8, .3, 1); }

/* TV light: three colours flickering out of step */
.tv rect { opacity: 0; mix-blend-mode: screen; }
.tv-b { animation: tvB 2.3s steps(1) infinite; }
.tv-p { animation: tvP 3.1s steps(1) infinite; }
.tv-w { animation: tvW 1.7s steps(1) infinite; }
@keyframes tvB { 0% { opacity: .32; } 18% { opacity: .18; } 31% { opacity: .4; } 47% { opacity: .1; } 63% { opacity: .34; } 80% { opacity: .22; } }
@keyframes tvP { 0% { opacity: .05; } 22% { opacity: .26; } 40% { opacity: .08; } 58% { opacity: .3; } 77% { opacity: 0; } }
@keyframes tvW { 0% { opacity: 0; } 35% { opacity: .16; } 41% { opacity: 0; } 70% { opacity: .22; } 76% { opacity: .04; } }
.ph-build .tv-b { animation-duration: .7s; }
.ph-build .tv-p { animation-duration: .9s; }
.ph-build .tv-w { animation-duration: .45s; }
.wsh { animation: wsh 2.3s steps(1) infinite; }
@keyframes wsh { 0% { transform: scale(1, 1); opacity: .32; } 31% { transform: scale(1.06, 1.1); opacity: .42; } 47% { transform: scale(.96, .95); opacity: .2; } 63% { transform: scale(1.04, 1.06); opacity: .36; } }
.glint { opacity: .25; animation: glint 1.7s steps(1) infinite; }
@keyframes glint { 0% { opacity: .2; } 35% { opacity: .75; } 41% { opacity: .15; } 70% { opacity: .9; } 76% { opacity: .3; } }

.blink { animation: blink 3.4s infinite; }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.1); } }

/* bucket A: bouncing with excitement, then shaking harder and harder */
.a-shake { --a: 1; animation: jit .55s ease-in-out infinite; }
@keyframes jit {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(calc(var(--a) * 1px), calc(var(--a) * -1.2px)) rotate(calc(var(--a) * .9deg)); }
  50% { transform: translate(0, calc(var(--a) * -.4px)) rotate(0); }
  75% { transform: translate(calc(var(--a) * -1px), calc(var(--a) * -1.2px)) rotate(calc(var(--a) * -.9deg)); }
}
.shake1 .a-shake { --a: 2.5; animation-duration: .14s; }
.shake2 .a-shake { --a: 4.5; animation-duration: .09s; }
.shake3 .a-shake { --a: 7; animation-duration: .06s; }
.a-puff { transition: transform .4s; }
.shake3 .a-puff { transform: scale(1.07, 1.1); }
.a-mouth-o, .a-dizzy, .a-stars { opacity: 0; }
.shake2 .a-mouth, .shake3 .a-mouth { opacity: 0; }
.shake2 .a-mouth-o, .shake3 .a-mouth-o { opacity: 1; }
.shake2 .a-eyes, .shake3 .a-eyes { transform: scale(1.15); }

/* popcorn spilling: a trickle while waiting, a stream once it builds up */
.sp { opacity: 0; }
.ph-loop .sp1, .ph-loop .sp2 { animation: spill 2.8s var(--d) infinite ease-in; }
.ph-build .sp { animation: spill .85s var(--d) infinite ease-in; }
@keyframes spill {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  8% { opacity: 1; }
  35% { transform: translate(calc(var(--dx) * .5), -46px) rotate(170deg); }
  100% { opacity: 1; transform: translate(var(--dx), 246px) rotate(520deg); }
}

/* bucket B: trembling behind a pillow */
.b-tremble { animation: tremble .08s linear infinite; }
@keyframes tremble { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1.4px, -.6px); } 50% { transform: translate(-1.2px, .5px); } 75% { transform: translate(.8px, .8px); } }
.b-pupils { animation: darting 1.1s steps(1) infinite; }
@keyframes darting { 0% { transform: translate(0, 0); } 30% { transform: translate(-3px, 1px); } 55% { transform: translate(3px, 0); } 80% { transform: translate(0, 2px); } }
.b-mouth-eat, .b-happy, .b-reach, .b-hand-k { opacity: 0; }
.b-sweat { animation: sweat 1.6s ease-in infinite; }
@keyframes sweat { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }

/* the boom */
.burst g, .ring, .flash { opacity: 0; }
.ph-boom .burst g { animation: burst .65s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) scale(.3) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(var(--s)) rotate(var(--r)); }
}
.ph-boom .ring { animation: ring .5s ease-out forwards; }
@keyframes ring { 0% { opacity: .9; transform: scale(.2); } 100% { opacity: 0; transform: scale(9); stroke-width: 1; } }
.ph-boom .flash { animation: flash .45s ease-out forwards; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: .95; } 100% { opacity: 0; } }
.ph-boom .a-pile, .ph-after .a-pile { opacity: 0; }

/* aftermath: A is dizzy and empty, B lowers the pillow and snacks on the fallout */
.landed g { opacity: 0; }
.ph-after .landed g { animation: land .35s var(--d) cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes land { 0% { opacity: 0; transform: translateY(-40px) rotate(-90deg); } 100% { opacity: 1; transform: none; } }
.ph-after .landed .lk-grab { animation: land .35s var(--d) cubic-bezier(.3, 1.6, .5, 1) forwards, gone .01s 1.05s forwards; }
@keyframes gone { to { opacity: 0; } }
@keyframes show { to { opacity: 1; } }
.ph-after .a-shake { animation: none; }
.ph-after .a-eyes, .ph-after .a-mouth { opacity: 0; }
.ph-after .a-dizzy { opacity: 1; }
.ph-after .a-dizzy path { animation: spin .9s linear infinite; }
.ph-after .a-mouth-o { opacity: 1; }
.ph-after .a-glasses { transform: translate(-4px, 6px) rotate(-14deg); transition: transform .3s; }
.ph-after .a-stars { opacity: 1; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ph-after .b-tremble { animation: tremble .08s linear 5; }
.ph-after .b-pillow { transform: translate(-6px, 40px) rotate(-8deg); transition: transform .3s .35s cubic-bezier(.3, 1.4, .5, 1); }
.ph-after .b-brows { transform: translateY(5px); transition: transform .3s .4s; }
.ph-after .b-sweat { animation: none; opacity: 0; }
.ph-after .b-hug-r { opacity: 0; transition: opacity .1s .65s; }
.ph-after .b-reach { animation: show .01s .65s forwards, reach 1.2s .65s ease-in-out forwards; }
@keyframes reach { 0% { transform: rotate(100deg); } 30% { transform: rotate(-28deg); } 37% { transform: rotate(-28deg); } 62% { transform: rotate(159deg); } 75% { transform: rotate(159deg); } 100% { transform: rotate(112deg); } }
.ph-after .b-hand-k { animation: show .01s 1.05s forwards, gone .01s 1.4s forwards; }
.ph-after .b-mouth-scared { animation: gone .01s .9s forwards; }
.ph-after .b-mouth-eat { animation: show .01s .9s forwards, munch .6s 1.4s forwards; }
@keyframes munch { 0%, 50%, 100% { transform: scaleY(.35); } 25%, 75% { transform: scaleY(1); } }
.ph-after .b-pupils { animation: none; }
.ph-after .b-eyes { animation: gone .01s 1.9s forwards; }
.ph-after .b-happy { animation: show .01s 1.9s forwards; }

/* short version: just the excited bucket, a quick pop */
.m-short .room-only, .m-short .b-all, .m-short .tv, .m-short .landed, .m-short .wsh { display: none; }
.m-short #cam { transform: translate(90px, 30px) scale(1.15); transition: none; }
.m-short .intro-cap, .m-short .intro-skip { display: none; }

/* reduced motion: a still frame that fades */
.st-cartoon.m-still *, .st-cartoon.m-still { animation: none !important; transition: opacity .3s !important; }
