/* ==========================================================
   peacock-run.css
   The two slanted text strips: a white peacock runs along each one. Behind it the
   words are written in (pass 1); on the second pass it erases them again, then it
   starts over. scripts/core/peacock.js adds the .pk-run layer to each strip.
   Pure CSS: three animated numbers (--a written, --b erased, --x peacock position).
   ========================================================== */
@property --a { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --b { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --x { syntax: "<number>"; inherits: true; initial-value: 0; }

/* the little icons between the phrases are white too */
.marquee-icon { filter: brightness(0) invert(1); }

.pk-run { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; --d: 15s;
  animation: pk-a var(--d) linear infinite, pk-b var(--d) linear infinite, pk-x var(--d) linear infinite; }
.pk-run__cover { position: absolute; inset: 0; background-color: inherit; }
/* hides what the peacock has not reached yet (pass 1) */
.pk-run__cover--ahead { clip-path: inset(0 0 0 calc(var(--a) * 100%)); }
/* hides what the peacock has already passed (pass 2) */
.pk-run__cover--behind { clip-path: inset(0 calc(100% - var(--b) * 100%) 0 0); }
.pk-run__bird {
  position: absolute; top: 50%; left: calc(var(--x) * 100%); height: 125%; width: auto; translate: -50% -50%;
  filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, .55));
  animation: pk-show var(--d) linear infinite, pk-hop .42s ease-in-out infinite;
}
.pk-run--late { animation-delay: -7.5s; }
.pk-run--late .pk-run__bird { animation-delay: -7.5s, 0s; }

/* 0-40% pass 1 (writes the words) - hold - 60-95% pass 2 (erases them) - restart */
@keyframes pk-a { 0% { --a: 0; animation-timing-function: cubic-bezier(.45, .05, .35, 1); } 40%, 100% { --a: 1; } }
@keyframes pk-b { 0%, 60% { --b: 0; animation-timing-function: cubic-bezier(.45, .05, .35, 1); } 95%, 100% { --b: 1; } }
@keyframes pk-x { 0% { --x: 0; animation-timing-function: cubic-bezier(.45, .05, .35, 1); } 40% { --x: 1; } 60% { --x: 0; animation-timing-function: cubic-bezier(.45, .05, .35, 1); } 95%, 100% { --x: 1; } }
@keyframes pk-show { 0%, 40%, 60%, 95% { opacity: 1; } 40.1%, 59.9%, 95.1%, 100% { opacity: 0; } }
@keyframes pk-hop { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9%) rotate(2deg); } }

@media (prefers-reduced-motion: reduce) { .pk-run { display: none; } }
