/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2333;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --border: #30363d;
    --tag-bg: #1f6feb33;
    --tag-text: #58a6ff;
    --code-bg: #1a1f2b;
    --max-width: 820px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

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

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ===== Header ===== */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 40px 0 30px;
    text-align: center;
}

.site-title a {
    color: var(--text);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.site-desc {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 1rem;
}

.site-author {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ===== Posts List (Index) ===== */
.posts-list {
    padding: 40px 0;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 30px;
    margin-bottom: 20px;
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.post-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.post-card-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.post-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.post-card-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-card-tags {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ===== Post Article ===== */
.post-article {
    padding: 40px 0 20px;
}

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

.post-article h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.post-article-tags {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-body {
    font-size: 1.05rem;
    line-height: 1.85;
}

.post-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.post-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 28px 0 12px;
}

.post-body p {
    margin-bottom: 16px;
}

.post-body ul, .post-body ol {
    margin: 0 0 16px 24px;
}

.post-body li {
    margin-bottom: 6px;
}

.post-body img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 20px 0;
    display: block;
}

.post-body code {
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
}

.post-body pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
}

.post-body pre code {
    background: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 0 8px 8px 0;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.post-body th, .post-body td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

.post-body th {
    background: var(--bg-card);
    font-weight: 600;
}

/* ===== Post Navigation ===== */
.post-nav {
    padding: 20px 0 40px;
    border-top: 1px solid var(--border);
}

.back-link {
    font-weight: 500;
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 0;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

/* ===== Progress Section ===== */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    margin-bottom: 28px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-weight: 600;
    font-size: 1rem;
}

.progress-count {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
}

.progress-bar-bg {
    background: var(--border);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #58a6ff, #3fb950);
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.continue-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.continue-btn:hover {
    background: var(--accent-hover);
    color: #fff !important;
}

.progress-complete {
    color: #3fb950;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ===== Read Badge ===== */
.post-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.post-card-top .post-card-date {
    margin-bottom: 0;
}

.read-badge {
    background: #3fb95033;
    color: #3fb950;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.post-card-read {
    border-color: #3fb95044;
}

/* ===== Bookmark Button ===== */
.mark-read-section {
    text-align: center;
    padding: 32px 0 8px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.bookmark-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 32px;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bookmark-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.bookmark-btn.bookmarked {
    background: #3fb95022;
    color: #3fb950;
    border-color: #3fb95066;
}

.post-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ===== Language Toggle ===== */
.lang-toggle {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 1px;
}

.lang-toggle:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.site-header .lang-toggle {
    margin-top: 14px;
}

.post-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .site-header {
        padding: 28px 0 20px;
    }

    .site-title a {
        font-size: 1.5rem;
    }

    .post-card {
        padding: 20px;
    }

    .post-card-title {
        font-size: 1.15rem;
    }

    .post-article h1 {
        font-size: 1.5rem;
    }

    .post-body {
        font-size: 1rem;
    }
}
