/* Hoot owl for the website: the hero owl (Rive) and the corner peek.  Pairs with hoot-owl-web.js.
 * Owned by the Animations - Owl chat.  Markup contract is at the top of hoot-owl-web.js. */

/* ---------- hero owl ---------- */
[data-hoot-owl] { position: relative; }
[data-hoot-owl] > .hoot-owl-fallback { display: block; width: 100%; height: 100%; object-fit: contain; }
.hoot-rive-on > .hoot-owl-fallback { visibility: hidden; }

/* Until the script decides (peek first, or pop in now) the owl stays hidden.  If the script never runs, it shows by itself. */
html:not(.hoot-owl-done) [data-hoot-owl] { opacity: 0; animation: hoot-owl-failsafe .3s ease 2.5s forwards; }
@keyframes hoot-owl-failsafe { to { opacity: 1; } }
[data-hoot-owl].hoot-owl-wait { opacity: 0; scale: .55; translate: 0 18px; }
[data-hoot-owl].hoot-owl-in { animation: hoot-owl-pop .75s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes hoot-owl-pop {
  0% { opacity: 0; scale: .55; translate: 0 18px; }
  45% { opacity: 1; }
  70% { scale: 1.05; translate: 0 -4px; }
  100% { opacity: 1; scale: 1; translate: 0 0; }
}

/* ---------- side-lean peek (E1, head + body) ----------
 * The owl leans in from the left edge, tipped 70 degrees, like peeking round a doorframe: the head comes into view and
 * the body runs on past the screen edge, so the head is always attached (never a floating head).  Wings are switched
 * off in the Rive owl.  .hoot-peek sits on the pivot point at the edge (JS sets its top); the lean box turns about that
 * point and the owl slides along its own up/down axis (the JS animates translate + rotate). */
.hoot-peek {
  --pk: 300px;
  position: fixed; left: 0; top: 50vh; width: 0; height: 0; z-index: 60; pointer-events: none;
}
.hoot-peek.is-small { --pk: 190px; }
.hoot-peek__lean {
  position: absolute; width: var(--pk); height: var(--pk);
  left: calc(var(--pk) * -0.5); top: calc(var(--pk) * -0.672);
  transform-origin: 50% 67.2%; rotate: 70deg;   /* pivot = the owl's chest, sitting right on the screen edge */
}
.hoot-peek__owl {
  position: absolute; inset: 0; transform-origin: 50% 67.2%;
  translate: 0 calc(var(--pk) * 0.66);            /* tucked past the edge until the JS leans it in */
}
.hoot-peek__owl > .hoot-owl-fallback { display: block; width: 100%; height: 100%; }
.hoot-peek__owl.hoot-rive-on > .hoot-owl-fallback { visibility: hidden; }
.hoot-peek__hit {                                 /* the head's box on screen: click target + overlap check */
  position: absolute; left: 0; top: calc(var(--pk) * -0.4);
  width: calc(var(--pk) * 0.6); height: calc(var(--pk) * 0.62);
  pointer-events: auto; cursor: pointer; border-radius: 0 50% 50% 0;
}

.hoot-peek__bubble {
  position: absolute; left: calc(var(--pk) * 0.64); bottom: calc(var(--pk) * -0.08);
  width: max-content; max-width: min(310px, calc(100vw - var(--pk) * 0.64 - 16px));
  box-sizing: border-box; margin: 0; padding: 12px 34px 12px 16px;
  background: #1b212a; color: #eef1f6; border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .38);
  font-family: inherit; font-weight: 500; font-size: 15px; line-height: 1.4; text-align: left;
  pointer-events: auto;
  opacity: 0; scale: .8; translate: -6px 8px; transform-origin: 0 100%;
  transition: opacity .2s ease, scale .2s ease, translate .2s ease;
}
.hoot-peek.is-small .hoot-peek__bubble { font-size: 14px; padding: 10px 30px 10px 13px; }
.hoot-peek__bubble::before {        /* the tail, pointing down-left at the owl */
  content: ''; position: absolute; left: -6px; bottom: 14px; width: 12px; height: 12px;
  background: inherit; border-left: inherit; border-bottom: inherit; rotate: 45deg; border-bottom-left-radius: 3px;
}
.hoot-peek.is-talking .hoot-peek__bubble {
  opacity: 1; scale: 1; translate: 0 0;
  transition: opacity .3s ease, scale .45s cubic-bezier(.2, 1.4, .4, 1), translate .45s cubic-bezier(.2, 1.4, .4, 1);
}
.hoot-peek__bubble p { margin: 0; }
.hoot-peek__close {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #a6b0bf; font-family: inherit; font-size: 18px; line-height: 24px; cursor: pointer;
}
.hoot-peek__close:hover, .hoot-peek__close:focus-visible { background: rgba(255, 255, 255, .08); color: #eef1f6; outline: none; }

/* measuring pass: final pose, invisible, no transitions */
.hoot-peek.is-measure { visibility: hidden; }
.hoot-peek.is-measure * { transition: none !important; }
.hoot-peek.is-measure .hoot-peek__bubble { opacity: 1; scale: 1; translate: 0 0; }


@media (prefers-reduced-motion: reduce) {
  [data-hoot-owl].hoot-owl-in { animation: none; }
  .hoot-peek { display: none !important; }
}
