.news-posts-carousel {
    width: 100%;
    position: relative;
}

.news-posts-carousel .news-posts-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.news-posts-carousel .news-posts-header .text-container {
    padding-right: 0;
    padding-left: 0;
}

.news-posts-carousel .news-posts-header .text-container h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 500px;
    margin: 0;
}

.news-posts-carousel .swiper-container{
    --swiper-navigation-size: 30px; 
    --swiper-navigation-sides-offset: -10px; 
    --swiper-navigation-top-offset: 45%;
    --swiper-navigation-color: black; 
    width: 100%;
    overflow: hidden;
}

.news-posts-carousel .swiper-slide {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.news-posts-carousel .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.news-posts-carousel .img-wrapper {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 7 / 4;
    display: flex;
    align-items: flex-end;
    background-size: cover;
    background-repeat: no-repeat;
}

.news-posts-carousel .img-wrapper p {
    color: white;
    background-color: var(--wp--preset--color--red);
    margin: 10px;
    padding: 2px 12px;
}

.news-posts-carousel .swiper-slide h4,
.news-posts-carousel .swiper-slide span {
    margin-top: 0.4em;
    margin-bottom: 0.4em;
}

.news-posts-carousel .truncate-title {
    display: -webkit-box;        /* Use a box model that supports line clamping */
    -webkit-line-clamp: 2;       /* Display only the first 3 lines */
    -webkit-box-orient: vertical;/* Set the box orientation to vertical */
    overflow: hidden;            /* Hide the overflowing text */
    text-overflow: ellipsis;     /* Show ellipsis for truncated text */
    max-height: calc(1.5em * 2); /* Limit the maximum height to 2 lines (line height of 1.5em) */
}

.news-posts-carousel .truncate-excerpt {
    display: -webkit-box;        /* Use a box model that supports line clamping */
    -webkit-line-clamp: 3;       /* Display only the first 3 lines */
    -webkit-box-orient: vertical;/* Set the box orientation to vertical */
    overflow: hidden;            /* Hide the overflowing text */
    text-overflow: ellipsis;     /* Show ellipsis for truncated text */
    max-height: calc(1.5em * 3); /* Limit the maximum height to 3 lines (line height of 1.5em) */
}

.news-posts-carousel .date {
    color: #888888 !important;
}

.news-posts-carousel .swiper-slide a:where(:not(.wp-element-button)) {
    text-decoration: none;
    color: var(--wp--preset--color--base) !important;
}

/* Mobile */

@media (max-width: 781px) {
    .news-posts-carousel {
        padding: 0;
    }


    .news-posts-carousel .swiper-button-prev,
    .news-posts-carousel .swiper-button-next {
        display: none !important;
    }
}

.wp-block-group .news-posts-carousel {
    position: relative;
}

@media (max-width: 752px) { 
    .news-posts-group .wp-block-button,
    .news-posts-group .wp-block-button a { /* Wide button on mobile */
      width: 100%;
    }
  
    .news-posts-group .hide-on-mobile { /* Hide button on mobile */
      display: none;
    }
    .news-posts-carousel .news-posts-header .text-container {
        flex-basis: 100%;
    }
  }
  
  @media (min-width: 753px) {
    .news-posts-group .hide-on-desktop { /* Hide button on desktop */
      display: none;
    }
  }
