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

/* Blog content styling */
.blog-content {
    line-height: 1.7;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    margin-top: 2rem;
    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.5rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.25rem;
}

.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 {
    border-left: 3px solid #e0e0e0;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #6c757d;
}

.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: 1.5rem;
}

.blog-main {
    flex: 0 1 950px;
    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: 2px solid #f0f0f0;
}

.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: #2d3436;
    text-decoration: none;
}

.blog-toc-list a.toc-active {
    color: #212529;
    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;
}
