/* Hoot v2 owl (logo owner).
   The owl is brand art: colors and outline never change. Nothing here uses filter, blend modes
   or opacity on the owl itself; motion is transform only (plus opacity on the separate sparkles
   and the contact shadow, which are not part of the owl).
   Part 1 ports the old rig rules from /assets/styles.css for any .hm-owl (old markup on inner pages).
   Part 2 is the richer hero owl (.h-owl, markup in v2-build/partials/owl.html, driven by owl.js). */

/* ---------- Part 1: classic rig (ported) ---------- */
body.v2 .hm-owl { display: block; flex: none; overflow: visible; --look-x: 0px; --look-y: 0px; forced-color-adjust: none; }
body.v2 .hm-owl .hm-rig-body { transform-box: fill-box; transform-origin: 50% 92%; animation: hm-breathe 5s ease-in-out infinite; }
body.v2 .hm-owl .hm-rig-eye { transform-box: fill-box; transform-origin: center; animation: hm-blink 7s ease-in-out infinite; }
body.v2 .hm-owl .hm-rig-pupil { transform: translate(var(--look-x), var(--look-y)); }
body.v2 .hm-owl .hm-rig-wing-left { transform-box: view-box; transform-origin: 76px 152px; }
body.v2 .hm-owl .hm-rig-wing-right { transform-box: view-box; transform-origin: 244px 152px; }
body.v2 .hm-owl[data-reaction='welcome'] .hm-rig-wing-right { animation: hm-wave 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='welcome'] .hm-rig-body { animation: hm-greet 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='curious'] .hm-rig-body { animation: hm-curious 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='curious'] .hm-rig-eye-right { animation: hm-wink 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='navigate'] .hm-rig-body { animation: hm-nod 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='download'] .hm-rig-wing-left { animation: hm-cheer-left 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='download'] .hm-rig-wing-right { animation: hm-cheer-right 1.3s ease-in-out; }
body.v2 .hm-owl[data-reaction='download'] .hm-rig-body { animation: hm-greet 1.3s ease-in-out; }
@keyframes hm-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes hm-blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
@keyframes hm-wave { 0%, 100% { transform: rotate(0); } 25%, 65% { transform: rotate(-65deg); } 45%, 80% { transform: rotate(-35deg); } }
@keyframes hm-greet { 0%, 100% { transform: translateY(0); } 35%, 65% { transform: translateY(-7px); } }
@keyframes hm-curious { 0%, 100% { transform: rotate(0); } 35%, 70% { transform: rotate(-8deg); } }
@keyframes hm-wink { 0%, 35%, 70%, 100% { transform: scaleY(1); } 45%, 60% { transform: scaleY(.08); } }
@keyframes hm-nod { 0%, 100% { transform: rotate(0); } 30%, 65% { transform: rotate(5deg); } 45%, 80% { transform: rotate(-3deg); } }
@keyframes hm-cheer-left { 0%, 100% { transform: rotate(0); } 35%, 65% { transform: rotate(55deg); } }
@keyframes hm-cheer-right { 0%, 100% { transform: rotate(0); } 35%, 65% { transform: rotate(-55deg); } }

/* ---------- Part 2: hero owl (.h-owl) ---------- */
body.v2 .h-owl {
  width: var(--h-owl-size, 300px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  position: relative;
  z-index: var(--h-z-owl, 3);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  --owl-lx: var(--look-x, 0px);
  --owl-ly: var(--look-y, 0px);
  --owl-tilt: 0deg;
}
@media (hover: hover) { body.v2 .h-owl { cursor: pointer; } }

/* every moving part pivots in the 320x320 artwork's own units */
body.v2 .h-owl :is(.h-owl__hop, .hm-rig-body, .hm-rig-head, .h-owl__look, .hm-rig-eye, .hm-rig-pupil, .h-owl__iris, .h-owl__lid, .hm-rig-wing, .h-owl__shadow, .hm-rig-effects > *) { transform-box: view-box; }
body.v2 .h-owl .h-owl__hop { transform-origin: 160px 300px; }
body.v2 .h-owl .hm-rig-body { transform-origin: 160px 298px; animation: h-owl-breathe 4.8s var(--h-ease-in-out, ease-in-out) infinite; }
body.v2 .h-owl .hm-rig-head { transform-origin: 160px 178px; }
body.v2 .h-owl .h-owl__look {
  transform-origin: 160px 178px;
  transform: translateX(calc(var(--owl-lx) * .45)) rotate(var(--owl-tilt));
}
body.v2 .h-owl .hm-rig-eye { animation: none; transform-origin: center; }
body.v2 .h-owl .hm-rig-pupil { transform: translate(var(--owl-lx), var(--owl-ly)); }
body.v2 .h-owl .hm-rig-pupil-left .h-owl__iris { transform-origin: 121px 130px; }
body.v2 .h-owl .hm-rig-pupil-right .h-owl__iris { transform-origin: 199px 130px; }
body.v2 .h-owl .h-owl__iris { transition: transform var(--h-dur-2, 280ms) var(--h-ease-out, ease-out); }
body.v2 .h-owl .h-owl__lid { transform: translateY(0); }
body.v2 .h-owl .hm-rig-wing-left { transform-origin: 78px 152px; animation: h-owl-wing-l 4.8s var(--h-ease-in-out, ease-in-out) infinite; }
body.v2 .h-owl .hm-rig-wing-right { transform-origin: 242px 152px; animation: h-owl-wing-r 4.8s var(--h-ease-in-out, ease-in-out) infinite; }
body.v2 .h-owl .h-owl__shadow { transform-origin: 160px 300px; }
body.v2 .h-owl .hm-rig-effects > * { transform-origin: center; transform-box: fill-box; }

/* pupils widen a little when you hover the owl */
@media (hover: hover) {
  body.v2 .h-owl:hover .h-owl__iris { transform: scale(1.08); }
}

/* Breathing: a soft swell from the feet, wings riding along. Feet stay planted. */
@keyframes h-owl-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.024); } }
@keyframes h-owl-wing-l  { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(2.2deg); } }
@keyframes h-owl-wing-r  { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-2.2deg); } }

