/* ==========================================================================
   greeting.css
   The one moving thing on the site. "Hello," starts in Tashkent and rolls
   west through the capitals (Moscow, Ankara, Berlin, Rome, Paris, Madrid,
   Lisbon), then lands at home in English. It rolls once and stops.
   With reduced motion switched on, it simply says "Hello,".
   ========================================================================== */

/* The window the words roll through: exactly one slot tall */
.roller {
  display: block;
  height: calc(var(--roller-slot) * 1em);
  overflow: hidden;
  /* The slot is taller than a normal line, so pull the next line back up by
     half the difference. The two baselines stay one line apart. */
  margin-bottom: calc((var(--leading-display) - var(--roller-slot)) * 0.5em);
  -webkit-user-select: none; /* copying the title copies "Hello," once */
  user-select: none;
}

.roller__track {
  display: block;
  /* Rest on the last word. "100%" is the track's own height, so this works
     for any number of words: add or remove a greeting in the HTML and the
     roll still ends on the last one. */
  transform: translateY(calc(var(--roller-slot) * 1em - 100%));
  animation: roller-roll var(--roll-duration) var(--roll-easing) var(--roll-delay) both;
}

.roller__word {
  display: block;
  line-height: var(--roller-slot);
  white-space: nowrap;
}

/* Only the start is written down: the roll ends on the resting transform */
@keyframes roller-roll {
  from {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .roller__track {
    animation: none;
  }
}
