/* Only a short decorative seam reveals. Content stays in its stable layout. */
.em-motion-ready main .section-space.em-stitch-playing::before {
  animation: em-chapter-stitches 540ms steps(12, end) both;
}
@keyframes em-chapter-stitches {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* The footer band remains visible; just its first 144px receives the gesture. */
.em-motion-ready .footer-seam { position: relative; }
.em-motion-ready .footer-seam.em-stitch-playing::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: min(144px, 100%);
  background: var(--footer-paper, #eae9e0);
  pointer-events: none;
  animation: em-footer-stitches 540ms steps(12, end) both;
}
@keyframes em-footer-stitches {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 0 0 100%); }
}

/* Four small stitches acknowledge a link, without changing its text or size. */
.em-motion-ready main .text-link { position: relative; }
.em-motion-ready main .text-link:focus-visible::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 32px;
  height: 6px;
  background: var(--stitched-line, url('embroidery-stitches.svg')) repeat-x left center;
  pointer-events: none;
  animation: em-link-stitches 160ms steps(4, end) both;
}
@media (hover: hover) and (pointer: fine) {
  .em-motion-ready main .text-link:hover::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 32px;
    height: 6px;
    background: var(--stitched-line, url('embroidery-stitches.svg')) repeat-x left center;
    pointer-events: none;
    animation: em-link-stitches 160ms steps(4, end) both;
  }
}
@keyframes em-link-stitches {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  .em-motion-ready main .section-space.em-stitch-playing::before { animation: none; }
  .em-motion-ready .footer-seam.em-stitch-playing::before { content: none; animation: none; }
  .em-motion-ready main .text-link:is(:hover, :focus-visible)::after { animation: none; }
}
