@media screen and (prefers-reduced-motion: no-preference) {
  .pn-reveal-word {
    display: inline-block;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
    animation: pn-word-rise 420ms cubic-bezier(.2, .75, .25, 1) backwards;
  }

  .pn-reveal-word:nth-of-type(2) { animation-delay: 34ms; }
  .pn-reveal-word:nth-of-type(3) { animation-delay: 68ms; }
  .pn-reveal-word:nth-of-type(4) { animation-delay: 102ms; }
  .pn-reveal-word:nth-of-type(5) { animation-delay: 136ms; }
  .pn-reveal-word:nth-of-type(6) { animation-delay: 170ms; }
  .pn-reveal-word:nth-of-type(7) { animation-delay: 204ms; }
  .pn-reveal-word:nth-of-type(n+8) { animation-delay: 238ms; }

  /* Visible groups enter on load. The observer stages offscreen groups on scroll. */
  [data-reveal],
  :where([data-scroll-reveal=""] > [data-reveal-item]:not(:focus-within)) {
    animation: pn-content-rise 420ms cubic-bezier(.2, .75, .25, 1) backwards;
  }
  :where([data-scroll-reveal=""] > [data-reveal-item]) { animation-delay: 100ms; }
  :where([data-scroll-reveal=""] > :nth-child(n+2 of [data-reveal-item])) { animation-delay: 165ms; }
  [data-reveal="1"] { animation-delay: 100ms; }
  [data-reveal="2"] { animation-delay: 165ms; }

  [data-scroll-reveal="pending"] > [data-reveal-item]:not(:focus-within) {
    animation: none;
    opacity: 0;
    translate: 0 10px;
  }
  [data-scroll-reveal="shown"] > [data-reveal-item]:not(:focus-within) {
    animation: pn-content-rise 460ms cubic-bezier(.24, .58, .28, 1) backwards;
    animation-delay: calc(var(--pn-group-delay, 0ms) + var(--pn-item-delay, 0ms));
  }
  [data-scroll-reveal] > :nth-child(2 of [data-reveal-item]) { --pn-item-delay: 260ms; }
  [data-scroll-reveal] > :nth-child(n+3 of [data-reveal-item]) { --pn-item-delay: 520ms; }
  [data-reveal]:focus-within,
  [data-scroll-reveal]:target > [data-reveal-item],
  [data-scroll-reveal] > [data-reveal-item]:is(:target, :has(:target)) {
    animation: none;
    opacity: 1;
    translate: none;
  }

  @keyframes pn-word-rise {
    from { opacity: 0; transform: perspective(440px) translateY(.4em) rotateX(-24deg); }
    to { opacity: 1; transform: none; }
  }
  @keyframes pn-content-rise {
    from { opacity: 0; translate: 0 10px; }
    to { opacity: 1; translate: none; }
  }
}

/* On narrow screens a word can hyphenate across lines while it rises. */
@media screen and (max-width: 700px) and (prefers-reduced-motion: no-preference) {
  .pn-reveal-word {
    display: inline;
    position: relative;
    animation-name: pn-inline-word-rise;
  }
  @keyframes pn-inline-word-rise {
    from { opacity: 0; top: .4em; }
    to { opacity: 1; top: 0; }
  }
}
