/* Enhanced Gallery Image Sizing */

/* Improve gallery card sizing and image fitting */
.gallery-card {
  aspect-ratio: 4 / 3;
  min-height: 280px;
  background-color: #f0f7fc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background-color: #ffffff;
  box-sizing: border-box;
}

/* Match the simpler browsing layout on the dedicated gallery page */
#gallery .gallery-card {
  min-height: 220px !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

#gallery .gallery-card img {
  object-fit: cover !important;
  padding: 0 !important;
  background-color: transparent !important;
}

#gallery .gallery-card:hover {
  transform: none !important;
  box-shadow: none !important;
}

#gallery .gallery-overlay {
  display: none !important;
}

#gallery.gallery,
#gallery {
  margin-top: 0 !important;
}

#gallery .gallery-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: 1.5rem !important;
}

#plans-grid .gallery-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 2rem !important;
}

#plans-grid.gallery {
  margin-top: 0 !important;
  padding: 1.5rem !important;
  border-radius: 24px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.98)) !important;
  box-shadow: 0 24px 60px rgba(15, 29, 53, 0.12) !important;
}

#plans-grid .gallery-card {
  min-height: 220px !important;
  background: #ffffff !important;
  border: 1px solid rgba(20, 33, 56, 0.08) !important;
  box-shadow: 0 16px 36px rgba(15, 29, 53, 0.08) !important;
}

#plans-grid .gallery-card img {
  object-fit: cover !important;
  padding: 0 !important;
  background: transparent !important;
}

#plans-grid .gallery-overlay {
  background: linear-gradient(180deg, rgba(7, 12, 22, 0.04), rgba(7, 12, 22, 0.76)) !important;
}

/* Create two distinct sizes for better visual balance */
@media (min-width: 900px) {
  .gallery-grid .gallery-card:nth-child(-n+2) {
    grid-column: span 2;
    grid-row: span 2;
  }
  
  .gallery-grid .gallery-card:nth-child(-n+2) img {
    object-fit: contain;
  }

  #gallery .gallery-grid .gallery-card:nth-child(-n+2) {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }

  #plans-grid .gallery-grid .gallery-card:nth-child(-n+2) {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
}

/* Medium screen adjustments */
@media (max-width: 900px) {
  .gallery-card {
    min-height: 240px;
  }
}

/* Mobile adjustments */
@media (max-width: 520px) {
  #gallery .gallery-grid {
    gap: 1rem !important;
  }

  #plans-grid .gallery-grid {
    gap: 1.25rem !important;
  }

  #plans-grid.gallery {
    padding: 1rem !important;
  }

  .gallery-card {
    aspect-ratio: 3 / 4;
    min-height: auto;
  }
  
  .gallery-card img {
    object-fit: contain;
  }
}
