/**
 * AI Perf Optimizer - Lazy Loading Helpers
 * Purpose: Prevent CLS with proper placeholders and smooth transitions
 */

/* Base styles for lazy-loaded background sections */
.lazy-bg, [data-bg] {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 60vh;
  contain-intrinsic-size: 1200px 700px; /* Reduces layout shift */
}

/* LQIP (Low Quality Image Placeholder) blur effect */
.lqip-blur {
  filter: blur(12px);
  transform: scale(1.02);
  transition: filter 0.4s ease, transform 0.4s ease, opacity 0.3s;
}

/* Ready state after full image loads */
.lqip-ready {
  filter: none;
  transform: none;
  opacity: 1;
}

/* Embed placeholder container (YouTube/Maps) */
.embed-lazy {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9; /* Adjust based on your needs */
  background: #111;
  overflow: hidden;
  cursor: pointer;
}

.embed-lazy img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.embed-lazy .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 16px/1 system-ui, sans-serif;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  transition: background 0.3s ease;
}

.embed-lazy:hover .play {
  background: rgba(0, 0, 0, 0.4);
}

/* Additional utility classes */
.embed-lazy iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
