/* CSS Variables for theming */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --code-bg: #0f0f1a;
    --border: #2a2a4a;
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #666666;
    --accent: #e94560;
    --accent-hover: #d63050;
    --code-bg: #f0f0f0;
    --border: #e0e0e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.logo:hover {
    color: var(--accent-hover);
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#theme-toggle:hover {
    border-color: var(--accent);
}

/* Main Content */
main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* Post List */
.post-list {
    list-style: none;
}

.post-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.post-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.post-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.post-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-excerpt {
    margin-top: 0.75rem;
    color: var(--text-secondary);
}

/* Single Post */
.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.post-header .post-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--accent);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Post Content (Markdown) */
.post-content {
    font-size: 1.1rem;
}

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

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

.post-content a {
    color: var(--accent);
}

.post-content a:hover {
    color: var(--accent-hover);
}

.post-content code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
}

.post-content pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    padding: 0;
    background: none;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.post-content img {
    max-width: 100%;
    border-radius: 8px;
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Error */
.error {
    text-align: center;
    padding: 2rem;
    color: var(--accent);
}

/* Responsive */
@media (max-width: 600px) {
    .post-title {
        font-size: 1.25rem;
    }
    
    .post-header .post-title {
        font-size: 1.5rem;
    }
}