/* Blog typography & layout */

/* --- Prose content spacing --- */
.blog-content h2 {
    scroll-margin-top: 5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
}

.blog-content h3 {
    scroll-margin-top: 5rem;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    line-height: 1.35;
    font-weight: 600;
    color: #1f2937;
}

.blog-content p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
    color: #374151;
}

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

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
    color: #374151;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.blog-content th, .blog-content td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    text-align: left;
}

.blog-content th {
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
}

.blog-content tr:nth-child(even) {
    background: #f9fafb;
}

.blog-content a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-content a:hover {
    color: #1d4ed8;
}

.blog-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #6b7280;
    font-style: italic;
}

.blog-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.blog-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.blog-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* --- Desktop TOC sidebar --- */
.blog-layout {
    display: flex;
    gap: 3rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.blog-sidebar {
    display: none; /* hidden on mobile */
    width: 15rem;
    flex-shrink: 0;
}

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

.blog-toc {
    position: sticky;
    top: 5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 1rem 0;
}

.blog-toc h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.blog-main {
    flex: 1;
    min-width: 0;
    max-width: 48rem;
}

/* --- Mobile TOC --- */
.mobile-toc {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .mobile-toc {
        display: none;
    }
}

.mobile-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.mobile-toc-content {
    padding: 0.75rem 1rem 1rem;
}

.mobile-toc-content a {
    display: block;
    padding: 0.3rem 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
}

.mobile-toc-content a:hover {
    color: #2563eb;
}

.mobile-toc-content a.h3-link {
    padding-left: 1rem;
}

/* --- Line clamp utility --- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}