[data-reading-motion] [data-reading-pending] {
  visibility: hidden;
}
/* 見出しの意味と行の高さを残し、完成形→透明→出現という逆戻りを防ぐ。 */
@media (prefers-reduced-motion: no-preference) {
  .sb-reading-boot [data-reading-motion] [data-reading-heading]:not([data-reading-state]),
  .sb-reading-boot [data-reading-motion] [data-reading-breeze]:not([data-reading-state]),
  [data-reading-motion] [data-reading-state="pending"] {
    opacity: 0;
  }
}
[data-reading-motion] [data-reading-pending]:focus-within {
  visibility: visible;
}
@media print {
  [data-reading-motion] [data-reading-pending] {
    visibility: visible !important;
  }
  [data-reading-motion] [data-reading-heading],
  [data-reading-motion] [data-reading-state],
  [data-reading-motion] .sb-motion-heading-letter {
    opacity: 1 !important;
    translate: none !important;
    rotate: none !important;
    clip-path: none !important;
  }
  .sb-motion-gust {
    display: none !important;
  }
}
/* 元の色分け・改行を引き継ぎ、句読点は前の文字と一緒に折り返す。 */
[data-reading-motion] .sb-motion-heading-text {
  display: inline;
  color: inherit;
}
[data-reading-motion] .sb-motion-heading-unit,
[data-reading-motion] .sb-motion-heading-letter {
  display: inline-block;
  color: inherit;
  vertical-align: baseline;
}
[data-reading-motion] .sb-motion-heading-unit {
  white-space: nowrap;
}

/* 風の一文。線は文字の後ろを横切る飾りで、色はページの --sb-motion-gust-color で決める。 */
.sb-motion-breeze {
  position: relative;
  isolation: isolate;
}
.sb-motion-gust {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(100%, 760px);
  height: clamp(96px, 11vw, 140px);
  overflow: visible;
  translate: -50% -50%;
  pointer-events: none;
}
.sb-motion-gust path {
  fill: none;
  stroke: var(--sb-motion-gust-color, currentColor);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 18 200;
  stroke-dashoffset: 18;
  opacity: 0;
  vector-effect: non-scaling-stroke;
}

.sb-motion-glint {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(112deg, transparent 30%, rgb(255 251 225 / 34%) 49%, transparent 68%);
  pointer-events: none;
}

/* 数字や本文を隠さず、背後のマーカーだけを左から引く。 */
.sb-motion-marker {
  position: relative;
  isolation: isolate;
}
.sb-motion-marker::after {
  position: absolute;
  z-index: -1;
  inset-block-end: .11em;
  inset-inline: -.035em;
  block-size: var(--sb-motion-marker-height, .2em);
  border-radius: .22em .1em .16em .12em;
  background: var(--sb-motion-marker-color, var(--sb-color-yellow));
  transform-origin: left center;
  pointer-events: none;
  content: "";
}
@media (prefers-reduced-motion: no-preference) {
  .sb-motion-marker::after {
    transform: scaleX(0);
    transition: transform var(--sb-motion-duration-emphasis) var(--sb-motion-ease-enter) var(--sb-motion-marker-delay, 0ms);
  }
  .sb-motion-marker.is-motion-marked::after {
    transform: scaleX(1);
  }
}

/* 図や操作は見せたまま、足元の線だけを一度動かす。 */
.sb-motion-follow {
  position: relative;
  isolation: isolate;
}
@media (prefers-reduced-motion: no-preference) {
  .sb-motion-follow.is-motion-following::after {
    position: absolute;
    z-index: 1;
    inset: auto 2px 0;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--sb-motion-follow-color, var(--sb-world-gold)) 32% 64%, transparent);
    animation: sb-motion-follow var(--sb-motion-duration-reveal) var(--sb-motion-ease-enter) both;
    transform-origin: left;
    pointer-events: none;
    content: "";
  }
}
@keyframes sb-motion-follow {
  from {
    opacity: .35;
    transform: scaleX(0);
  }
  65% {
    opacity: .9;
    transform: scaleX(1);
  }
  to {
    opacity: 0;
    transform: scaleX(1);
  }
}

/* pathLength="1" の複製線をなぞる。図の元の線は常時表示する。 */
@keyframes sb-motion-trace {
  0% {
    stroke-dashoffset: 1;
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  72% {
    stroke-dashoffset: 0;
    opacity: .95;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}

