/* 全局 Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #f4f1ea; /* 温暖米色 */
    color: #2b1e15;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
    line-height: 1.8;
}

/* 容器 */
.container, .detail-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px 100px;
}

/* ================= 导航菜单 (新增) ================= */
.nav-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid #d4c9b8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    font-size: 18px;
    color: #6b5744;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.nav-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 241, 234, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.nav-close {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 28px;
    cursor: pointer;
    color: #8a7860;
    padding: 10px;
}

.nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.nav-link {
    font-size: 22px;
    color: #2b1e15;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 12px;
    transition: background 0.2s;
}
.nav-link:hover { background: rgba(0,0,0,0.05); }
.nav-link.small { font-size: 14px; color: #8a7860; margin-top: 20px; }
.nav-divider { width: 40px; height: 1px; background: #d4c9b8; margin: 10px 0; }

/* ================= 首页 Header 区域 ================= */
header {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
}
header h1 { font-weight: 500; letter-spacing: 1px; margin-bottom: 5px; }
.subtitle { font-size: 14px; color: #8a7860; }

/* 搜索框样式 */
.search-wrapper {
    position: absolute;
    top: 0;
    right: 0;
}
.search-wrapper input {
    width: 140px;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #d4c9b8;
    background: rgba(255,255,255,0.6);
    font-size: 13px;
    color: #555;
    transition: all 0.3s ease;
    outline: none;
    backdrop-filter: blur(5px);
}
.search-wrapper input:focus {
    width: 220px;
    background: #fff;
    border-color: #8a7860;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ================= 标签栏 (胶囊风格) ================= */
.tag-scroller {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 2px 15px 2px;
    margin-bottom: 30px;
    border-bottom: 1px solid #e5dfd5;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tag-scroller::-webkit-scrollbar { display: none; }

.tag-pill {
    padding: 6px 16px;
    background: #e8dfd3;
    color: #6b5744;
    border-radius: 100px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.tag-pill:hover {
    background: #dcd0c0;
    transform: translateY(-1px);
}
.tag-pill.active {
    background: #2b1e15;
    color: #f4f1ea;
    box-shadow: 0 2px 8px rgba(43, 30, 21, 0.3);
}

/* ================= 文章卡片 ================= */
.timeline { display: flex; flex-direction: column; gap: 24px; }

.post-card {
    background: #fdfcfa;
    border: 1px solid #e5dfd5;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-color: #dcd0c0;
}

.post-preview { 
    font-size: 15px; 
    color: #333; 
    margin-bottom: 12px; 
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta { font-size: 12px; color: #999; display: flex; justify-content: space-between; align-items: center; }
.tag-label { color: #8a7860; background: #ede8dd; padding: 2px 6px; border-radius: 4px; margin-left: 8px; }

/* ================= 归档页样式 (新增) ================= */
.archive-year {
    font-size: 24px;
    font-weight: bold;
    margin: 40px 0 20px;
    color: #8a7860;
    border-bottom: 2px solid #e5dfd5;
    padding-bottom: 10px;
}
.archive-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed #e5dfd5;
    color: #444;
    text-decoration: none;
    transition: color 0.2s;
}
.archive-item:hover { color: #b55d07; }
.archive-date { font-family: monospace; color: #999; margin-right: 15px; font-size: 14px; }

/* ================= 标签墙样式 (新增) ================= */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}
.tag-big {
    font-size: 16px;
    padding: 10px 24px;
    background: #fff;
    border: 1px solid #d4c9b8;
    border-radius: 30px;
    text-decoration: none;
    color: #555;
    transition: all 0.2s;
}
.tag-big:hover {
    background: #2b1e15;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* ================= 详情页 & Markdown ================= */
.detail-header { margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.back-btn { text-decoration: none; color: #6b5744; font-size: 14px; padding: 6px 12px; border: 1px solid #d4c9b8; border-radius: 6px; background: #fff; transition: .2s; }
.back-btn:hover { background: #f4f1ea; }
.detail-time { font-size: 13px; color: #888; }

.markdown-body { font-size: 16px; line-height: 1.9; color: #222; }
.markdown-body h1, .markdown-body h2 { margin-top: 30px; margin-bottom: 15px; color: #111; }
.markdown-body p { margin-bottom: 18px; }
.markdown-body blockquote { border-left: 4px solid #d4c9b8; padding-left: 15px; color: #666; margin: 20px 0; font-style: italic; }
.markdown-body img { max-width: 100%; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.markdown-body span[style] { display: inline; }

/* 代码块与复制按钮 */
.markdown-body pre {
    position: relative;
    background: #f8f6f2;
    border: 1px solid #e5dfd5;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 20px 0;
}
.markdown-body pre code {
    font-family: "Menlo", "Monaco", "Consolas", monospace;
    font-size: 14px;
    background: transparent;
    padding: 0;
}
.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d4c9b8;
    color: #8a7860;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    user-select: none;
    backdrop-filter: blur(4px);
}
.markdown-body pre:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover {
    background: #fff;
    color: #2b1e15;
    border-color: #8a7860;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.copy-code-btn.copied {
    background: #e6f4ea;
    color: #1e8e3e;
    border-color: #ceead6;
}

/* 媒体网格 & 查看器 */
.media-grid { display: grid; gap: 10px; margin-top: 20px; }
.media-grid.grid-1 { grid-template-columns: 1fr; }
.media-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.media-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.media-grid.grid-many { grid-template-columns: repeat(3, 1fr); }
.media-grid-item img {
    width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1/1;
    border-radius: 6px; cursor: zoom-in; transition: opacity .2s;
}
.media-grid-item img:hover { opacity: 0.85; }
.media-grid.grid-1 .media-grid-item img { aspect-ratio: auto; max-height: 600px; object-fit: contain; }

.image-viewer { position: fixed; inset: 0; background: rgba(10,10,10,0.95); z-index: 999; display: none; align-items: center; justify-content: center; }
.image-viewer.active { display: flex; }
.image-viewer img { max-width: 95%; max-height: 92%; border-radius: 4px; }
.image-viewer-close { position: absolute; top: 30px; right: 30px; color: #fff; font-size: 24px; cursor: pointer; background: rgba(255,255,255,0.1); width: 40px; height: 40px; border-radius: 50%; display:flex; align-items:center; justify-content:center; }

@media (max-width: 600px) {
    .search-wrapper { position: relative; margin-top: 15px; text-align: center; }
    .search-wrapper input { width: 100%; }
    .search-wrapper input:focus { width: 100%; }
}
