/* =================================================================
   NH Related Posts - Premium Modern Design (Flex Version)
   Responsive | Beautiful | Professional
   ================================================================= */

/* Main Container */
.related_posts {
    margin: 70px auto;
    padding: 50px 25px;
    max-width: 1200px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

/* Decorative Background Pattern */
.related_posts::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Heading */
.related_posts h3 {
    font-size: clamp(26px, 5vw, 36px);
    font-weight: 800;
    margin: 0 0 45px 0 !important;
    text-align: center;
    color: #000000;
    position: relative;
    letter-spacing: -0.5px;
}

/* Heading Underline */
.related_posts h3::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
}

/* Posts Flex Container */
.related_posts ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* Center posts horizontally */
    gap: 30px;
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
    z-index: 1;
}

/* Post Card */
.related_posts ul li {
    flex: 0 1 300px;           /* base width 300px, shrink/grow as needed */
    max-width: 300px;          /* maximum width for each card */
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Single Post Centering */
.related_posts ul li:only-child {
    margin: 0 auto;            /* Single post will be centered */
}

/* Hover Effect */
.related_posts ul li:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4);
    /* border-color: rgba(255, 255, 255, 0.6); */
}

/* Link */
.related_posts ul li a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    position: relative;
}

/* Image */
.related_posts ul li img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.related_posts ul li:hover img {
    transform: scale(1.1);
}

/* Image Overlay */
.related_posts ul li a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 220px;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(102, 126, 234, 0.1) 50%,
            rgba(102, 126, 234, 0.6) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.related_posts ul li:hover a::before {
    opacity: 1;
}

/* Read More Badge */
.related_posts ul li a::after {
    content: '→';
    position: absolute;
    top: 180px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: #ffffff;
    color: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.related_posts ul li:hover a::after {
    opacity: 1;
    transform: scale(1);
}

/* Content Container */
.related_posts ul li>a {
    padding-bottom: 25px;
}

/* Title */
.related_posts ul li strong {
    display: block;
    font-size: clamp(17px, 2.8vw, 20px);
    font-weight: 700;
    color: #1a202c;
    margin: 20px 22px 10px 22px;
    line-height: 1.5;
    transition: color 0.3s ease;
    min-height: 50px;
}

.related_posts ul li:hover strong {
    color: #667eea;
}

/* Excerpt */
.related_posts ul li p {
    font-size: 14px;
    color: #64748b;
    margin: 0 22px 5px 22px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category Badge */
.related_posts ul li .category-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* RESPONSIVE DESIGN */

/* Tablet Landscape (1024px) */
@media (max-width: 1024px) {
    .related_posts ul li {
        flex: 0 1 260px;
        max-width: 260px;
    }

    .related_posts ul li img {
        height: 200px;
    }

    .related_posts ul li a::before {
        height: 200px;
    }

    .related_posts ul li a::after {
        top: 160px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Tablet Portrait (768px) */
@media (max-width: 768px) {
    .related_posts ul li {
        flex: 0 1 240px;
        max-width: 240px;
    }

    .related_posts ul li img {
        height: 180px;
    }

    .related_posts ul li a::before {
        height: 180px;
    }

    .related_posts ul li a::after {
        top: 140px;
    }
}

/* Mobile (576px) */
@media (max-width: 576px) {
    .related_posts ul li {
        flex: 0 1 100%;
        max-width: 100%;
    }

    .related_posts ul li img {
        height: 200px;
    }

    .related_posts ul li a::before {
        height: 200px;
    }

    .related_posts ul li a::after {
        top: 160px;
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

/* Extra Small Mobile (400px) */
@media (max-width: 400px) {
    .related_posts ul li img {
        height: 180px;
    }

    .related_posts ul li a::before {
        height: 180px;
    }
}
