/* CSS Variables for theming */
:root {
    --bg-color: #fafafa;
    --text-color: #1a1a1a;
    --text-secondary: #666;
    --link-color: #1a1a1a;
    --link-hover: #555;
    --border-color: #e0e0e0;
    --code-bg: #f4f4f4;
    --nav-bg: #fafafa;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e8e8e8;
    --text-secondary: #a0a0a0;
    --link-color: #e8e8e8;
    --link-hover: #b0b0b0;
    --border-color: #333;
    --code-bg: #2a2a2a;
    --nav-bg: #1a1a1a;
}

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

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

body {
    font-family: 'EB Garamond', Georgia, serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
header {
    margin-bottom: 3rem;
}

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

.nav-name {
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-color);
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

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

/* Theme toggle button */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

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

.sun-icon {
    display: none;
}

.moon-icon {
    display: inline;
}

[data-theme="dark"] .sun-icon {
    display: inline;
}

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

/* Main content */
main {
    flex: 1;
}

/* Post styles */
article h1 {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

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

.post-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.post-meta time {
    color: var(--text-secondary);
}

.view-count {
    color: var(--text-secondary);
}

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

.post-content {
    font-size: 1.05rem;
}

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

.post-content h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem;
}

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

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

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

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

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

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

.post-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background-color: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

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

.post-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
}

.post-content img.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    float: right;
    margin: 0 0 1rem 1.5rem;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}

.post-content th, .post-content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.post-content th {
    background-color: var(--code-bg);
}

/* Blog list */
.post-list h1 {
    margin-bottom: 2rem;
}

.posts {
    list-style: none;
}

.posts li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

.posts a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
}

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

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

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .container {
        padding: 1.5rem 1rem;
    }

    article h1 {
        font-size: 1.75rem;
    }

    .posts li {
        flex-direction: column;
        gap: 0.25rem;
    }
}
