.highlighter-rouge {
    font-size: 0.875rem;
}

/* Blog content styling */
.blog-content {
    color: #3c3e38;
    font-size: 1.08rem;
    line-height: 2;
    padding: 0 3rem 3.25rem;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    color: #303a30;
    margin-top: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.blog-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.blog-content h2 {
    font-size: 1.55rem;
    border-bottom: 1px solid #e6e6de;
    padding-bottom: 0.55rem;
}

.blog-content h3 {
    font-size: 1.25rem;
}

.blog-content p {
    margin-bottom: 1rem;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content blockquote {
    background: #f5f6ef;
    border-left: 3px solid #9eaa83;
    border-radius: 0 0.4rem 0.4rem 0;
    padding: 1rem 1.25rem;
    margin: 2rem 0;
    font-style: normal;
    color: #5c6257;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

/* Multi-column image layouts */
.blog-content .row img {
    margin: 0.5rem 0;
    transition: transform 0.2s ease-in-out;
}

.blog-content .row img:hover {
    transform: scale(1.02);
}

/* Image gallery styles */
.blog-content .img-fluid {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.blog-content .shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Responsive image containers */
.blog-content .col-md-6 img,
.blog-content .col-md-4 img,
.blog-content .col-lg-3 img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.375rem;
}

/* Mixed content layouts */
.blog-content .col-md-8 {
    padding-right: 1rem;
}

.blog-content .col-md-4 {
    padding-left: 1rem;
}

@media (max-width: 768px) {
    .blog-content .col-md-8,
    .blog-content .col-md-4 {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .blog-content .col-md-6 img,
    .blog-content .col-md-4 img {
        height: 150px;
    }
}

.blog-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.blog-content table th,
.blog-content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

.blog-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Math formula styling */
.katex-display {
    margin: 1.5rem 0;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
}

.katex {
    font-size: 1.1em;
}

/* Ensure math formulas are properly displayed */
.katex-display .katex {
    display: inline-block;
    white-space: nowrap;
}

/* Fix for math formula containers */
.katex-display {
    display: block;
    width: 100%;
}

/* Ensure proper spacing around math formulas */
.blog-content .katex-display {
    margin: 2rem 0;
    padding: 1rem 0;
}

/* Inline math styling */
.katex-inline {
    display: inline;
    margin: 0 0.2em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
}

/* Blog layout — content preserves original width, TOC uses remaining space */
.blog-layout-wrapper {
    display: flex;
    justify-content: center;
    padding: 0 15px;
    gap: 2rem;
}

.blog-main {
    flex: 0 1 840px;
    min-width: 0;
}

.blog-toc-sidebar {
    flex: 0 0 auto;
    width: clamp(160px, 18vw, 360px);
    display: none;
}

@media (min-width: 992px) {
    .blog-toc-sidebar {
        display: block;
    }
}

/* Blog Table of Contents */
.blog-toc-nav {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding-left: 0.75rem;
    border-left: 1px solid #dfe2d6;
}

.blog-toc-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin-bottom: 0.75rem;
}

.blog-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blog-toc-list li {
    margin-bottom: 0.25rem;
}

.blog-toc-list a {
    display: block;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #999;
    text-decoration: none;
    padding: 0.15rem 0;
    transition: color 0.2s ease;
}

.blog-toc-list a:hover {
    color: #557054;
    text-decoration: none;
}

.blog-toc-list a.toc-active {
    color: #466246;
    font-weight: 600;
}

.blog-toc-list .toc-h3 {
    padding-left: 0.75rem;
}

.blog-toc-list .toc-h4 {
    padding-left: 1.5rem;
}

/* Hide TOC scrollbar */
.blog-toc-nav::-webkit-scrollbar {
    width: 0;
}

.blog-toc-nav {
    scrollbar-width: none;
}

.post-article { overflow: hidden; }
.post-header { background: linear-gradient(135deg, #f7f8f2, #fffefb); border-bottom: 1px solid #e9eadf; padding: 3.1rem 3rem 2.4rem; }
.post-header h1 { color: #303b30; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: 0.02em; line-height: 1.35; margin: 0 0 1.2rem; }
.post-kicker { margin-bottom: 0.65rem; }
.post-meta { color: #85887c; font-family: "Lato", sans-serif; font-size: 0.88rem; }
.post-views { margin-left: 1rem; white-space: nowrap; }
.post-views i { margin-right: 0.15rem; }
.comments-section { background: #fff; border: 1px solid rgba(79, 85, 67, 0.09); border-radius: 0.8rem; box-shadow: 0 10px 30px rgba(61, 67, 51, 0.05); margin-bottom: 2.5rem; padding: 2.4rem 3rem; }
.comments-heading { border-bottom: 1px solid #e9eadf; margin-bottom: 1.7rem; padding-bottom: 1.25rem; }
.comments-heading h2 { color: #344235; font-size: 1.45rem; margin: 0 0 0.45rem; }
.comments-heading p:last-child { color: #83877c; font-size: 0.9rem; margin-bottom: 0; }

@media (max-width: 767.98px) {
    .blog-layout-wrapper { padding: 0; }
    .post-header { padding: 2.25rem 1.35rem 1.75rem; }
    .blog-content { font-size: 1rem; line-height: 1.9; padding: 0 1.35rem 2.25rem; }
    .blog-content h2 { font-size: 1.35rem; margin-top: 2.25rem; }
    .comments-section { border-radius: 0.7rem; padding: 1.75rem 1.35rem; }
    .post-views { margin-left: 0.7rem; }
}
