/* ==========================================
   MEDIA OPTIMIZATION
   ========================================== */

/* Image Loading Optimization */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

img[loading="lazy"] {
  opacity: 0;
  animation: fadeInImage 0.5s ease-in forwards;
}

@keyframes fadeInImage {
  to {
    opacity: 1;
  }
}

/* Video Optimization */
video {
  background: linear-gradient(135deg, #FAF6F0 0%, #F0E8D8 100%);
}

/* Сакриј volume контроле - видео увек без звука */
video::-webkit-media-controls-mute-button {
  display: none;
}

video::-webkit-media-controls-volume-slider {
  display: none;
}

video::-webkit-media-controls-panel {
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), rgba(0,0,0,0.7));
}

/* Lazy Load Placeholder */
.lazy-placeholder {
  background: linear-gradient(135deg, #FAF6F0 0%, #F0E8D8 100%);
  position: relative;
  overflow: hidden;
}

.lazy-placeholder::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(212, 175, 55, 0.1) 50%, 
    transparent 100%
  );
  animation: shimmerAnimation 2s infinite;
}

@keyframes shimmerAnimation {
  to {
    left: 100%;
  }
}

/* Video Container Optimization */
.video-container {
  position: relative;
  background: #1a1816;
  border-radius: 1rem;
  overflow: hidden;
}

.video-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(212, 175, 55, 0.1), transparent);
  pointer-events: none;
  z-index: 1;
}

/* Responsive Video */
.aspect-video {
  aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
  .aspect-video {
    padding-bottom: 56.25%; /* 16:9 fallback */
    height: 0;
    position: relative;
  }
  
  .aspect-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

/* Preload Critical Images */
@media (prefers-reduced-motion: no-preference) {
  img[data-priority="high"] {
    content-visibility: auto;
  }
}

/* Performance Hints */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* GPU Acceleration for Videos */
video {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  img[loading="lazy"],
  video {
    animation: none;
    transition: none;
  }
}

