/* Recent Posts Block Styling */
.qc-swiper-container.recent-posts-slider {
  margin: 2rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  overflow: visible;
}

/* Wrapper for better positioning of navigation elements */
.qc-swiper-container .recent-posts-slider-wrapper {
  position: relative;
  padding-top: 0.5rem;
  padding-bottom: 2rem;
  overflow: hidden;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  justify-items: center;
}

.qc-swiper-container .recent-posts-container {
  padding: 1.25rem;
  position: relative;
}

.qc-swiper-container .recent-posts-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Swiper container customization - NAMESPACED */
.qc-swiper-container .qc-swiper {
  padding-bottom: 0; /* Remove padding, controls are now outside */
  overflow: visible;
}

/* Ensure both class names are targeted */
.qc-swiper-container .swiper.qc-swiper,
.qc-swiper-container .qc-swiper {
  padding-bottom: 0;
  overflow: visible;
}
.recent-posts-slider-wrapper .swiper {
  overflow: visible;
}
/* Removed generic .swiper selector that could affect other components */

/* Card design with fixed dimensions */
.qc-swiper-container .swiper-slide {
  height: auto;
  display: flex;
  overflow: visible;
}

.qc-swiper-container .post-card {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qc-swiper-container .post-card:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Fixed height image container */
.qc-swiper-container .post-card__image {
  width: 100%;
  height: 180px; /* Exact pixel height for all images */
  overflow: hidden;
  position: relative;
  flex: 0 0 auto; /* Prevent image from stretching */
}

.qc-swiper-container .post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Add this more specific rule to override Elementor */
.elementor .qc-swiper-container .post-card__image img,
.qc-swiper-container .post-card__image img.lazyloaded,
.qc-swiper-container .post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
  transition: transform 0.5s ease;
}

/* Style specifically for the fallback image */
.qc-swiper-container .post-card__image--fallback img {
  object-fit: cover; /* Ensure it fills the container */
  object-position: center; /* Center the image */
}

.qc-swiper-container .post-card:hover .post-card__image img {
  transform: scale(1.05);
}

/* Fixed height content section with internal flexbox layout */
.qc-swiper-container .post-card__content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 250px; /* Fixed height for content area */
}

/* Title with fixed height - 2 lines */
.qc-swiper-container .post-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
  height: 2.8em; /* Fixed height for title (2 lines) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
}

.qc-swiper-container .post-card__title a {
  color: #28465a;
  text-decoration: none;
}

.qc-swiper-container .post-card__title a:hover {
  color: #ff914d;
}

/* Author meta section with fixed height */
.qc-swiper-container .post-card__meta {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #666;
  flex-wrap: wrap;
  min-height: 1.75rem;
  height: 1.75rem;
  overflow: hidden;
  flex: 0 0 auto;
}

.qc-swiper-container .post-card__author-image {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.qc-swiper-container .post-card__author-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Style for author initial fallback */
.qc-swiper-container .post-card__author-image--fallback {
  background-color: #28465a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
}

.qc-swiper-container .post-card__author-name {
  margin-right: 0.5rem;
}

.qc-swiper-container .post-card__date:before {
  content: "•";
  margin-right: 0.5rem;
}

/* Excerpt with fixed height - 3 lines */
.qc-swiper-container .post-card__excerpt {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #444;
  margin-bottom: 1rem;
  flex: 1 0 auto;
  position: relative; /* Needed for pseudo-element positioning */
  height: 4.2em; /* Fixed height for exactly 3 lines */
  overflow: hidden;
}

/* Horizontal fade effect along the bottom */
.qc-swiper-container .post-card__excerpt:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.6em; /* Height of one line */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none; /* So it doesn't interfere with text selection */
}

/* Read more always at the bottom */
.qc-swiper-container .post-card__read-more {
  align-self: flex-start;
  color: #28465a;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
  margin-top: auto; /* Push to bottom */
  flex: 0 0 auto; /* Don't allow stretching */
}

.qc-swiper-container .post-card__read-more:hover {
  color: #ff914d;
  text-decoration: underline;
}

/* Swiper controls container - IMPROVED LAYOUT */
.qc-swiper-container .qc-swiper-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  position: relative;
  width: 100%;
  gap: 5px; /* Add consistent spacing between elements */
}

/* Swiper navigation customization - POSITIONING FIX */
.qc-swiper-container .qc-swiper-button-next,
.qc-swiper-container .qc-swiper-button-prev,
.qc-swiper-container .swiper-button-next,
.qc-swiper-container .swiper-button-prev {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: 50%;
  color: #28465a;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Make navigation arrows smaller */
.qc-swiper-container .qc-swiper-button-next:after,
.qc-swiper-container .qc-swiper-button-prev:after,
.qc-swiper-container .swiper-button-next:after,
.qc-swiper-container .swiper-button-prev:after {
  font-size: 1.25rem;
  font-family: swiper-icons !important;
}

/* Style the pagination - IMPROVED LAYOUT */
.qc-swiper-container .qc-swiper-pagination,
.qc-swiper-container .swiper-pagination {
  position: relative;
  bottom: auto;
  left: auto;
  width: auto;
  flex-grow: 0;
  display: flex;
  justify-content: center;
  margin: 0 15px;
}

.qc-swiper-container .swiper-pagination-bullet {
  margin: 0 5px;
  opacity: 1;
  background: #28465a;
}

.qc-swiper-container .swiper-pagination-bullet-active {
  background-color: #3ca5aa;
}

.qc-swiper-container .recent-posts-none {
  text-align: center;
  padding: 3rem 0;
  font-style: italic;
  color: #666;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .qc-swiper-container .qc-swiper-button-next {
    right: -2.5rem;
  }

  .qc-swiper-container .qc-swiper-button-prev {
    left: -2.5rem;
  }
}

@media (max-width: 1024px) {
  .qc-swiper-container .post-card__content {
    height: 230px; /* Slightly shorter on tablets */
  }

  .qc-swiper-container .post-card__image {
    height: 160px;
  }

  .qc-swiper-container .qc-swiper-button-next {
    right: -2rem;
  }

  .qc-swiper-container .qc-swiper-button-prev {
    left: -2rem;
  }
}

@media (max-width: 768px) {
  .qc-swiper-container .recent-posts-title {
    font-size: 1.5rem;
  }

  .qc-swiper-container .post-card__title {
    font-size: 1rem;
  }

  .qc-swiper-container .post-card__content {
    padding: 1rem;
    height: 220px;
  }

  .qc-swiper-container .qc-swiper-button-next,
  .qc-swiper-container .qc-swiper-button-prev {
    width: 30px;
    height: 30px;
    margin: 0 5px;
  }

  .qc-swiper-container .qc-swiper-button-next:after,
  .qc-swiper-container .qc-swiper-button-prev:after {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .qc-swiper-container .post-card__image {
    height: 180px; /* Taller images on mobile */
  }

  .qc-swiper-container .recent-posts-container {
    padding: 1rem 0.75rem;
  }

  .qc-swiper-container .post-card__content {
    height: auto; /* Allow natural height on mobile */
    min-height: 200px;
  }

  .qc-swiper-container .qc-swiper-controls {
    margin-top: 1rem;
  }

  .qc-swiper-container .qc-swiper-button-next,
  .qc-swiper-container .qc-swiper-button-prev {
    width: 25px;
    height: 25px;
  }
}

/* Special handling for shortcode version */
.recent-posts-shortcode.qc-swiper-container .recent-posts-container {
  margin: 0 9vw;
}
