:root {
    --max-content-width: 750px;
    --toc-width: 250px;
    --main-font: Georgia, 'Times New Roman', serif;
    --text-color: #333;
    --link-color: #0066cc;
    --border-color: #e0e0e0;
    --bg-subtle: #f1f1f1;
    --muted: #666;
    --faint: #888;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--main-font);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-color);
    background: #fafafa;
    overflow-x: hidden;
    padding-bottom: 4rem;
}

hr { border: none; border-top: 1px solid var(--border-color); margin: 2rem 0; }

/* Site header: fixed top-right name */
.site-header { position: fixed; top: 1rem; right: 1.5rem; z-index: 100; }
.site-header a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    opacity: 0.8;
}
.site-header a:hover { opacity: 1; }

.mobile-article-header { display: none; }

.container, main.container { max-width: 1400px; margin: 0 auto; padding: 4.5rem 2rem 2rem; }

/* Home: wordmark + timeline */
.landing { display: flex; gap: 4rem; min-height: calc(100vh - 10rem); align-items: flex-start; }
.landing-left { flex: 0 0 40%; position: sticky; top: 8rem; padding-top: 4rem; }
.landing-right { flex: 1; max-width: 600px; }
.wordmark { font-size: 2.6rem; font-weight: normal; line-height: 1.15; text-wrap: balance; }
.tagline { color: var(--faint); margin-top: 0.75rem; font-style: italic; }
.intro { margin-top: 1.5rem; color: var(--muted); font-size: 0.95rem; }
.intro a { color: var(--link-color); text-decoration: none; }

