/* Theme Variables */
:root {
    --bg-primary: #faf8f5;
    --bg-secondary: #f5f5f5;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #888;
    --link-color: #0066cc;
    --border-color: #ddd;
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --inline-code-bg: #f0ede8;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --link-color: #5cacee;
    --border-color: #404040;
    --code-bg: #0d0d0d;
    --code-text: #d4d4d4;
    --inline-code-bg: #2a2a2a;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2a2a2a;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-muted: #888;
        --link-color: #5cacee;
        --border-color: #404040;
        --code-bg: #0d0d0d;
        --code-text: #d4d4d4;
        --inline-code-bg: #2a2a2a;
    }
}

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

html {
    font-size: 16px;
}

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

/* Container */
.container {
    max-width: 650px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
    opacity: 0.8;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-primary);
    transition: fill 0.3s ease;
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

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

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

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .sun-icon {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle .moon-icon {
        display: none;
    }
}

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

[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Header Section */
.header {
    margin-bottom: 1.5rem;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bio {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Links Section */
.links {
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.links a {
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    transition: opacity 0.2s ease;
}

.links a:hover {
    opacity: 0.6;
}

.links a svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Section Styling */
hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.section {
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.section ul {
    list-style: none;
}

.section li {
    margin-bottom: 0.75rem;
}

.section a {
    color: var(--link-color);
    text-decoration: none;
}

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

.date {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

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

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }
}

/* Blog Post Styles */
.back-link {
    margin-bottom: 2rem;
}

.back-link a {
    color: var(--text-secondary);
    text-decoration: none;
}

.back-link a:hover {
    color: var(--text-primary);
}

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

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

.post-content h1 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-content h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

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

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

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

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

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

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

.post-content code {
    font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.post-content p code,
.post-content li code {
    background-color: var(--inline-code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

.post-content th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

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

/* Syntax Highlighting */
.keyword { color: #569cd6; }
.string { color: #ce9178; }
.comment { color: #6a9955; }
.function { color: #dcdcaa; }
.number { color: #b5cea8; }
