/* =================================================================
   1. 全局变量与重置 (Variables & Reset)
================================================================= */
:root {
    /* 背景：极光色 */
    --bg-gradient: linear-gradient(135deg, #e0f7fa 0%, #e8f5e9 50%, #fce4ec 100%);
    
    /* 材质：强玻璃（实）与轻玻璃（透） */
    --glass-heavy: rgba(255, 255, 255, 0.85);
    --glass-light: rgba(255, 255, 255, 0.45);
    
    --card-border: 1px solid rgba(255, 255, 255, 0.8);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    
    --text-main: #2d3748;
    --text-light: #718096;
    --primary-color: #38b2ac; 
    
    --radius: 20px; 
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', 'Noto Sans SC', "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

a { text-decoration: none; color: inherit; transition: all 0.2s; }
a:hover { color: var(--primary-color); }

/* === 卡片基础 === */
.card {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.article-list-card, .post-content-card { background: var(--glass-heavy); }
.sidebar, .clock-card, .calendar-card, .sticky-sidebar { background: var(--glass-light); }

/* =================================================================
   2. 首页布局 (Home Page Layout) - 关键对齐部分
================================================================= */
.dashboard-container {
    display: grid;
    /* 首页列宽：左 240px，右 280px，中间自适应 */
    grid-template-columns: 240px 1fr 280px; 
    gap: 24px;
    
    max-width: 1280px; 
    width: 95%;
    
    margin: auto; /* 垂直居中 */
    
    /* === 关键修改：stretch 让三列高度强制相等 === */
    align-items: stretch; 
}

/* --- 左侧栏 --- */
.sidebar {
    display: flex; flex-direction: column; padding: 24px;
    /* === 关键修改：高度100% 以填满左侧空间 === */
    height: 100%;
}
.profile-header { margin-bottom: 30px; text-align: center; }

/* 首页侧边栏头像：120px */
.profile-header .avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%; 
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    border: 2px solid rgba(255,255,255,0.8);
    object-fit: cover; 
}

.profile-header h3 { justify-content: center; font-size: 1.1rem; font-weight: 700; margin-bottom: 5px; }
.tag { font-size: 0.6rem; background: rgba(56, 178, 172, 0.15); color: var(--primary-color); padding: 2px 6px; border-radius: 6px; margin-left: 5px; vertical-align: middle;}
.profile-info p { font-size: 0.75rem; color: var(--text-light); letter-spacing: 1px; }

.menu { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
    padding: 12px 16px; border-radius: 12px;
    display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 0.95rem;
}
.menu-item:hover, .menu-item.active { background: rgba(255,255,255, 0.7); color: var(--primary-color); }
.menu-item i { width: 24px; text-align: center; }

/* --- 中间文章列表 --- */
.center-column { 
    display: flex; flex-direction: column; 
    /* === 关键修改：高度100% === */
    height: 100%;
}
.article-list-card { 
    padding: 30px; 
    /* === 关键修改：flex: 1 撑满高度 === */
    flex: 1; 
}

.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(0,0,0,0.05);
}
.card-header h3 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.article-list { list-style: none; }
.article-list li { margin-bottom: 15px; }
.article-link {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-radius: 12px;
    background: rgba(255,255,255, 0.5); 
    transition: all 0.2s;
}
.article-link:hover { background: #fff; transform: translateX(5px); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }

/* --- 右侧栏 --- */
.right-column { 
    display: flex; flex-direction: column; gap: 24px; 
    /* === 关键修改：高度100% === */
    height: 100%;
}
.clock-card { height: 100px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#digital-clock { font-size: 2.8rem; font-family: 'Nunito', sans-serif; font-weight: 300; letter-spacing: -1px; }

.calendar-card { 
    padding: 24px;
    /* === 关键修改：让日历卡片自动拉伸以填补空白，实现底部对齐 === */
    flex: 1; 
}
.calendar-header { text-align: center; margin-bottom: 15px; font-weight: 700; color: var(--text-main); }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 10px; }
.calendar-weekdays span { font-size: 0.8rem; color: var(--text-light); font-weight: bold; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 8px; column-gap: 2px; text-align: center; }
.calendar-grid span { font-size: 0.9rem; padding: 6px 0; border-radius: 8px; cursor: default; font-family: 'Nunito', sans-serif; }
.calendar-grid span.prev-date, .calendar-grid span.next-date { color: #cbd5e0; }
.calendar-grid span.today { background: var(--primary-color); color: white; box-shadow: 0 2px 8px rgba(56, 178, 172, 0.4); }
.calendar-grid span.current-date:hover:not(.today) { background: rgba(255,255,255,0.8); }

/* =================================================================
   3. 文章页面 & 归档页面 (共用部分)
================================================================= */

/* 悬浮导航：右上角 */
.floating-menu {
    position: fixed; top: 30px; right: 40px; left: auto; z-index: 9999;
    background: var(--glass-light); 
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255, 0.6);
    border-radius: 50px; padding: 8px 12px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

/* 悬浮球头像：40px */
.floating-menu .avatar {
    width: 40px !important; 
    height: 40px !important; 
    border-radius: 50%; 
    border: 2px solid #fff; 
    object-fit: cover;
    display: block; 
    margin: 0 !important;
}

.float-links { display: flex; gap: 8px; }
.float-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; color: var(--text-light); transition: all 0.2s;
}
.float-btn:hover { background: #fff; color: var(--primary-color); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* 文章容器 */
.post-layout-container {
    display: grid;
    grid-template-columns: 240px 1fr; 
    gap: 24px; 
    max-width: 1280px; 
    width: 95%;
    margin: 60px auto;
    align-items: stretch; 
}
.post-sidebar-column { order: 1; }
.post-main-column    { order: 2; }

/* 侧边目录 */
.sticky-sidebar {
    position: -webkit-sticky;
    position: sticky; 
    top: 24px; 
    padding: 24px; 
    border-radius: var(--radius);
    max-height: 85vh; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.sticky-sidebar:hover { scrollbar-color: rgba(0,0,0,0.1) transparent; }

.toc-title { margin-bottom: 15px; font-weight: bold; border-left: 4px solid var(--primary-color); padding-left: 10px; }
.toc-content { list-style: none; }
.toc-link { display: block; padding: 6px 10px; color: var(--text-light); font-size: 0.9rem; border-radius: 8px; transition: all 0.2s; }
.toc-link:hover, .toc-link.active { color: var(--primary-color); background: rgba(255,255,255,0.6); font-weight: 600; }

/* 文章内容 */
.post-content-card { padding: 50px; min-height: 60vh; }
.post-title { font-size: 2rem; font-weight: 700; margin-bottom: 15px; text-align: center; }
.post-meta { display: flex; justify-content: center; gap: 20px; margin-bottom: 40px; color: var(--text-light); font-size: 0.9rem; }
.post-body { line-height: 1.8; color: #333; }
.post-body h2 { font-size: 1.5rem; margin-top: 30px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.post-body img { max-width: 100%; border-radius: 12px; display: block; margin: 20px auto; }

/* 返回按钮 */
.back-home-btn {
    display: inline-flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    color: var(--text-main); padding: 12px 35px; border-radius: 50px;
    font-weight: 600; font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: all 0.3s ease;
}
.back-home-btn:hover {
    background: #fff; color: var(--primary-color); transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 178, 172, 0.25); 
}
.post-footer-nav { margin-top: 60px; text-align: center; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 30px; }

/* =================================================================
   4. 移动端适配
================================================================= */
@media (max-width: 1000px) {
    .dashboard-container { grid-template-columns: 1fr; max-width: 600px; }
    .sidebar, .right-column { display: none; } 
    
    .post-layout-container { grid-template-columns: 1fr; }
    .sticky-sidebar { display: none; }
    
    .floating-menu { top: 15px; left: 50%; right: auto; transform: translateX(-50%); padding: 6px 12px; }
    .floating-menu .avatar { width: 32px !important; height: 32px !important; }
}

/* =================================================================
   5. 归档页面 (Archives)
================================================================= */
.archive-layout-container {
    max-width: 900px;
    width: 95%;
    margin: 80px auto 40px auto;
    display: flex;
    justify-content: center;
}
.archive-card {
    width: 100%;
    padding: 40px;
    background: var(--glass-heavy);
    min-height: 80vh;
}
.year-group { margin-bottom: 40px; }
.year-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 1rem; color: var(--text-main); }
.year-number { font-weight: 700; font-size: 1.2rem; width: 50px; }
.year-dot { width: 8px; height: 8px; border-radius: 50%; background: #d9d9d9; }
.year-count { font-size: 0.85rem; color: var(--text-light); }

.year-list { display: flex; flex-direction: column; }
.archive-item { display: flex; align-items: center; padding: 12px 0; text-decoration: none; color: var(--text-main); transition: all 0.2s; cursor: pointer; border-radius: 8px; }
.archive-item:hover { background: rgba(255,255,255,0.5); }
.archive-date { width: 50px; font-size: 0.9rem; color: var(--text-light); font-weight: 500; text-align: left; flex-shrink: 0; }

.archive-timeline-node { position: relative; width: 30px; display: flex; justify-content: center; align-items: center; margin-right: 10px; }
.node-line { position: absolute; top: 20px; bottom: -20px; width: 1px; background: #eee; z-index: 0; display: block; }
.archive-item:last-child .node-line { display: none; }
.node-dot { width: 6px; height: 6px; background: #d9d9d9; border-radius: 50%; z-index: 1; transition: all 0.3s; }

.archive-item:hover .node-dot { background: var(--primary-color); transform: scale(1.5); box-shadow: 0 0 0 4px rgba(56, 178, 172, 0.1); }
.archive-item:hover .archive-title { color: var(--primary-color); transform: translateX(5px); }

.archive-info { flex: 1; display: flex; align-items: center; justify-content: space-between; overflow: hidden; }
.archive-title { font-weight: 600; font-size: 0.95rem; transition: all 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 15px; }
.archive-tags { display: flex; gap: 8px; flex-shrink: 0; }
.archive-tags span { font-size: 0.75rem; color: var(--text-light); background: rgba(0,0,0,0.03); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 600px) {
    .archive-tags { display: none; }
    .year-header { font-size: 0.9rem; }
}