@property --animationValue {
  inherits: true;
  initial-value: 0;
  syntax: "<number>";
}

@property --animationAngle {
  inherits: true;
  initial-value: 0deg;
  syntax: "<angle>";
}

@keyframes accentBorderAnimation {
  to {
    --animationValue: 100;
  }
}

@keyframes rotateAnimation {
  0% {
    --animationAngle: 0deg;
  }
  25% {
    --animationAngle: 90deg;
  }
  50% {
    --animationAngle: 180deg;
  }
  75% {
    --animationAngle: 270deg;
  }
  100% {
    --animationAngle: 360deg;
  }
}

@keyframes cardSlide {
  from {
    translate: 0 20%;
    opacity: 0;
  }
  to {
    translate: 0 0;
    opacity: 1;
  }
}

/* accentBorder */

[data-animation="accentBorder"] {
  --corner: calc(1% * var(--animationValue, 0));
  --border-size: var(--animation-size, 3px);
  --border-color: var(--animation-color, var(--color-main));
  position: relative;
  overflow: visible !important;
  animation: accentBorderAnimation 2s ease-out infinite;
}

[data-animation="accentBorder"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  width: calc(100% + calc(var(--border-size) * 2));
  height: calc(100% + calc(var(--border-size) * 2));
  background-image: conic-gradient(
    var(--border-color) var(--corner),
    transparent var(--corner)
  );
  border-radius: calc(var(--border-radius) + 2px);
}

@media (max-width: 1024px) {
  [data-template="banner"] .banner .bannerPicture[data-animation="accentBorder"] {
    width: calc(100vw - calc(var(--gap-size) * 2));
    margin: 0 auto;
    border-radius: var(--border-radius);
  }
}

/* accentHeader */

[data-animation="accentHeader"] {
  --text-color: var(--animation-color, var(--color-text-main));
  align-self: start;
  display: inline-block;
  margin: 0 auto;
  background-image: linear-gradient(var(--animationAngle), var(--color-main), var(--text-color));
  background-clip: text;
  color: transparent !important;
  animation: rotateAnimation 5s ease-out infinite;
}

/* cardSlide */

[data-animation="cardSlide"] {
  --index: sibling-index();
  --count: sibling-count();
  --entry-start: -300%;
  --entry-step: calc((100% - var(--entry-start)) / (var(--count) + 1));
  --entry: calc(var(--entry-start) + var(--index) * var(--entry-step));
  animation: cardSlide 1ms ease-out both;
  animation-timeline: view(block);
  animation-range: entry var(--entry) contain 50%;
}

/* intersectionObserver section--visible */

/* sectionOpacity  */

section[data-animation="sectionOpacity"] {
  opacity: 0;
  transition: opacity 500ms linear;
}

section[data-animation="sectionOpacity"].section--visible {
  opacity: 1;
}

/* shakeAnimation */

@keyframes shakeAnimation {
  0% {
    transform: translateX(-20px);
  }
  25% {
    transform: translateX(20px);
  }
  50% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
  100% {
    transform: translateX(0);
  }
}

section[data-animation="shakeAnimation"].section--visible {
  animation: shakeAnimation 1s;
  animation-delay: 300ms;
}

/* sectionRotate */

@keyframes sectionRotate {
  0% {
    transform: rotate(2deg);
  }
  25% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(1deg);
  }
  75% {
    transform: rotate(-1deg);
  }
  100% {
    transform: rotate(0);
  }
}

section[data-animation="sectionRotate"].section--visible {
  animation: sectionRotate 600ms;
  animation-delay: 300ms;
  animation-iteration-count: 1;
}