/* recipes/glitch: a jolt on words already on the page (Nov 18, the AT site board: "glitches here and there"). Three levels: nudge (a held-step jump), glitch (two
   coloured ghosts slice across and leave), break (and the line flickers, the c01 site's CRT habit, once). Tokens only; the ghosts take the look's colours. Every
   delay rides --tempo. The driver puts .gl-on on to play it and takes it off at the end, so it replays. Forwards, never both: during a delay the words rest and
   the ghosts stay hidden. */
.gl { position: relative; }
.gl-nudge { --gl-len: calc(var(--t-beat-s) * 1); }
.gl-glitch { --gl-len: calc(var(--t-beat-s) * 2); }
.gl-break { --gl-len: calc(var(--t-beat-s) * 3); }
.gl-g { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.gl-g1 { color: var(--gl-g1, var(--accent)); --gl-x: -.06em; }
.gl-g2 { color: var(--gl-g2, currentColor); --gl-x: .05em; }
.gl-on { animation: gljolt var(--gl-len) var(--ease-step) calc(var(--gl-d, 0s) * var(--tempo)) forwards; }
.gl-break.gl-on { animation-name: glbreak; }
.gl-on > .gl-g1 { animation: glghost var(--gl-len) var(--ease-step) calc(var(--gl-d, 0s) * var(--tempo)) forwards; }
.gl-on > .gl-g2 { animation: glghost2 var(--gl-len) var(--ease-step) calc(var(--gl-d, 0s) * var(--tempo)) forwards; }
@keyframes gljolt { 0% { transform: translateX(.06em); } 20% { transform: translateX(-.05em) skewX(-6deg); } 40% { transform: translateX(.03em); } 60% { transform: skewX(4deg); } 100% { transform: none; } }
@keyframes glbreak { 0% { opacity: 1; transform: translateX(.06em); } 12% { opacity: .2; } 18% { opacity: .9; transform: translateX(-.05em) skewX(-6deg); } 26% { opacity: .35; }
  34% { opacity: 1; transform: translateX(.03em); } 60% { transform: skewX(4deg); } 100% { opacity: 1; transform: none; } }
@keyframes glghost { 0% { opacity: .9; clip-path: inset(10% 0 62% 0); transform: translateX(var(--gl-x)); } 25% { clip-path: inset(55% 0 20% 0); transform: translateX(calc(var(--gl-x) * -1.5)); }
  50% { clip-path: inset(30% 0 45% 0); transform: translateX(var(--gl-x)); } 75% { opacity: .9; clip-path: inset(70% 0 5% 0); } 100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; } }
@keyframes glghost2 { 0% { opacity: .9; clip-path: inset(60% 0 15% 0); transform: translateX(var(--gl-x)); } 25% { clip-path: inset(15% 0 60% 0); transform: translateX(calc(var(--gl-x) * -1.5)); }
  50% { clip-path: inset(75% 0 2% 0); transform: translateX(var(--gl-x)); } 75% { opacity: .9; clip-path: inset(5% 0 80% 0); } 100% { opacity: 0; clip-path: inset(50% 0 50% 0); transform: none; } }
@keyframes glfade { from { opacity: .55; } to { opacity: 1; } }
/* less motion: no jump and no ghosts; the words dim a little and come back once (gentler, not none); the driver starts no timer */
@media (prefers-reduced-motion: reduce) {
  .gl .gl-g { display: none; }
  .gl.gl-on { animation: glfade var(--t-beat) var(--ease-out) var(--gl-d, 0s) both; }
}
.less-motion .gl .gl-g { display: none; }
.less-motion .gl.gl-on { animation: glfade var(--t-beat) var(--ease-out) var(--gl-d, 0s) both; }
