/* -------------------------------------------------
   SHARED BASE
-------------------------------------------------- */

.related-blog-posts-container {
    max-width: 1170px;          /* single posts only – homepage overrides this */
    margin-left: auto;
    margin-right: auto;
    padding: 0 1em 20px 0;
    box-sizing: border-box;
}

.related-posts-scroll {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 1.25em;
    gap: 1em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.related-post-item {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    scroll-snap-align: center;
    background: #fff;
    overflow: hidden;
    width: 90vw;
    max-width: 340px;
    height: 100%;
}

/* Image Wrapper */
.related-post-image {
    position: relative;
  flex: 0 0 auto;
    aspect-ratio: 16 / 10; /* adjust if needed */
    width: 100%;
    overflow: hidden;
}



.related-post-image-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Featured image */
.related-post-thumb {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* Overlay background on hover */
.related-post-image-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

/* Arrow icon (masked) */
.related-post-image-link::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 30%;
    width: 40px;
    height: 40px;
    background-color: #fff; /* arrow color */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    z-index: 2;
    transition: 0.4s ease;

    -webkit-mask-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 5L21 12M21 12L14 19M21 12L3 12' stroke='%234A5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;

    mask-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 5L21 12M21 12L14 19M21 12L3 12' stroke='%234A5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

/* Hover effect */
.related-post-image-link:hover .related-post-thumb {
    transform: scale(1.05);
}
.related-post-image-link:hover::before {
    opacity: 1;
}
.related-post-image-link:hover::after {
    opacity: 1;
    left: 50%;
}

/* Text */
.related-post-text {
    background: #fff;
    text-align: left;
    height: 100%;
}
.related-blog-posts-container .section-title{
	margin-bottom:20px;
}
.related-post-title {
    font-size: 1.2rem;
    margin: 10px 0 5px;
    line-height: 1.4;

}
.related-post-title a {
    text-decoration: none;
    transition: color 0.2s ease;
}
.related-post-title a:hover {
    color: #5440fa;
}

.related-post-date {
    font-size: 0.875rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0;
}

.calendar-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
}

/* View / Read more link (support both classes) */
.view-more-link {
	color: #060311;
    display: inline-block;
    position: relative;
    text-decoration: none;
    font-weight: 500;
    padding-bottom: 2px;
	font-size: 0.875rem;
}

.view-more-link::after {
    content: '';
    display: block;
    margin-top: 4px;
    width: 50%; /* half width of text */
    border-bottom: 2px solid #5440fa;
    transition: width 0.3s;
}

.view-more-link:hover {
    color: #5440fa;
}

.view-more-link:hover::after {
    width: 100%; /* animate to full width on hover */
}
.view-more-link:hover {
    color: #5440fa;
}
.related-post-readmore:hover::after,
.view-more-link:hover::after {
    width: 100%;
}

.related-blog-posts-container.latestpost{
	margin-top:40px;
}

/* -------------------------------------------------
   SINGLE POST PAGES (related/latest blocks)
   - Mobile: 1 per swipe
   - Tablet: 2 per swipe
   - Desktop: show all (e.g., 4) – no scroll
-------------------------------------------------- */

/* Tablet (600–1023px): 2 per swipe */
@media (min-width: 600px) and (max-width: 1023px) {
    .related-blog-posts-container:not(.related-posts-home) .related-post-item {
        width: 48vw;
        max-width: 48vw;
    }
}

/* Desktop (≥1024px): wrap & show all posts, no scroll */
@media (min-width: 1024px) {
    .related-blog-posts-container:not(.related-posts-home) .related-posts-scroll {
        overflow-x: visible;
        flex-wrap: wrap;
        gap: 20px;
    }
    .related-blog-posts-container:not(.related-posts-home) .related-post-item {
        flex: 0 0 calc(25% - 15px);   /* 4 items (adjust automatically with your PHP count) */
        max-width: none;
        scroll-snap-align: unset;
        width: auto;
    }
}

/* -------------------------------------------------
   HOMEPAGE (inside Elementor container)
   .related-posts-home wrapper
   - Mobile: 1 per swipe
   - Tablet: 2 per swipe
   - Desktop: 3 column grid, no scroll
-------------------------------------------------- */

.related-posts-home {
    max-width: none !important;
    width: 100% !important;
    padding: 0;
    margin: 40px 0;
    box-sizing: border-box;
}

/* Desktop (≥1024px): 3-column grid */
@media (min-width: 1024px) {
    .related-posts-home .related-posts-scroll {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 30px;
        overflow: visible;
    }
	/*
    .related-posts-home .related-post-item {
        width: 100% !important;
        max-width: none !important;
        flex: 1 1 auto;
        scroll-snap-align: unset;
    }
	*/
}

/* Tablet (600–1023px): horizontal scroll with 2 cards per swipe */
@media (min-width: 600px) and (max-width: 1023px) {
    .related-posts-home .related-posts-scroll {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 1.25em;
        gap: 1em;
    }
	/*
    .related-posts-home .related-post-item {
        flex: 0 0 48vw;
        max-width: 48vw !important;
        scroll-snap-align: center;
    }
	*/
}
@media (max-width: 1024px) {
	.related-blog-posts-container:not(.related-posts-home){
padding-left:15px;		
	}
}

/* Mobile (<600px): 1 card per swipe */
@media (max-width: 599px) {
    .related-posts-home .related-posts-scroll {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 1.25em;
        gap: 1em;
    }
	/*
    .related-posts-home .related-post-item {
        flex: 0 0 90vw;
        max-width: 320px !important;
        scroll-snap-align: center;
    }
	*/
}
