/* Spacing comes from block settings on containers, not theme defaults on text tags. */
.manta-tr :is(h1, h2, h3, h4, p) {
  margin-block: 0;
  margin-inline: 0;
  padding-block: 0;
  padding-inline: 0;
}

.manta-tr-text-container {
  display: block;
  overflow-wrap: break-word;
  word-break: normal;
}

.manta-tr-text-container.manta-tr-spacing-letter .manta-tr-word-container {
  display: inline;
  white-space: nowrap;
  max-width: 100%;
}

/* Spaces must stay collapsible inline content; as inline-blocks they become
   atomic boxes that can wrap to the start of a line and offset the text. */
.manta-tr-el-container[data-manta-tr-space],
.manta-tr-el-container[data-manta-tr-space] .manta-tr-el {
  display: inline;
  white-space: normal;
}

.manta-tr-text-container.manta-tr-alignment-left {
  text-align: left;
}

.manta-tr-text-container.manta-tr-alignment-center {
  text-align: center;
}

.manta-tr-text-container.manta-tr-alignment-right {
  text-align: right;
}

.manta-tr-el-container {
  vertical-align: middle;
  display: inline-block;
  animation-fill-mode: forwards;
  --manta-tr-el-delay: calc(
    ((var(--manta-tr-item-index, sibling-index()) - 1) * var(--manta-tr-item-delay)) + var(--manta-tr-animation-delay)
  );
}

