/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-text: #333;
    --color-bg: #fff;
    --color-border: #e5e5e5;
    --color-code-bg: #f8f8f8;
    --color-link: #333;
    --color-link-hover: #666;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    --max-width: 65ch;
    --line-height: 1.6;
    --font-size: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #e5e5e5;
        --color-bg: #0a0a0a;
        --color-border: #333;
        --color-code-bg: #1a1a1a;
        --color-link: #e5e5e5;
        --color-link-hover: #b5b5b5;
    }
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1.5rem;
}

.site-nav a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Main content */
.site-main {
    min-height: 60vh;
    margin-bottom: 3rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

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

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

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--color-code-bg);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

pre {
    background-color: var(--color-code-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background: none;
    padding: 0;
}

/* Lists */
ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--color-border);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* Home page */
.home-intro {
    margin-bottom: 3rem;
}

.home-intro h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.home-intro p {
    font-size: 1.125rem;
    color: var(--color-link-hover);
}

.recent-posts {
    margin-bottom: 3rem;
}

.recent-posts h2 {
    margin-bottom: 1.5rem;
}

.post-list {
    list-style: none;
    padding: 0;
}

.post-list li {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.post-list li:last-child {
    border-bottom: none;
}

.post-list h3 {
    margin-bottom: 0.5rem;
}

.post-list h3 a {
    text-decoration: none;
}

.post-list h3 a:hover {
    text-decoration: underline;
}

.post-meta {
    font-size: 0.9rem;
    color: var(--color-link-hover);
    margin-bottom: 0.5rem;
}

.post-excerpt {
    color: var(--color-link-hover);
}

/* Post page */
.post-header {
    margin-bottom: 2rem;
}

.post-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.post-content {
    margin-bottom: 3rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h1:first-child,
.post-content h2:first-child,
.post-content h3:first-child,
.post-content h4:first-child,
.post-content h5:first-child,
.post-content h6:first-child {
    margin-top: 0;
}

/* Related posts */
.related-posts {
    border-top: 1px solid var(--color-border);
    padding-top: 2rem;
}

.related-posts h2 {
    margin-bottom: 1rem;
}

.related-posts ul {
    list-style: none;
    padding: 0;
}

.related-posts li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.related-posts a {
    text-decoration: none;
}

.related-posts a:hover {
    text-decoration: underline;
}

.related-posts time {
    font-size: 0.9rem;
    color: var(--color-link-hover);
    margin-left: 1rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-wrapper {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-link-hover);
}

.footer-wrapper p {
    margin-bottom: 0.5rem;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .header-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .site-nav {
        gap: 1rem;
    }
    
    .related-posts li {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .related-posts time {
        margin-left: 0;
        margin-top: 0.25rem;
    }
    
    .home-intro h1 {
        font-size: 2rem;
    }
    
    .post-title {
        font-size: 2rem;
    }
}