:root {
    --container-max-width: 2000px;
    --sidebar-width: 350px;
    --main-content-max-width: 75ch;
    --background-color: #fdfdfd;
    --theme-color: #37c;
    --theme-color-dark: #33c;
    --theme-color-light: #f5f5f5;
    --theme-color-highlights: #333;
    --text-color: #000;
    --serif-font: Georgia, serif;
    /* --sans-serif-font: 'Helvetica Neue', Helvetica, Arial, sans-serif; */
    --sans-serif-font: 'IBM Plex Sans', sans-serif;
    --heading-font: "IBM Plex Sans", sans-serif;
    --gap-sm: .5rem;
    --gap-md: 1rem;
    --gap-lg: 2rem;
}

body, html {
    position: relative;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    max-width: 100%;
    font-family: var(--serif-font);
    font-size: 16px;
    line-height: 1.7rem;
    color: var(--text-color);
    background-color: var(--background-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
}

p {
    margin-top: 0;
    margin-bottom: var(--gap-sm);
}

header {
    padding: var(--gap-md);
    border-bottom: 1px solid var(--border-color);
}

.container {
    display: flex;
    flex-direction: row;
    max-width: var(--container-max-width);
    justify-content: center;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    padding-right: var(--sidebar-width);
}

.column {
    display: flex;
    flex-direction: column;
}

.left {
    background-color: var(--background-color);
    width: var(--sidebar-width);
}

.right {
  width: 0px;
}

.content {
    width: 100%;
    padding-bottom: var(--gap-lg);
}

.sticky-div {
    position: sticky;
    top: 40px;
    padding: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Webkit browsers like Chrome, Safari */
.sticky-div::-webkit-scrollbar {
    width: 2px;
}

.sticky-div::-webkit-scrollbar-track {
    background: #fff;
}

.sticky-div::-webkit-scrollbar-thumb {
    border-radius: 2px;
}


.main {
    max-width: var(--main-content-max-width);
    padding-left: var(--gap-lg);
    padding-right: var(--gap-lg);
    box-sizing: border-box;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Add this new rule */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: var(--gap-md) auto;
}

/* Figure and caption styles */
figure {
    margin: var(--gap-lg) auto;
    text-align: center;
    max-width: 100%;
}

figure img {
    margin: 0 auto;  /* Override the default img margins since figure has its own */
}

figcaption {
    margin-top: var(--gap-sm);
    font-style: italic;
    color: #666;
    font-size: 0.95em;
    line-height: 1.4;
}

.collapsed-sidebar {
    display: none;
    background-color: var(--background-color);
    padding: 10px 20px;
}

@media (max-width: 1450px) {
    .container {
        flex-direction: column;
        transform: none;
        padding-right: 0;
    }
    .left, .right {
        display: none;
    }
    .collapsed-sidebar {
        display: none;  /* Hide the non-collapsible version */
    }
    .main {
        padding-left: var(--gap-md);
        padding-right: var(--gap-md);
        max-width: min(100%, var(--main-content-max-width));
        margin: 0 auto; 
    }
    .main-content-container {
        left: 0;
    }
    .cover-image-container {
        width: 100%;
        margin-right: 0;
    }
}

header nav {
    max-width: var(--container-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

header nav ul {
    list-style-type: none;
}

header nav ul li {
    margin-left: var(--gap-md);
}

a,
a:active {
    color: var(--theme-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Hover effect (optional) */
header nav ul li a:hover {
    text-decoration: underline;
}

hr.toc-separator {
    border-top: 1px solid var(--theme-color-highlights);
    margin: 0;
}

.table-of-contents {
    font-family: var(--sans-serif-font);
}

.toc-site-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: left;
    font-family: var(--heading-font);
}

.toc-site-title a {
    color: var(--theme-color-highlights);
    text-decoration: none;
}

.toc-site-title a:hover {
    text-decoration: underline;
}

.table-of-contents .essay-entry {
    margin: 0.75rem 0;
    font-size: 1em;
    position: relative;
    display: flex;
    align-items: baseline;
}

.table-of-contents .essay-number {
    margin-right: 0.0rem;
    color: #888;
    font-weight: bold;
    min-width: 1.5rem;
    display: inline-block;
}

.table-of-contents .essay-entry a {
    display: inline-block;
    text-decoration: none;
    color: var(--theme-color-highlights);
}

.table-of-contents .essay-entry a:hover {
    text-decoration: underline;
}

.table-of-contents .current-essay-group {
    margin: 1rem 0;
    position: relative;
}

.table-of-contents .current-essay {
    margin: 0 0 0.5rem 0;
    position: relative;
    display: flex;
    align-items: baseline;
}

.table-of-contents .current-marker {
    position: absolute;
    left: -1.2em;
    color: #888;
}

.table-of-contents .toc-content {
    margin: 0;
    padding-left: 1.2rem;
    position: relative;
}

.table-of-contents .toc-sections {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.table-of-contents .section-item {
    line-height: 1.3;
    margin-bottom: 0;
    padding-left: 1.2rem;
    font-size: 0.95em;
    position: relative;
}

.table-of-contents .toc-h2 { padding-left: 1.2rem; }
.table-of-contents .toc-h3 { padding-left: 2rem; }
.table-of-contents .toc-h4 { padding-left: 2.8rem; }
.table-of-contents .toc-h5 { padding-left: 3.6rem; }
.table-of-contents .toc-h6 { padding-left: 4.4rem; }

.table-of-contents a {
    text-decoration: none;
    color: var(--theme-color-highlights);
}

.table-of-contents a:hover {
    text-decoration: underline;
}

.site-name {
    font-size: var(--gap-md);
    text-align: right;
    color: #555;
}

.site-name a:hover {
    text-decoration: underline;
}

.post-authors {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin-bottom: 1.5em;
    font-style: italic;
    font-family: var(--sans-serif-font);
}

.post-title {
    text-align: center;
    font-family: var(--heading-font);
    font-size: 2.5em;
    margin-bottom: 0.3em;
}


h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    font-weight: bold;
    line-height: 1.4em;
    letter-spacing: .01em;
}

/* Special styling for h3 headings on the intro page */
.intro-content h3 {
    margin-bottom: 0;
}

.heading-font {
    font-family: var(--heading-font);
}


.post-meta {
    color: #666;
    margin-top: 0;
    text-align: center;
    font-family: var(--sans-serif-font);
    font-size: var(--gap-md);
}

.post-summary {
    text-align: justify;
    margin: 1rem;
}

.post-content {
    width: 100%;
    padding: var(--gap-lg) 0;
    border-top: 1px solid var(--theme-color-highlights);
    border-bottom: 1px solid var(--theme-color-highlights);
}

.post-content p {
    margin-bottom: 1.5rem;
}

.footer {
    text-align: left;
    font-size: var(--gap-md);
}



/* Tab styles */
.tab-container {
    width: 100%;
    margin-top: var(--gap-lg);
}

.tab-container input[type="radio"] {
    display: none;
}

.tab-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--gap-md);
}

.tab-button {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    font-family: var(--sans-serif-font);
    text-align: center;
    border: 1px solid #ccc;
    letter-spacing: .01em;
}

.tab-button:hover {
    background-color: var(--theme-color-light);
    border-color: var(--theme-color-highlights);
    color: var(--theme-color-highlights);
}

.tab-content {
    display: none;
}

/* Show active tab content */
#tab1:checked ~ #chronological,
#tab2:checked ~ #type,
#tab3:checked ~ #topic {
    display: block;
}

/* Style for active tab button */
#tab1:checked ~ .tab-buttons label[for="tab1"],
#tab2:checked ~ .tab-buttons label[for="tab2"],
#tab3:checked ~ .tab-buttons label[for="tab3"] {
    border: 2px solid var(--theme-color-highlights);
    color: var(--theme-color-highlights);
    font-weight: bold;
}

.link-heading{
    font-style: italic;
    font-family: var(--sans-serif-font);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .tab-buttons {
        flex-direction: column;
    }

    .tab-button {
        margin-bottom: 5px;
    }
}

/* make quotes italicised */
blockquote {
    font-style: italic;
    color: #333;
    border-left: 1px solid var(--theme-color-highlights);
    margin: var(--gap-md) 0;
    padding-left: var(--gap-md);
}

code {
    font-size: 0.9em;
}

.post-navigation {
    margin: 0;
    padding: 0;
}

.post-navigation .nav-link {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.post-navigation a {
    color: #333;
    text-decoration: none;
}

.post-navigation a:hover {
    text-decoration: underline;
}

.toc-content {
    margin: 1em 0;
}

.post-navigation-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1em 0;
}

.post-navigation-footer .nav-link {
    margin: 0;
    width: 100%;
}

.post-navigation-footer .nav-link.small {
    font-size: 0.8em;
    color: #666;
}

.post-navigation-footer .nav-link.large {
    font-size: 1.2em;
    color: #333;
    text-align: right;
    width: 100%;
}

.post-navigation-footer a {
    text-decoration: none;
}

.post-navigation-footer a:hover {
    text-decoration: underline;
}

.cover-image-container {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
}

.cover-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    margin: 0;
}