.timeline { width: 100%; position: relative; padding: 4rem 0; }
.timeline::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
    background: repeating-linear-gradient(to bottom, #888 0, #888 4px, transparent 4px, transparent 8px);
}
.timeline-item {
    position: relative; margin-bottom: 2.5rem; text-decoration: none;
    color: inherit; display: block; padding-left: 3.5rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
    content: ''; position: absolute; left: 0; top: 0.65rem; width: 3rem; height: 1px;
    background: repeating-linear-gradient(to right, #888 0, #888 4px, transparent 4px, transparent 8px);
}
.timeline-item:hover .timeline-title { opacity: 0.6; }
.timeline-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.4rem; }
.timeline-title { font-weight: 600; font-size: 0.95rem; color: var(--text-color); transition: opacity 0.2s; }
.timeline-date { font-size: 0.8rem; color: var(--faint); white-space: nowrap; }
.timeline-desc { font-size: 0.85rem; color: #777; line-height: 1.5; }

/* Article layout */
.content-area { display: flex; align-items: flex-start; gap: 2rem; }
.content-area-no-toc > .article-content { max-width: var(--max-content-width); margin: 0 auto; }
article.content.no-toc > header { margin-left: auto; margin-right: auto; }
article.content > header { max-width: var(--max-content-width); margin-left: calc(var(--toc-width) + 2rem); margin-bottom: 2rem; }
.article-content { max-width: var(--max-content-width); min-width: 0; }

article h1 { font-size: 2.5rem; line-height: 1.3; margin-bottom: 1rem; font-weight: normal; text-wrap: balance; }
.description { font-size: 1.1rem; color: var(--muted); margin: 0.5rem 0 1rem; line-height: 1.5; font-style: italic; }
.meta { font-size: 0.9rem; color: var(--faint); }
.meta > * { margin-right: 1rem; }

.featured-image { margin: 2rem 0 2.8rem; }
.featured-image img { width: 100%; height: auto; display: block; }

/* Table of contents */
.toc {
    position: sticky; top: 2rem; flex: 0 0 var(--toc-width); align-self: flex-start;
    max-height: calc(100vh - 4rem); overflow-y: auto; font-size: 0.85em; line-height: 1.5;
}
.toc h3 { font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin-bottom: 1rem; font-weight: normal; }
.toc ul { list-style: none; }
.toc > nav > ul > li { margin: 0.5rem 0; }
.toc li li { margin: 0.3rem 0; }
.toc ul ul { padding-left: 1.2rem; margin-top: 0.2rem; }
.toc a { color: var(--text-color); text-decoration: none; opacity: 0.7; transition: opacity 0.2s; display: block; }
.toc > nav > ul > li > a { font-weight: 500; opacity: 0.85; }
.toc ul ul a { font-size: 0.95em; }
.toc a:hover { opacity: 1; }
.toc a.active { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* Article typography */
.article-content h2 { font-size: 1.6rem; margin: 2rem 0 1rem; line-height: 1.3; font-weight: normal; scroll-margin-top: 3rem; }
.article-content h3 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; line-height: 1.3; font-weight: normal; scroll-margin-top: 3rem; }
.article-content h4 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; line-height: 1.3; scroll-margin-top: 3rem; }
.article-content p { margin-bottom: 1.2rem; }
.article-content ul, .article-content ol { margin: 0 0 1.2rem 1.5rem; }
.article-content li { margin-bottom: 0.4rem; }
.article-content li > ul, .article-content li > ol { margin-top: 0.4rem; margin-bottom: 0; }
.article-content a { color: var(--link-color); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.article-content a:hover { border-bottom-color: var(--link-color); }
.article-content blockquote { border-left: 3px solid var(--border-color); padding-left: 1.5rem; margin: 1.5rem 0; font-style: italic; color: var(--muted); }
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content code { font-size: 0.85em; padding: 0.2em 0.4em; background: var(--bg-subtle); border-radius: 3px; font-family: Menlo, 'Courier New', monospace; }
.article-content pre { background: var(--bg-subtle); padding: 1rem; border-radius: 4px; overflow-x: auto; margin: 1.5rem 0; font-size: 0.9em; line-height: 1.5; }
.article-content pre code { padding: 0; background: none; font-size: inherit; }
.article-content img { max-width: 100%; height: auto; display: block; margin: 2rem auto; }
.article-content p img + em, .article-content img + em {
    display: block; text-align: center; font-size: 0.85rem; color: var(--muted);
    margin-top: -1.5rem; margin-bottom: 2rem; line-height: 1.4;
}
.article-content table { border-collapse: collapse; margin: 1.5rem 0; width: 100%; font-size: 0.95em; }
.article-content th, .article-content td { border: 1px solid var(--border-color); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
.article-content th { background: var(--bg-subtle); }
.article-content sup { font-size: 0.7em; line-height: 0; }
.article-content .twitter-tweet { margin: 1.5rem auto; }
.article-content .footnotes { font-size: 0.85em; color: var(--muted); margin-top: 3rem; }
.post-categories { margin-top: 3rem; font-size: 0.85rem; color: var(--faint); }
.post-categories a { color: var(--faint); text-transform: capitalize; }

/* Footer */
.site-footer {
    max-width: 1400px; margin: 4rem auto 0; padding: 2rem;
    display: flex; justify-content: center; gap: 2rem; font-size: 0.8rem; color: #999;
}
.site-footer a { color: #999; text-decoration: none; }
.site-footer a:hover { color: var(--muted); }

@media (max-width: 1199px) {
    article.content > header { margin-left: 0; }
    .toc { display: none; }
    .content-area > .article-content { margin: 0 auto; }
}

@media (max-width: 900px) {
    .landing { flex-direction: column; gap: 0; min-height: 0; }
    .landing-left { position: static; padding-top: 0; flex: none; }
    .landing-right { max-width: none; }
    .timeline { padding-top: 2.5rem; }
}

@media (max-width: 768px) {
    .site-header { display: none; }
    .mobile-article-header {
        display: block; text-align: center; font-size: 1.1rem; letter-spacing: 0.02em;
        margin-bottom: 1.5rem; padding-top: 0.5rem; color: var(--text-color); text-decoration: none;
    }
    .container, main.container { padding: 1.5rem 1.25rem 2rem; }
    article h1 { font-size: 2rem; }
    .wordmark { font-size: 2.2rem; }
    .timeline-header { flex-direction: column; gap: 0.15rem; }
}
