/* Konto website round 2: the cast kit (owned by agent A).
   People come from tools/rig.js as inline SVG with named parts. This file moves those parts.
   Put pose, mood, motion and prop classes on the svg or on any ancestor:
     poses   p-stand p-phone p-tap p-give p-wave p-carry p-sit p-desk p-ride p-hips p-point p-think p-cheer p-sitphone p-sittap p-drive
     moods   x-neutral (default) x-smile x-worried x-surprised x-proud, plus talk / laugh
     motion  walking riding driving waving typing nod shake look-r look-l look-down glow hop
     car     h-cargo (the parcel on the back seat)
     props   h-phone h-screen h-parcel h-cash h-box h-bag   (p-phone shows the phone, p-tap the screen,
             p-carry the box by themselves)
   Joints ease between poses (0.7 s); faces cross-fade between moods (0.22 s). */

.kc.kc-crop { overflow: hidden; }
.kc { display: block; overflow: visible; --kc-ease: cubic-bezier(.34, 1.3, .5, 1); --kc-soft: cubic-bezier(.45, 0, .2, 1); }
.kc .kc-all, .kc .kc-up, .kc .kc-head, .kc .face, .kc .arm, .kc .fore, .kc .hand, .kc .leg, .kc .shin,
.kc .brow, .kc .eye-open, .kc .m-talk, .kc .spokes, .kc .kc-legs { transform-box: view-box; }

/* ---------- joints ---------- */
.kc { --sh-r: -7deg; --el-r: 5deg; --sh-l: 7deg; --el-l: -5deg; }
.kc .arm-r { transform: rotate(var(--sh-r)); }
.kc .fore-r { transform: rotate(var(--el-r)); }
.kc .arm-l { transform: rotate(var(--sh-l)); }
.kc .fore-l { transform: rotate(var(--el-l)); }
/* hands counter-rotate so whatever they hold stays upright */
.kc .hand-r { transform: rotate(calc(-1 * (var(--sh-r) + var(--el-r)))); }
.kc .hand-l { transform: rotate(calc(-1 * (var(--sh-l) + var(--el-l)))); }
.kc .arm, .kc .fore, .kc .hand { transition: transform .7s var(--kc-ease); }
.kc .leg, .kc .shin, .kc .kc-all, .kc .kc-head, .kc .face { transition: transform .7s var(--kc-soft); }

/* rig:poses:start */
.kc.p-stand, .p-stand .kc { --sh-r: -7deg; --el-r: 5deg; --sh-l: 7deg; --el-l: -5deg; }
.kc.p-phone, .p-phone .kc { --sh-r: -9.3deg; --el-r: 114.4deg; --sh-l: 9deg; --el-l: -10deg; }
.kc.p-tap, .p-tap .kc { --sh-r: -28.9deg; --el-r: 119.2deg; --sh-l: 40.5deg; --el-l: -139.6deg; }
.kc.p-give, .p-give .kc { --sh-r: -53.8deg; --el-r: -38.7deg; --sh-l: 8deg; --el-l: -6deg; }
.kc.p-wave, .p-wave .kc { --sh-r: -130.3deg; --el-r: -47.1deg; --sh-l: 8deg; --el-l: -6deg; }
.kc.p-carry, .p-carry .kc { --sh-r: -58.2deg; --el-r: 102.8deg; --sh-l: 58.2deg; --el-l: -102.8deg; }
.kc.p-sit, .p-sit .kc { --sh-r: -36.7deg; --el-r: 62.3deg; --sh-l: -8.1deg; --el-l: -40.2deg; }
.kc.p-desk, .p-desk .kc { --sh-r: -33.8deg; --el-r: 94.4deg; --sh-l: 33.8deg; --el-l: -94.4deg; }
.kc.p-ride, .p-ride .kc { --sh-r: -10deg; --el-r: -89deg; --sh-l: -48.5deg; --el-l: -34.7deg; }
.kc.p-hips, .p-hips .kc { --sh-r: -35.8deg; --el-r: 62.7deg; --sh-l: 35.8deg; --el-l: -62.7deg; }
.kc.p-point, .p-point .kc { --sh-r: -92.8deg; --el-r: -18.4deg; --sh-l: 8deg; --el-l: -6deg; }
.kc.p-think, .p-think .kc { --sh-r: 56.9deg; --el-r: 149.7deg; --sh-l: -6deg; --el-l: -91.6deg; }
.kc.p-cheer, .p-cheer .kc { --sh-r: -163.9deg; --el-r: 9.2deg; --sh-l: 163.9deg; --el-l: -9.2deg; }
.kc.p-sitphone, .p-sitphone .kc { --sh-r: -12.5deg; --el-r: 110.9deg; --sh-l: 42.9deg; --el-l: -112.1deg; }
.kc.p-sittap, .p-sittap .kc { --sh-r: -28.9deg; --el-r: 119.2deg; --sh-l: 40.5deg; --el-l: -139.6deg; }
.kc.p-drive, .p-drive .kc { --sh-r: -41.1deg; --el-r: 85.7deg; --sh-l: 6.1deg; --el-l: -71.3deg; }
/* rig:poses:end */

