/* Ninja, the page pet (pet.js, SITE-47): the roaming Servitor's styles (feature/special-glow accounts.css,
   "the roaming Servitor"), renamed ev-pet, minus the home, treat and swap effects.
   One zero-size layer at the document's origin holds it, so it takes no layout and scrolls with the page.
   The box is the BODY (the round black shape, feet on the card edge); the art and its snow draw outside the box
   (overflow visible), so only the body catches the mouse and the page under the snow stays clickable. */
.ev-pet-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 20; }
.ev-pet {
  position: absolute; left: 0; top: 0; width: 107px; height: 76px; pointer-events: none;
  will-change: transform;
}
.ev-pet[hidden] { display: none; }
.ev-pet-btn {
  pointer-events: auto; position: absolute; inset: 0; width: 107px; height: 76px; padding: 0; margin: 0;
  display: block; background: transparent; border: 0; border-radius: 46% 46% 40% 40%; cursor: grab; touch-action: none;
  overflow: visible; color: inherit; font: inherit;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.ev-pet.is-dragging .ev-pet-btn { cursor: grabbing; }
.ev-pet.is-passthrough .ev-pet-btn { pointer-events: none; }
.ev-pet-btn:focus-visible { outline: 2px solid var(--blurple-hi, #8894f7); outline-offset: 2px; }
.ev-pet-shadow {
  position: absolute; left: 18%; bottom: -4px; width: 64%; height: 9px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent 72%); opacity: 0.75;
}
.ev-pet[data-state="held"] .ev-pet-shadow, .ev-pet[data-state="air"] .ev-pet-shadow,
.ev-pet[data-state="hopping"] .ev-pet-shadow, .ev-pet[data-state="dropping"] .ev-pet-shadow { opacity: 0.25; }
.ev-pet-tilt, .ev-pet-flip, .ev-pet-body { position: absolute; inset: 0; display: block; }
.ev-pet-tilt { transform-origin: 50% 30%; }
.ev-pet-tilt.is-settling { transition: transform 240ms ease-out; }
.ev-pet-body { transform-origin: 50% 90%; }
/* The art's 200 unit square at 0.889 px a unit: the body (x 40 to 160, y 86 to 171) fills the box. */
.ev-pet-art { position: absolute; left: -36px; top: -76px; width: 178px; height: 178px; display: block; pointer-events: none; }
.ev-pet-art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ev-pet-mop { position: absolute; right: -10px; bottom: 0; width: 16px; height: 28px; pointer-events: none; }
.ev-pet-mop svg { width: 100%; height: 100%; }

/* The snow (Chris 2026-11-16: "Can we also change the rain effect to snow?"). The flakes sit where the approved art's
   raindrops were and keep each drop's own --T (fall time), --d (offset) and --ty (fall distance); --sx is each flake's
   sway. --fall-slow stretches the times so snow drifts (rain was 1.3 after "about 30% slower"); the splashes are now soft
   puffs where a flake lands. */
.ev-pet { --fall-slow: 2.4; }
.ev-pet .fx .snow, .ev-pet .fx .settle { transform-box: fill-box; transform-origin: center; }
.ev-pet .fx-snow .snow { animation: ev-pet-snow calc(var(--T, .9s) * var(--fall-slow)) linear calc(var(--d, 0s) * var(--fall-slow)) infinite; }
.ev-pet .fx-snow .settle { animation: ev-pet-settle calc(.9s * var(--fall-slow)) ease-out calc(var(--d, 0s) * var(--fall-slow)) infinite; }
@keyframes ev-pet-snow {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .95; }
  30% { transform: translate(var(--sx, 2px), calc(var(--ty, 0px) * .3)); }
  55% { transform: translate(calc(var(--sx, 2px) * -1), calc(var(--ty, 0px) * .55)); }
  80% { transform: translate(var(--sx, 2px), calc(var(--ty, 0px) * .8)); opacity: .9; }
  100% { transform: translate(0, var(--ty, 0px)); opacity: 0; }
}
@keyframes ev-pet-settle { 0%, 60% { opacity: 0; transform: scale(.4); } 72% { opacity: .55; } 100% { opacity: 0; transform: scale(1.2); } }
/* The yoink face (Chris 2026-11-16: "when you picked them up ... their eyes would get bigger"; first built for
   Spike, feature/site-25-companion den-critter.css): while held, the whites go wide and the pupils shrink, and
   they settle back on release. Both stay inside the mask band (whites 7 to 9.1 units, the band is 13 tall). */
.ev-pet .ev-eye-w, .ev-pet .ev-eye-p { transform-box: fill-box; transform-origin: center; transition: transform 140ms cubic-bezier(.2, 1.6, .4, 1); }
.ev-pet-body.is-yoinked .ev-eye-w { transform: scale(1.3); }
.ev-pet-body.is-yoinked .ev-eye-p { transform: scale(0.75); }

/* No arms (Chris 2026-11-16: "I don't want the ninja to have arms"): the art's two arm groups are gone, and so is their swing. */

/* Floating words: always above the pet. JS stacks them (bottom) and nudges them on screen (--shift); the float is
   the separate `translate` property so it never fights that shift. */
.ev-pet-pop {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 2; pointer-events: none; white-space: nowrap;
  transform: translateX(calc(-50% + var(--shift, 0px)));
  font-family: var(--sans, system-ui, sans-serif); font-size: 13px; font-weight: 700; line-height: 1.25; color: #f5f6ff;
  animation: ev-pet-float 1.1s ease-out forwards;
}
/* Comic words (Chris 2026-10-10: "fun comic book language, like POW, BOOM"): chunky outlined letters, a tilt, a quick
   pop and fade, in Ninja's cool violet; a dark outline and shadow keep them readable on the page. */
.ev-pet-pop.is-impact {
  font-family: "Arial Black", Impact, "Haettenschweiler", var(--sans, sans-serif); font-size: 20px; font-weight: 900; font-style: italic;
  letter-spacing: 0.02em; color: #c4b8ff; -webkit-text-stroke: 1.5px #1a0f08; paint-order: stroke fill;
  text-shadow: 0 2px 0 #1a0f08, 0 0 10px rgba(0, 0, 0, 0.7);
  rotate: var(--tilt, -8deg); animation: ev-pet-impact 0.9s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
@media (max-width: 480px) { .ev-pet-pop.is-impact { font-size: 18px; } }
@keyframes ev-pet-impact { 0% { opacity: 0; scale: 0.3; } 25% { opacity: 1; scale: 1.3; } 45% { scale: 1; } 75% { opacity: 1; translate: 0 -8px; } 100% { opacity: 0; translate: 0 -16px; } }
.ev-pet-pop.is-heart, .ev-pet-pop.is-zzz, .ev-pet-pop.is-puff { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.ev-pet-pop.is-heart { color: #ff6b8a; font-size: 18px; animation-duration: 1.3s; }
.ev-pet-pop.is-zzz { font-family: var(--serif, serif); color: #d6d9f5; font-size: 15px; animation: ev-pet-zzz 1.9s ease-out forwards; }
.ev-pet-pop.is-puff { width: 10px; height: 10px; border-radius: 50%; background: #7cc4f0; animation: ev-pet-puff 0.7s ease-out forwards; }

@media (prefers-reduced-motion: no-preference) {
  .ev-pet-body.is-walking { animation: ev-pet-step 360ms ease-in-out infinite; }
  .ev-pet-body.is-landing { animation: ev-pet-squash 340ms ease-out; }
  .ev-pet-body.is-landing.is-dizzy { animation: ev-pet-squash 340ms ease-out, ev-pet-dizzy 560ms ease-in-out 340ms; }
  .ev-pet-body.is-asleep { animation: ev-pet-breathe 2.6s ease-in-out infinite; }
  .ev-pet-body.is-chasing { animation: ev-pet-chase 800ms ease-in-out 2; }
  .ev-pet-body.is-yoinked { animation: ev-pet-yoink 300ms ease-out; }
  .ev-pet-body.is-air { transform: scale(0.96, 1.06); }
  .ev-pet-body.is-happy { animation: ev-pet-wiggle 700ms ease-in-out; }
  .ev-pet-body.is-sweeping { animation: ev-pet-step 360ms ease-in-out infinite; }
  .ev-pet.is-hop .ev-pet-btn { animation: ev-pet-hop 560ms ease-out; }
}
@keyframes ev-pet-step { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes ev-pet-hop { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-18px); } 65% { transform: translateY(0); } 80% { transform: translateY(-5px); } }
@keyframes ev-pet-squash { 0% { transform: scale(1, 1); } 32% { transform: scale(1.28, 0.72); } 62% { transform: scale(0.92, 1.1); } 100% { transform: scale(1, 1); } }
@keyframes ev-pet-dizzy { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes ev-pet-breathe { 0%, 100% { transform: rotate(8deg) scale(0.92); } 50% { transform: rotate(8deg) scale(0.97); } }
@keyframes ev-pet-chase { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 50% { transform: rotate(15deg); } 75% { transform: rotate(-10deg); } }
@keyframes ev-pet-yoink { 0% { transform: scale(1); } 35% { transform: scale(1.18, 0.82); } 65% { transform: scale(0.92, 1.08); } 100% { transform: scale(1); } }
@keyframes ev-pet-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(10deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(6deg); } }
@keyframes ev-pet-float { 0% { opacity: 0; translate: 0 6px; scale: 0.7; } 16% { opacity: 1; translate: 0 0; scale: 1.08; } 30% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -26px; } }
@keyframes ev-pet-zzz { 0% { opacity: 0; translate: 0 0; scale: 0.7; } 18% { opacity: 0.95; } 100% { opacity: 0; translate: 12px -28px; scale: 1.15; } }
@keyframes ev-pet-puff { 0% { opacity: 0; scale: 0.3; } 28% { opacity: 0.9; scale: 1.15; } 100% { opacity: 0; scale: 2.4; translate: 14px -10px; } }

/* reduced motion: it just stands. No snow, no walking, no floating words. */
@media (prefers-reduced-motion: reduce) {
  .ev-pet .fx-snow { display: none; }
  .ev-pet, .ev-pet-btn, .ev-pet-body, .ev-pet-pop, .ev-pet .ev-eye-w, .ev-pet .ev-eye-p { animation: none !important; transition: none !important; }
}

/* Tossed overboard (SITE-47): a throw that misses every card fades as it sinks past the page bottom, then drops back in from the top. */
.ev-pet.is-overboard { opacity: 0; transition: opacity .16s ease-in; }
