/* Pip: the Jofect assistant. Requires tokens.css. Markup: pip/pip-inline.svg.
   State classes on the <svg class="pip">: is-found, is-lifted, is-typing, is-hopping, is-loading. Idle blinks on its own.
   Loading: <svg class="pip is-loading" role="status" aria-label="Loading"> replaces spinners (see BRAND.md, section 8). */
.pip { width: 48px; height: 48px; overflow: visible; }
.pip .pip-shape { fill: var(--jf-pip-body); transition: fill var(--jf-dur) var(--jf-ease-out); }
.pip .pip-eye { fill: var(--jf-pip-eye); }
.pip .pip-slot { fill: none; stroke: var(--jf-seat-idle); stroke-width: 2.5; stroke-dasharray: 6 4; stroke-dashoffset: 3; opacity: 0; }
.pip .pip-dots { opacity: 0; }
.pip .pip-dots rect { fill: var(--jf-primary); }
.pip .pip-body { transform-box: view-box; transform-origin: 60px 102px; transition: transform var(--jf-dur-slow) var(--jf-ease-out); }
.pip .pip-eyes { transform-box: view-box; transform-origin: 60px 60px; animation: pip-blink 6s infinite; }
.pip .pip-spin { transform-box: view-box; transform-origin: 60px 66px; }
.pip .pip-shadow { fill: var(--jf-text); opacity: 0; transform-box: view-box; transform-origin: 60px 108px; }

/* loading: Pip hops, does a full spin in the air, lands with a squash. Replaces spinners. 1.4s loop */
.pip.is-loading .pip-body { animation: pip-load-hop 1.4s var(--jf-ease-out) infinite; }
.pip.is-loading .pip-spin { animation: pip-load-spin 1.4s cubic-bezier(0.45, 0, 0.25, 1) infinite; }
.pip.is-loading .pip-eyes { transform: translate(2px, -3px); animation: none; }
.pip.is-loading .pip-shadow { opacity: 0.12; animation: pip-load-shadow 1.4s var(--jf-ease-out) infinite; }

/* found something: amber, lifted out of its slot like the logo's seat */
.pip.is-found .pip-shape { fill: var(--jf-pip-found); }
.pip.is-found .pip-eye { fill: var(--jf-pip-found-eye); }
.pip.is-found .pip-body, .pip.is-lifted .pip-body { transform: translate(7px, -13px); }
.pip.is-found .pip-slot, .pip.is-lifted .pip-slot { opacity: 1; transition: opacity var(--jf-dur) var(--jf-ease-out) 150ms; }

/* typing: eyes look down, three seats fill in turn */
.pip.is-typing .pip-eyes { transform: translate(-2px, 6px); animation: none; }
.pip.is-typing .pip-dots { opacity: 1; }
.pip.is-typing .pip-dots rect { animation: pip-dot 900ms infinite; opacity: 0.2; }
.pip.is-typing .pip-dots rect:nth-child(2) { animation-delay: 300ms; }
.pip.is-typing .pip-dots rect:nth-child(3) { animation-delay: 600ms; }

/* hop: greeting or success */
.pip.is-hopping .pip-body { animation: pip-hop 500ms var(--jf-ease-out); }

@keyframes pip-load-hop {
  0%, 100% { transform: scale(1.12, 0.86); }
  14% { transform: translateY(-8px) scale(0.94, 1.08); }
  42% { transform: translateY(-34px); }
  72% { transform: translateY(-6px) scale(0.97, 1.03); }
  86% { transform: scale(1.08, 0.92); }
  93% { transform: none; }
}
@keyframes pip-load-spin { 0%, 14% { transform: rotate(0deg); } 72%, 100% { transform: rotate(360deg); } }
@keyframes pip-load-shadow { 0%, 100% { transform: scaleX(1.1); opacity: 0.14; } 42% { transform: scaleX(0.55); opacity: 0.05; } }
@keyframes pip-blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.15); } }
@keyframes pip-dot { 0%, 100% { opacity: 0.2; } 33% { opacity: 1; } }
@keyframes pip-hop {
  0% { transform: scale(1.1, 0.88); }
  25% { transform: translateY(-10px) scale(0.94, 1.08); }
  50% { transform: translateY(-18px); }
  80% { transform: scale(1.08, 0.92); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pip .pip-eyes, .pip.is-typing .pip-dots rect, .pip.is-hopping .pip-body { animation: none; }
  .pip .pip-body { transition: none; }
  .pip.is-typing .pip-dots rect { opacity: 1; }
  /* loading without motion: Pip looks up and three seats fade in and out (opacity only) */
  .pip.is-loading .pip-body, .pip.is-loading .pip-spin, .pip.is-loading .pip-shadow { animation: none; }
  .pip.is-loading .pip-dots { opacity: 1; }
  .pip.is-loading .pip-dots rect { animation: pip-dot 1.8s infinite; animation-duration: 1.8s !important; animation-iteration-count: infinite !important; }
  .pip.is-loading .pip-dots rect:nth-child(2) { animation-delay: 600ms; }
  .pip.is-loading .pip-dots rect:nth-child(3) { animation-delay: 1200ms; }
}
