/* Add cn-text-blur-reveal to a heading, paragraph, link or text wrapper.
   Optional controls: --cn-blur-duration: 750ms; --cn-blur-stagger: 30ms;
   --cn-blur-amount: 10px; --cn-blur-offset: -0.18em.
   Only JS-generated letters are hidden; without JS the text stays readable. */
/* Generated spans inherit their original text node's color. Theme rules
   such as .section-title span must only color the authored highlight. */
.cn-text-blur-reveal .cn-blur-node,
.cn-text-blur-reveal .cn-blur-visual,
.cn-text-blur-reveal .cn-blur-word,
.cn-text-blur-reveal .cn-blur-letter,
.cn-text-blur-reveal .cn-blur-accessible {
  color: inherit;
}

.cn-text-blur-reveal .cn-blur-word {
  white-space: nowrap;
}

.cn-text-blur-reveal .cn-blur-letter {
  display: inline-block;
  opacity: 0;
  filter: blur(var(--cn-blur-amount, 10px));
  transform: translateY(var(--cn-blur-offset, -0.18em));
}

.cn-text-blur-reveal.cn-blur-playing .cn-blur-letter {
  animation: cn-text-blur-in var(--cn-blur-duration, 750ms)
    cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--cn-blur-index) * min(var(--cn-blur-stagger, 30ms), var(--cn-blur-step-cap, 30ms)));
}

/* Keep gradient text colored while each letter has its own blur layer. */
.cn-text-blur-reveal .cn-blur-gradient-letter {
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Performance path for phones, tablets, compact laptops and long copy.
   It preserves authored gradient spans and animates one composited element
   instead of creating a filtered layer for every character. */
.cn-text-blur-reveal.cn-blur-lite-ready {
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transform: translate3d(0, var(--cn-blur-offset, -0.18em), 0);
}

.cn-text-blur-reveal.cn-blur-lite-playing {
  animation: cn-text-blur-lite-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cn-text-blur-lite-in {
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translate3d(0, 0, 0);
  }
}

/* Keep continuous original text available to assistive technology. */
.cn-text-blur-reveal .cn-blur-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes cn-text-blur-in {
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* Start each manifesto paragraph wipe when its heading reveal completes. */
.wwd-manifesto-body.cn-manifesto-wipe-playing p {
  animation: cn-manifesto-horizontal-wipe 850ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--cn-manifesto-wipe-delay, 0ms);
}

@keyframes cn-manifesto-horizontal-wipe {
  from {
    opacity: 0.25;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cn-text-blur-reveal.cn-blur-lite-ready,
  .cn-text-blur-reveal.cn-blur-lite-playing {
    animation: none !important;
    opacity: 1;
    clip-path: none;
    transform: none;
  }

  .cn-text-blur-reveal .cn-blur-letter {
    animation: none !important;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .wwd-manifesto-body.cn-manifesto-wipe-playing p {
    animation: none !important;
  }
}

@media print {
  .cn-text-blur-reveal.cn-blur-lite-ready,
  .cn-text-blur-reveal.cn-blur-lite-playing {
    animation: none !important;
    opacity: 1;
    clip-path: none;
    transform: none;
  }

  .cn-text-blur-reveal .cn-blur-letter {
    animation: none !important;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .wwd-manifesto-body.cn-manifesto-wipe-playing p {
    animation: none !important;
  }
}
