@use "../../foundations/helpers/forward.helpers.scss" as *;

.ds-teaser-dot {
  --ds-teaser-dot-size: #{ds-px-to-rem(10px)};

  @at-root .ds-force-px#{&} {
    --ds-teaser-dot-size: 10px;
  }

  display: inline-block;
  box-sizing: border-box;
  position: relative;
  height: var(--ds-teaser-dot-size);
  width: var(--ds-teaser-dot-size);
  margin-right: calc(var(--ds-teaser-dot-size) * 0.1);
  color: $ds-theme-color;

  @media (prefers-reduced-motion: no-preference) {
    &.ds-teaser-dot--flashing {
      animation: dot-pulse 2s ease infinite;
    }
    &.ds-teaser-dot--flashing::after {
      animation: ripple-pulse 2s linear infinite;
    }
  }

  &::after,
  &.ds-teaser-dot--flashing::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    transform-origin: 50% 50%;
    background-color: currentColor;
    border-radius: 50%;
  }
}

@keyframes dot-pulse {
  0% {
    transform: scale(0.95);
  }

  70% {
    transform: scale(1);
  }

  100% {
    transform: scale(0.95);
  }
}

@keyframes ripple-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.4;
  }

  70% {
    transform: scale(2);
    opacity: 0;
  }

  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}
