/* Professor Greenleaf animation kit (generated by build_greenleaf.py).
   Put the classes on the element that wraps an INLINE pose SVG (or on the <svg>).
   Every animated group already carries transform-box/transform-origin inline,
   so these keyframes only set `transform`/`opacity`.
   One class per target: #gl-char {breathe | inhale | bounce | shiver},
   #gl-face {nod | tilt | droop}, #gl-lids {blink}, #gl-ember {ember | ember-hot}.
   Blink depth comes from --gl-blink (set per file on #gl-lids in the classic set;
   1 means the eyes are already closed). */

@media (prefers-reduced-motion: no-preference) {
  .gl-breathe #gl-char   { animation: gl-breathe 4s ease-in-out infinite; }
  .gl-inhale #gl-char    { animation: gl-inhale 1.5s ease-in-out infinite; }
  .gl-bounce #gl-char    { animation: gl-bounce .46s ease-in-out infinite; }
  .gl-shiver #gl-char    { animation: gl-shiver .12s linear infinite; }

  .gl-blink #gl-lids     { animation: gl-blink 5.2s linear infinite; }

  .gl-nod #gl-face       { animation: gl-nod 1.4s ease-in-out infinite; }
  .gl-tilt #gl-face      { animation: gl-tilt 3.2s ease-in-out infinite; }
  .gl-droop #gl-face     { animation: gl-droop 3.4s ease-in-out infinite; }

  .gl-ember #gl-ember     { animation: gl-ember 2.4s ease-in-out infinite; }
  .gl-ember-hot #gl-ember { animation: gl-ember-hot .8s ease-in-out infinite; }

  .gl-wisps #gl-smoke .gl-wisp:not(.gl-ring):not(.gl-fog) { animation: gl-wisp 4.6s ease-out infinite; }
  .gl-wisps #gl-smoke .gl-wisp:nth-child(2) { animation-delay: -1.5s; }
  .gl-wisps #gl-smoke .gl-wisp:nth-child(3) { animation-delay: -3.1s; }
  .gl-wisps #gl-smoke .gl-fog { animation: gl-fog 9s ease-in-out infinite; }
  .gl-rings #gl-smoke .gl-ring { animation: gl-ring 3.6s ease-out infinite; }
  .gl-rings #gl-smoke .gl-ring:nth-child(2) { animation-delay: -1.2s; }
  .gl-rings #gl-smoke .gl-ring:nth-child(3) { animation-delay: -2.4s; }

  .gl-wave #gl-arm-r     { animation: gl-wave .9s ease-in-out infinite; }
  .gl-tap #gl-joint      { animation: gl-tap .8s ease-in-out infinite; }
  .gl-float #gl-fx       { animation: gl-float 2.6s ease-in-out infinite; }
}

@media (prefers-reduced-motion: reduce) {
  /* hold a calm still frame: no loops, smoke stays as drawn */
  [class*="gl-"] #gl-char, [class*="gl-"] #gl-face, [class*="gl-"] #gl-lids,
  [class*="gl-"] #gl-ember, [class*="gl-"] .gl-wisp, [class*="gl-"] #gl-arm-r,
  [class*="gl-"] #gl-joint, [class*="gl-"] #gl-fx { animation: none !important; }
}

@keyframes gl-breathe { 0%, 100% { transform: none; }
  50% { transform: translateY(-1.5px) scale(1.012, 1.018); } }
@keyframes gl-inhale { 0%, 100% { transform: none; } 55% { transform: scale(1.035, 1.025); } }
@keyframes gl-bounce { 0%, 100% { transform: none; }
  50% { transform: translateY(-6px) scale(1.01, .99); } }
@keyframes gl-shiver { 0% { transform: translateX(-1.5px); } 25% { transform: translateX(1.5px); }
  50% { transform: translateX(-1px); } 75% { transform: translateX(1.2px); } 100% { transform: translateX(-1.5px); } }
@keyframes gl-blink { 0%, 93%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(var(--gl-blink, 3.2)); } }
@keyframes gl-nod { 0%, 100% { transform: none; } 30% { transform: translateY(3px) rotate(1.5deg); }
  60% { transform: translateY(-1px); } }
@keyframes gl-tilt { 0%, 100% { transform: none; } 50% { transform: rotate(-4deg); } }
@keyframes gl-droop { 0%, 100% { transform: none; } 50% { transform: translateY(4px) rotate(-2deg); } }
@keyframes gl-ember { 0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.18); opacity: 1; } }
@keyframes gl-ember-hot { 0%, 100% { transform: scale(1.1); opacity: .95; }
  50% { transform: scale(1.35); opacity: 1; } }
@keyframes gl-wisp { 0% { transform: translateY(8px) scaleY(.85); opacity: 0; } 15% { opacity: 1; }
  100% { transform: translate(-6px, -38px) scale(1.15, 1.3); opacity: 0; } }
@keyframes gl-fog { 0%, 100% { transform: none; } 50% { transform: translate(4px, -3px) scale(1.03); } }
@keyframes gl-ring { 0% { transform: translate(14px, 14px) scale(.55); opacity: 0; } 20% { opacity: 1; }
  100% { transform: translate(-26px, -36px) scale(1.4); opacity: 0; } }
@keyframes gl-wave { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(10deg); } }
@keyframes gl-tap { 0%, 100% { transform: none; } 40% { transform: rotate(-6deg); } 55% { transform: rotate(2deg); } }
@keyframes gl-float { 0%, 100% { transform: none; } 50% { transform: translateY(-6px); } }

/* Sequence stage helpers: stack all frames, show one. */
.gl-stage { position: relative; }
.gl-stage > .gl-frame { position: absolute; inset: 0; opacity: 0; visibility: hidden; }
.gl-stage > .gl-frame.is-on { opacity: 1; visibility: visible; }
.gl-stage > .gl-frame.gl-fade-in { transition: opacity 280ms ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) {
  .gl-stage > .gl-frame.gl-fade-in { transition: none; }
}
