:root {
    --primary-color: #333;
    --secondary-color: #666;
    --background-color: #fff;
    --border-color: #eee;
    --link-color: #0066cc;
    --max-width: 800px;
    --code-bg: #f5f5f5;
    --category-bg: #f0f0f0;
}

html[data-theme="dark"] {
    --primary-color: #e0e0e0;
    --secondary-color: #999;
    --background-color: #1a1a1a;
    --border-color: #333;
    --link-color: #66b3ff;
    --code-bg: #2a2a2a;
    --category-bg: #2a2a2a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--background-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

header nav {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
}

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

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

.nav-links a {
    color: var(--secondary-color);
    text-decoration: none;
}

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

#search {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 200px;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--secondary-color);
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.post-preview {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
}

.post-preview-content {
    flex: 1;
}

.post-preview-image {
    flex-shrink: 0;
    width: 200px;
    height: 120px;
}

.post-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.post-preview h2 {
    margin-bottom: 0.5rem;
}

.post-preview h2 a {
    color: var(--primary-color);
    text-decoration: none;
}

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

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

.post-meta .date::after {
    content: " • ";
    margin: 0 0.5rem;
}

.post-meta .category {
    background-color: var(--category-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.post-header {
    margin-bottom: 2rem;
}

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

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

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

.post-content h3 {
    margin: 1.5rem 0 0.75rem;
}

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

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

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

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

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

.youtube-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 2rem 0;
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.search-results {
    margin-bottom: 2rem;
}

.search-results h2 {
    margin-bottom: 1rem;
}

.search-result {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-result h3 {
    margin-bottom: 0.5rem;
}

.search-result h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.search-result h3 a:hover {
    color: var(--link-color);
}

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

footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--border-color);
}

@media (max-width: 600px) {
    .nav-links {
        gap: 1rem;
    }
    
    #search {
        width: 150px;
    }
    
    .post-header h1 {
        font-size: 2rem;
    }
    
    .post-preview {
        flex-direction: column;
    }
    
    .post-preview-image {
        width: 100%;
        height: 200px;
    }
}