/* CLS (Cumulative Layout Shift) Optimization CSS */

/* Image loading optimization */
img[width][height] {
  aspect-ratio: attr(width) / attr(height);
}

/* Gallery specific optimizations */
.galleryGrid {
  contain: layout style paint;
}

.galleryGrid.-type-2 {
  grid-template-columns: 0.6fr 0.2fr 0.2fr;
  grid-template-rows: 0.4fr 0.6fr;
  min-height: 300px;
  aspect-ratio: 16/9;
}

@media (max-width: 991px) {
  .galleryGrid.-type-2 {
    grid-template-columns: 1fr 1fr 1fr;
    min-height: 250px;
  }
}

@media (max-width: 767px) {
  .galleryGrid.-type-2 {
    grid-template-columns: 1fr 1fr;
    min-height: 200px;
  }
}

@media (max-width: 575px) {
  .galleryGrid.-type-2 {
    grid-template-columns: 1fr;
    min-height: 150px;
  }
}

.galleryGrid.-type-3 {
  grid-template-columns: 0.2fr 0.2fr 0.2fr;
  grid-template-rows: 0.4fr 0.6fr;
  min-height: 200px;
  aspect-ratio: 3/2;
}

@media (max-width: 991px) {
  .galleryGrid.-type-3 {
    grid-template-columns: 1fr 1fr 1fr;
    min-height: 180px;
  }
}

.galleryGrid__item {
  contain: layout style paint;
  border-radius: 1rem;
  overflow: hidden;
  background-color: #f8f9fa;
  transition: transform 0.3s ease;
}

.galleryGrid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

/* Ensure LCP images are immediately visible and not lazy loaded */
.galleryGrid__item img[fetchpriority="high"] {
  loading: eager !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Prevent layout shift from font loading */
.text-loading {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  visibility: hidden;
}

.text-loaded {
  visibility: visible;
}

/* Section spacing optimization */
.pt-40 {
  padding-top: 2.5rem;
  min-height: 3rem;
}

.pb-60 {
  padding-bottom: 3.75rem;
}

.py-10 {
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
  min-height: 1.25rem;
}

.mb-60 {
  margin-bottom: 3.75rem;
}

/* Loading states to prevent jumps */
.loading-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Form input stability */
.searchMenu-date {
  min-height: 60px;
  contain: layout;
}

/* Button stability */
.button {
  contain: layout style;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Container width stability */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding-left: 15px;
  padding-right: 15px;
}

/* Responsive image containers */
.hero {
  min-height: 400px;
  contain: layout;
}

@media (max-width: 768px) {
  .hero {
    min-height: 300px;
  }
}

/* Prevent flash of unstyled content */
.flash-prevent {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.flash-prevent.loaded {
  opacity: 1;
}
