/* 基础Flex布局容器 */
.archive-main-wrapper {
    display: flex;
    align-items: flex-start;
    /* 必须align-items: flex-start才能让sticky生效 */
    gap: 20px;
    width: 100%;
    position: relative;
    /* 确保容器内部分栏 */
}

/* 基础样式 (Base Styles) */
.archive-year-nav {
    box-sizing: border-box;
    z-index: 999;
    /* 确保在顶层但不覆盖交互 */
}

/* 锚点定位偏移 (防止被顶部导航栏遮挡) */
.year-anchor-target {
    scroll-margin-top: 80px;
    /* 根据实际Header高度调整 */
    display: block;
    /* 确保scroll-margin生效 */
}

/* 基础Flex布局容器 */
.archive-main-wrapper {
    display: flex;
    align-items: flex-start;
    /* 必须align-items: flex-start才能让sticky生效 */
    gap: 20px;
    width: 100%;
    position: relative;
    /* 确保容器内部分栏 */
}

/* 右侧内容区域 */
.archive-content-wrapper {
    flex: 1;
    /* 占据剩余宽度 */
    min-width: 0;
    /* 防止Flex子元素溢出 */
}

/* 左侧年份导航 (Desktop: Static Sidebar) */
@media screen and (min-width: 1200px) {
    .archive-year-nav.vertical-nav {
        width: 120px;
        flex-shrink: 0;
        /* 防止被压缩 */
        position: static;
        /* 修改为静态定位，随页面滚动 */

        display: flex;
        flex-direction: column;
        background: transparent;
        /* 不需要背景色，融入页面 */
        padding: 0;
        margin: 0;
        z-index: 10;
        /* 移除 max-height 和 overflow-y，让其自然延伸 */
    }

    .archive-year-nav .nav-label {
        font-size: 14px;
        font-weight: bold;
        color: var(--font-color);
        margin-bottom: 10px;
        text-align: center;
        display: block;
        padding-bottom: 5px;
        border-bottom: 2px solid var(--theme-color);
        /* 标题下划线 */
    }

    .year-nav-link {
        display: block;
        width: 100%;
        text-align: center;
        padding: 6px 0;
        margin-bottom: 4px;
        color: #2a2a2a;
        /* 默认深色 - 适合浅色背景 */
        font-weight: 600;
        /* 增加字重 */
        border-radius: 4px;
        font-size: 13px;
        transition: all 0.2s;
        text-decoration: none;
        border-left: 3px solid transparent;
        /* 左侧指示条 */
        background: rgba(255, 255, 255, 0.6);
        /* 轻微背景 */
    }

    /* 浅色背景下的年份导航（明确定义） */
    body.light-background .year-nav-link {
        color: #2a2a2a !important;
        /* 深色文字 */
        background: rgba(255, 255, 255, 0.6);
        text-shadow: none;
    }

    body.light-background .year-nav-link:hover {
        background: rgba(255, 255, 255, 0.9);
        color: #000 !important;
        font-weight: bold;
        border-left-color: var(--theme-color);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    /* 深色背景下的年份导航 */
    body.dark-background .year-nav-link {
        color: #ffffff !important;
        /* 白色文字 */
        background: rgba(255, 255, 255, 0.15) !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    body.dark-background .year-nav-link:hover {
        background: rgba(255, 255, 255, 0.25) !important;
        color: #fff !important;
        font-weight: bold;
        border-left-color: var(--theme-color);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    /* 默认悬停效果（当没有 light/dark 类时） */
    .year-nav-link:hover {
        background: #fff;
        color: #000;
        font-weight: bold;
        border-left-color: var(--theme-color);
        /* 悬停显示指示条 */
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }

    /* 浅色背景下的空年份样式 */
    body.light-background .year-nav-link.empty {
        color: #777 !important;
        opacity: 0.8;
        background: rgba(200, 200, 200, 0.25);
    }

    /* 深色背景下的空年份样式 */
    body.dark-background .year-nav-link.empty {
        color: rgba(255, 255, 255, 0.65) !important;
        /* 浅白色 */
        opacity: 0.75;
        background: rgba(255, 255, 255, 0.08) !important;
    }

    .year-nav-link.empty:hover {
        background: rgba(200, 200, 200, 0.2) !important;
        color: #888 !important;
        font-weight: normal !important;
        border-left-color: transparent !important;
        /* 悬停时不显示指示条 */
        box-shadow: none !important;
    }
}

/* Mobile/Tablet: 顶部自适应/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .category-container {
        grid-template-columns: 1fr;
        /* Single column on mobile */
    }
}

/* ==========================================================================
   Archives Timeline Redesign - Option B: Left Accent Bar (No Dots)
   ========================================================================== */

/* 1. 重置/隐藏默认的时间线样式 (圆点、原线条) */
.article-sort-item::before,
.article-sort-title::before,
.article-sort-title::after {
    content: none !important;
    display: none !important;
}

/* 隐藏可能存在的默认时间轴线条 (视具体主题实现而定) */
.article-sort::before {
    display: none !important;
}

/* 2. 新的时间线容器样式 - 左侧彩线 */
.article-sort {
    border-left: 4px solid var(--theme-color) !important;
    /* 加粗的左侧彩线 */
    padding-left: 25px !important;
    margin-left: 10px !important;
}

/* 3. 年份标题样式 */
.article-sort-title {
    position: relative;
    margin: 40px 0 20px 0 !important;
    padding-left: 0 !important;
    font-size: 22px !important;
    font-weight: bold !important;
    color: var(--font-color);
    line-height: 1.2;
}

/* 可选：为年份增加一个小图标或装饰，如果需要的话。
   根据Option B描述，保持简洁。 */

/* 4. 文章卡片项样式 */
.article-sort-item {
    margin: 0 0 10px 0 !important;
    padding: 12px 18px !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8) !important;
    /* 淡白色配80%透明度 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    /* 强制垂直排列 */
    align-items: flex-start !important;
    /* Key: Left align all children */
    justify-content: center;
}

