/* ============================================
 * Archives Page - Optimized Light/Dark Adaptive System
 * ============================================ */

/* 基础Flex布局容器 */
.archive-main-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    position: relative;
}

/* 右侧内容区域 */
.archive-content-wrapper {
    flex: 1;
    min-width: 0;
}

/* 锚点定位偏移 */
.year-anchor-target {
    scroll-margin-top: 80px;
    display: block;
}

/* ============================================
 * 左侧年份导航 - 智能适配
 * ============================================ */
@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;
    }

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

    /* 年份链接 - 默认样式（Light 背景） */
    .year-nav-link {
        display: block;
        width: 100%;
        text-align: center;
        padding: 8px 0;
        margin-bottom: 4px;
        color: #2a2a2a;
        font-weight: 600;
        border-radius: 6px;
        font-size: 13px;
        transition: all 0.3s ease;
        text-decoration: none;
        border-left: 3px solid transparent;
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Light 背景下的年份导航 */
    body.light-background .archive-year-nav .nav-label {
        color: #2a2a2a;
        text-shadow: none;
    }

    body.light-background .year-nav-link {
        color: #2a2a2a;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    body.light-background .year-nav-link:hover {
        background: #ffffff;
        color: var(--theme-color);
        font-weight: 700;
        border-left-color: var(--theme-color);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        transform: translateX(2px);
    }

    body.light-background .year-nav-link.empty {
        color: #999;
        opacity: 0.7;
        background: rgba(240, 240, 240, 0.7);
    }

    /* Dark 背景下的年份导航 */
    body.dark-background .archive-year-nav .nav-label {
        color: #ffffff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    body.dark-background .year-nav-link {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    body.dark-background .year-nav-link:hover {
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
        font-weight: 700;
        border-left-color: var(--theme-color);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
        transform: translateX(2px);
    }

    body.dark-background .year-nav-link.empty {
        color: rgba(255, 255, 255, 0.5);
        opacity: 0.6;
        background: rgba(255, 255, 255, 0.08);
    }

    body.dark-background .year-nav-link.empty:hover {
        background: rgba(255, 255, 255, 0.12);
        border-left-color: transparent;
    }
}

/* ============================================
 * 时间线样式 - 重置默认
 * ============================================ */
.article-sort-item::before,
.article-sort-title::before,
.article-sort-title::after,
.article-sort::before {
    content: none !important;
    display: none !important;
}

/* 新的时间线 - 左侧彩线 */
.article-sort {
    border-left: 4px solid var(--theme-color);
    padding-left: 25px;
    margin-left: 10px;
}

/* ============================================
 * 年份标题 - 智能适配
 * ============================================ */
.article-sort-title {
    position: relative;
    margin: 40px 0 20px 0 !important;
    padding-left: 0 !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    line-height: 1.2;
}

/* Light 背景下的年份标题 */
body.light-background .article-sort-title {
    color: #2a2a2a !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark 背景下的年份标题 */
body.dark-background .article-sort-title {
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ============================================
 * 文章卡片 - 智能适配
 * ============================================ */
.article-sort-item {
    margin: 0 0 12px 0 !important;
    padding: 16px 20px !important;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

/* Light 背景下的文章卡片 */
body.light-background .article-sort-item:not(.year) {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-background .article-sort-item:not(.year):hover {
    background: #ffffff !important;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Dark 背景下的文章卡片 */
body.dark-background .article-sort-item:not(.year) {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-background .article-sort-item:not(.year):hover {
    background: rgba(255, 255, 255, 0.18) !important;
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* 年份分隔符 - 透明背景 */
.article-sort-item.year,
body.light-background .article-sort-item.year,
body.dark-background .article-sort-item.year {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* ============================================
 * 文章元素 - 智能适配
 * ============================================ */

/* 重置所有子元素定位 */
.article-sort-item>* {
    margin-left: 0 !important;
    padding-left: 0 !important;
    position: relative !important;
    left: 0 !important;
    transform: none !important;
}

/* 时间标签 */
.article-sort-item-time {
    font-size: 13px !important;
    padding-left: 0 !important;
    order: 1 !important;
    margin: 0 0 6px 0 !important;
    width: 100%;
}

body.light-background .article-sort-item-time {
    color: #666 !important;
}

body.dark-background .article-sort-item-time {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* 文章标题 */
.article-sort-item-title {
    font-size: 16px !important;
    font-weight: 500;
    display: block;
    margin: 0 0 10px 0 !important;
    padding-left: 0 !important;
    transition: color 0.3s ease;
    order: 2 !important;
    width: 100%;
}

body.light-background .article-sort-item-title {
    color: #2a2a2a !important;
}

body.light-background .article-sort-item-title:hover {
    color: var(--theme-color) !important;
}

body.dark-background .article-sort-item-title {
    color: #ffffff !important;
}

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

/* 缩略图 */
.article-sort-item-img {
    order: 3 !important;
    margin: 8px 0 0 0 !important;
    width: 120px !important;
    max-width: 120px !important;
    height: auto !important;
    max-height: 80px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    align-self: flex-start !important;
    display: block !important;
    float: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

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;
}

/* ============================================
 * 年份分隔符 - 智能适配
 * ============================================ */
.article-sort-item.year {
    font-size: 26px !important;
    font-weight: 700 !important;
    padding-bottom: 10px !important;
    margin-bottom: 20px !important;
    border-bottom: 2px solid;
}

/* Light 背景下的年份分隔符 */
body.light-background .article-sort-item.year {
    color: #2a2a2a !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border-bottom-color: rgba(0, 0, 0, 0.15);
}

/* Dark 背景下的年份分隔符 */
body.dark-background .article-sort-item.year {
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

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

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

    .article-sort-title {
        font-size: 24px !important;
    }
}

@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;
        padding: 15px;
        border-radius: 8px;
    }

    /* Light 背景 - 移动端 */
    body.light-background .archive-year-nav.vertical-nav {
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    /* Dark 背景 - 移动端 */
    body.dark-background .archive-year-nav.vertical-nav {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

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

    .year-nav-link {
        display: inline-block;
        padding: 6px 14px;
        border-radius: 6px;
        font-size: 13px;
        text-decoration: none;
        border: none;
    }

    body.light-background .year-nav-link {
        background: rgba(0, 0, 0, 0.05);
        color: #2a2a2a;
    }

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

    body.dark-background .year-nav-link {
        background: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }

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