.gallery-masonry {
    width: 100%;
    max-width: 1200px;
    column-count: 4; /* Masonry effect */
    column-gap: 16px; /* Space between columns */
  }
  
  @media (max-width: 992px) {
    .gallery-masonry {
      column-count: 3;
    }
  }
  
  @media (max-width: 768px) {
    .gallery-masonry {
      column-count: 2;
    }
  }

  @media (max-width: 550px) {
    .gallery-masonry {
      column-count: 1;
    }
  }
  
  .gallery-masonry-item {
    break-inside: avoid; /* Prevent images from breaking across columns */
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 8px;
    background: #ddd;
  }
  
  .gallery-masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    cursor: pointer; /* Indicate clickable items */
  }
  
  /* Popup Styles */
  .gallery-masonry-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
  }
  
  .gallery-masonry-popup.active {
    visibility: visible;
    opacity: 1;
  }
  
  .gallery-masonry-popup-image {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
  }
  
  .gallery-masonry-popup-caption {
    margin-top: 16px;
    color: white;
    font-size: 1rem;
    text-align: center;
    max-width: 90%;
  }
  
  .gallery-masonry-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
  }
  
  /**
    * backend only ----------------------------------------------------------------
    */
  
  /* Masonry Layout */
  body.wp-admin .is-style-masonry-layout {
    width: 100%;
    max-width: 1200px;
    column-count: 4; /* Masonry effect */
    column-gap: 16px; /* Space between columns */
  }
  
  @media (max-width: 992px) {
    body.wp-admin .is-style-masonry-layout {
      column-count: 3;
    }
  }
  
  @media (max-width: 768px) {
    body.wp-admin .is-style-masonry-layout {
      column-count: 2;
    }
  }

  @media (max-width: 550px) {
    body.wp-admin .is-style-masonry-layout {
      column-count: 1;
    }
  }
  
  body.wp-admin figure.is-style-masonry-layout.wp-block-gallery.has-nested-images {
    display: block;
    align-items: flex-start;
  }
  
  body.wp-admin .is-style-masonry-layout .wp-block-image {
    break-inside: avoid; /* Prevent images from breaking across columns */
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 8px;
    background: #ddd;
  }
  
  body.wp-admin figure.is-style-masonry-layout.wp-block-gallery.has-nested-images.columns-default figure.wp-block-image:not(#individual-image) {
    width: 100%;
    margin-bottom: 10px;
  }
  
  body.wp-admin .is-style-masonry-layout .wp-block-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    cursor: pointer; /* Indicate clickable items */
  }