/* sitting: thighs forward, shins down, the whole figure drops onto the seat */
.kc.p-sit .kc-all, .p-sit .kc .kc-all, .kc.p-desk .kc-all, .p-desk .kc .kc-all, .kc.p-sitphone .kc-all, .p-sitphone .kc .kc-all, .kc.p-sittap .kc-all, .p-sittap .kc .kc-all { transform: translateY(58px); }
.kc.p-ride .kc-all, .p-ride .kc .kc-all { transform: translateY(12px); }
.kc.p-ride .kc-up, .p-ride .kc .kc-up { transform: rotate(5deg); }
.kc.p-sit .leg, .p-sit .kc .leg, .kc.p-sitphone .leg, .p-sitphone .kc .leg, .kc.p-sittap .leg, .p-sittap .kc .leg, .kc.p-desk .leg, .p-desk .kc .leg, .kc.p-ride .leg, .p-ride .kc .leg { transform: rotate(-90deg); }
.kc.p-sit .shin, .p-sit .kc .shin, .kc.p-sitphone .shin, .p-sitphone .kc .shin, .kc.p-sittap .shin, .p-sittap .kc .shin, .kc.p-desk .shin, .p-desk .kc .shin, .kc.p-ride .shin, .p-ride .kc .shin { transform: rotate(90deg); }
.kc.p-ride .leg-r, .p-ride .kc .leg-r { transform: rotate(-80deg); }
.kc.p-ride .shin-r, .p-ride .kc .shin-r { transform: rotate(58deg); }
.kc .skirt { transition: opacity .3s; }
.kc .robe-top { opacity: 0; }
.kc.p-sit .skirt, .p-sit .kc .skirt, .kc.p-sitphone .skirt, .p-sitphone .kc .skirt, .kc.p-sittap .skirt, .p-sittap .kc .skirt, .kc.p-desk .skirt, .p-desk .kc .skirt, .kc.p-ride .skirt, .p-ride .kc .skirt { opacity: 0; }
.kc.p-sit .robe-top, .p-sit .kc .robe-top, .kc.p-sitphone .robe-top, .p-sitphone .kc .robe-top, .kc.p-sittap .robe-top, .p-sittap .kc .robe-top, .kc.p-desk .robe-top, .p-desk .kc .robe-top, .kc.p-ride .robe-top, .p-ride .kc .robe-top { opacity: 1; }
.kc.p-sit .kc-shadow, .p-sit .kc .kc-shadow, .kc.p-sitphone .kc-shadow, .p-sitphone .kc .kc-shadow, .kc.p-sittap .kc-shadow, .p-sittap .kc .kc-shadow, .kc.p-desk .kc-shadow, .p-desk .kc .kc-shadow { opacity: 0; }
.kc .kc-bike { opacity: 0; transition: opacity .35s ease, transform .7s var(--kc-soft); }
.kc.p-ride .kc-bike, .p-ride .kc .kc-bike { opacity: 1; }
.kc.p-ride .kc-bike, .p-ride .kc .kc-bike { transform: translateY(-12px); }
.kc.p-ride .kc-shadow, .p-ride .kc .kc-shadow { transform: scaleX(2.6); transform-box: fill-box; transform-origin: 50% 50%; }

