/* Blog 外框與文章樣式：色彩沿用首頁 */
:root {
    --primary-color: #0f172a;
    --accent-color: #3b82f6;
    --text-color: #334155;
    --muted-color: #64748b;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Microsoft JhengHei', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

/* 語言切換 */
.lang-switch {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.lang-btn {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 4px 9px;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
    color: var(--muted-color);
}

.lang-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 頁首 */
.site-header {
    background: white;
    padding: 20px 16px 14px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.brand {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 1px;
}

.site-nav {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 20px;
}

.site-nav a {
    color: var(--muted-color);
    text-decoration: none;
    font-weight: 500;
}

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

/* 主內容 */
.blog-main {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 32px auto;
    padding: 0 16px;
}

.page-title {
    color: var(--primary-color);
    font-size: 1.6rem;
    margin: 0 0 20px;
}

.empty {
    color: var(--muted-color);
}

/* 列表卡片 */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.post-cover {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f1f5f9;
}

.post-card-body {
    padding: 18px 22px 20px;
}

.post-card h2 {
    font-size: 1.2rem;
    margin: 6px 0;
}

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

.post-card h2 a:hover {
    color: var(--accent-color);
}

.post-card p {
    margin: 0;
    color: var(--muted-color);
    font-size: 0.95rem;
}

/* 日期、分類、標籤 */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 0.85rem;
    color: var(--muted-color);
}

.badge {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}

.badge-news {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-docs {
    background: #ecfdf5;
    color: #047857;
}

.badge-draft {
    background: #fff7ed;
    color: #c2410c;
}

.tag {
    color: var(--muted-color);
    text-decoration: none;
}

.tag:hover {
    color: var(--accent-color);
}

/* 分頁 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.page-info {
    color: var(--muted-color);
    font-size: 0.9rem;
}

/* 單篇文章 */
.post {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 28px 32px;
}

.post h1 {
    color: var(--primary-color);
    font-size: 1.7rem;
    line-height: 1.35;
    margin: 12px 0 10px;
}

.back-link {
    font-size: 0.9rem;
    text-decoration: none;
}

.post-body {
    margin-top: 24px;
    overflow-wrap: break-word;
}

.post-body h2,
.post-body h3 {
    color: var(--primary-color);
    margin-top: 1.8em;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-body pre {
    background: #f6f8fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.5;
}

.post-body pre code.hljs {
    background: transparent;
}

.post-body :not(pre) > code {
    background: #f1f5f9;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-body blockquote {
    margin: 1em 0;
    padding: 4px 16px;
    border-left: 4px solid var(--accent-color);
    background: #f8fafc;
    color: var(--muted-color);
}

.post-body table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1em 0;
}

.post-body th,
.post-body td {
    border: 1px solid var(--border-color);
    padding: 6px 12px;
}

.post-body th {
    background: #f1f5f9;
}

.not-found {
    text-align: center;
    padding: 40px 0;
}

.not-found h1 {
    font-size: 3rem;
    color: var(--primary-color);
    margin: 0;
}

/* 頁尾 */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--muted-color);
}

@media (max-width: 600px) {
    .lang-switch {
        position: static;
        text-align: right;
        padding: 8px 16px 0;
        background: white;
    }

    .post {
        padding: 18px 16px 24px;
    }

    .post h1 {
        font-size: 1.4rem;
    }
}
