/* Blog Posts Masonry Block Styles */
.gingerup-blog-posts-masonry {
  max-width: 1200px;
  margin: 0 auto;
}

.blog-masonry-title {
  font-family: "Lexend", sans-serif;
  font-weight: 600;
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
}

.masonry-container {
  display: flex;
  gap: 20px;
  align-items: start;
}

.masonry-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* Masonry item variations */
.masonry-item {
  break-inside: avoid;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.masonry-item:hover {
  transform: translateY(-5px);
}

.masonry-item:hover .post-card {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* True masonry layout with X pattern: big, small, small, big */
.masonry-item:nth-child(1) {
  height: 440px;
}

.masonry-item:nth-child(2) {
  height: 270px;
}

.masonry-item:nth-child(3) {
  height: 270px;
}

.masonry-item:nth-child(4) {
  height: 440px;
}

/* Post card styles */
.post-card {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  transition: all 0.3s ease;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-image {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: 100%;
  display: flex;
  flex: 1;
  margin: 0;
  padding: 0;
}

.post-image a {
  display: flex;
  height: 100%;
  width: 100%;
  flex: 1;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.post-image img {
  transition: transform 0.3s ease;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  max-width: none !important;
  max-height: none !important;
}

.post-image:hover img {
  transform: scale(1.05);
}

/* Title overlay */
.post-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.post-title {
  color: white !important;
  font-size: 18px !important;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.post-title a {
  color: white !important;
  text-decoration: none;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.post-title a:hover {
  opacity: 0.9;
}

/* Hide all other elements */
.post-categories,
.post-meta,
.post-excerpt,
.read-more-btn {
  display: none !important;
}

.no-posts-found {
  font-family: "Lexend", sans-serif;
  font-size: 18px;
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .masonry-container {
    gap: 15px;
  }

  .masonry-column {
    gap: 15px;
  }

  .masonry-item:nth-child(1),
  .masonry-item:nth-child(4) {
    height: 350px;
  }

  .masonry-item:nth-child(2),
  .masonry-item:nth-child(3) {
    height: 220px;
  }

  .post-title {
    font-size: 16px !important;
  }

  .post-content {
    padding: 15px;
  }

  .blog-masonry-title {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .masonry-container {
    flex-direction: column;
    gap: 20px;
  }

  .masonry-column {
    width: 100%;
  }

  .masonry-item:nth-child(1),
  .masonry-item:nth-child(4) {
    height: 300px;
  }

  .masonry-item:nth-child(2),
  .masonry-item:nth-child(3) {
    height: 250px;
  }

  .gingerup-blog-posts-masonry {
    padding: 15px !important;
  }

  .blog-masonry-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }

  .post-title {
    font-size: 16px !important;
  }

  .post-content {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .masonry-item:nth-child(1),
  .masonry-item:nth-child(4) {
    height: 250px;
  }

  .masonry-item:nth-child(2),
  .masonry-item:nth-child(3) {
    height: 200px;
  }

  .post-title {
    font-size: 14px !important;
  }

  .post-content {
    padding: 12px;
  }

  .blog-masonry-title {
    font-size: 1.5rem;
  }
}

/* CSS Grid fallback for older browsers */
@supports not (display: flex) {
  .masonry-container {
    display: block;
    columns: 2;
    column-gap: 20px;
  }

  .masonry-column {
    display: inline-block;
    width: 100%;
  }

  .masonry-item {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 20px;
  }

  .masonry-item:nth-child(1) {
    height: 440px;
  }

  .masonry-item:nth-child(2) {
    height: 270px;
  }

  .masonry-item:nth-child(3) {
    height: 270px;
  }

  .masonry-item:nth-child(4) {
    height: 440px;
  }

  @media (max-width: 768px) {
    .masonry-container {
      columns: 1;
    }

    .masonry-item:nth-child(1),
    .masonry-item:nth-child(4) {
      height: 300px;
    }

    .masonry-item:nth-child(2),
    .masonry-item:nth-child(3) {
      height: 250px;
    }
  }
}