/* ---------- the courier's small car (rig opts.car / parkedCar): the driver sits, the body hides his legs ---------- */
.kc.p-drive .kc-all, .p-drive .kc .kc-all { transform: translateY(58px); }
.kc.p-drive .leg, .p-drive .kc .leg { transform: rotate(-90deg); }
.kc.p-drive .shin, .p-drive .kc .shin { transform: rotate(90deg); }
.kc.p-drive .skirt, .p-drive .kc .skirt { opacity: 0; }
.kc.p-drive .robe-top, .p-drive .kc .robe-top { opacity: 1; }
.kc.p-drive .kc-shadow, .p-drive .kc .kc-shadow, .kc-incar .kc-shadow { opacity: 0; }
.kc .spokes { transform-box: view-box; }
.kc-incar .kc-legs { display: none; }
.kc .car-cargo { opacity: 0; transition: opacity .2s ease; }
.kc.h-cargo .car-cargo, .h-cargo .kc .car-cargo { opacity: 1; }
.kc.driving .spokes, .driving .kc .spokes { animation: kc-spin .45s linear infinite; }
.kc.driving .kc-carride, .driving .kc .kc-carride { animation: kc-car-bump .3s ease-in-out infinite alternate; }
.kc.p-drive .kc-legs + .kc-up, .p-drive .kc .kc-legs + .kc-up { animation: none; }
@keyframes kc-car-bump { from { translate: 0 0; } to { translate: 0 -2.5px; } }

/* ---------- props ---------- */
.kc .pr, .kc .fing { opacity: 0; transition: opacity .25s ease; }
.kc.p-phone .pr-phone, .p-phone .kc .pr-phone, .kc.p-sitphone .pr-phone, .p-sitphone .kc .pr-phone, .kc.p-sittap .pr-screen, .p-sittap .kc .pr-screen, .kc.p-sittap .fing-l, .p-sittap .kc .fing-l,
.kc.p-tap .pr-screen, .p-tap .kc .pr-screen,
.kc.p-tap .fing-l, .p-tap .kc .fing-l,
.kc.p-carry .pr-box, .p-carry .kc .pr-box,
.kc.h-phone .pr-phone, .h-phone .kc .pr-phone,
.kc.h-screen .pr-screen, .h-screen .kc .pr-screen,
.kc.h-parcel .pr-parcel, .h-parcel .kc .pr-parcel,
.kc.h-cash .pr-cash, .h-cash .kc .pr-cash,
.kc.h-box .pr-box, .h-box .kc .pr-box,
.kc.h-bag .pr-bag, .h-bag .kc .pr-bag,
.kc.p-point .fing-l, .p-point .kc .fing-l { opacity: 1; }
.kc.h-screen .pr-phone, .h-screen .kc .pr-phone { opacity: 0; }

/* ---------- faces ---------- */
.kc .m, .kc .eye-happy, .kc .eye-wide, .kc .cheeks, .kc .sweat, .kc .face-glow { opacity: 0; transition: opacity .22s ease; }
.kc .m-neutral, .kc .eye-open { opacity: 1; }
.kc .eye-open { transition: opacity .22s ease; animation: kc-blink 4.6s infinite; }
.kc .brow { transition: transform .3s var(--kc-ease); }

.kc.x-smile .m-neutral, .x-smile .kc .m-neutral { opacity: 0; }
.kc.x-smile .m-smile, .x-smile .kc .m-smile,
.kc.x-smile .cheeks, .x-smile .kc .cheeks { opacity: 1; }
.kc.x-smile .brow, .x-smile .kc .brow { transform: translateY(-2px); }

