/* Trichy Event Quest: the "life" layer (see life.js). 1em = 1% of the painting's width. */
.life { position: absolute; pointer-events: none; overflow: hidden; contain: layout paint; }
.life i { position: absolute; display: block; font-style: normal; }
.life .lf-at { width: 0; height: 0; }

/* wiper: arm plus blade, pivots on its left end */
.lf-wiper { left: 0; top: -.2em; height: .4em; transform-origin: 0 50%; transform: rotate(var(--a0)); animation: lf-wipe .9s ease-in-out infinite alternate; }
.lf-wiper::before, .lf-wiper::after { content: ''; position: absolute; border-radius: 1em; }
.lf-wiper::before { left: 0; right: 10%; top: 32%; height: 36%; background: #26262b; }
.lf-wiper::after { left: 24%; right: 0; top: 0; height: 100%; background: linear-gradient(#3b3b42, #111115); box-shadow: 0 .06em .12em rgba(0, 0, 0, .35); }
.lf-cap { border-radius: 50%; background: radial-gradient(circle at 40% 35%, #55555c, #18181c 70%); }
@keyframes lf-wipe { from { transform: rotate(var(--a0)); } to { transform: rotate(var(--a1)); } }

/* smoke and steam: soft puffs that grow, drift and fade */
.lf-puff { border-radius: 50%; opacity: 0; --c: rgba(214, 208, 202, .78);
  background: radial-gradient(circle, var(--c) 0, var(--c) 22%, transparent 68%); animation: lf-puff 2.6s ease-out infinite; }
@keyframes lf-puff { 0% { transform: translate(0, 0) scale(.25); opacity: 0; } 12% { opacity: .9; }
  100% { transform: translate(var(--dx), var(--dy)) scale(2); opacity: 0; } }

/* lights */
.lf-glow, .lf-streak { --c: rgba(255, 236, 170, .85); mix-blend-mode: screen; }
.lf-glow { border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .95) 0, var(--c) 16%, transparent 66%); }
.lf-streak { border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .9), var(--c) 30%, transparent); }
.lf-pulse { animation: lf-pulse 2.6s ease-in-out infinite alternate; }
.lf-flicker { animation: lf-flicker 3.4s linear infinite; }
.lf-flash { opacity: 0; animation: lf-flash 3.6s linear infinite; }
.lf-blink { animation: lf-blink 1.1s steps(1) infinite; }
@keyframes lf-pulse { from { opacity: .35; transform: scale(.85); } to { opacity: .95; transform: scale(1.08); } }
@keyframes lf-flicker { 0%, 100% { opacity: .75; } 8% { opacity: .55; } 12% { opacity: .9; } 30% { opacity: .7; } 33% { opacity: .95; } 52% { opacity: .62; }
  55% { opacity: .88; } 71% { opacity: .78; } 74% { opacity: .5; } 77% { opacity: .92; } }
@keyframes lf-flash { 0%, 52% { opacity: 0; transform: scale(.7); } 55% { opacity: 1; transform: scale(1.15); } 61% { opacity: .08; transform: scale(.85); }
  66% { opacity: 1; transform: scale(1.15); } 74%, 100% { opacity: 0; transform: scale(.7); } }
@keyframes lf-blink { 0% { opacity: 1; } 50% { opacity: .1; } }

/* string lights, stars, fireflies, water glints */
.lf-tw { --c: rgba(255, 214, 120, .9); border-radius: 50%; background: radial-gradient(circle, #fffbe8 0, var(--c) 30%, transparent 70%); animation: lf-tw 2s ease-in-out infinite; }
@keyframes lf-tw { 0%, 100% { opacity: .15; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
.lf-glint { --c: rgba(255, 238, 200, .9); border-radius: 50%; background: radial-gradient(closest-side, #fff, var(--c) 40%, transparent); opacity: 0; animation: lf-glint 2.4s ease-in-out infinite; }
@keyframes lf-glint { 0%, 100% { opacity: 0; transform: scaleX(.2); } 50% { opacity: .9; transform: scaleX(1); } }

/* birds: two curved wings that flap while the bird crosses the sky */
.lf-bird { --c: rgba(40, 28, 46, .78); left: -8%; animation: lf-fly 22s linear infinite; }
.lf-wings { inset: 0; animation: lf-flap .5s ease-in-out infinite alternate; }
.lf-wings::before, .lf-wings::after { content: ''; position: absolute; top: 0; width: 52%; height: 100%; border-top: .3em solid var(--c); border-radius: 50% 50% 0 0; }
.lf-wings::before { left: 0; transform-origin: 100% 0; } .lf-wings::after { right: 0; transform-origin: 0 0; }
@keyframes lf-flap { from { transform: scaleY(1); } to { transform: scaleY(-.55) translateY(-.2em); } }
@keyframes lf-fly { 0% { transform: translate(0, 0); } 50% { transform: translate(60em, var(--vy)); } 100% { transform: translate(122em, 0); } }

/* patches: a feathered copy of part of the painting, moved a hair (people shifting, banners, garlands) */
.lf-patch { background-repeat: no-repeat; background-size: 100em auto;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); }
.lf-breathe { --amt: .014; animation: lf-breathe 3.4s ease-in-out infinite alternate; }
.lf-sway { --amt: 1.2deg; animation: lf-sway 3.2s ease-in-out infinite alternate; }
.lf-flutter { --amt: 2.5deg; animation: lf-flutter 1.9s ease-in-out infinite alternate; }
.lf-shake { --amt: .14em; animation: lf-shake .16s linear infinite alternate; }
@keyframes lf-breathe { from { transform: scale(1, 1); } to { transform: scale(calc(1 + var(--amt) * .3), calc(1 + var(--amt))); } }
@keyframes lf-sway { from { transform: rotate(calc(var(--amt) * -1)); } to { transform: rotate(var(--amt)); } }
@keyframes lf-flutter { from { transform: skewY(calc(var(--amt) * -1)) scaleX(1); } to { transform: skewY(var(--amt)) scaleX(.97); } }
@keyframes lf-shake { from { transform: translateY(0); } to { transform: translateY(var(--amt)); } }

/* a light sweep across a shiny thing (the ticket on the laptop) */
.lf-shine { overflow: hidden; }
.lf-band { top: -30%; left: 0; width: 38%; height: 160%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent);
  transform: translateX(-160%) skewX(-18deg); animation: lf-shine 3.6s ease-in-out infinite; }
@keyframes lf-shine { 0% { transform: translateX(-160%) skewX(-18deg); } 40%, 100% { transform: translateX(330%) skewX(-18deg); } }

/* typing dots in a chat bubble */
.lf-cover { border-radius: 50%; background: radial-gradient(closest-side, var(--bg) 78%, transparent); }
.lf-type { --c: #fffdf8; border-radius: 50%; background: radial-gradient(circle at 45% 40%, #fff, var(--c) 60%, rgba(0, 0, 0, .06) 100%); animation: lf-type 1.3s ease-in-out infinite; }
@keyframes lf-type { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(var(--up)); } }

/* scanner beam */
.lf-scanbox { overflow: hidden; }
.lf-beam { --c: rgba(255, 60, 40, .9); left: 0; right: 0; top: 0; height: .25em; background: var(--c); box-shadow: 0 0 .6em .2em var(--c); animation: lf-beam 1.6s ease-in-out infinite alternate; }
@keyframes lf-beam { from { transform: translateY(0); } to { transform: translateY(var(--h)); } }


/* ---- characters: sprites cut from the painting (tools/rig.py), small readable gestures ---- */
.lf-spr { background-repeat: no-repeat; }
.lf-a-shake { --amt: 8deg; animation: lf-a-shake 4s ease-in-out infinite; }
.lf-a-nod { --amt: 4deg; animation: lf-a-nod 3.2s ease-in-out infinite; }
.lf-a-look { --amt: 6deg; animation: lf-a-look 5s ease-in-out infinite; }
.lf-a-crane { --amt: 5deg; animation: lf-a-crane 4s ease-in-out infinite; }
.lf-a-tilt { --amt: 7deg; animation: lf-a-tilt 1.6s ease-in-out infinite alternate; }
.lf-a-down { --amt: 0deg; animation: lf-a-down 5s ease-in-out infinite; }
.lf-a-lean { --amt: 3deg; animation: lf-a-lean 4s ease-in-out infinite; }
.lf-a-sway { --amt: 1.5deg; animation: lf-a-sway 1.4s ease-in-out infinite alternate; }
.lf-a-hop { --amt: .5em; animation: lf-a-hop 3s ease-out infinite; }
.lf-a-tap { --amt: 12deg; animation: lf-a-tap 2.4s linear infinite; }
.lf-a-walk { --amt: .3em; animation: lf-a-walk .32s ease-in-out infinite alternate; }
.lf-a-swing { --amt: 8deg; animation: lf-a-swing .64s ease-in-out infinite alternate; }
.lf-a-scratch { --amt: 6deg; animation: lf-a-scratch 2.2s linear infinite; }
.lf-a-laugh { --amt: .25em; animation: lf-a-laugh 2.6s linear infinite; }
.lf-a-pat { --amt: -60deg; animation: lf-a-pat 4s ease-in-out infinite; }
.lf-a-five { --amt: -40deg; animation: lf-a-five 4s ease-in-out infinite; }
.lf-a-give { --amt: -12deg; animation: lf-a-give 5s ease-in-out infinite; }
.lf-a-take { --amt: 8deg; --amt2: -8deg; animation: lf-a-take 5s ease-in-out infinite; }
.lf-a-pass { --sx: 0em; --sy: 0em; --ex: 0em; --ey: 0em; animation: lf-a-pass 5s ease-in-out infinite; }
.lf-a-tearL { animation: lf-a-tearL 4.5s ease-in-out infinite; }
.lf-a-tearR { animation: lf-a-tearR 4.5s ease-in-out infinite; }
@keyframes lf-a-shake { 0%, 30%, 100% { transform: rotate(0); } 4%, 14% { transform: rotate(calc(var(--amt) * -1)); } 9%, 19% { transform: rotate(var(--amt)); } 24% { transform: rotate(0); } }
@keyframes lf-a-nod { 0%, 40%, 100% { transform: none; } 8%, 24% { transform: translateY(.18em) rotate(var(--amt)); } 16%, 32% { transform: none; } }
@keyframes lf-a-look { 0%, 12%, 82%, 100% { transform: none; } 22%, 40% { transform: translateX(-.25em) rotate(calc(var(--amt) * -1)); } 52%, 70% { transform: translateX(.25em) rotate(var(--amt)); } }
@keyframes lf-a-crane { 0%, 25%, 75%, 100% { transform: none; } 35%, 65% { transform: translateY(-.35em) rotate(var(--amt)); } }
@keyframes lf-a-tilt { from { transform: none; } to { transform: rotate(var(--amt)); } }
@keyframes lf-a-down { 0%, 15%, 85%, 100% { transform: none; } 25%, 75% { transform: translateY(.22em) rotate(var(--amt)); } }
@keyframes lf-a-lean { 0%, 20%, 75%, 100% { transform: none; } 32%, 62% { transform: rotate(var(--amt)); } }
@keyframes lf-a-sway { from { transform: rotate(calc(var(--amt) * -1)); } to { transform: rotate(var(--amt)); } }
@keyframes lf-a-hop { 0%, 60%, 72%, 84%, 100% { transform: none; } 66% { transform: translateY(calc(var(--amt) * -1)); } 78% { transform: translateY(calc(var(--amt) * -.6)); } }
@keyframes lf-a-tap { 0%, 50%, 62%, 74%, 86%, 100% { transform: none; } 56%, 68%, 80% { transform: rotate(calc(var(--amt) * -1)); } }
@keyframes lf-a-walk { from { transform: none; } to { transform: translateY(calc(var(--amt) * -1)); } }
@keyframes lf-a-swing { from { transform: rotate(calc(var(--amt) * -1)); } to { transform: rotate(var(--amt)); } }
@keyframes lf-a-scratch { 0%, 30%, 100% { transform: none; } 5%, 15%, 25% { transform: rotate(var(--amt)); } 10%, 20% { transform: rotate(calc(var(--amt) * -.5)); } }
@keyframes lf-a-laugh { 0%, 45%, 100% { transform: none; } 5%, 15%, 25%, 35% { transform: translateY(calc(var(--amt) * -1)); } 10%, 20%, 30%, 40% { transform: none; } }
@keyframes lf-a-pat { 0%, 30%, 76%, 100% { transform: none; } 42%, 54%, 66% { transform: rotate(var(--amt)); } 48%, 60% { transform: rotate(calc(var(--amt) + 9deg)); } }
@keyframes lf-a-five { 0%, 30%, 66%, 100% { transform: none; } 42%, 52% { transform: rotate(var(--amt)); } 47% { transform: rotate(calc(var(--amt) * 1.1)); } }
@keyframes lf-a-give { 0%, 8%, 55%, 100% { transform: none; } 22%, 40% { transform: rotate(var(--amt)); } }
@keyframes lf-a-take { 0%, 28%, 85%, 100% { transform: none; } 40% { transform: rotate(var(--amt)); } 56%, 70% { transform: rotate(var(--amt2)); } }
@keyframes lf-a-pass { 0% { opacity: 0; transform: translate(var(--sx), var(--sy)); } 8%, 22% { opacity: 1; transform: translate(var(--sx), var(--sy)); }
  40% { opacity: 1; transform: none; } 56%, 84% { opacity: 1; transform: translate(var(--ex), var(--ey)); } 92%, 100% { opacity: 0; transform: translate(var(--ex), var(--ey)); } }
@keyframes lf-a-tearL { 0%, 38%, 90%, 100% { transform: none; } 48%, 78% { transform: translate(-.5em, .15em) rotate(-8deg); } }
@keyframes lf-a-tearR { 0%, 38%, 90%, 100% { transform: none; } 48%, 78% { transform: translate(.5em, -.05em) rotate(7deg); } }


.lf-a-flip { animation: lf-a-flip 4.5s ease-in-out infinite; }
.lf-a-ring { --amt: 14deg; animation: lf-a-ring 2.6s ease-in-out infinite; }
@keyframes lf-a-flip { 0%, 55%, 100% { transform: none; opacity: 1; } 68% { transform: perspective(40em) rotateX(-84deg); opacity: 1; }
  70% { transform: perspective(40em) rotateX(-90deg); opacity: 0; } 88% { transform: none; opacity: 0; } 96% { opacity: 1; } }
@keyframes lf-a-ring { 0%, 45%, 100% { transform: none; } 6%, 18%, 30% { transform: rotate(var(--amt)); } 12%, 24%, 36% { transform: rotate(calc(var(--amt) * -1)); } }

.lf-a-drop { --dx: 0em; --dy: -20em; animation: lf-a-drop 2.6s ease-in infinite; }
@keyframes lf-a-drop { 0% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(-30deg); } 8% { opacity: 1; }
  40% { opacity: 1; transform: none; } 46% { transform: scale(1.15, .8); } 52% { transform: none; } 80%, 100% { opacity: 1; transform: none; } }

/* reaction bubbles */
.lf-emo { left: 0; top: 0; white-space: nowrap; padding: .12em .5em .16em; border-radius: 1em; background: #fff; color: #1B1430;
  font: 800 1em/1.15 'Baloo 2', 'Baloo Thambi 2', system-ui, sans-serif; box-shadow: 0 .12em .35em rgba(0, 0, 0, .3);
  transform-origin: 50% 100%; opacity: 0; animation: lf-emo 5s ease infinite; }
.lf-emo::after { content: ''; position: absolute; left: 50%; bottom: -.22em; width: .45em; height: .45em; margin-left: -.22em; background: inherit; transform: rotate(45deg); }
.lf-emo-angry { background: #D9412F; color: #fff; } .lf-emo-laugh { background: #F2B233; } .lf-emo-yay { background: #2DBE60; color: #fff; }
.lf-emo-chat { letter-spacing: .08em; }
@keyframes lf-emo { 0% { opacity: 0; transform: translate(-50%, -100%) scale(.3); } 6% { opacity: 1; transform: translate(-50%, -100%) scale(1.12); }
  10%, 42% { opacity: 1; transform: translate(-50%, -100%) scale(1); } 50%, 100% { opacity: 0; transform: translate(-50%, -110%) scale(.7); } }

/* ticket perforation, clap spark, ground shadow */
.lf-perf { width: 0; border-left: .2em dashed rgba(120, 66, 10, .75); opacity: 0; animation: lf-perf 4.5s linear infinite; }
@keyframes lf-perf { 0%, 12% { opacity: 0; } 22%, 40% { opacity: 1; } 46%, 100% { opacity: 0; } }
.lf-ray { left: -.12em; top: -1.6em; width: .24em; height: .9em; border-radius: .2em; background: #FFE27A; box-shadow: 0 0 .3em #FFC93D;
  transform-origin: 50% 1.6em; opacity: 0; animation: lf-ray 4s ease-out infinite; }
@keyframes lf-ray { 0%, 42% { opacity: 0; transform: rotate(var(--r)) translateY(.6em) scaleY(.4); } 46% { opacity: 1; transform: rotate(var(--r)) translateY(0) scaleY(1); }
  58%, 100% { opacity: 0; transform: rotate(var(--r)) translateY(-.9em) scaleY(.6); } }
.lf-shadow { border-radius: 50%; background: radial-gradient(closest-side, rgba(60, 30, 15, .42), rgba(60, 30, 15, .18) 60%, transparent); }

/* a phone screen that chats */
.lf-chat { position: absolute; overflow: hidden; background: #EFE7DA; box-shadow: inset 0 0 0 .08em rgba(0, 0, 0, .08); font: 600 1em/1.2 Inter, system-ui, sans-serif; color: #1B1430; }
.lf-chat-h { position: absolute; left: 0; right: 0; top: 0; height: 2.6em; display: flex; align-items: center; gap: .45em; padding: 0 .6em; background: #1F8A5B; color: #fff; font-size: 1em; font-weight: 700; }
.lf-chat-h b { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: #fff; color: #1F8A5B; font: 800 1em/1 'Baloo 2', sans-serif; }
.lf-chat-b { position: absolute; left: 0; right: 0; top: 2.6em; bottom: 0; overflow: hidden; }
.lf-chat-l { padding: .6em .5em; display: flex; flex-direction: column; gap: .45em; transition: transform .45s ease, opacity .4s; }
.lf-chat-l.out { opacity: 0; }
.lf-msg { max-width: 82%; padding: .4em .6em; border-radius: .8em; font-size: 1.05em; box-shadow: 0 .06em .12em rgba(0, 0, 0, .12); animation: lf-pop .35s cubic-bezier(.34, 1.56, .64, 1) both; }
.lf-msg.in { align-self: flex-start; background: #fff; border-bottom-left-radius: .2em; }
.lf-msg.out { align-self: flex-end; background: #D2F5C4; border-bottom-right-radius: .2em; }
.lf-msg .lf-tdot { position: static; display: inline-block; width: .45em; height: .45em; margin: .1em .12em; border-radius: 50%; background: #8E8A99; animation: lf-type 1s ease-in-out infinite; --up: -.3em; }
.lf-msg .lf-tdot:nth-child(2) { animation-delay: .15s; } .lf-msg .lf-tdot:nth-child(3) { animation-delay: .3s; }
@keyframes lf-pop { from { opacity: 0; transform: translateY(.6em) scale(.9); } to { opacity: 1; transform: none; } }

/* reduced motion: everything holds still in its rest pose; things that only exist in motion are hidden */
@media (prefers-reduced-motion: reduce) {
  .life i, .life i::before, .life i::after { animation: none !important; }
  .lf-puff, .lf-bird, .lf-glint, .lf-flash, .lf-streak, .lf-beam, .lf-band, .lf-patch, .lf-emo, .lf-perf, .lf-ray { display: none !important; }
  .lf-msg, .lf-chat-l { animation: none !important; transition: none !important; }
  .lf-glow { opacity: .6; } .lf-type { opacity: 1; }
}
