.main-img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  background-position: center center;
  contain: paint;
  content-visibility: auto;
  aspect-ratio: 3/1;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.title_over {
  font-size: 28px;
  font-weight: 200;
  padding-left: 5px;
  padding-right: 5px;
}
.descr_over {
  font-size: 18px;
  font-weight: 200;
  padding-left: 5px;
  padding-right: 5px;
  padding-bottom: 5px;
}
@media (min-width: 125px) {
  .main-img {
    height: 350px;
  }
}
@media (min-width: 425px) {
  .main-img {
    height: 300px;
  }
}
@media (min-width: 768px) {
  .main-img {
    height: 350px;
  }
}
@media (min-width: 1024px) {
  .main-img {
    height: 400px;
  }
}
@media (min-width: 1140px) {
  .main-img {
    height: 400px !important;
  }
}

/* Gallery Grid Styling */
/* Styles for the content loaded into #gallery-container by gallery_data.php */

#gallery-container .gallery-thumb {
  /* This element is a direct child of .row.g-1 and acts as a column. */
  box-sizing: border-box; /* Crucial for width/padding calculations. */

  /* For approximately 6 thumbnails across (100% / 6 = 16.666%) */
  width: 16.666%;

  /* The .g-1 utility on the parent .row adds padding to this element for gutters.
     So, no explicit margin is needed on .gallery-thumb for spacing. */
}

#gallery-container .gallery-thumb .gallery-link {
  display: block;
  width: 100%;
  height: 100%; /* Ensures link fills the fixed height of the thumb if image has fixed height */
  text-decoration: none;
  overflow: hidden; /* Important for child image's border-radius to be visible */
  /* If you want the link itself to have rounded corners (matching image): */
  border-radius: var(--bs-border-radius-sm, 0.2rem); /* Bootstrap's small border radius */
}

#gallery-container .gallery-thumb .gallery-image {
  display: block; /* Removes extra space beneath the image. */
  width: 100%; /* Image fills its container (.gallery-link). */

  /* For fixed height thumbnails where images cover the area (like in Image 1) */
  height: 80px; /* Adjust this value to your desired thumbnail height. */
  object-fit: cover; /* Scales image to fill, cropping if necessary. */
  object-position: center; /* Centers the image within the crop. */
  border-radius: var(--bs-border-radius-sm, 0.2rem); /* Rounded corners for the image. */
}

/* Responsive adjustments for the gallery grid */
@media (max-width: 1200px) {
  /* Bootstrap xl breakpoint */
  #gallery-container .gallery-thumb {
    width: 20%; /* 5 columns */
  }
  #gallery-container .gallery-thumb .gallery-image {
    height: 75px; /* Adjust height if desired */
  }
}

@media (max-width: 992px) {
  /* Bootstrap lg breakpoint */
  #gallery-container .gallery-thumb {
    width: 25%; /* 4 columns */
  }
  #gallery-container .gallery-thumb .gallery-image {
    height: 70px; /* Adjust height if desired */
  }
}

@media (max-width: 768px) {
  /* Bootstrap md breakpoint */
  #gallery-container .gallery-thumb {
    width: 33.333%; /* 3 columns */
  }
  #gallery-container .gallery-thumb .gallery-image {
    height: 65px; /* Adjust height if desired */
  }
}

@media (max-width: 576px) {
  /* Bootstrap sm breakpoint */
  #gallery-container .gallery-thumb {
    width: 50%; /* 2 columns */
  }
  #gallery-container .gallery-thumb .gallery-image {
    height: 60px; /* Adjust height if desired */
  }
}

/* Styles for loading/error messages within the gallery */
#gallery-container .loading,
#gallery-container .error-message {
  width: 100%;
  text-align: center;
  padding: 1rem; /* Use CSS variables from :root if defined, e.g., var(--space-md) */
}

#gallery-container .ajax-error-details {
  font-size: 0.875em;
  max-height: 100px;
  overflow-y: auto;
  border: 1px solid var(--bs-border-color, #dee2e6); /* Bootstrap border color */
  padding: 0.5rem; /* Use CSS variables from :root if defined */
  margin-top: 0.5rem;
  text-align: left;
  word-break: break-all;
  background-color: var(--bs-tertiary-bg, #f8f9fa); /* Bootstrap tertiary background */
  border-radius: var(--bs-border-radius-sm, 0.2rem);
}

.single-listing-image-outer {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--bg-color);
  contain: paint;
}
