/* Optimized Reviews Section Styles - Performance-focused */

/* Enhanced react-masonry-css Styles with better tablet spacing */
.masonry-grid {
  display: flex;
  margin-left: -2rem;
  width: auto;
  contain: layout style; /* Performance optimization */
}

.masonry-grid_column {
  padding-left: 2rem;
  background-clip: padding-box;
  contain: layout style; /* Performance optimization */
}

.masonry-grid_column > div {
  margin-bottom: 2rem;
}

/* Responsive spacing adjustments with tablet optimization */
@media (max-width: 640px) {
  .masonry-grid {
    margin-left: -1rem;
  }

  .masonry-grid_column {
    padding-left: 1rem;
  }

  .masonry-grid_column > div {
    margin-bottom: 1.5rem;
  }
}

/* Tablet-specific improvements (641px - 1023px) */
@media (min-width: 641px) and (max-width: 1023px) {
  .masonry-grid {
    margin-left: -1.5rem;
  }

  .masonry-grid_column {
    padding-left: 1.5rem;
  }

  .masonry-grid_column > div {
    margin-bottom: 2rem;
  }
}

/* iPad Air specific optimization (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .masonry-grid {
    margin-left: -2rem;
  }

  .masonry-grid_column {
    padding-left: 2rem;
  }

  .masonry-grid_column > div {
    margin-bottom: 2.25rem;
  }
}

/* Large desktop spacing */
@media (min-width: 1280px) {
  .masonry-grid {
    margin-left: -2.5rem;
  }

  .masonry-grid_column {
    padding-left: 2.5rem;
  }

  .masonry-grid_column > div {
    margin-bottom: 2.5rem;
  }
}

/* Ensure smooth transitions for masonry items */
.masonry-item {
  transition: transform 0.3s ease, opacity 0.3s ease;
  width: 100%;
  contain: layout style; /* Performance optimization */
}

/* Mobile Peek + Scroll Styles */
.mobile-reviews-container {
  width: 100%;
  overflow: hidden;
  contain: layout style; /* Performance optimization */
}

.featured-review-container {
  position: relative;
}

.featured-review {
  transform: scale(1);
  transition: transform 0.3s ease;
}

.featured-review:hover {
  transform: scale(1.02);
}

.peek-container {
  position: relative;
  overflow: visible;
}

.peek-reviews-stack {
  position: relative;
}

.peek-review-wrapper {
  position: relative;
  transition: all 0.3s ease;
}

.peek-primary {
  opacity: 0.95;
  transform: translateY(0);
}

.peek-secondary {
  opacity: 0.85;
  transform: translateY(8px);
}

.peek-review {
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.peek-review:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.scroll-hint {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.scroll-hint:hover {
  opacity: 1;
}

.additional-reviews {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth scrolling for mobile */
.mobile-reviews-container {
  scroll-behavior: smooth;
}

/* Enhanced mobile spacing */
@media (max-width: 640px) {
  .featured-review-container {
    margin-bottom: 2rem;
  }

  .peek-reviews-stack {
    gap: 1rem;
  }

  .peek-secondary {
    transform: translateY(4px);
  }

  .scroll-hint {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
  }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 767px) {
  .peek-primary {
    opacity: 1;
  }

  .peek-secondary {
    opacity: 0.9;
    transform: translateY(6px);
  }
}

/* Performance optimizations for all review cards */
.review-card {
  contain: layout style;
  will-change: auto; /* Let browser decide */
}

/* Only hint will-change during hover for transform/opacity */
.review-card:hover {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.review-card:not(:hover) {
  will-change: auto;
}
