/* The stage, shared by the shop and the street outside. stage.js adds a patch per character that
   moves while they talk, one speech bubble and reaction marks. A patch is a soft-edged copy of
   the painting named by --art, so set --art on whatever holds the painting. */
.actor-cel {
  position: absolute; inset: 0; pointer-events: none; visibility: hidden;
  background: var(--art) 0 0 / 100% 100% no-repeat;
  -webkit-mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), #000 72%, transparent 100%);
  mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), #000 72%, transparent 100%);
  transform-origin: var(--cx) var(--foot);
}
.actor-cel.talking { visibility: visible; will-change: transform; animation: talk-nod .6s steps(1) infinite; }
.actor-cel.talking[data-move="rattle"] { animation-name: talk-rattle; animation-duration: .45s; }
.actor-cel.talking[data-move="thump"] { animation-name: talk-thump; animation-duration: .34s; }
.actor-cel.talking[data-move="rock"] { animation-name: talk-rock; animation-duration: .72s; }
/* Props that never stop: put class "always" on a patch in the markup. */
.actor-cel.always { visibility: visible; }
.actor-cel.always[data-move="bobble"] { animation: prop-bobble 1.7s steps(1) infinite; }
.actor-cel.always[data-move="sway"] { animation: prop-sway 5.5s ease-in-out infinite; }
.actor-cel.always[data-move="flap"] { animation: prop-sway 3.6s ease-in-out infinite; --swing: 2deg; }
@keyframes prop-bobble { 0% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }
@keyframes prop-sway { 0%, 100% { transform: rotate(calc(var(--swing, 1.2deg) * -1)); } 50% { transform: rotate(var(--swing, 1.2deg)); } }
.fortune-window.talking img { animation: talk-sway .5s steps(1) infinite; }
/* Bomi keeps time while her tape deck drawer is open. */
.deck-on .actor-cel[data-actor="Bomi"]:not(.talking) { visibility: visible; animation: talk-thump .52s steps(1) infinite; }
/* Held poses, a few a second, so the motion reads as drawn frames. */
@keyframes talk-nod { 0% { transform: scale(1.008,1.035) rotate(-1deg); } 33% { transform: rotate(.8deg); } 66% { transform: scale(1,1.02); } }
@keyframes talk-rattle { 0% { transform: translate(0,-.45%) scale(1,1.02); } 33% { transform: rotate(-.5deg); } 66% { transform: translate(.12%,-.15%); } }
@keyframes talk-thump { 0% { transform: scale(1.045); } 50% { transform: none; } }
@keyframes talk-rock { 0% { transform: rotate(-.7deg); } 33% { transform: rotate(.6deg) scale(1,1.012); } 66% { transform: none; } }
@keyframes talk-sway { 0% { transform: translateY(-1.2%) scale(1.03); } 50% { transform: none; } }

.bubble {
  position: absolute; z-index: 3; left: 0; top: 0; width: max-content; max-width: min(40cqw, 330px);
  padding: .5em .8em .58em; pointer-events: none;
  background: var(--shop-paper); color: var(--shop-ink); border: 2.5px solid var(--shop-ink); border-radius: 14px;
  filter: drop-shadow(3px 4px 0 var(--shop-ink));
  font: 700 clamp(11px, 1.7cqw, 19px)/1.22 Arial, sans-serif; letter-spacing: -.015em;
  transform: rotate(var(--tilt, 0deg)); transform-origin: var(--tail, 50%) calc(100% + 12px);
}
.bubble::after {
  content: ''; position: absolute; left: var(--tail, 50%); bottom: -9px; width: 14px; height: 14px;
  background: inherit; border: solid var(--shop-ink); border-width: 0 2.5px 2.5px 0;
  transform: translateX(-50%) skewX(12deg) rotate(45deg);
}
.bubble b { display: block; margin-bottom: .15em; font: 800 .62em/1.3 'Courier New', monospace; letter-spacing: .13em; text-transform: uppercase; }
.bubble[data-speaker="Nani"] b { color: #29561f; }
.bubble[data-speaker="Reggie"] b { color: #9d253b; }
.bubble[data-speaker="Bomi"] b { color: #604783; }
.bubble[data-speaker="Dubu"] b { color: #235751; }
.bubble[data-speaker="Madam Petty"] b { color: #733755; }
.bubble[data-speaker="Valet"] b { color: #744021; }
/* A voice from another room. */
.bubble.aside, .bubble.aside::after { border-style: dashed; }
.bubble.pop { animation: bubble-pop .24s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes bubble-pop { 0% { opacity: 0; transform: scale(.35) rotate(-4deg); } 100% { opacity: 1; transform: rotate(var(--tilt, 0deg)); } }
@container (max-width: 620px) { .bubble { max-width: 62cqw; border-width: 2px; border-radius: 10px; } }

.stage-mark {
  position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
  color: var(--shop-ink); font: italic 900 clamp(14px, 2.6cqw, 31px)/1 'Arial Black', Impact, sans-serif;
  text-shadow: 2px 0 var(--shop-paper), -2px 0 var(--shop-paper), 0 2px var(--shop-paper), 0 -2px var(--shop-paper), 2px 2px var(--shop-paper), -2px -2px var(--shop-paper), 2px -2px var(--shop-paper), -2px 2px var(--shop-paper);
  animation: mark-pop 1.3s ease-out both;
}
@keyframes mark-pop {
  0% { opacity: 0; transform: translate(-50%,-60%) scale(.3) rotate(-14deg); }
  16% { opacity: 1; transform: translate(-50%,-112%) scale(1.18) rotate(7deg); }
  28% { transform: translate(-50%,-100%) scale(1) rotate(-3deg); }
  74% { opacity: 1; transform: translate(-50%,-100%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%,-135%) scale(1) rotate(-3deg); }
}

.tube-flicker {
  position: absolute; left: 33.5%; top: 11.5%; width: 32%; height: 2.6%; pointer-events: none;
  background: #2b2416; border-radius: 3px; mix-blend-mode: multiply; opacity: 0;
  animation: tube-flicker 13s steps(1) infinite;
}
@keyframes tube-flicker { 0%, 100% { opacity: 0; } 61% { opacity: .3; } 61.6% { opacity: 0; } 62.3% { opacity: .42; } 63% { opacity: 0; } 91% { opacity: .25; } 91.5% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .actor-cel, .stage-mark, .tube-flicker { display: none; }
  .bubble.pop { animation: none; }
}
