/**
 * Ava Lazy Load - Public Styles
 *
 * Styles for lazy loaded images on the frontend
 *
 * @package AvaLazy
 * @since   1.0.0
 */

/* Base lazy load styles */
.ava-lazy {
  opacity: 0;
  transition: opacity 300ms ease-in-out;
  will-change: opacity;
}

.ava-lazy.loaded {
  opacity: 1;
}

.ava-lazy.load-error {
  opacity: 0.5;
  filter: grayscale(100%);
}

/* Loading spinner */
.ava-lazy-wrapper {
  position: relative;
  display: inline-block;
  background-color: #f0f0f1;
}

.ava-lazy-wrapper::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: ava-lazy-spin 0.8s linear infinite;
  z-index: 1;
}

.ava-lazy-wrapper.loaded::before {
  display: none;
}

/* Spinner animation */
@keyframes ava-lazy-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Fade in animation variants */
.ava-lazy.fade-fast {
  transition-duration: 150ms;
}

.ava-lazy.fade-slow {
  transition-duration: 600ms;
}

/* Blur effect while loading */
.ava-lazy.blur-up {
  filter: blur(10px);
  transition: filter 300ms ease-in-out, opacity 300ms ease-in-out;
}

.ava-lazy.blur-up.loaded {
  filter: blur(0);
}

/* Responsive image container */
.ava-lazy-container {
  position: relative;
  overflow: hidden;
  background-color: #f0f0f1;
}

.ava-lazy-container::after {
  content: '';
  display: block;
  padding-bottom: 56.25%; /* 16:9 aspect ratio by default */
}

.ava-lazy-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Noscript fallback */
noscript img {
  opacity: 1 !important;
}

/* Print styles */
@media print {
  .ava-lazy {
    opacity: 1 !important;
  }
  
  .ava-lazy-wrapper::before {
    display: none !important;
  }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ava-lazy {
    transition-duration: 0.01ms !important;
  }
  
  .ava-lazy-wrapper::before {
    animation: none !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .ava-lazy-wrapper {
    background-color: #1e1e1e;
  }
  
  .ava-lazy-wrapper::before {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #4a9eff;
  }
}