.kc.x-worried .m-neutral, .x-worried .kc .m-neutral { opacity: 0; }
.kc.x-worried .m-worried, .x-worried .kc .m-worried, .kc.x-worried .sweat, .x-worried .kc .sweat { opacity: 1; }
.kc.x-worried .brow-l, .x-worried .kc .brow-l { transform: translateY(-1px) rotate(-16deg); }
.kc.x-worried .brow-r, .x-worried .kc .brow-r { transform: translateY(-1px) rotate(16deg); }

.kc.x-surprised .m-neutral, .x-surprised .kc .m-neutral,
.kc.x-surprised .eye-open, .x-surprised .kc .eye-open { opacity: 0; }
.kc.x-surprised .m-surprised, .x-surprised .kc .m-surprised,
.kc.x-surprised .eye-wide, .x-surprised .kc .eye-wide { opacity: 1; }
.kc.x-surprised .brow, .x-surprised .kc .brow { transform: translateY(-6px); }

.kc.x-proud .m-neutral, .x-proud .kc .m-neutral,
.kc.x-proud .eye-open, .x-proud .kc .eye-open { opacity: 0; }
.kc.x-proud .m-proud, .x-proud .kc .m-proud, .kc.x-proud .eye-happy, .x-proud .kc .eye-happy,
.kc.x-proud .cheeks, .x-proud .kc .cheeks { opacity: 1; }
.kc.x-proud .brow, .x-proud .kc .brow { transform: translateY(-3px); }

/* laugh: happy eyes on any mood; talk: the mouth moves */
.kc.laugh .eye-open, .laugh .kc .eye-open { opacity: 0; }
.kc.laugh .eye-happy, .laugh .kc .eye-happy { opacity: 1; }
.kc.talk .m, .talk .kc .m { opacity: 0; }
.kc.talk .m-talk, .talk .kc .m-talk { opacity: 1; animation: kc-talk .34s ease-in-out infinite alternate; }

/* ---------- head ---------- */
.kc.look-r .face, .look-r .kc .face { transform: translateX(5px); }
.kc.look-l .face, .look-l .kc .face { transform: translateX(-5px); }
.kc.look-r .kc-head, .look-r .kc .kc-head { transform: rotate(4deg); }
.kc.look-l .kc-head, .look-l .kc .kc-head { transform: rotate(-4deg); }
.kc.look-down .face, .look-down .kc .face, .kc.p-phone .face, .p-phone .kc .face, .kc.p-sitphone .face, .p-sitphone .kc .face { transform: translate(-3px, 4px); }
.kc.look-down .kc-head, .look-down .kc .kc-head, .kc.p-phone .kc-head, .p-phone .kc .kc-head, .kc.p-sitphone .kc-head, .p-sitphone .kc .kc-head { transform: rotate(-5deg); }
.kc.nod .kc-head, .nod .kc .kc-head { animation: kc-nod .9s var(--kc-soft) 2; }
.kc.shake .kc-head, .shake .kc .kc-head { animation: kc-shake .7s ease-in-out 2; }
.kc.glow .face-glow, .glow .kc .face-glow { opacity: .42; }
.kc.glow .scr-glow, .glow .kc .scr-glow { opacity: .55; }

/* ---------- life: breathing, blinking ---------- */
.kc .kc-up > .kc-head { animation: kc-head-bob 3.4s ease-in-out infinite alternate; }
.kc .kc-legs + .kc-up { animation: kc-breathe 3.4s ease-in-out infinite alternate; }
.kc.p-ride .kc-legs + .kc-up, .p-ride .kc .kc-legs + .kc-up { animation: none; }

