:root {
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --color-text: #2c3e50;
    --color-link: #2c3e50;
    --color-link-hover: #0984E3;
    --color-muted: #6b7280;
}

* {
    box-sizing: border-box;
}

body {
    line-height: 1.7;
    max-width: 650px;
    margin: 3rem auto;
    padding: 0 1rem;
    color: #2c3e50;
    font-size: 1.125rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 2rem;
}

p {
    margin-bottom: 1.5rem;
}

a {
    color: #2c3e50;
    text-decoration: none;
    border-bottom: 1px solid #2c3e50;
}

a:hover {
    border-bottom: 2px solid #2c3e50;
}

/* Navigation */
.chapter-nav {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.chapter-nav a {
    color: var(--color-muted);
    border-bottom: none;
}

.chapter-nav a:hover {
    color: var(--color-text);
    border-bottom: none;
}

/* Chapter title */
h1.chapter-title {
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 2rem;
}

/* Content styling */
.chapter-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 2.5rem 0;
}

/* Images */
.chapter-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.captioned-image-container {
    margin: 2rem 0;
}

.captioned-image-container figure {
    margin: 0;
}

.captioned-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Hide substack UI elements */
.image-link-expand,
.pencraft,
button {
    display: none !important;
}

/* Chapter navigation at bottom */
.chapter-footer {
    font-family: var(--font-primary);
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.chapter-footer a {
    color: var(--color-text);
    border-bottom: none;
    padding: 0.5rem 0;
}

.chapter-footer a:hover {
    color: var(--color-link-hover);
    border-bottom: none;
}

.chapter-footer .prev::before {
    content: "\2190\00a0";
}

.chapter-footer .next::after {
    content: "\00a0\2192";
}

/* Mobile optimization */
@media (max-width: 600px) {
    body {
        padding: 0 1rem;
        margin: 2rem auto;
    }

    h1.chapter-title {
        font-size: 1.5rem;
    }
}
