body {
    font-family: "Times New Roman", serif;
    background-color: #eee;
    font-size: 1.6em;
}

html {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border: 0;
}

header,
footer {
    margin: 4rem 0;
    text-align: center;
    font-size: 1.2em;
}

main {
    font-size: 1.1em;
}

/* Container for ToC and Content */
.content-container {
    display: flex;
    margin-top: 20px;
    max-width: 1400px; /* Adjusted max-width to use more of the available space */
    margin: 0 auto;
    padding-left: 20px; /* Add a little padding on the left */
}

/* Table of Contents Styling */
.table-of-contents {
    width: 20%; /* Reduced width to give more space to the content */
    padding-right: 20px;
    border-right: 2px solid #ccc;
    position: sticky;
    top: 20px; /* Adjust this value as needed */
    align-self: flex-start;
    max-height: calc(100vh - 20px); /* Ensure it doesn't overflow the viewport */
    overflow-y: auto;
}

.table-of-contents ul {
    list-style-type: square;
    padding-left: 20px;
}

.table-of-contents li {
    margin-bottom: 10px;
}

/* Right column for search and main content */
.right-column {
    width: 80%; /* Increased width of the main content area */
    padding-left: 40px;
    box-sizing: border-box;
}

/* Adjust the margin-top to provide space for sticky search bar */
.main-content h2::before,
.main-content h3::before,
.main-content h4::before {
    content: "";
    display: block;
    height: 80px; /* Adjust this value based on your sticky search bar height */
    margin-top: -80px; /* This should match the height */
    visibility: hidden;
}

/* Ensure the search bar does not overlap with the header */
.main-content {
    padding-top: 20px; /* Additional padding to avoid content overlap */
}

/* Sticky Search Bar */
#search-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #eee; /* Matches the page background */
    padding-bottom: 10px;
}

/* Style for the search input */
#search-input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 10px;
}

/* Styling for the search result container */
#search-results .search-result {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

/* Styling for the link wrapping the content */
#search-results .search-result a {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Hover effect for the search result box */
#search-results .search-result:hover {
    background-color: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* Styling for the search result title */
#search-results .search-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
}

/* Style for the search result snippet */
#search-results .search-result p {
    margin-top: 8px;
    line-height: 1.5;
}

/* Highlighted text */
#search-results .search-result mark {
    background-color: #fffbcc;
    font-weight: bold;
}

/* Ensure the container takes full width */
.container a:link, .container a:visited {
    font-weight: bold;
    text-decoration: none;
    color: #000;
}

.container a:hover, .container a:active {
    font-weight: bold;
    text-decoration: none;
    color: #000;
}

ul {
    list-style: square outside none;
    font-size: inherit;
    background: #eeeeee;
    padding: 8px 0 9px 45px;
    margin: 0 0 1.25em 30px;
    line-height: 1.25;
}

hr {
    display: none;
}

.container {
    width: 100%;
    max-width: 1400px; /* Updated to match content-container */
    margin: 0 auto;
}

.hr {
    height: 1px;
    margin: 2rem 0;
    background: #ddd;
}

h1, h2, h3, h4, h5, h6 {
    color: #333;
}

h1 {
    font-size: 2.5em;
    font-weight: 700;
}

h2 {
    font-size: 2em;
    font-weight: 700;
}

h3 {
    font-size: 1.5em;
    font-weight: 700;
}

.entry-meta {
    margin-bottom: 50px;
}

/* Media Query for Mobile Devices */
@media (max-width: 768px) {
    .content-container {
        flex-direction: column; /* Stack the ToC and content vertically */
        padding-left: 10px;
    }

    .table-of-contents {
        width: 100%; /* Take full width on mobile */
        position: relative; /* Disable sticky positioning on mobile */
        border-right: none; /* Remove border on mobile */
        border-bottom: 2px solid #ccc; /* Add bottom border instead */
        margin-bottom: 20px; /* Add some space below the ToC */
        max-height: none; /* Remove the max-height restriction */
        overflow-y: visible; /* Ensure all content is visible */
    }

    .right-column {
        width: 100%; /* Take full width on mobile */
        padding-left: 10px;
    }

    h1, h2, h3 {
        font-size: 1.5em; /* Reduce heading sizes on mobile */
    }

    body {
        font-size: 1.4em; /* Slightly reduce body font size */
    }

    /* Sticky Search Bar for mobile */
    #search-container {
        position: sticky;
        top: 0;
        z-index: 1000;
        background-color: #eee;
        padding-bottom: 10px;
        width: 100%; /* Ensure the search container takes full width */
    }

    /* Ensure the search bar appears above the Table of Contents */
    .content-container {
        order: 1;
    }

    .table-of-contents {
        order: 2;
    }

    #search-container {
        order: 0;
    }
}
