/* ########## Glitch text reveal ########## */

.word {
  position: relative;
  display: inline-block;
}

[data-char] {
    color: transparent !important;
    position: relative;

    &::after {
        content: attr(data-char);
        position: absolute;
        top: 0;
        left: 0;

        color: white;
        visibility: visible !important;
        animation-duration: 0.2s;
        animation-delay: 0.1s;
        animation-timing-function: steps(1);
        animation-fill-mode: backwards;
    }
}

a [data-char]::after, button [data-char]::after  {
  color: var(--theme-color-light);
  font-family: "Bitcount Grid Double", 'Courier New', Courier, monospace;
}

h1 [data-char]::after {
  color: white;
  font-family: "Motorblock", "Bitcount Grid Double", 'Courier New', Courier, monospace;
}

h1 [data-char] {
  font-family: "Motorblock", "Bitcount Grid Double", 'Courier New', Courier, monospace;
}

h2 [data-char]::after {
  color: white;
  font-family: "Motorblock", 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

h2 [data-char] {
  font-family: "Motorblock", 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

h3 [data-char]::after {
  color: white;
  font-family: "Motorblock", "Bitcount Grid Double", 'Courier New', Courier, monospace;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

h3 [data-char] {
  font-family: "Motorblock", "Bitcount Grid Double", 'Courier New', Courier, monospace;
}

.kretsian_container {
  h2 [data-char]::after {
    text-decoration: underline;
  }

  h5 [data-char]::after {
    font-family: "Bitcount Grid Double", 'Courier New', Courier, monospace;
    font-style: italic;
  }

  b [data-char]::after {
    font-family: "Bitcount Grid Double", 'Courier New', Courier, monospace;
    font-style: italic;
    font-weight: 400;
    text-decoration: underline;
  }
}

b {
  &.kretsn7EA [data-char]::after {
    animation-duration: 0.5s;
    animation-delay: 0.25s;
  }
}

.main-text {
  p {
    b [data-char] {
      color: white
    }
  }
}

.splitting .word {
  display: inline;
}

.splitting .char {
  display: inline;
}

// Trigger animation when ScrollOut detects element in viewport
[data-scroll='out'] [data-char]::after {
    animation-name: none;
}

[data-scroll='in'] [data-char]::after {
    animation-name: glitch-switch;
    animation-duration: 0.2s;
    animation-timing-function: steps(1);
    animation-iteration-count: calc((var(--char-index) / var(--char-total)) * 4 + 1);
}


a:hover [data-char]::after {
  animation: glitch-switch 0.2s steps(1);
  animation-iteration-count: 1;
  font-weight: 700;
}

.glitching {
  [data-char]::after {
    animation: glitch-switch 0.1s steps(1);
    animation-iteration-count: 1;
  }

  &#password-submit [data-char]::after {
    animation: glitch-switch 0.2s steps(1);
    animation-iteration-count: 20;
  }
}

#button_nolleenkat:hover [data-char]::after {
    animation: glitch-switch 0.3s steps(1);
    animation-iteration-count: 1;
}

// animation variants
.reveal--0 {
  [data-char]::after {
    animation-iteration-count: calc((var(--char-index) / var(--char-total)) * 4 + 1);
  }
}

.reveal--1 {
  [data-char]::after {
    animation-iteration-count: 4;
  }
}

.reveal--2 {
  [data-char]::after {
    animation-iteration-count: var(--count);
  }
}

.reveal--3 {
  [data-char]::after {
    animation-iteration-count: calc((var(--char-index) / var(--char-total)) * 1 + 1);
  }
}


@keyframes glitch-switch {
  0% {
    content: var(--char-0);
  }

  10% {
    content: var(--char-1);
  }

  20% {
    content: var(--char-2);
  }

  30% {
    content: var(--char-3);
  }

  40% {
    content: var(--char-4);
  }

  50% {
    content: var(--char-5);
  }

  60% {
    content: var(--char-6);
  }

  70% {
    content: var(--char-7);
  }

  80% {
    content: var(--char-8);
  }

  90% {
    content: var(--char-9);
  }

  100% {
    content: var(--char-0);
  }
}