/* Container for the hover effect */
.image-hover-container {
  position: relative; /* This is crucial for positioning the text over the image */
  display: inline-block; /* Makes the container wrap the image size */
  text-decoration: none; /* Removes the default link underline */
}

/* The image itself */
.hover-image {
  display: block; /* Removes any extra space below the image */
  width: 100%;
  height: auto;
  transition: filter 0.3s ease-in-out; /* Smooth transition for the darkening effect */
}

/* The text overlay */
.hover-text {
  position: absolute; /* Lifts the text up to be placed over the image */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* The magic trick to perfectly center the text */
  
  color: white;
  font-size: 1.5rem; /* Adjust size as needed */
  font-weight: bold;
  text-align: center;
  
  opacity: 0; /* The text is completely transparent by default */
  transition: opacity 0.3s ease-in-out; /* Smooth transition for the text fade-in */
}

/* --- The Hover Effects --- */

/* When you hover over the container, darken the image */
.image-hover-container:hover .hover-image {
  filter: brightness(50%); /* Darkens the image to 50% brightness */
}

/* When you hover over the container, make the text visible */
.image-hover-container:hover .hover-text {
  opacity: 1; /* Fades the text in to be fully visible */
}

/* --- 1. The Gallery Grid Layout --- */

.cat-gallery-grid {
  display: grid;
  /* Creates responsive columns: they are at least 150px wide, but grow to fill space */
  grid-template-columns: repeat(auto-fill, 350px);
  /* Sets the height of a standard grid row */
  grid-auto-rows: 150px;
  gap: 10px; /* The space between your photos */
}

/* --- 2. The Item Sizing --- */

/* Make an item span two columns */
.grid-item--width-2 {
  grid-column: span 2;
}

/* Make an item span two rows */
.grid-item--height-2 {
  grid-row: span 2;
}

/* --- 3. The Hover Effect (Updated for the grid) --- */

.image-hover-container {
  position: relative;
  display: block; /* Use block to fill the grid area */
  text-decoration: none;
}

.hover-image {
  display: block;
  /* Make the image fill its container, cropping if necessary */
  width: 100%;
  height: 100%;
  object-fit: cover; 
  transition: filter 0.3s ease-in-out;
}

.hover-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* The hover actions */
.image-hover-container:hover .hover-image {
  filter: brightness(50%);
}

.image-hover-container:hover .hover-text {
  opacity: 1;
}
