:root {
    --accent: #FF4D4D;
    --bg: #ffffff;
    --fg: #1a1a1a;
    --fg-muted: #666666;
    --border: #e5e5e5;
    --code-bg: #f5f5f5;
    --link: var(--accent);
    --link-hover: #ff3333;
    --max-width: 800px;
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --fg: #e5e5e5;
    --fg-muted: #999999;
    --border: #333333;
    --code-bg: #2a2a2a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

.main-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fg);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

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

.nav-links a:hover {
    color: var(--accent);
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg);
    padding: 0.5rem;
    display: flex;
    align-items: center;
}

[data-theme="dark"] .sun-icon,
[data-theme="light"] .moon-icon {
    display: none;
}

/* Main */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

/* Home */
.hero {
    text-align: center;
    padding: 3rem 0 4rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--fg-muted);
}

.recent-posts h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* Posts */
.post-preview {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

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

.post-preview h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.post-preview h3 a {
    color: var(--fg);
    text-decoration: none;
    transition: color 0.2s;
}

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

.post-meta {
    display: flex;
    gap: 1rem;
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-summary {
    color: var(--fg-muted);
    line-height: 1.7;
}

/* Single post */
.post-header {
    margin-bottom: 3rem;
}

.post-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.post-content {
    line-height: 1.8;
}

.post-content h2 {
    font-size: 2rem;
    margin: 2.5rem 0 1rem;
}

.post-content h3 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

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

.post-content a {
    color: var(--link);
    text-decoration: underline;
}

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

.post-content code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

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

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 2rem 0;
}

.post-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--fg-muted);
    font-style: italic;
}

.post-content ul, .post-content ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

/* TOC */
.toc {
    background: var(--code-bg);
    padding: 1.5rem;
    border-radius: 5px;
    margin-bottom: 2rem;
}

.toc h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.toc ul {
    list-style: none;
    margin: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--fg);
    text-decoration: none;
}

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

/* Tags */
.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.tag {
    background: var(--code-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    text-decoration: none;
    color: var(--fg);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.tag:hover {
    background: var(--accent);
    color: white;
}

/* List page */
.year-group {
    margin-bottom: 3rem;
}

.year-group h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

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

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    color: var(--fg-muted);
}

.social-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.social-links a {
    color: var(--fg-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--accent);
}

/* Profile image */
.profile-image {
    position: fixed;
    bottom: 20px;
    left: auto;
    right: 20px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: transform 0.3s ease;
    object-fit: cover;
    object-position: center;
}

.profile-image:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .post-header h1 {
        font-size: 2rem;
    }

    .main-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .profile-image {
        width: 100px;
        height: 100px;
        bottom: 15px;
        right: 15px;
        object-fit: cover;
        object-position: center;
    }
}
