:root {
    --bg-color: #fff;
    --text-color: #000;
    --border-color: #afafaf;
    --muted: #6b6b6b;
    --link-color: #2b56dd;
}

.dark {
    --bg-color: #0a0a0a;
    --text-color: #e5e5e5;
    --border-color: #333;
    --muted: #8a8a8a;
    --link-color: #6fa8ff;
}

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

html {
    overflow-y: scroll;
    background-color: var(--bg-color);
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-feature-settings: 'onum' 1;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-color);
    max-width: 600px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-color);
}

p { margin-bottom: 1.3rem; }
h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 2rem; }

a.link {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}
a.link:hover { opacity: .7; }

/* Theme Toggle Star */
.theme-star {
    background: none;
    border: none;
    color: var(--link-color);
    font-family: inherit;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    margin-left: .1em;
    line-height: 1;
    vertical-align: baseline;
}
.theme-star:hover { opacity: .7; }

/* Section Layouts */
section { margin-top: 3rem; }
section h2 { font-size: .95rem; font-weight: 400; color: var(--muted); margin-bottom: 1.1rem; }

.row-list { list-style: none; }
.row-list li {
    display: grid;
    grid-template-columns: 4rem 1fr auto;
    align-items: baseline;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.row-list .year { color: var(--text-color); }
.row-list .title { color: var(--text-color); text-decoration: none; transition: opacity .15s ease; }
.row-list .title:hover { opacity: .5; }
.row-list .date { color: var(--text-color); white-space: nowrap; text-align: right; }

.connect-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

/* Article specific typography (fallback, single-column pages) */
article p { margin-bottom: 1.5rem; }
article h1 { font-size: 1.4rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 0.5rem; }
.meta-data { color: var(--muted); font-size: 0.9rem; margin-bottom: 2.5rem; display: block; }

nav { margin-bottom: 3rem; }
nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
nav a:hover { color: var(--text-color); text-decoration: underline; }

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--muted);
    font-size: .75rem;
}

/* Text selection highlight */
::selection {
    background-color: rgba(247, 199, 60, 0.35);
    color: var(--text-color);
}

.dark ::selection {
    background-color: rgba(247, 199, 60, 0.22);
    color: var(--text-color);
}

/* Hover preview popup */
.preview-popup {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px) scale(.98);
    transition: opacity .15s ease, transform .15s ease;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    border: 1px solid var(--border-color);
}
.preview-popup.visible { opacity: 1; transform: translateY(0) scale(1); }
.preview-popup img { display: block; width: 220px; height: auto; }
@media (max-width:640px) { .preview-popup { display: none; } }

/* ============================================= */
/* Post page — two-column layout (fixed left nav, */
/* content column with right-hand border rule)     */
/* ============================================= */

body.post {
    max-width: none;
    padding: 0;
}

.post-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
    display: grid;
    grid-template-columns: 150px minmax(0, 600px);
    gap: 4rem;
    align-items: start;
}

.post-nav {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    position: sticky;
    top: 4rem;
    margin-bottom: 0;
}

.post-nav .back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: .95rem;
}
.post-nav .back-link:hover { color: var(--text-color); text-decoration: underline; }

.post-nav .post-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    list-style: none;
}

.post-nav .post-list a {
    color: var(--muted);
    text-decoration: none;
    font-size: .95rem;
    line-height: 1.5;
}
.post-nav .post-list a:hover { color: var(--text-color); text-decoration: underline; }

.post-nav .post-list .current {
    color: var(--text-color);
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.5;
}

.post-content {
    border-right: 1px solid var(--border-color);
    padding-right: 3rem;
}

.post-content h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: 2.5rem;
}

.post-content .lede {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 2rem;
}

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

.post-content footer {
    border-top: none;
    padding-top: 0;
    margin-top: 3rem;
}

@media (max-width: 800px) {
    .post-wrap {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2.5rem 1.25rem 4rem;
    }
    .post-nav {
        position: static;
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
    }
    .post-content {
        border-right: none;
        padding-right: 0;
    }
}
