/* Related Articles Component */

.related-articles-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.related-articles-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: left;
}

.related-articles-grid {
    display: grid;
    gap: 1.5rem;
}

.related-article-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.related-article-card:hover {
    box-shadow: var(--card-shadow);
    transform: translateY(-2px);
}

.related-article-link {
    display: flex; /* Make the link a flex container */
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.related-article-link:hover {
    text-decoration: none;
}

.related-article-thumbnail {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.related-article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

/* Remove duplicate - this is now handled in the desktop layout section */

.related-article-card:hover .related-article-thumbnail img {
    transform: scale(1.05);
}

.related-article-content {
    padding: 1rem;
}

.related-article-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-article-meta {
    font-size: 0.85rem;
    color: var(--text-meta);
    font-style: italic;
}

/* Mobile Layout */
.mobile-related {
    display: block;
}

.desktop-related {
    display: none;
}

.mobile-related .related-articles-grid {
    grid-template-columns: 1fr;
}

/* Desktop Layout */
@media (min-width: 768px) {
    .mobile-related {
        display: none;
    }
    
    .desktop-related {
        display: block;
    }
    
    .desktop-related .related-articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .desktop-related .related-article-card {
        height: 100px; /* Fixed height for consistency */
    }
    
    .desktop-related .related-article-link {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        height: 100%; /* Fill the card */
    }
    
    .desktop-related .related-article-thumbnail {
        width: 120px; /* Increased width for better aspect ratio */
        height: 100px; /* Fixed height */
        flex-shrink: 0;
        overflow: hidden;
        margin-right: 1rem;
    }
    
    .desktop-related .related-article-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .desktop-related .related-article-content {
        flex: 1;
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between; /* Space out title and meta */
        min-width: 0; /* Allow text to wrap/truncate properly */
        overflow: hidden; /* Prevent content overflow */
    }
    
    .desktop-related .related-article-title {
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 0.5rem;
        color: var(--text-primary, #333) !important; /* Force color with important */
        display: block;
        overflow: hidden;
        word-wrap: break-word;
        hyphens: auto;
        flex-grow: 1; /* Take available space */
    }
    
    .desktop-related .related-article-meta {
        font-size: 0.8rem;
        color: var(--text-meta, #666) !important; /* Force color with important */
        font-style: italic;
        margin-top: auto; /* Push to bottom */
        flex-shrink: 0; /* Don't shrink */
    }
}

/* Large Desktop - More spacious layout */
@media (min-width: 1200px) {
    .desktop-related .related-article-card {
        height: 120px; /* Larger height for bigger screens */
    }
    
    .desktop-related .related-article-link {
        height: 120px; /* Match card height */
    }
    
    .desktop-related .related-article-thumbnail {
        width: 140px; /* Proportionally larger */
        height: 120px;
        margin-right: 1.25rem;
    }
    
    .desktop-related .related-article-content {
        padding: 1.25rem 0;
    }
    
    .desktop-related .related-article-title {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        color: var(--text-primary, #333) !important; /* Force color */
    }
    
    .desktop-related .related-article-meta {
        font-size: 0.85rem;
        color: var(--text-meta, #666) !important; /* Force color */
        font-style: italic;
    }
}

/* Dark mode support */
body.dark-mode .related-article-card {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
}

body.dark-mode .related-article-title {
    color: var(--text-primary-dark);
}

body.dark-mode .related-article-meta {
    color: var(--text-meta-dark);
}

body.dark-mode .related-articles-section {
    border-top-color: var(--border-dark);
}