.artist-credit {
    text-align: right;
    margin-top: 0.1rem;
    margin-bottom: var(--gap-md);
    font-size: 0.8rem;
    line-height: 1.2;
    font-family: var(--sans-serif-font);
}

.artist-credit a {
    color: var(--theme-color);
    text-decoration: none;
}

.artist-credit a:hover {
    text-decoration: underline;
}

/* New container for the main text content */
.main-content-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    left: 0;
}

/* Adjust the post title and meta to be centered */
.post-title, .post-meta {
    text-align: center;
    width: 100%;
}

/* Adjust the post content to fit within the new container */
.post-content {
    width: 100%;
    padding: var(--gap-lg) 0;
    border-top: 1px solid var(--theme-color-highlights);
    border-bottom: 1px solid var(--theme-color-highlights);
}

/* Adjust the footer to fit within the new container */
.footer {
    width: 100%;
    text-align: left;
    font-size: var(--gap-md);
    padding: var(--gap-md) 0;
    font-family: var(--sans-serif-font);
}

@media (min-width: 1451px) {
    /* Restore large‑screen layout tweaks */
    .main-content-container {
        left: calc((100vw - var(--main-content-max-width) - var(--sidebar-width)) / 4);
    }
    .cover-image-container {
        width: calc(100% + (100vw - var(--main-content-max-width) - var(--sidebar-width)) / 2);
        margin-right: calc(-1 * (100vw - var(--main-content-max-width) - var(--sidebar-width)) / 2);
    }
}

