/* Mr. Handy, the homepage's empty state (assets/js/mr-handy.js). He flies in from the right, settles next to his
 * speech bubble and keeps floating: the CSS bob moves him as a whole, the loop clip moves his arms and flame. The
 * entrance replays on its own each time #journal-empty comes back from [hidden]. With animations off he is simply
 * there, as a still. */
#journal-empty:not([hidden]) {
  display:flex; align-items:center; justify-content:center; gap:4px;
  padding:18px 14px 18px 22px; text-align:left; overflow:hidden; /* the fly-in starts outside the box */
}

/* ---- speech bubble, its tail pointing right at him ---- */
.mh-bubble {
  position:relative; flex:0 1 380px; padding:12px 15px 14px;
  background:var(--main-bg, var(--card-bg)); border:1px solid var(--main-border-color); border-radius:10px;
  animation:mh-bubble .35s cubic-bezier(.3,1.5,.6,1) .55s both; transform-origin:100% 60%;
}
.mh-bubble::after {
  content:''; position:absolute; right:-8px; top:58%; width:14px; height:14px;
  background:inherit; border:solid var(--main-border-color); border-width:1px 1px 0 0; transform:rotate(45deg);
}
.mh-kicker {
  display:block; margin-bottom:4px; color:var(--lab-accent, var(--link-color));
  font:700 10px/1.4 ui-monospace,Consolas,monospace; letter-spacing:1px; text-transform:uppercase;
}
.mh-line { margin:0 0 11px; color:var(--heading-color); font-size:.95rem; line-height:1.45; overflow-wrap:anywhere; }

/* ---- the robot ---- */
.mh-bot {
  --mh-size:170px;
  flex:0 0 var(--mh-size); width:var(--mh-size); height:var(--mh-size);
  animation:mh-arrive .8s cubic-bezier(.25,1.25,.5,1) both;
}
.mh-hover { position:relative; display:block; width:100%; height:100%; animation:mh-hover 2.6s ease-in-out .8s infinite; }
.mh-hover > * { position:absolute; inset:0; display:block; width:100%; height:100%; }
/* The loop takes over from the still once it plays; its first frame is the still. */
.mh-clip { opacity:0; }
.mh-hover.is-live .mh-clip { opacity:1; }
.mh-hover.is-live .mh-still { visibility:hidden; }
html.lab-motion-off .mh-clip { display:none; }
html.lab-motion-off .mh-hover.is-live .mh-still { visibility:visible; }
.mh-bot.is-looking .mh-hover > * { animation:mh-look .6s ease-in-out; transform-origin:50% 40%; }

@keyframes mh-arrive {
  0% { transform:translate(140%, -30%) rotate(18deg); opacity:0; }
  15% { opacity:1; }
  70% { transform:translate(-6%, 4%) rotate(-7deg); }
  100% { transform:none; }
}
@keyframes mh-bubble { from { transform:scale(.6); opacity:0; } to { transform:none; opacity:1; } }
@keyframes mh-hover { 0%, 100% { transform:translateY(0); } 50% { transform:translateY(-7px); } }
@keyframes mh-look {
  0%, 100% { transform:none; }
  30% { transform:rotate(-9deg) translateX(-4px); }
  65% { transform:rotate(6deg); }
}

@media (max-width: 575px) {
  #journal-empty:not([hidden]) { padding:14px 8px 14px 14px; }
  .mh-bot { --mh-size:104px; }
  .mh-line { font-size:.9rem; }
}
@media print { .mh-bot { display:none; } }
