/* the wordmark, pointed at, backspaces into a face: the letters go one at a time from the end of
   observer, skipping the o of occasional, the dot and the o of observer, until o.o is left. held
   there, it blinks. let go, it types itself back in. --i on each letter is its place in that order,
   set by js/observer.js

   a hidden copy of the whole word holds the box at full width, so the face shrinks to the middle
   under the observer and the pointer never falls off it mid-delete */

.wordmark { display: inline-grid; }

.wordmark::after {
  content: "occasional.observer";
  grid-area: 1 / 1;
  visibility: hidden;
}

.wordmark .face {
  grid-area: 1 / 1;
  justify-self: center;
  display: inline-flex;
  white-space: nowrap;
}

.wordmark .fold > span {
  transition: font-size 0s calc((15 - var(--i)) * 28ms);
}

.wordmark .eye { transform-origin: 50% 55%; }

.wordmark:is(:hover, :focus-visible) .fold > span {
  font-size: 0;
  transition-delay: calc(var(--i) * 45ms);
}

/* once it's settled, the eyes do one thing for as long as the pointer stays, picked fresh each
   hover by js/observer.js (data-eyes): blink, or look around. a blink drops fast and lifts slower,
   mostly single, now and then a double, never on a beat. a look is a quick dart then a hold */
@keyframes mark-blink {
  0%, 3.5%, 40%, 43%, 44%, 47%, 78%, 81.5%, 100% { scale: 1 1; animation-timing-function: ease-in; }
  1%, 1.6%, 41%, 41.4%, 45%, 45.4%, 79%, 79.6%  { scale: 1 0.06; animation-timing-function: ease-out; }
}

@keyframes mark-look {
  0%, 12%, 76.5%, 100% { translate: 0 0; }
  13.5%, 30%           { translate: -0.08em 0; }
  31.5%, 46%           { translate: 0.08em 0.01em; }
  47.5%, 60%           { translate: 0.04em -0.06em; }
  61.5%, 75%           { translate: -0.05em 0.03em; }
}

.wordmark:is(:hover, :focus-visible) .eye {
  animation: mark-blink 7s 0.9s infinite;
}

.wordmark[data-eyes="look"]:is(:hover, :focus-visible) .eye {
  animation: mark-look 6s cubic-bezier(0.2, 0.8, 0.3, 1) 0.9s infinite;
}

/* for anyone who asks for less motion, the face just appears, still */
@media (prefers-reduced-motion: reduce) {
  .wordmark :is(.fold > span, .eye) {
    transition: none !important;
    animation: none !important;
  }
}
