.lk-profile__avatar-wrapper,
.user__avatar-wrapper {
  position: relative;
}

.lk-profile__avatar-wrapper.image-loading::before,
.user__avatar-wrapper.image-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--prime, #ffcc00);
  border-radius: 50%;
  animation: image-loader-spin 0.8s linear infinite;
  z-index: 10;
  pointer-events: none;
}

.lk-profile__avatar-wrapper.image-loading::after,
.user__avatar-wrapper.image-loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  z-index: 9;
  pointer-events: none;
}

.lk-profile__avatar-wrapper.image-loading .lk-profile__img,
.user__avatar-wrapper.image-loading img:not(.user__avatar-frame):not(.lk-profile__frame) {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.lk-profile__avatar-wrapper.image-loaded .lk-profile__img,
.user__avatar-wrapper.image-loaded img:not(.user__avatar-frame):not(.lk-profile__frame) {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.lk-profile__avatar-wrapper.image-error .lk-profile__img,
.user__avatar-wrapper.image-error img:not(.user__avatar-frame):not(.lk-profile__frame) {
  opacity: 0.6;
  filter: grayscale(0.5);
}

.lk-profile__frame,
.user__avatar-frame {
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lk-profile__avatar-wrapper.image-loading .lk-profile__frame,
.user__avatar-wrapper.image-loading .user__avatar-frame {
  opacity: 0.3;
}

.lk-profile__avatar-wrapper.image-loaded .lk-profile__frame,
.user__avatar-wrapper.image-loaded .user__avatar-frame {
  opacity: 1;
}

@keyframes image-loader-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.lk-profile__img[src*="user.svg"],
img[src*="user.svg"] {
  object-fit: contain;
  padding: 10%;
}

.lk-profile__img[src*=".gif"],
.user__avatar img[src*=".gif"]:not(.user__avatar-frame) {
  transition: none !important;
  opacity: 1 !important;
  filter: none !important;
}

.lk-profile__frame[src*=".gif"],
.user__avatar-frame[src*=".gif"] {
  transition: none !important;
  opacity: 1 !important;
  filter: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .lk-profile__avatar-wrapper.image-loading::before,
  .user__avatar-wrapper.image-loading::before {
    animation: none;
    opacity: 0.8;
  }
  
  .lk-profile__img,
  .user__avatar img,
  .lk-profile__frame,
  .user__avatar-frame {
    transition: none;
  }
}