.manta-tr-text-container.manta-tr-ease {
  --manta-tr-transform-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.manta-tr-text-container.manta-tr-linear {
  --manta-tr-transform-timing-function: linear;
}

.manta-tr-text-container.manta-tr-elastic {
  --manta-tr-transform-timing-function: cubic-bezier(0.862, 0.554, 0, 0.995);
}

.manta-tr-text-container.manta-tr-bouncy {
  --manta-tr-transform-timing-function: linear(
    0,
    0.12 8.2%,
    0.195 12.8%,
    0.275 16.9%,
    0.366 20.7%,
    0.47 24.3%,
    0.598 28%,
    0.735 31.5%,
    1 37.8%,
    0.842 41.9%,
    0.786 43.6%,
    0.742 45.2%,
    0.706 46.8%,
    0.682 48.3%,
    0.668 49.8%,
    0.665 50.5%,
    0.664 51.2%,
    0.668 52.5%,
    0.681 53.9%,
    0.702 55.3%,
    0.733 56.8%,
    0.807 59.5%,
    0.999 65.5%,
    0.939 67.7%,
    0.899 69.7%,
    0.885 70.7%,
    0.876 71.6%,
    0.87 72.6%,
    0.868 73.6%,
    0.869 74.4%,
    0.874 75.3%,
    0.892 77.2%,
    0.915 78.9%,
    0.977 82.8%,
    1 84.5%,
    0.987 85.8%,
    0.978 87%,
    0.973 88.2%,
    0.971 89.5%,
    0.975 91.6%,
    0.996 96.8%,
    0.999 98.3%,
    1
  );
}

.manta-tr-text-container.manta-tr-overshoot {
  --manta-tr-transform-timing-function: cubic-bezier(0.837, 2, 0.127, 1.005);
}

.manta-tr-text-container.manta-tr-fade-ease {
  --manta-tr-fade-timing-function: cubic-bezier(0, 1, 0, 1);
}

.manta-tr-text-container.manta-tr-fade-linear {
  --manta-tr-fade-timing-function: linear;
}

.manta-tr-text-container.manta-tr-fade-elastic {
  --manta-tr-fade-timing-function: cubic-bezier(0.862, 0.554, 0, 0.995);
}

.manta-tr-text-container.manta-tr-fade-bouncy {
  --manta-tr-fade-timing-function: linear(
    0,
    0.12 8.2%,
    0.195 12.8%,
    0.275 16.9%,
    0.366 20.7%,
    0.47 24.3%,
    0.598 28%,
    0.735 31.5%,
    1 37.8%,
    0.842 41.9%,
    0.786 43.6%,
    0.742 45.2%,
    0.706 46.8%,
    0.682 48.3%,
    0.668 49.8%,
    0.665 50.5%,
    0.664 51.2%,
    0.668 52.5%,
    0.681 53.9%,
    0.702 55.3%,
    0.733 56.8%,
    0.807 59.5%,
    0.999 65.5%,
    0.939 67.7%,
    0.899 69.7%,
    0.885 70.7%,
    0.876 71.6%,
    0.87 72.6%,
    0.868 73.6%,
    0.869 74.4%,
    0.874 75.3%,
    0.892 77.2%,
    0.915 78.9%,
    0.977 82.8%,
    1 84.5%,
    0.987 85.8%,
    0.978 87%,
    0.973 88.2%,
    0.971 89.5%,
    0.975 91.6%,
    0.996 96.8%,
    0.999 98.3%,
    1
  );
}

.manta-tr-text-container.manta-tr-fade-overshoot {
  --manta-tr-fade-timing-function: cubic-bezier(0.837, 2, 0.127, 1.005);
}

.manta-tr-el-container.manta-tr-reverse {
  --manta-tr-el-delay: calc(
    (
        (var(--manta-tr-total-items, sibling-count()) - var(--manta-tr-item-index, sibling-index())) *
          var(--manta-tr-item-delay)
      ) +
      var(--manta-tr-animation-delay)
  );
}

.manta-tr-grow .manta-tr-el-container,
.manta-tr-slide .manta-tr-el-container,
.manta-tr-wave .manta-tr-el-container {
  opacity: 0;
}

.manta-tr-grow.manta-tr-animated .manta-tr-el-container,
.manta-tr-slide.manta-tr-animated .manta-tr-el-container,
.manta-tr-wave.manta-tr-animated .manta-tr-el-container {
  animation-name: manta-tr-fade;
  animation-duration: var(--manta-tr-fade-duration, var(--manta-tr-animation-duration));
  animation-delay: calc(var(--manta-tr-el-delay) + var(--manta-tr-fade-delay, 0ms));
  animation-timing-function: var(--manta-tr-fade-timing-function);
}

.manta-tr-el {
  display: inline-block;
  animation-fill-mode: forwards;
}

.manta-tr-grow.manta-tr-animated .manta-tr-el,
.manta-tr-slide.manta-tr-animated .manta-tr-el {
  animation-name: manta-tr-grow;
  animation-duration: var(--manta-tr-animation-duration);
  animation-delay: var(--manta-tr-el-delay);
  animation-timing-function: var(--manta-tr-transform-timing-function, ease);
}

@keyframes manta-tr-grow {
  0% {
    transform: scale(calc((200 - var(--manta-tr-animation-intensity)) / 200));
  }
  100% {
    transform: scale(1);
  }
}

@keyframes manta-tr-fade {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

.manta-tr-wave.manta-tr-animated .manta-tr-el {
  animation-name: manta-tr-wave;
  animation-duration: var(--manta-tr-animation-duration);
  animation-delay: var(--manta-tr-el-delay);
  animation-timing-function: var(--manta-tr-transform-timing-function, ease);
}

.manta-tr-wave .manta-tr-el-container {
  overflow: var(--manta-tr-overflow);
}

.manta-tr-wave.manta-tr-direction-up {
  --manta-tr-wave-direction: translate3d(0, calc(var(--manta-tr-animation-intensity) * -0.01em), 0);
}

.manta-tr-wave.manta-tr-direction-down {
  --manta-tr-wave-direction: translate3d(0, calc(var(--manta-tr-animation-intensity) * 0.01em), 0);
}

.manta-tr-wave.manta-tr-direction-left {
  --manta-tr-wave-direction: translate3d(calc(var(--manta-tr-animation-intensity) * -0.01em), 0, 0);
}

.manta-tr-wave.manta-tr-direction-right {
  --manta-tr-wave-direction: translate3d(calc(var(--manta-tr-animation-intensity) * 0.01em), 0, 0);
}

@keyframes manta-tr-wave {
  0% {
    transform: var(--manta-tr-wave-direction);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

.manta-tr-reveal.manta-tr-animated .manta-tr-el {
  animation-name: manta-tr-reveal;
  opacity: 0;
  animation-duration: var(--manta-tr-animation-duration);
  animation-delay: var(--manta-tr-el-delay);
  animation-timing-function: var(--manta-tr-transform-timing-function, ease);
  animation-fill-mode: forwards;
}

.manta-tr-reveal .manta-tr-el-container {
  animation-delay: var(--manta-tr-el-delay);
  animation-duration: var(--manta-tr-animation-duration);
  animation-timing-function: var(--manta-tr-transform-timing-function, ease);
}

.manta-tr-reveal .manta-tr-el-container:not([data-manta-tr-space]) {
  position: relative;
}

.manta-tr-reveal .manta-tr-el-container:not([data-manta-tr-space])::after {
  content: '';
  display: block;
  position: absolute;
  inset: 100%;
  background: var(--manta-tr-reveal-overlay-color);
  background-size: 1000% 100%;
}
.manta-tr-reveal.manta-tr-animated .manta-tr-el-container:not([data-manta-tr-space])::after {
  background-size: 1000% 1000%;
  animation-name: manta-tr-reveal-after;
  animation-timing-function: inherit;
  animation-fill-mode: inherit;
  animation-delay: inherit;
  animation-duration: inherit;
}

@keyframes manta-tr-reveal {
  50% {
    opacity: 0;
  }
  51% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}

.manta-tr-reveal.manta-tr-direction-up {
  --manta-tr-from-inset: 0 0 100% 0;
  --manta-tr-to-inset: 100% 0 0 0;
}
.manta-tr-reveal.manta-tr-direction-down {
  --manta-tr-from-inset: 100% 0 0 0;
  --manta-tr-to-inset: 0 0 100% 0;
}
.manta-tr-reveal.manta-tr-direction-left {
  --manta-tr-from-inset: 0 100% 0 0;
  --manta-tr-to-inset: 0 0 0 100%;
}
.manta-tr-reveal.manta-tr-direction-right {
  --manta-tr-from-inset: 0 0 0 100%;
  --manta-tr-to-inset: 0 100% 0 0;
}

@keyframes manta-tr-reveal-after {
  0% {
    inset: var(--manta-tr-from-inset);
    background-position: 100% 100%;
  }
  50% {
    inset: 0;
  }
  100% {
    inset: var(--manta-tr-to-inset);
    background-position: 0% 0%;
  }
}

.manta-tr-typewriter .manta-tr-el-container,
.manta-tr-typewriter .manta-tr-el-container[data-manta-tr-space] {
  display: inline-block;
  overflow: hidden;
}

/* Typewriter needs spaces as atomic boxes (max-width reveal), so keep
   their width explicitly instead of relying on inline whitespace. */
.manta-tr-typewriter .manta-tr-el-container[data-manta-tr-space],
.manta-tr-typewriter .manta-tr-el-container[data-manta-tr-space] .manta-tr-el {
  white-space: pre;
  display: inline-block;
}

.manta-tr-typewriter .manta-tr-el-container {
  max-width: 0;
  /* Each letter owns a non-overlapping time slot [(n-1)·delay, n·delay). --manta-tr-random-number (0..1)
     only shifts the letter within its own slot, so the gap between keystrokes is random while
     the left-to-right order can never break. */
  animation-delay: calc(
    (var(--manta-tr-item-index, sibling-index()) - 1 + var(--manta-tr-random-number, 0)) * var(--manta-tr-item-delay) +
      var(--manta-tr-animation-delay)
  );
}

.manta-tr-typewriter .manta-tr-el-container.manta-tr-reverse {
  animation-delay: calc(
    (
        var(--manta-tr-total-items, sibling-count()) - var(--manta-tr-item-index, sibling-index()) +
          var(--manta-tr-random-number, 0)
      ) *
      var(--manta-tr-item-delay) + var(--manta-tr-animation-delay)
  );
}

.manta-tr-typewriter .manta-tr-el-container > .manta-tr-el {
  opacity: 1;
}

.manta-tr-typewriter-cursor {
  width: 2px;
  height: 1em;
  margin-left: 0.15em;
  display: inline-block !important;
  background: currentColor;
  vertical-align: middle;
  transform: translateX(-100%);
  animation: manta-tr-typewriter-cursor-idle 1s steps(2, jump-none) infinite;
}

.manta-tr-typewriter.manta-tr-animated .manta-tr-el-container {
  animation-name: manta-tr-typewriter;
}

.manta-tr-typewriter.manta-tr-animated > .manta-tr-typewriter-cursor {
  animation-duration: 1s;
  animation-timing-function: steps(2, jump-none);
  animation-iteration-count: round(
    up,
    calc(
      2 +
        var(
          --manta-tr-typewriter-total-int,
          calc(
            (var(--manta-tr-total-items, sibling-count()) * var(--manta-tr-item-delay-int)) +
              var(--manta-tr-animation-delay-int)
          )
        ) /
        1000
    )
  );
  animation-fill-mode: forwards;
  animation-name: manta-tr-typewriter-cursor;
}

@keyframes manta-tr-typewriter {
  1% {
    max-width: 100%;
  }
  100% {
    max-width: 100%;
  }
}

@keyframes manta-tr-typewriter-cursor-idle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes manta-tr-typewriter-cursor {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Printing: every reveal at its end state, without the typewriter cursor. */
@media print {
  .manta-tr-text-container,
  .manta-tr-text-container *,
  .manta-tr-text-container *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition: none !important;
  }

  .manta-tr-typewriter-cursor {
    display: none !important;
  }
}
