.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-gap: 12px;
}

.masonry-item {
    background-color: #f7f9fc;
    position: relative;
    overflow: hidden;
   opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.masonry-item:nth-child(1) {
    animation-delay: 0.3s;
}

.masonry-item:nth-child(2) {
    animation-delay: 0.6s;
}

.masonry-item a {
    display: block;
    position: relative;
}

.masonry-item a img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.masonry-item .post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f1f1f1; /* Set your desired background color */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.masonry-item:hover .post-overlay {
    opacity: 0.8;
}

.masonry-item .post-content {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 20px;
    color: #fff; /* Set your desired text color */
}

.masonry-item h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.masonry-item .entry-content {
    margin-top: 10px;
    font-size: 14px;
}

.masonry-content {
    padding: 6px;
    width: calc(100% - 24px);
}

.masonry-image {
    position: relative;
    width: 100%;
    padding-bottom: 9%; /* Adjust the aspect ratio as needed */
    width: calc(100% - 12px);
    height: auto;
    margin: 6px;

    img {
        position: absolute;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.masonry-image img {
    transition: transform 0.9s ease;
}

.masonry-image img:hover {
    transform: scale(1.03) rotate(+0.6deg);
}

.masonry-navigation {
  text-align: center;
  margin-top: 20px;
}

.masonry-prev,
.masonry-next {
  display: inline-block;
  padding: 5px 10px;
  background-color: #f2f2f2;
  border-radius: 5px;
  margin: 0 5px;
}

.masonry-prev:hover,
.masonry-next:hover {
  background-color: #e0e0e0;
}

.masonry-prev a,
.masonry-next a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

.masonry-navigation {
  text-align: center;
  margin-top: 20px;
}

.masonry-navigation a {
  display: inline-block;
  padding: 5px 10px;
  margin-right: 36px; /* Adjust the margin-right value to increase or decrease the spacing */
  background-color: #f5f5f5;
  color: #333;
  text-decoration: none;
  border: 0.3px solid #ccc;
  border-radius: 3px;
}

.masonry-navigation a:last-child {
  margin-right: 0; /* Remove the margin-right from the last button to avoid extra space */
}

.masonry-navigation a:hover {
  background-color: #e0e0e0;
}