/*
 * The theme's signature motions. Each has a reduced-motion fallback at the
 * end of this file: no movement, only an instant state or a short fade.
 */

/* Karaoke headline: words light one at a time, reading direction, 120ms each.
   app.js wraps each word in .karaoke-word and toggles .is-lit. */
.karaoke-word {
  border-radius: 0.2em;
  transition: background-color 90ms linear, color 90ms linear;
}

.karaoke-word.is-lit {
  background: var(--color-highlight);
  color: var(--color-on-highlight);
}

/* While the sweep runs, the template's own <mark> waits its turn. */
[data-karaoke].is-playing mark {
  background: transparent;
  color: inherit;
}

/* The "cut" transition: a yellow line slices the screen from the reading
   start and the new content is revealed behind it, under 250ms. The reveal
   fills backwards only: a clip-path left on <main> after it ends would clip
   every fixed overlay inside it (the «ready» poster) to the page's box. */
.cut-enter {
  position: relative;
  animation: cut-reveal var(--duration-cut) var(--ease-out) backwards;
}

.cut-enter::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 1;
  inline-size: 3px;
  background: var(--color-highlight);
  pointer-events: none;
  animation: cut-line var(--duration-cut) var(--ease-out) both;
}

@keyframes cut-reveal {
  from { clip-path: inset(0 0 0 100%); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes cut-line {
  from { inset-inline-start: 0; opacity: 1; }
  to { inset-inline-start: 100%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }

  .cut-enter {
    animation: cut-fade 150ms ease-out backwards !important;
  }

  .cut-enter::before {
    display: none;
  }

  @keyframes cut-fade {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .btn:active {
    scale: 1;
  }
}
