/* Layered grid reserves the longest phrase's full size before the first swap. */
.keepsake-hero .hero-title-lead { display: block; }
.keepsake-hero .hero-rotating {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'phrase';
  align-items: center;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: .035em .03em .075em;
  line-height: 1.08;
  text-align: center;
  white-space: normal;
  overflow: visible;
}
.keepsake-hero .hero-word {
  display: block;
  grid-area: phrase;
  min-width: 0;
  max-width: 100%;
  opacity: 0;
  transform: translateY(.22em);
  pointer-events: none;
  text-wrap: balance;
  overflow-wrap: normal;
}
.keepsake-hero .hero-word.is-active { opacity: 1; transform: none; }

/* Position, size and any fixed paper angle belong to the surrounding design. */
.keepsake-hero [data-hero-float] {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  animation: hero-gentle-float var(--hero-float-duration, 9s) ease-in-out infinite;
  animation-delay: var(--hero-float-delay, 0s);
  animation-play-state: paused;
}
.keepsake-hero[data-hero-motion='running'] [data-hero-float] { animation-play-state: running; }
.keepsake-hero [data-hero-float]:nth-of-type(2n) {
  --hero-float-duration: 11s;
  --hero-float-delay: -3.5s;
  --hero-float-distance: 5px;
  --hero-float-tilt: -.8deg;
}
@keyframes hero-gentle-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 calc(-1 * var(--hero-float-distance, 7px)); rotate: var(--hero-float-tilt, 1deg); }
}
.motion-paused .keepsake-hero [data-hero-float],
body[data-motion='paused'] .keepsake-hero [data-hero-float],
body[data-reduce-motion='true'] .keepsake-hero [data-hero-float] { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .keepsake-hero .hero-word { opacity: 0 !important; transform: none !important; }
  .keepsake-hero .hero-word:first-child { opacity: 1 !important; }
  .keepsake-hero [data-hero-float] { animation: none !important; translate: none; rotate: none; }
}
