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

:root {
    --bg: #111;
    --bg-secondary: #1a1a1a;
    --text: #d4d4d4;
    --text-muted: #888;
    --text-heading: #e5e5e5;
    --link: #c9a0dc;
    --link-hover: #e0c0f0;
    --border: #2a2a2a;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "PT Serif", Georgia, "Times New Roman", serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas,
        monospace;
    --max-width: 720px;
    --sidebar-width: 180px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* === Layout === */
.site-wrapper {
    display: flex;
    flex-direction: row;
    max-width: 960px;
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
    gap: 4rem;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 4rem;
    align-self: flex-start;
}

.site-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 2rem;
}

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

.site-title a:hover {
    color: var(--link);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
}

nav a:hover,
nav a.active {
    color: var(--text-heading);
}

/* === Main Content === */
.main-content {
    flex: 1;
    min-width: 0;
    max-width: var(--max-width);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    line-height: 1.3;
    font-size: 0.9375rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1.25rem;
    font-family: var(--font-serif);
    font-size: 1rem;
}

ul, ol {
    font-size: 1rem;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--link-hover);
}

strong {
    color: var(--text-heading);
}

/* === Page Titles (kept large) === */
.about-content h1,
.post-header h1,
#content > h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* === About / Homepage === */
.about-content p {
    font-size: 1rem;
}

/* === Post List (Writing page) === */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-list-item {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background-color 0.15s;
}

.post-list-item:first-child {
    border-top: 1px solid var(--border);
}

.post-list-item:hover {
    background-color: var(--bg-secondary);
}

.post-list-item h3 {
    color: var(--text-heading);
    font-size: 1rem;
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.post-list-item .date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === Single Post === */
.post-header {
    margin-bottom: 2.5rem;
}

.post-header h1 {
    margin-bottom: 0.5rem;
}

.post-header .date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.post-body {
    font-family: var(--font-serif);
}

.post-body p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.post-body ul,
.post-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    font-family: var(--font-serif);
    font-size: 1rem;
}

.post-body li {
    margin-bottom: 0.4rem;
}

.post-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1rem;
    color: var(--text-muted);
    margin: 1.5rem 0;
    font-style: italic;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.post-body pre {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
}

.post-body code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--bg-secondary);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    color: #e0a0c0;
}

.post-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* === Prev/Next Navigation === */
.prev-next {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.prev-next a {
    color: var(--text-muted);
    text-decoration: none;
}

.prev-next a:hover {
    color: var(--text-heading);
}

/* === Built With === */
.built-with {
    margin-top: 4rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.built-with a {
    color: var(--text-muted);
    text-decoration: underline;
}

.built-with a:hover {
    color: var(--text-heading);
}

/* === Footer === */
.site-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1rem;
}

.site-footer a:hover {
    color: var(--text-heading);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    margin-left: 0;
}

/* === Responsive === */
@media (max-width: 768px) {
    .site-wrapper {
        flex-direction: column;
        padding: 2rem 1.25rem 4rem;
        gap: 2rem;
    }

    .sidebar {
        width: 100%;
        position: static;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 2rem;
    }

    .site-title {
        margin-bottom: 0;
    }

    nav {
        flex-direction: row;
        gap: 1rem;
    }

    .about-content h1,
    .post-header h1,
    #content > h1 {
        font-size: 1.25rem;
    }
}