/* 深色背景下的文章卡片样式 - 使用更具体的选择器覆盖glassmorphism.css */
body.dark-background #content-inner .article-sort-item,
body.dark-background .article-sort .article-sort-item {
    background: rgba(255, 255, 255, 0.8) !important;
    /* 深色背景下也使用淡白色80%透明度 */
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

/* 年份标记不需要白色背景 */
.article-sort-item.year,
body.dark-background .article-sort-item.year,
body.dark-background #content-inner .article-sort-item.year,
body.dark-background .article-sort .article-sort-item.year {
    background: transparent !important;
    border: none !important;
}

/* 深色背景下的文章卡片文字颜色 - 因为现在背景是白色，所以文字需要是深色 */
body.dark-background #content-inner .article-sort-item .article-sort-item-title,
body.dark-background .article-sort .article-sort-item .article-sort-item-title {
    color: #2a2a2a !important;
    text-shadow: none !important;
}

body.dark-background #content-inner .article-sort-item .article-sort-item-time,
body.dark-background .article-sort .article-sort-item .article-sort-item-time {
    color: #666 !important;
    text-shadow: none !important;
}

body.dark-background #content-inner .article-sort-item .article-sort-item-title:hover,
body.dark-background .article-sort .article-sort-item .article-sort-item-title:hover {
    color: var(--theme-color) !important;
}

/* 悬停效果：背景高亮 + 轻微右移 */
.article-sort-item:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    /* 悬停时增加不透明度 */
    transform: translateX(5px);
}

body.dark-background #content-inner .article-sort-item:hover,
body.dark-background .article-sort .article-sort-item:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    /* 深色背景下悬停时也增加不透明度 */
}

/* Reset all child elements */
.article-sort-item>* {
    margin-left: 0 !important;
    padding-left: 0 !important;
    position: relative !important;
    /* Reset any absolute positioning */
    left: 0 !important;
    transform: none !important;
    /* Remove any transforms */
}

/* 元素排序：时间 -> 标题 -> 缩略图 */

/* 时间 (Order 1) */
.article-sort-item-time {
    color: #858585 !important;
    font-size: 13px !important;
    padding-left: 0 !important;
    order: 1 !important;
    margin: 0 0 4px 0 !important;
    width: 100%;
}

/* 标题 (Order 2) */
.article-sort-item-title {
    font-size: 16px !important;
    font-weight: 500;
    color: var(--font-color) !important;
    display: block;
    margin: 0 0 8px 0 !important;
    padding-left: 0 !important;
    transition: color 0.2s;
    order: 2 !important;
    width: 100%;
}

.article-sort-item-title:hover {
    color: var(--theme-color) !important;
    transform: none !important;
}

/* 缩略图 (Order 3) - Completely Reset */
.article-sort-item-img {
    order: 3 !important;
    margin: 8px 0 0 0 !important;
    /* Only top margin */
    width: 120px !important;
    max-width: 120px !important;
    height: auto !important;
    max-height: 80px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    align-self: flex-start !important;
    /* Force to container's left edge */
    display: block !important;
    float: none !important;
}

/* If thumbnail is wrapped in <a> tag */
a.article-sort-item-img,
.article-sort-item-img-wrap {
    margin-left: 0 !important;
    padding-left: 0 !important;
    position: relative !important;
    display: block !important;
    align-self: flex-start !important;
    width: auto !important;
    float: none !important;
}

/* 6. 文章元信息 (日期) */
/* .article-sort-item-time 已在上方定义 */

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .article-sort {
        padding-left: 15px !important;
        border-left-width: 3px !important;
    }

    .article-sort-item {
        padding: 10px 12px !important;
    }
}

/* 7. 年份分隔符样式增强 */
.article-sort-item.year {
    font-size: 24px !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
    text-decoration-color: #ffffff !important;
    /* 白色下划线 */
    text-underline-offset: 4px !important;
    color: #ffffff !important;
    /* 白色文字 */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    /* 添加阴影增强可读性 */
    padding-bottom: 8px !important;
    margin-bottom: 20px !important;
}

/* Mobile/Tablet: 顶部自适应 (Fallback) */
@media screen and (max-width: 1199px) {
    .archive-main-wrapper {
        flex-direction: column;
        /* 上下排列 */
    }

    .archive-year-nav.vertical-nav {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 20px;
        background: var(--card-bg);
        padding: 15px;
        border-radius: 8px;
    }

    .archive-year-nav .nav-label {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
        font-weight: bold;
    }

    .year-nav-link {
        display: inline-block;
        padding: 5px 12px;
        background: #fff;
        border-radius: 4px;
        font-size: 13px;
        color: var(--font-color);
        border: 1px solid #eee;
        text-decoration: none;
    }

    .year-nav-link:hover {
        background: var(--theme-color);
        color: #fff;
    }
}