/* Custom Page Styles */

.page-hero-section {
    background-color: #f8f9fa;
    padding: 3rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 10px;
}

.page-hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    color: #343a40;
    margin: 0;
}

.page-content-section {
    padding: 4rem 1.5rem;
    position: relative; /* Needed for absolute positioning of the TOC */
}

.page-layout-container {
    /* This container now only holds the main content, not the TOC */
    max-width: 800px; /* Reduced width to accommodate right sidebar */
    margin-left: 320px; /* Make space for the left sidebar (TOC width + gap) */
    margin-right: 320px; /* Make space for the right sidebar */
}

.page-toc-wrapper {
    width: 280px;
    flex-shrink: 0;
    position: absolute; /* Position relative to the page-content-section */
    left: 0;
}

.page-recent-posts-wrapper {
    width: 280px;
    position: absolute;
    right: 0;
}


.page-content {
    margin-top: -50px;
}

.page-toc-wrapper.is-sticky {
    position: fixed;
    top: 20px; /* Margin from the top when sticky */
}

.page-toc-wrapper.is-bottomed {
    position: absolute; /* Position relative to page-content-section */
}

.page-toc {
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.page-toc h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.page-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-toc li a {
    display: block;
    padding: 0.5rem;
    color: #5a6472;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: 5px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease-in-out;
}

.page-toc li a:hover {
    background-color: #e9ecef;
    color: #333;
}

.page-toc li a.active {
    color: #00305d;
    font-weight: 600;
    background-color: #e9ecef;
    border-left: 3px solid #00305d;
}

.page-container {
    flex-grow: 1;
    min-width: 0; /* Prevents flexbox overflow issues */
}

.page-content h1, .page-content h2, .page-content h3 {
    scroll-margin-top: 120px; /* Offset for smooth scroll to account for sticky nav */
}

/* Responsive: TOC moves above content on smaller screens */
@media (max-width: 991px) {
    .page-layout-container {
        flex-direction: column;
    }

    .page-toc-wrapper {
        position: static; /* Unset all special positioning */
        width: 100%;
        margin-bottom: 3rem;
    }
    
    .page-recent-posts-wrapper {
        position: static;
        width: 100%;
        margin-top: 3rem;
    }

    .page-toc-wrapper.is-sticky,
    .page-toc-wrapper.is-bottomed {
        position: static;
        top: auto;
    }
}