/* Collapsible inline TOC styles */
.inline-toc-container {
    width: 100%;
    text-align: center; /* center child inline elements */
}

.inline-toc-toggle {
    display: flex; /* block‑level flex so margin auto works */
    align-items: center;
    justify-content: space-between; /* Changed from center to space-between */
    font-size: 1.4em;
    height: 2.2rem;
    padding: 0 1rem; /* Added horizontal padding */
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 1rem auto;
    font-family: var(--heading-font);
    color: var(--theme-color-highlights);
    position: relative; /* Added for absolute positioning of text */
}

.inline-toc-toggle-icon {
    font-size: 1.7em;
    position: relative;
    top: -0.2rem;
    margin-right: 0; /* Removed right margin */
    z-index: 1; /* Ensure icon stays above text */
    width: 1.2em; /* Fixed width for the icon */
    height: 1.2em; /* Fixed height for the icon */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Add a new class for the text content */
.inline-toc-toggle-text {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 0;
}

.inline-toc-toggle:hover {
    background: var(--theme-color-light);
    color: var(--theme-color-highlights);
    text-decoration: none;
}

.inline-toc-toggle::after {
    content: none;
}

.inline-toc-content {
    display: none;
    margin-top: 1rem;
    width: 100%;
}

.inline-toc-content.expanded {
    display: block;
}

/* Center the nav container but keep headings left‑aligned */
.inline-toc-content .table-of-contents {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

/* Inline TOC wrapper styles */
.inline-toc-wrapper {
    display: none;  /* Hidden by default on large screens */
}

@media (max-width: 1450px) {
    .inline-toc-wrapper {
        display: block;  /* Show on smaller screens */
    }
}

/* Add media query for mobile devices */
@media (max-width: 600px) {
    .inline-toc-toggle {
        font-size: 1.2em; /* Slightly smaller font size on mobile */
    }
    
    .inline-toc-toggle-icon {
        font-size: 1.4em; /* Smaller icon size on mobile */
        width: 1em;
        height: 1em;
    }
}

/* Follow Section Styling */
.follow-section {
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    font-size: 1em;
    line-height: 1.5;
    font-family: var(--sans-serif-font);
}

/* Subscribe form styling */
.subscribe-form {
    display: flex;
    margin: 0.3rem 0;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.subscribe-form input[type="email"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: var(--sans-serif-font);
    font-size: 0.85em;
    background-color: transparent;
    color: var(--text-color);
    width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

.subscribe-form input[type="email"]:focus {
    border-color: var(--theme-color-highlights);
}

.subscribe-form button {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: transparent;
    color: var(--theme-color-highlights);
    text-decoration: none;
    font-family: var(--sans-serif-font);
    font-size: 0.85em;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.subscribe-form button:hover {
    background-color: var(--theme-color-light);
    text-decoration: none;
    border-color: var(--theme-color-highlights);
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.action-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: var(--theme-color-highlights);
    text-decoration: none;
    font-family: var(--sans-serif-font);
    font-size: 1.05em !important;
    text-align: center;
    flex: 1;
    margin: 0 0.25rem;
}

.action-button:hover {
    background-color: var(--theme-color-light);
    text-decoration: none;
}

.follow-title {
    font-weight: normal;
    color: #666;
    font-size: 1.05em;
    display: block;
    margin-bottom: 0.5rem;
}

.follow-section p {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
}

.follow-section a {
    color: var(--theme-color);
    text-decoration: none;
    font-size: 1em;
}

.follow-section a:hover {
    text-decoration: underline;
}

.follow-table {
    margin-top: 0.2rem;
    border-spacing: 0;
    border-collapse: collapse;
}

.follow-table td {
    padding: 0.15rem 0.3rem;
    vertical-align: middle;
    white-space: nowrap;
}

.follow-table td:first-child {
    padding-left: 0;
}

.social-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
    margin: 0;
}

.follow-table a {
    color: var(--theme-color);
    text-decoration: none;
    font-size: 0.85em;
}

.follow-table a:hover {
    text-decoration: underline;
}

.about-sidebar {
    padding: 1rem;
    font-family: var(--sans-serif-font);
}

.about-sidebar .toc-site-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 1rem;
}

.about-sidebar .toc-site-title a {
    color: var(--theme-color-highlights);
    text-decoration: none;
}

.about-sidebar .toc-site-title a:hover {
    text-decoration: underline;
}

/* Mobile follow section - only visible on small screens */
.mobile-follow-section {
    display: none; /* Hidden by default on large screens */
    width: 100%;
    padding-top: var(--gap-md);
}

@media (max-width: 1450px) {
    .mobile-follow-section {
        display: block; /* Show on smaller screens */
        border-top: 1px solid var(--theme-color-highlights);
    }
}

/* Hide site title within the inline collapsible TOC */
.inline-toc-content .toc-site-title {
    display: none;
}

/* Footnote styling */
.footnote-ref {
    text-decoration: none;
    color: var(--theme-color);
    position: relative;
}

/* Hide CSS pseudo-element tooltips since JS-driven tooltips will be used */
.footnote-ref::after, .footnote-ref::before {
    display: none !important;
}

/* Styles for the interactive footnote tooltip */
.footnote-tooltip {
    position: absolute;
    display: none;
    background: var(--background-color);
    border: 1px solid var(--theme-color-highlights);
    padding: 0.5rem;
    border-radius: 4px;
    max-width: 600px;
    min-width: 350px;
    font-size: 0.9em;
    color: var(--text-color);
    z-index: 1000;
    white-space: normal;
    word-wrap: break-word;
}

/* Links inside the tooltip */
.footnote-tooltip a {
    color: var(--theme-color);
    text-decoration: none;
}
.footnote-tooltip a:hover {
    color: var(--theme-color-highlights);
    text-decoration: underline;
}

/* Final subscribe section on history page */
.final-subscribe-section {
    margin: 2rem 0;
    padding: 1rem;
    text-align: center;
}

.final-subscribe-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--theme-color-highlights);
}

.final-subscribe-section .subscribe-form {
    max-width: 400px;
    margin: 0 auto;
}