/* Knowledge Hub Post Styles */

/* Typography */
.prose {
    max-width: 65ch;
    color: #374151;
}

/* Two-column layout with TOC */
.article-container {
    display: block;
    position: relative;
    margin-bottom: 2rem;
    min-height: 800px; /* Ensure minimum height for scrolling */
}

/* On larger screens, create a two-column layout */
@media (min-width: 1024px) {
    .article-container.with-toc {
        display: grid;
        grid-template-columns: minmax(250px, 1fr) minmax(0, 3fr);
        gap: 2rem;
        align-items: flex-start;
    }
    
    .toc-container {
        position: sticky; /* Make the container sticky */
        top: 100px; /* Stick at 100px from top */
        height: calc(100vh - 120px); /* Set height to viewport minus offset */
        align-self: start; /* Align to the top */
        margin-top: 0;
        padding-top: 1rem;
    }
    
    /* When we reach the end of the article */
    .toc-container.at-article-end {
        position: relative; /* Switch back to relative positioning */
        top: auto; /* Reset top value */
        bottom: 0; /* Position at the bottom */
    }
    
    .toc-sticky {
        position: relative; /* Change to relative */
        max-height: 100%; /* Use full height of parent */
        overflow-y: auto; /* Enable scrolling for long TOCs */
        padding-right: 1rem;
    }
    
    /* Ensure post content and TOC are aligned at the top */
    .post-content {
        margin-top: 0;
        padding-top: 1rem; /* Add padding to match TOC */
    }
}

/* Table of Contents styling */
.toc-container {
    margin-bottom: 2rem;
}

.toc-sticky {
    background-color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.toc-list {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
}

.toc-item {
    margin-bottom: 0.5rem;
}

.toc-link {
    color: #4b5563;
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: #2563eb;
    border-left-color: #93c5fd;
}

.active-toc-link {
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 600;
}

/* Mobile styling - make TOC collapsible on small screens */
@media (max-width: 1023px) {
    .toc-sticky {
        margin-bottom: 2rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .toc-container h2 {
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .toc-container h2::after {
        content: "▼";
        font-size: 0.75rem;
        transition: transform 0.3s ease;
    }
    
    .toc-container.collapsed h2::after {
        transform: rotate(-90deg);
    }
    
    .toc-container.collapsed .toc-list {
        display: none;
    }
}

/* Remaining Post Styles */
.prose h2 {
    margin-top: 2em;
    margin-bottom: 1em;
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
}

.prose h3 {
    margin-top: 1.6em;
    margin-bottom: 0.8em;
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.4;
    color: #111827;
}

.prose p {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    line-height: 1.75;
}

.prose a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.prose a:hover {
    color: #1d4ed8;
}

.prose strong {
    font-weight: 600;
    color: #111827;
}

.prose ul, .prose ol {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose blockquote {
    font-style: italic;
    color: #6b7280;
    border-left-width: 4px;
    border-left-color: #e5e7eb;
    padding-left: 1rem;
    margin: 1.5rem 0;
}

.prose img {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-radius: 0.375rem;
}

.prose code {
    color: #111827;
    background-color: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: monospace;
}

.prose pre {
    background-color: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.prose pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.875em;
    line-height: 1.7;
}

/* Author Section */
.border-t {
    margin-top: 3rem;
    padding-top: 2rem;
}

/* Related Posts Section */
.related-posts {
    margin-top: 3rem;
} 