/**
 * Related Posts Slider Styles
 * Custom styles for Slick Slider integration on the blog page
 */

/* Slider Container */
.related-posts {
    margin: 0  0; /* Increased bottom margin for dots */
    position: relative;
}

.related-posts-slider {
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    overflow: visible; /* Allow slides to be visible outside the container */
}

/* Fix for Slick slider items */
.related-posts-slider .slick-track {
    display: flex !important;
}

.related-posts-slider .slick-slide {
    height: inherit !important;
    display: flex !important;
    margin-right: 10px !important; /* Add consistent 10px spacing between slides */
}

.related-posts-slider .slick-slide > div {
    display: flex;
    height: 339px;
    width: 100%; /* Full width */
    margin: 0;
    padding: 0;
}

/* Slider Items (Related Posts) */
.related-post {
    position: relative;
    overflow: hidden;
    margin: 0 10px 0 0; /* Add right margin for spacing */
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

@media (min-width: 768px) {
    .related-post {
        flex-direction: column;
    }
}

/* Related Post Images */
.related-post-image {
    width: 100%;
    overflow: hidden;
}

@media (min-width: 768px) {
    .related-post-image {
        width: 40%;
    }
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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



.related-post-date {
    display: block;
    font-size: 16px;
    color: #999;
}

.related-post-title {
        height: 58px;
    font-size: 32px;
    margin-bottom: 0;
    color: #fff;
}

.related-post-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 15px;
    
    /* Multi-browser support for line clamping */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* Fallback for non-supporting browsers */
    max-height: 4.8em; /* 3 lines × 1.6 line height */
    position: relative;
}

/* Additional ellipsis fallback for browsers that don't support line-clamp */
.related-post-excerpt::after {
    content: '...';
    position: absolute;
    right: 0;
    bottom: 0;
    background: #2A2A2A; /* Match the background color */
    padding-left: 4px;
    display: none; /* Hide by default, will be shown with JS if needed */
}

.read-more {
    display: inline-flex;
    align-items: center;
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s;
}

.read-more svg {
    margin-left: 5px;
    transition: transform 0.3s;
}

.read-more:hover {
    color: #FCCA09;
}

.read-more:hover svg {
    transform: translateX(3px);
}

/* Slider Navigation */
.related-posts-navigation {
    position: absolute;
    top: 61px;
    right: 47px;
    display: flex
;
    gap: 10px;
    z-index: 10;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #FCCA09;
}

.nav-btn:hover path {
    stroke: #1A1A1A;
}

/* Slick Dots Customization */
.related-posts .slick-dots {
    bottom: -30px;
}

.related-posts .slick-dots li button:before {
    color: #fff;
    opacity: 0.3;
}

.related-posts .slick-dots li.slick-active button:before {
    color: #FCCA09;
    opacity: 1;
}

/* Add padding to the container for edge spacing */
.related-posts .container {
    padding-left: 43px;
    padding-right: 30px;
}

/* Mobile styles - Based on 375px width design */
@media (max-width: 767px) {
    /* Related posts section */
    .related-posts {
        margin: 0 0 50px 0;
        padding: 0;
    }
    
    .related-posts .container {
        padding: 0 0 0 15px;
        border-right: 0;
    }

    .related-posts h2 {
        font-size: 24px;
        line-height: 100%;
        margin: 50px 0 20px 30px;
    }

    .related-posts-navigation {
        top: 30px;
        right: 30px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .nav-btn.prev {
        background-color: #2A2A2A;
    }
    
    .nav-btn.next {
        background-color: #FFFFFF;
    }
    
    .nav-btn.next svg path {
        stroke: #1A1A1A;
    }
    
    /* Related post cards */
    .related-posts-slider .slick-slide > div {
        height: 200px;
        padding: 0;
        margin: 0;
    }
    
    .related-post {
        flex-direction: column;
        height: auto;
        margin: 0 15px;
        width: calc(100% - 30px);
        max-width: 268px;
    }
    
    .related-post-image {
        width: 100%;
        height: 268px;
    }
    
    .related-post-content {
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    
    .related-post-date {
        font-size: 14px;
        line-height: 22px;
        text-transform: uppercase;
    }
    
    .related-post-title {
        font-size: 24px;
        line-height: 100%;
        letter-spacing: -0.03em;
        margin-bottom: 16px;
    }
    
    .related-post-excerpt {
        font-size: 16px;
        margin: 0 0 16px 0;
        max-height: none;
    }
    
    .read-more {
        font-size: 14px;
        line-height: 22px;
        letter-spacing: -0.05em;
        position: relative;
    }
    
    .read-more::after {
        content: '';
        position: absolute;
        width: 76px;
        height: 1px;
        left: 0;
        bottom: -5px;
        background-color: #FFFFFF;
    }
}

/* Small Mobile styles - 320px to 480px */
@media (max-width: 480px) {
    /* Left aligned carousel with 70% card and 25% peek of next */
    .related-posts { overflow: hidden; padding: 0; background-color: #1A1A1A; margin: 0;}
    .related-posts-slider .slick-slide{
            height: 550px !important;
    }

    .related-posts .container { padding: 0 0 0 15px; }

    .related-posts-slider { margin: 0; padding: 0; overflow: visible; }
    .related-posts-slider .slick-list { overflow: visible !important; padding: 0 !important; margin: 0; }
    .related-posts-slider .slick-track { display: flex !important; margin-left: 0; }

    /* Variable width slides */
    .related-posts-slider .slick-slide { margin: 0 5vw 0 0 !important; }
    .related-posts-slider .slick-slide > div { width: 70vw !important; }

    /* Ensure the first slide touches the left edge */
    .related-posts-slider .slick-slide:first-child { margin-left: 0 !important; }

    /* Card sizing */
    .related-post { width: 70vw; max-width: none; margin: 0; }
    .related-post-image { height: 55vw; max-height: 300px; }

    .related-posts h2 { font-size: 24px; line-height: 1.2; margin: 30px 0 20px 10px; }

    .related-posts-navigation { top: auto; right: auto; left: 15px; bottom: 15px; }
}