/* Blink (owl.js toggles .is-blink at random, sometimes twice) */
body.v2 .h-owl.is-blink .h-owl__lid { animation: h-owl-blink 210ms cubic-bezier(.4, 0, .2, 1); }
@keyframes h-owl-blink { 0%, 100% { transform: translateY(0); } 42%, 58% { transform: translateY(64px); } }

/* Idle head tilt (owl.js adds .is-tilt now and then; direction from --owl-tilt-dir) */
body.v2 .h-owl.is-tilt .hm-rig-head { animation: h-owl-tilt 1.7s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl.is-tilt .hm-rig-body { animation: h-owl-lean 1.7s var(--h-ease-in-out, ease-in-out); }
@keyframes h-owl-tilt { 0%, 100% { transform: rotate(0deg); } 25%, 70% { transform: rotate(calc(var(--owl-tilt-dir, -1) * 7deg)); } }
@keyframes h-owl-lean { 0%, 100% { transform: rotate(0deg); } 25%, 70% { transform: rotate(calc(var(--owl-tilt-dir, -1) * 2.5deg)); } }

/* Hello on first view: one big wave with the right wing, a little bounce, a curious tilt */
body.v2 .h-owl.is-hello .hm-rig-wing-right { animation: h-owl-wave 1.6s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl.is-hello .hm-rig-body { animation: h-owl-greet 1.6s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl.is-hello .hm-rig-head { animation: h-owl-hello-head 1.6s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl.is-hello .h-owl__spark--honey { animation: h-owl-spark 1.6s var(--h-ease-out, ease-out) .35s; }
@keyframes h-owl-wave { 0%, 100% { transform: rotate(0); } 18% { transform: rotate(-82deg); } 34% { transform: rotate(-52deg); } 50% { transform: rotate(-82deg); } 66% { transform: rotate(-52deg); } 82% { transform: rotate(-70deg); } }
@keyframes h-owl-greet { 0%, 100% { transform: scale(1, 1); } 12% { transform: scale(1.03, .96); } 30%, 70% { transform: translateY(-6px) scale(1, 1.02); } }
@keyframes h-owl-hello-head { 0%, 100% { transform: rotate(0); } 25%, 75% { transform: rotate(5deg); } }
@keyframes h-owl-spark { 0% { opacity: 0; transform: translateY(6px) scale(.4) rotate(0deg); } 30% { opacity: 1; transform: translateY(-4px) scale(1.1) rotate(25deg); } 100% { opacity: 0; transform: translateY(-16px) scale(.6) rotate(60deg); } }

/* Hop on click / tap: crouch, jump with a double flap, squash on landing */
body.v2 .h-owl.is-hop .h-owl__hop { animation: h-owl-hop 820ms cubic-bezier(.3, .7, .4, 1); }
body.v2 .h-owl.is-hop .hm-rig-wing-left { animation: h-owl-flap-l 820ms ease-in-out; }
body.v2 .h-owl.is-hop .hm-rig-wing-right { animation: h-owl-flap-r 820ms ease-in-out; }
body.v2 .h-owl.is-hop .hm-rig-body { animation: none; }
body.v2 .h-owl.is-hop .h-owl__shadow { animation: h-owl-shadow 820ms cubic-bezier(.3, .7, .4, 1); }
body.v2 .h-owl.is-hop .hm-rig-sparkle-left { animation: h-owl-spark 900ms var(--h-ease-out, ease-out) 160ms; }
body.v2 .h-owl.is-hop .hm-rig-sparkle-right { animation: h-owl-spark 900ms var(--h-ease-out, ease-out) 240ms; }
@keyframes h-owl-hop {
  0%   { transform: none; }
  14%  { transform: scale(1.06, .9); }
  34%  { transform: translateY(-30px) scale(.97, 1.05); }
  50%  { transform: translateY(-36px) scale(1, 1); }
  72%  { transform: translateY(0) scale(1.07, .9); }
  86%  { transform: scale(.98, 1.03); }
  100% { transform: none; }
}
@keyframes h-owl-flap-l { 0%, 14%, 100% { transform: rotate(0); } 28% { transform: rotate(52deg); } 40% { transform: rotate(12deg); } 52% { transform: rotate(48deg); } 66% { transform: rotate(4deg); } }
@keyframes h-owl-flap-r { 0%, 14%, 100% { transform: rotate(0); } 28% { transform: rotate(-52deg); } 40% { transform: rotate(-12deg); } 52% { transform: rotate(-48deg); } 66% { transform: rotate(-4deg); } }
@keyframes h-owl-shadow { 0%, 100% { transform: none; opacity: .38; } 14% { transform: scaleX(1.06); } 50% { transform: scaleX(.66); opacity: .16; } 72% { transform: scaleX(1.08); opacity: .42; } }

/* owl-motion.js reactions, re-mapped onto the hero rig */
body.v2 .h-owl[data-reaction='welcome'] .hm-rig-wing-right { animation: h-owl-wave 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='welcome'] .hm-rig-body { animation: h-owl-greet 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='curious'] .hm-rig-body { --owl-tilt-dir: -1; animation: h-owl-lean 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='curious'] .hm-rig-head { animation: h-owl-curious 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='curious'] .h-owl__lid--r { animation: h-owl-wink 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='curious'] .hm-rig-eye-right { animation: none; }
body.v2 .h-owl[data-reaction='navigate'] .hm-rig-body { animation: none; }
body.v2 .h-owl[data-reaction='navigate'] .hm-rig-head { animation: h-owl-nod 1.1s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='download'] .hm-rig-wing-left { animation: h-owl-cheer-l 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='download'] .hm-rig-wing-right { animation: h-owl-cheer-r 1.3s var(--h-ease-in-out, ease-in-out); }
body.v2 .h-owl[data-reaction='download'] .hm-rig-body { animation: h-owl-greet 1.3s var(--h-ease-in-out, ease-in-out); }
@keyframes h-owl-curious { 0%, 100% { transform: rotate(0); } 30%, 72% { transform: rotate(-7deg); } }
@keyframes h-owl-wink { 0%, 34%, 72%, 100% { transform: translateY(0); } 44%, 62% { transform: translateY(64px); } }
@keyframes h-owl-nod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(6deg); } 55% { transform: rotate(-4deg); } 78% { transform: rotate(2deg); } }
@keyframes h-owl-cheer-l { 0%, 100% { transform: rotate(0); } 30%, 66% { transform: rotate(62deg); } 48% { transform: rotate(44deg); } }
@keyframes h-owl-cheer-r { 0%, 100% { transform: rotate(0); } 30%, 66% { transform: rotate(-62deg); } 48% { transform: rotate(-44deg); } }

/* Optional: hide the contact shadow when the owl does not stand on a surface */
body.v2 .h-owl--no-shadow .h-owl__shadow { display: none; }

/* ---------- Brand mark micro-interaction (nav / footer lockup) ---------- */
body.v2 .h-brand__mark { transform-origin: 50% 90%; transition: transform var(--h-dur-2, 280ms) var(--h-ease-spring, ease-out); }
@media (hover: hover) {
  body.v2 .h-brand:hover .h-brand__mark { transform: rotate(-8deg) translateY(-1px); }
}
body.v2 .h-brand:active .h-brand__mark { transform: scale(.94); }

/* ---------- Pause, motion off, reduced motion ---------- */
html.owl-sleep body.v2 .hm-owl * { animation-play-state: paused; }
html.motion-off body.v2 .hm-owl,
html.motion-off body.v2 .hm-owl * { animation: none !important; transition: none !important; }
html.motion-off body.v2 .h-owl { cursor: default; }
html.motion-off body.v2 .h-brand__mark { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  /* only the moving parts are reset, so the mirrored right-wing feathers keep their own transform */
  body.v2 .hm-owl :is(.hm-rig-body, .hm-rig-head, .h-owl__look, .hm-rig-eye, .hm-rig-pupil, .h-owl__iris, .h-owl__lid, .hm-rig-wing, .h-owl__hop, .h-owl__shadow) {
    animation: none !important; transition: none !important; transform: none !important;
  }
  body.v2 .h-owl { cursor: default; }
  body.v2 .h-brand__mark { transform: none !important; }
}
