/* ══════════════════════════════════════════════════════
   PERFORMANCE CSS
   Skeleton loaders, lazy-load transitions, image optimization
   ══════════════════════════════════════════════════════ */

/* ── SKELETON LOADERS ────────────────────────────────── */

.skeleton-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.skeleton-img {
  width: 100%;
  height: 180px;
  background: #f0ece3;
}

.skeleton-body {
  padding: 16px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: #f0ece3;
  margin-bottom: 10px;
}

.skeleton-line-sm { width: 40%; height: 10px; }
.skeleton-line-lg { width: 85%; height: 16px; }
.skeleton-line-md { width: 70%; }

.skeleton-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.skeleton-price {
  width: 60px;
  height: 20px;
  border-radius: 6px;
  background: #f0ece3;
}

.skeleton-btn {
  width: 70px;
  height: 32px;
  border-radius: 16px;
  background: #f0ece3;
}

/* Pulse animation */
.skeleton-pulse {
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* ── LAZY-LOAD IMAGE TRANSITIONS ─────────────────────── */

img[data-src] {
  opacity: 0;
  transition: opacity 0.4s ease;
}

img.loaded,
img[loading="lazy"] {
  opacity: 1;
}

/* Prevent layout shift for images */
img {
  max-width: 100%;
  height: auto;
}

/* Product image container aspect ratio */
.product-image-container {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 aspect ratio */
  overflow: hidden;
  border-radius: 12px;
  background: #f9f7f2;
}

.product-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.4s ease;
}

.product-image-container img:hover {
  transform: scale(1.05);
}

/* ── CONTENT-VISIBILITY OPTIMIZATION ─────────────────── */

.below-fold {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/* ── REDUCED MOTION ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .skeleton-pulse { animation: none; opacity: 0.6; }
  img[data-src] { transition: none; }
  .product-image-container img { transition: none; }
}

/* ── PRINT OPTIMIZATION ──────────────────────────────── */

@media print {
  .skeleton-card { display: none; }
  .icon-action-bar { display: none; }
}
