


.blog {

    .post .post-title a {
        color: $base-color;
    }



    .has-sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 2rem;

        @media (min-width: 768px) {
            flex-wrap: nowrap;
        }
    }

    // Add specific ordering for sidebar right layout
    .col-sidebar {
        width: 100%;
        min-width: 280px;

        @media (min-width: 768px) {
            min-width: 250px;
        }
        
        @media (max-width: 380px) {
            min-width: 240px;
        }
    }

    .col-content {
        &.narrow-content {
            max-width: 720px;
        }
    }

    // Blog post readability improvements
    .post-summary,
    .post-content {
        line-height: 1.75;
        font-size: 1.125rem; // 18px
        color: var(--bs-body-color);

        p {
            margin-bottom: 1.5rem;
        }

        h1, h2, h3, h4, h5, h6 {
            margin-top: 2rem;
            margin-bottom: 1rem;
            line-height: 1.3;
            font-weight: 600;
        }

        h1 { font-size: 2.5rem; }
        h2 { font-size: 2rem; }
        h3 { font-size: 1.75rem; }
        h4 { font-size: 1.5rem; }
        h5 { font-size: 1.25rem; }
        h6 { font-size: 1.125rem; }

        ul, ol {
            margin-bottom: 1.5rem;
            
            li {
                margin-bottom: 0.75rem;
                line-height: 1.75;
            }
        }

        blockquote {
            border-left: 4px solid var(--bs-primary);
            padding-left: 1.5rem;
            margin: 2rem 0;
            font-style: italic;
            color: var(--bs-secondary-color);
        }

        code {
            background-color: var(--bs-gray-100);
            padding: 0.2em 0.4em;
            border-radius: 3px;
            font-size: 0.9em;
        }

        pre {
            background-color: var(--bs-gray-100);
            padding: 1rem;
            border-radius: 0.375rem;
            overflow-x: auto;
            margin: 1.5rem 0;

            code {
                background-color: transparent;
                padding: 0;
            }
        }
    }

    .blog-sidebar {
        position: sticky;
        top: 2rem;

        .sidebar-section {
            margin-bottom: 2rem;
            padding: 1.5rem;
            background: #edf1f4;
            border-radius: 0.5rem;

            // Increase padding and set minimum width on smaller screens
            @media (max-width: 767px) {
                padding: 2rem;
                min-width: 280px;
                width: 100%;
            }
            
            @media (max-width: 380px) {
                min-width: 240px;
                padding: 1.5rem;
            }

            h3 {
                margin-bottom: 1rem;
                font-size: 1.2rem;
                font-weight: 600;
                color: var(--bs-gray-900);
            }

            ul {
                list-style: none;
                padding: 0;
                margin: 0;

                li {
                    margin-bottom: 0.75rem;

                    a {
                        color: $sidebar-link-color;
                        transition: color 0.2s ease;
                        font-weight: 300;;

                        &:hover {
                            color: var(--bs-primary);
                            text-decoration: underline;
                        }
                    }
                }
            }

            &.recent-posts {
                ul li {
                    // Ensure proper wrapping on small screens
                    @media (max-width: 767px) {
                        a {
                            overflow-wrap: break-word;
                            line-height: 1.4;
                            display: block;
                        }
                    }
                }
                
                .post-date {
                    display: block;
                    font-size: 0.875rem;
                    color: var(--bs-gray-900);
                }
            }
            
            // Categories use the global tag styling for consistency
        }
    }

    // Featured posts styling
    .featured-post-container {
        width: 100%;
        .p-4 {
            padding: 2rem !important;
        }

        .col-lg-8 {
            max-width: 100%;
        }

        @media (min-width: 992px) {
            
            .p-md-5 {
                padding: 3rem !important;
            }
            
            .col-lg-8 {
                max-width: 90%;
            }
        }
    }

    // Featured post thumbnail styling
    .featured-thumbnail {
        max-height: 300px;
        width: auto;
        object-fit: cover;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        
        @media (min-width: 992px) {
            max-height: 350px;
        }
    }

    // Secondary featured posts image styling
    .secondary-featured-img {
        width: 200px;
        height: 250px;
        object-fit: cover;
    }

    // Table of Contents styling
    .table-of-contents {
        margin: 2rem 0;
        padding: 1.5rem;
        background: #f8f9fa;
        border-radius: 0.5rem;
        border-left: 4px solid var(--bs-primary);

        .toc-heading {
            margin-bottom: 1rem;
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--bs-gray-900);
        }

        .toc-content {
            ul {
                list-style: none;
                padding-left: 0;
                margin: 0;

                ul {
                    padding-left: 1.5rem;
                    margin-top: 0.5rem;
                }

                li {
                    margin-bottom: 0.5rem;

                    a {
                        color: var(--bs-body-color);
                        text-decoration: none;
                        font-weight: 400;
                        transition: color 0.2s ease;

                        &:hover {
                            color: var(--bs-primary);
                            text-decoration: underline;
                        }
                    }
                }
            }
        }
    }
}

@include color-mode(dark) {
    .blog {

        .post .post-title a {
            color: $dark-primary;
        }

        // Readability improvements for dark mode
        .post-summary,
        .post-content {
            color: var(--bs-gray-200);

            code {
                background-color: var(--bs-gray-800);
                color: var(--bs-gray-200);
            }

            pre {
                background-color: var(--bs-gray-800);
            }

            blockquote {
                color: var(--bs-gray-400);
            }
        }

        .blog-sidebar {
            .sidebar-section {
                background: var(--bs-gray-800);

                h3 {
                    color: var(--bs-white);
                }

                /* Remove the general black color for all links */
                /* ul li a {
                    color: black;
                } */

                &.recent-posts {
                    a {
                        color: white;
                    }

                    .post-date {
                        color: var(--bs-gray-500);
                    }
                }
                
                // Categories dark mode handled by global tag styling
            }
        }

        // Table of Contents dark mode styling
        .table-of-contents {
            background: var(--bs-gray-800);

            .toc-heading {
                color: var(--bs-white);
            }

            .toc-content ul li a {
                color: var(--bs-gray-300);

                &:hover {
                    color: var(--bs-primary);
                }
            }
        }
    }

    .btn-outline-secondary{
        color: var(--bs-white);
        border-color: var(--bs-white);
    }
}

.posts-list-simple {
    list-style: none;
    padding: 0;
    margin: 0;

    li.post {
        padding: 1rem 0;
        border-bottom: 1px solid var(--bs-border-color);

        &:last-child {
            border-bottom: none;
        }

        a {
            color: var(--bs-body-color);
            text-decoration: none;
            font-size: 1.1rem;
            font-weight: 500;

            &:hover {
                color: var(--bs-primary);
            }
        }

        .meta {
            font-size: 0.9rem;
            color: var(--bs-secondary-color);
            margin-top: 0.25rem;
        }
    }
}