/* ---------- motion ---------- */
.kc.walking .leg-l, .walking .kc .leg-l { animation: kc-step .9s ease-in-out infinite alternate; }
.kc.walking .leg-r, .walking .kc .leg-r { animation: kc-step .9s ease-in-out infinite alternate-reverse; }
.kc.walking .shin-l, .walking .kc .shin-l { animation: kc-knee .9s ease-in-out infinite alternate-reverse; }
.kc.walking .shin-r, .walking .kc .shin-r { animation: kc-knee .9s ease-in-out infinite alternate; }
.kc.walking .kc-all, .walking .kc .kc-all { animation: kc-bob .45s ease-in-out infinite alternate; }
.kc.walking:not(.p-carry):not(.p-phone):not(.p-tap):not(.p-give) .arm-r, .walking:not(.p-carry):not(.p-phone):not(.p-tap):not(.p-give) .kc .arm-r { animation: kc-swing-r .9s ease-in-out infinite alternate; }
.kc.walking:not(.p-carry):not(.p-tap) .arm-l, .walking:not(.p-carry):not(.p-tap) .kc .arm-l { animation: kc-swing-l .9s ease-in-out infinite alternate; }

.kc.riding .spokes, .riding .kc .spokes { animation: kc-spin .5s linear infinite; }
.kc.riding .kc-up, .riding .kc .kc-up { animation: kc-ride-bump .32s ease-in-out infinite alternate; }
.kc.riding .puff, .riding .kc .puff { animation: kc-puff .8s ease-out infinite; transform-box: fill-box; transform-origin: 100% 50%; }
.kc .puff { opacity: 0; }

.kc.waving .fore-r, .waving .kc .fore-r { animation: kc-wave .5s ease-in-out infinite alternate; }
.kc.typing .fore-r, .typing .kc .fore-r { animation: kc-type-r .28s ease-in-out infinite alternate; }
.kc.typing .fore-l, .typing .kc .fore-l { animation: kc-type-l .28s ease-in-out infinite alternate-reverse; }
.kc.hop .kc-all, .hop .kc .kc-all { animation: kc-hop .6s var(--kc-ease) 1; }

@keyframes kc-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }
@keyframes kc-breathe { from { transform: scaleY(1); } to { transform: scaleY(1.014); } }
@keyframes kc-head-bob { from { translate: 0 0; } to { translate: 0 -1.6px; } }
@keyframes kc-talk { from { transform: scaleY(.45); } to { transform: scaleY(1.05); } }
@keyframes kc-nod { 0%, 100% { rotate: 0deg; } 40% { rotate: 7deg; translate: 0 2px; } }
@keyframes kc-shake { 0%, 100% { rotate: 0deg; } 25% { rotate: -6deg; } 75% { rotate: 6deg; } }
@keyframes kc-step { from { transform: rotate(-20deg); } to { transform: rotate(20deg); } }
@keyframes kc-knee { from { transform: rotate(0deg); } to { transform: rotate(26deg); } }
@keyframes kc-bob { from { translate: 0 0; } to { translate: 0 -4px; } }
@keyframes kc-swing-r { from { transform: rotate(-20deg); } to { transform: rotate(14deg); } }
@keyframes kc-swing-l { from { transform: rotate(-14deg); } to { transform: rotate(20deg); } }
@keyframes kc-spin { to { transform: rotate(360deg); } }
@keyframes kc-ride-bump { from { translate: 0 0; } to { translate: 0 -2px; } }
@keyframes kc-puff { 0% { opacity: .8; transform: translateX(0) scale(.6); } 100% { opacity: 0; transform: translateX(-30px) scale(1.5); } }
@keyframes kc-wave { from { rotate: -14deg; } to { rotate: 16deg; } }
@keyframes kc-type-r { from { translate: 0 0; } to { translate: 0 -3px; } }
@keyframes kc-type-l { from { translate: 0 0; } to { translate: 0 -3px; } }
@keyframes kc-hop { 0%, 100% { translate: 0 0; } 35% { translate: 0 -18px; } 60% { translate: 0 2px; } }

@media (prefers-reduced-motion: reduce) {
  .kc *, .kc { animation: none !important; transition-duration: .001s !important; }
}
