.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    grid-gap: 0; /* No gap between images */
}

.gallery-item {
    position: relative;
    width: 100%; /* Full width of the column */
    padding-top: 100%; /* Equal width and height for square aspect ratio */
    overflow: hidden; /* Ensures the image stays within the bounds of the container */
    background-size: cover; /* Cover ensures the image fills the container */
    background-position: center; /* Centers the image within the container */
    text-decoration: none; /* Optional: removes underline from links */
}

.gallery-item .title {
    position: absolute;
    top: 50%; /* Centered vertically */
    left: 50%; /* Centered horizontally */
    transform: translate(-50%, -50%); /* Adjust position to truly center */
    color: white;
    text-align: center;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.5s ease;
    z-index: 2; /* Ensure the title is above the overlay */
    font-size: 16px; /* Adjust font size as needed */
    width: 80%;
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7); /* Semi-transparent black background */
    opacity: 0; /* Initially hidden */
    transition: opacity 0.5s ease;
    z-index: 1; /* Below the title */
}
.gallery .title {
  font-size: 28px;
  font-weight: 800;
}
.gallery-item:hover::after,
.gallery-item:hover .title {
    opacity: 1; /* Show overlay and title on hover */
}
.gallery .title small {
  font-size: 20px;
  font-weight: 400;
}

.gallery .excerpt {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFF;
  width: 80%;
}
#cm-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox-content {
    width: 70%;
    height: 80%;
    background: #fff;
    position: relative;
}

.lightbox-content iframe {
    width: 100%;
    height: 100%;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #FFF;
    font-size: 1.5em;
}
@media (max-width: 768px) { /* Adjust the max-width as needed for your breakpoint */
    .gallery {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on smaller screens */
    }
}
@media (max-width: 480px) { /* Adjust the max-width as needed for your breakpoint */
  .cm_portfolio_items-template-default h1 {
    font-size: 23px;
    line-height: 26px;
    margin-left: 10px!important;
    margin-right: 10px!important;
  }
  .gallery .title {
    font-size: 24px;
    font-weight: 700;
    line-height: 27px;
  }
  .ct-text-block {
    margin-left: 12px!important;
    margin-right: 12px!important;
    margin-bottom: 20px!important;
    margin-top: 10px!important;
  }
  .text-emphasize {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 30px!important;
    padding: 25px 15px!important;
  }
}