﻿/* ---
post.css specific styles for the article archive page
--- */

/* 让整个页面的滚动都变得丝滑 */
html {
    scroll-behavior: smooth;
}

.archive-page-wrapper {
    max-width: 1200px;
    margin: 2rem auto;
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    padding: 0 1rem;
}
.archive-main-content {
    display: none; /* Hide original container, we use a new layout */
}

.archive-articles-container {
    flex: 1; 
    min-width: 0;
    /* This container doesn't need a background, the inner list items will have it */
}

.archive-header {
    margin-bottom: 2rem;
    text-align: center;
}

.archive-title {
    font-size: 2.5rem;
    margin: 0 0 1.5rem 0;
    color: rgba(255, 255, 255, 0.9);
}

.archive-sidebar {
    width: 300px; /* Narrower sidebar */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 90px;
}

.sidebar-card .card-title {
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    color: white;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.search-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

#archive-search {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#archive-search:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.5);
}

.search-wrapper .fa-search {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
}

.archive-section {
    margin-bottom: 0;
}

.archive-year-group {
    margin-bottom: 2.5rem;
}

.archive-year {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.archive-list {
    list-style: none;
    padding: 0;
    border-left: none;
}

.archive-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.archive-item:hover {
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.archive-date {
    width: 60px;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.7);
}

.archive-link {
    color: #fff;
    text-decoration: none;
    flex-grow: 1;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.archive-link:hover {
    color: #60a5fa;
}

.archive-item.hidden {
    display: none;
}

.categories-container,
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.category-item,
.tag-item {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.category-item:hover,
.tag-item:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: rgba(74, 144, 226, 0.8);
    transform: translateY(-2px);
}

.category-item.active,
.tag-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: bold;
}

.category-count {
    font-size: 0.8em;
    margin-left: 0.5rem;
    padding: 0.1rem 0.4rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* ---
Styles for Single Post Pages (w*.html)
--- */

.post-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.post-cover {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.post-title {
    font-size: 2.2rem;
    margin: 0 0 1rem 0;
    color: #fff;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.post-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-body {
    line-height: 1.8;
    font-size: 1.05rem;
}

.post-body h2 {
    font-size: 1.8rem;
    color: #fff;
    margin: 2.5rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.post-body .post-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.post-body .post-link:hover {
    border-bottom-color: #60a5fa;
}

.post-footer {
    margin-top: 3rem;
}

.comments-section h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.5rem;
}

/* 鍝嶅簲寮忚皟鏁?*/
@media (max-width: 768px) {
    .post-content {
        padding: 1.5rem;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .post-meta {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }
}
.post-toc-card {
    position: sticky;
    top: 90px;
}

.post-toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-toc-link {
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.post-toc-link:hover {
    background: rgba(96, 165, 250, 0.18);
    color: #fff;
    transform: translateX(4px);
}

.post-body,
.post-body h2,
.post-body h3 {
    scroll-margin-top: 100px;
}

@media (max-width: 768px) {
    .post-toc-card {
        position: static;
    }
}

/* --- 基础设置 --- */
#post-header {
    scroll-margin-top: 100px;
}

.post-body, .post-body h2, .post-body h3 {
    scroll-margin-top: 100px;
}

/* --- 侧边栏整体布局 --- */
/* --- 侧边栏整体容器 --- */
.sidebar {
    display: flex;
    flex-direction: column;
    position: relative;
    /* 确保侧边栏不会撑得比内容区还长，防止推不动喵 */
    height: auto; 
}

/* 🌟 核心：这是唯一的粘性控制点 */
.sticky-sidebar-group {
    position: sticky;
    top: 80px; /* 这里控制离导航栏的距离，请确保 site-header 高度一致喵 */
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* 目录和导航之间的间距 */
    z-index: 10;
    /* 性能优化 */
    will-change: transform;
}

/* --- 卡片基础样式：彻底取消内部定位 --- */
.post-toc-card, .post-nav-card {
    position: relative !important; 
    top: 0 !important; /* 强制清除之前的 90px 或 420px 偏移喵！ */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin: 0 !important; /* 间距由父级 gap 控制 */
}

/* --- 文章导航内容样式 (补全) --- */
.post-nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.nav-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.nav-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}
.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: block;
    line-height: 1.4;
}
.nav-link:hover {
    color: #60a5fa;
    transform: translateX(4px);
}
.nav-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.2rem 0;
}

/* 手机端回归原始流式布局 */
@media (max-width: 1024px) {
    .sticky-sidebar-group {
        position: static !important;
        transform: none !important;
        display: block;
    }
    .post-toc-card { margin-bottom: 1.5rem !important; }
}

/* --- 响应式处理 --- */
@media (max-width: 1024px) {
    .post-toc-card {
        position: static;
    }
    .post-nav-card {
        margin-top: 1rem;
    }
}

/* --- 代码复制框 (保持原样喵) --- */
.code-copy-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2d2d2d;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.copy-content {
    color: #eab308;
    font-family: 'Consolas', monospace;
    font-size: 1rem;
    font-weight: bold;
    flex-grow: 1;
    text-align: left;
    /* 🌟 核心魔法：保留换行符并允许自动折行 */
    white-space: pre-wrap;
    /* 如果内容太长，确保它不会撑破盒子喵 */
    word-break: break-all;
}
/* 顺便优化一下容器，让它在多行时对齐更好看 */
.code-copy-box {
    display: flex;
    align-items: flex-start; /* 🌟 从 center 改为 flex-start，让按钮对齐第一行 */
    justify-content: space-between;
    background: #2d2d2d;
    padding: 1rem 1.2rem; /* 增加一点内边距喵 */
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.copy-btn {
    /* 按钮固定一下位置，不要随文字变长而变形喵 */
    flex-shrink: 0; 
    margin-top: 0.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: url('cur/2.ani'), pointer;
    transition: all 0.2s ease;
    margin-left: 1rem;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.copy-btn.success { background: #92868c; color: white; }