/* ==========================================================================
   PRIOR KNOWLEDGE — single-column centered layout
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: #fafafa;
    color: #222;
    font-family: 'Lora', Georgia, serif;
    line-height: 1.75;
}

/* --- Centered container --- */
#body-container {
    display: flex;
    flex-direction: column;
    width: 65ch;
    min-height: 100vh;
}

@media (max-width: 768px) {
    #body-container {
        width: 100%;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

/* --- Header & Top Nav --- */
#header {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding-top: 2rem;
}

#header h1 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin: 0 0 0.25rem 0;
    text-align: center;
}

#header-text a {
    text-decoration: none;
    color: #111;
}

#header-text a:hover {
    color: #222;
}

#header-subtitle {
    display: none;
    font-family: 'Lora', Georgia, serif;
    font-size: 1.1rem;
    font-style: italic;
    color: #555;
    margin: 0 0 1rem 0;
    text-align: center;
}

/* Hamburger — hidden on desktop, centered "☰ Menu" button on mobile */
#hamburger-btn {
    display: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #222;
    background: none;
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    padding: 0.35rem 1.25rem;
    margin: 0 auto 1.5rem auto;
}

#topnav {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #222;
    border-top: 2px solid #222;
    font-family: 'IBM Plex Mono', monospace;
    width: 100%;
    margin-bottom: 2rem;
}

#topnav ul {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.25rem 1.25rem;
    padding: 0.5rem 0;
}

#topnav ul li a {
    text-decoration: none;
    color: #555;
    font-size: 0.8rem;
    font-weight: 400;
    transition: color 0.15s;
}

#topnav ul li a:hover {
    color: #111;
}

#topnav ul li a.active {
    color: #111;
    font-weight: 700;
}

/* --- Content area --- */
#content {
    flex: 1;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', Georgia, serif;
    color: #111;
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

p {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

/* --- Links --- */
a {
    color: #222;
    text-decoration: none;
}

#content a {
    text-decoration: underline;
    text-decoration-color: #bbb;
    text-underline-offset: 2px;
}

#content a:hover {
    text-decoration-color: #222;
}

/* --- Article --- */
.article-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 0.5rem;
}

.article-title a {
    text-decoration: none !important;
    color: #111;
}

.post-time {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.post-time a {
    text-decoration: none !important;
    color: inherit;
}

/* --- Standfirst --- */
#single-content > p:first-child {
    font-size: 1.05em;
}

/* --- Epigraph shortcode --- */
.right-align {
    text-align: right;
    font-style: italic;
    color: #555;
    margin: 1.5rem 0 2rem 0;
    padding-right: 1rem;
    font-size: 0.95em;
    line-height: 1.6;
}

.keep-linebreaks {
    white-space: pre-wrap;
}

/* --- Table of Contents --- */
.toc-wrapper {
    margin: 1.5rem 0 2rem 0;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: #f9f9f9;
}

.toc-wrapper summary {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #555;
    cursor: pointer;
    padding: 0.6rem 1rem;
    list-style: none;
}

.toc-wrapper summary::-webkit-details-marker {
    display: none;
}

.toc-wrapper summary::before {
    content: "▸ ";
}

.toc-wrapper[open] summary::before {
    content: "▾ ";
}

.toc-wrapper nav#TableOfContents {
    padding: 0 1rem 0.6rem 1rem;
}

.toc-wrapper nav#TableOfContents ul {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}

.toc-wrapper nav#TableOfContents > ul {
    padding-left: 0;
}

.toc-wrapper nav#TableOfContents li {
    margin-bottom: 0.25rem;
}

.toc-wrapper nav#TableOfContents a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #555;
    text-decoration: none;
}

.toc-wrapper nav#TableOfContents a:hover {
    color: #111;
}

/* --- Figures & Images --- */
figure {
    margin: 1.5rem 0;
    padding: 0;
}

figure img {
    max-width: 100%;
    height: auto;
    display: block;
}

figure figcaption,
figure figcaption h4 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
    color: #555;
    font-style: italic;
    margin-top: 0.5rem;
    font-weight: 400;
}

/* --- Footnotes --- */
.footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
    font-size: 0.88rem;
    color: #444;
    line-height: 1.6;
}

.footnotes ol {
    padding-left: 1.5rem;
}

.footnotes li {
    margin-bottom: 0.75rem;
}

.footnotes a {
    color: #555;
}

.footnote-ref {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

.footnote-ref a {
    color: #555;
    text-decoration: none !important;
}

.footnote-backref {
    text-decoration: none !important;
    color: #555;
    font-size: 0.85em;
}

sup a {
    color: #555;
    text-decoration: none !important;
    font-size: 0.75em;
}

/* --- Series navigation at bottom of essay --- */
.series-next {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

.series-next a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: #222;
    text-decoration: none !important;
    font-weight: 700;
}

.series-next a:hover {
    text-decoration: underline !important;
}

/* --- List pages --- */
#list-main {
    display: block;
}

#list-main h1 {
    font-size: 1.75rem;
}

#list-main ul {
    list-style: none;
    padding: 0;
}

#list-main ul li {
    margin-bottom: 0.5rem;
}

#list-main ul li a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
}

/* --- Single page --- */
#main-single {
    display: block;
    overflow-wrap: anywhere;
}

#main-single img {
    max-width: 100%;
    height: auto;
}

/* --- Footer --- */
#footer {
    text-align: center;
    padding: 2rem 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #888;
    border-top: 1px solid #e0e0e0;
    margin-top: 2rem;
}

/* --- Mailchimp signup --- */
#mc_embed_signup {
    background: transparent !important;
    font-size: 0.8rem !important;
    padding: 0 !important;
}

#mc_embed_signup label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #555;
}

#mc_embed_signup .email {
    font-size: 0.8rem;
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ccc;
    background: #fff;
    margin-top: 0.4rem;
}

#mc_embed_signup .button {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    background: #222;
    color: #fafafa;
    border: none;
    padding: 0.4rem 1rem;
    cursor: pointer;
    margin-top: 0.4rem;
}

#mc_embed_signup .button:hover {
    background: #444;
}

/* --- Blockquotes --- */
blockquote {
    margin: 1.5rem 0;
    padding-left: 1.25rem;
    border-left: 2px solid #ddd;
    color: #444;
    font-style: italic;
}

/* --- Code --- */
code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85em;
    background: #f0f0f0;
    padding: 0.15em 0.3em;
    border-radius: 2px;
}

pre code {
    display: block;
    padding: 1rem;
    overflow-x: auto;
    background: #f0f0f0;
}

/* --- Lists in content --- */
#single-content ul,
#single-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

#single-content li {
    margin-bottom: 0.4rem;
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    #hamburger-btn {
        display: block;
    }

    #header-subtitle {
        display: block;
    }

    #topnav {
        display: none;
        border-top: none;
    }

    #topnav.open {
        display: block;
    }

    #topnav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.5rem 0;
    }

    #topnav ul li {
        width: 100%;
    }

    #topnav ul li a {
        display: block;
        padding: 0.4rem 0;
        font-size: 0.8rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    figure {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    figure img {
        width: 100%;
    }
}
