/* CSS Variables */
:root {
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #888888;
    --border: #e5e5e5;
    --link: #1772d0;
    --link-hover: #f09228;
    --code-bg: #f5f5f5;
    --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --bg-secondary: #252525;
    --text: #e5e5e5;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border: #333333;
    --link: #6db3f2;
    --link-hover: #f09228;
    --code-bg: #2d2d2d;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lato', Verdana, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.site-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.site-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.site-nav a:hover {
    color: var(--link);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

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

.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;
}

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

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text);
}

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

.post-item {
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

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

.post-item a {
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.post-item time {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

/* Post */
.post-header {
    margin-bottom: 40px;
}

.post-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.post-meta {
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.post-meta .separator {
    color: var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

/* Post Content */
.post-content {
    line-height: 1.8;
    font-size: 17px;
}

.post-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.post-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 36px;
    margin-bottom: 16px;
    color: var(--text);
}

.post-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.post-content ul, .post-content ol {
    margin-bottom: 20px;
    padding-left: 28px;
    color: var(--text-secondary);
}

.post-content li {
    margin-bottom: 10px;
}

.post-content li::marker {
    color: var(--text-muted);
}

.post-content a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

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

.post-content strong {
    color: var(--text);
    font-weight: 600;
}

/* Code */
.post-content code {
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    background: var(--code-bg);
    padding: 3px 8px;
    border-radius: 4px;
}

.post-content pre {
    position: relative;
    background: var(--code-bg);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.post-content pre code {
    background: none;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
}

.post-content pre:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--link);
    color: white;
    border-color: var(--link);
}

/* Blockquote */
.post-content blockquote {
    border-left: 4px solid var(--link);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Images */
.post-content img {
    max-width: 100%;
    border-radius: 12px;
    margin: 32px 0;
    box-shadow: 0 4px 20px var(--shadow);
}

/* Post Navigation */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.post-nav-item {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.post-nav-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.post-nav-item.next {
    text-align: right;
}

.post-nav-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.post-nav-title {
    display: block;
    color: var(--text);
    font-weight: 500;
}

/* Tags Page */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

.tags-list .tag {
    font-size: 15px;
    padding: 8px 16px;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--link);
    color: white;
    border-color: var(--link);
    transform: translateY(-2px);
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    .site-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .site-nav {
        gap: 16px;
    }

    .page-title {
        font-size: 28px;
    }

    .post-title {
        font-size: 28px;
    }

    .post-content {
        font-size: 16px;
    }

    .post-item {
        flex-direction: column;
        gap: 4px;
    }

    .post-nav {
        grid-template-columns: 1fr;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
}

/* Selection */
::selection {
    background: var(--link);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
