/* Blog Carousel Styles */
.related-posts {
    margin: 5rem 0;
    position: relative;
}

.related-posts-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

/* Convert grid to carousel */
.related-posts-grid {
    display: flex;
    overflow-x: hidden;
    scroll-behavior: smooth;
    gap: 2rem;
    padding: 1rem 0;
    position: relative;
    width: 100%;
}

.related-posts-grid .blog-card {
    min-width: calc(33.333% - 1.33rem);
    transition: transform 0.3s ease;
}

/* Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: none;
}

.carousel-arrow.prev {
    left: -25px;
}

.carousel-arrow.next {
    right: -25px;
}

.related-posts:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-arrow:focus {
    outline: none;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .related-posts-grid .blog-card {
        min-width: calc(50% - 1rem);
    }
}

@media (max-width: 768px) {
    .related-posts-grid {
        overflow-x: auto;
        padding-bottom: 1.5rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .related-posts-grid .blog-card {
        min-width: 85%;
        scroll-snap-align: center;
    }
    
    .carousel-arrow {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .related-posts-grid .blog-card {
        min-width: 100%;
    }
}

/* Make sure blog cards maintain a nice aspect ratio */
.blog-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-category {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    font-size: 0.7rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.blog-card-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--light);
    transition: color 0.2s ease;
}

.blog-card-description {
    font-size: 0.9rem;
    color: rgba(248, 250, 252, 0.7);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.blog-card-link {
    display: inline-flex;
    align-items: center;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    margin-top: auto;
}

.blog-card-link i {
    margin-left: 0.3rem;
    transition: transform 0.2s ease;
}

.blog-card-link:hover {
    color: var(--primary);
}

.blog-card-link:hover i {
    transform: translateX(3px);
}

/* Blog-specific fixes */
/* Fix for footer padding in blog pages */
.page-wrapper footer,
#footer,
.blog footer,
body[class*="blog"] footer {
    padding: 6rem 0 2rem !important;
}

/* Fix for back-to-top button position in blog pages */
.page-wrapper .back-to-top,
.page-wrapper #back-to-top,
#footer + .back-to-top,
#footer ~ #back-to-top,
body[class*="blog"] .back-to-top,
body[class*="blog"] #back-to-top {
    right: 2rem !important;
    left: auto !important;
}
