/* recipes/reveal: a whole line arrives once, in one of five styles (Nov 18, the AT reel motion boards, his "have the whole title and subtitle use the effect
   whether it's blur or some of the other ones"). blur (a word at a time, a word-sized blur), slam (the line lands from big, the skin's land curve), flap (each
   letter a flight-board flap, wordcycle's look), glitch (the line jumps in with two coloured ghosts), type (a letter at a time). Tokens only; colours come from
   the page's look (--accent and the ghosts' --rv-g1, --rv-g2). Every delay rides --tempo, so a board's slow-motion is one property. */
.rv { --rv-flap: color-mix(in srgb, currentColor 12%, transparent); display: inline; }
.rv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rv-line { font-size: calc(var(--rv-fit, 1) * 1em); }          /* fit: the driver shrinks a line that is wider than its frame (--rv-fit, at most 1) */
.rv-word { display: inline-block; white-space: nowrap; }
.rv-accent { color: var(--rv-accent, var(--accent)); }
.rv-p { display: inline-block; animation-duration: var(--t-beat-s); animation-delay: calc(var(--d, 0s) * var(--tempo)); animation-fill-mode: both; }

/* blur: each word rises out of a blur */
.rv-blur .rv-p { animation-name: rvblur; animation-timing-function: var(--ease-out); animation-duration: calc(var(--t-beat-s) * 1.5); }
@keyframes rvblur { 0% { opacity: 0; filter: blur(.25em); transform: translateY(.18em); } 100% { opacity: 1; filter: blur(0); transform: none; } }

/* slam: the whole line lands from big */
/* fit: it starts only as big as the frame allows (--rv-from, up to 1.7), grown from the side with room (--rv-origin); the driver measures both */
.rv-slam .rv-p { animation-name: rvslam; animation-timing-function: var(--ease-land); transform-origin: var(--rv-origin, 50% 50%); }
@keyframes rvslam { 0% { opacity: 0; transform: scale(var(--rv-from, 1.7)); } 40% { opacity: 1; } 100% { opacity: 1; transform: none; } }

/* flap: each letter a flap that turns over, a beat apart (no tile row behind: his AT 36 note on the flight board) */
.rv-flap .rv-word { perspective: 3em; }
.rv-flap .rv-p { padding: 0 .04em; margin: 0 .02em; border-radius: .08em; animation-name: rvflap; animation-timing-function: var(--ease-out);
  background: linear-gradient(var(--rv-flap) 0 49%, color-mix(in srgb, currentColor 30%, transparent) 49% 51%, var(--rv-flap) 51%); }
@keyframes rvflap { 0% { opacity: 0; transform: rotateX(90deg); } 55% { opacity: 1; transform: rotateX(-14deg); } 100% { opacity: 1; transform: none; } }

/* glitch: the line jumps in on held steps, two ghosts slice across and leave */
.rv-glitch .rv-p { position: relative; animation-name: rvglitch; animation-timing-function: var(--ease-step); animation-duration: calc(var(--t-beat-s) * 2); }
.rv-g { position: absolute; inset: 0; pointer-events: none; opacity: 0; animation: rvghost calc(var(--t-beat-s) * 2) var(--ease-step) calc(var(--d, 0s) * var(--tempo)) both; }
.rv-g1 { color: var(--rv-g1, var(--accent)); --rv-x: -.06em; }
.rv-g2 { color: var(--rv-g2, currentColor); --rv-x: .05em; animation-name: rvghost2; }
.rv-glitch .rv-accent { color: inherit; }
.rv-glitch .rv-txt .rv-accent { color: var(--rv-accent, var(--accent)); }
@keyframes rvglitch { 0% { opacity: 0; transform: translateX(.08em); } 20% { opacity: 1; transform: translateX(-.05em) skewX(-6deg); } 40% { transform: translateX(.03em); } 60% { transform: skewX(4deg); } 100% { opacity: 1; transform: none; } }
@keyframes rvghost { 0% { opacity: .9; clip-path: inset(10% 0 62% 0); transform: translateX(var(--rv-x)); } 25% { clip-path: inset(55% 0 20% 0); transform: translateX(calc(var(--rv-x) * -1.5)); }
  50% { clip-path: inset(30% 0 45% 0); transform: translateX(var(--rv-x)); } 75% { opacity: .9; clip-path: inset(70% 0 5% 0); } 100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; } }

@keyframes rvghost2 { 0% { opacity: .9; clip-path: inset(60% 0 15% 0); transform: translateX(var(--rv-x)); } 25% { clip-path: inset(15% 0 60% 0); transform: translateX(calc(var(--rv-x) * -1.5)); }
  50% { clip-path: inset(75% 0 2% 0); transform: translateX(var(--rv-x)); } 75% { opacity: .9; clip-path: inset(5% 0 80% 0); } 100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; } }

/* type: a letter at a time */
.rv-type .rv-p { animation-name: rvtype; animation-timing-function: var(--ease-step); animation-duration: var(--t-beat-s); }
@keyframes rvtype { 0% { opacity: 0; } 100% { opacity: 1; } }

@keyframes rvfade { from { opacity: 0; } to { opacity: 1; } }
/* less motion: the line is drawn whole and fades in once at its own delay (gentler, not none); no ghosts, no flaps turning */
@media (prefers-reduced-motion: reduce) {
  .rv .rv-p { animation: none; }
  .rv .rv-g { display: none; }
  .rv .rv-line { display: inline; animation: rvfade var(--t-beat) var(--ease-out) var(--rv-d, 0s) both; }
}
.less-motion .rv .rv-p { animation: none; }
.less-motion .rv .rv-g { display: none; }
.less-motion .rv .rv-line { display: inline; animation: rvfade var(--t-beat) var(--ease-out) var(--rv-d, 0s) both; }
