/* --- CSS 变量定义 --- */
:root {
    --primary-color: #1e293b; /* Slate 800 */
    --primary-hover: #334155; /* Slate 700 */
    --bg-color: #F2F5F9;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-secondary: #4b5563;
    --text-light: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-blue-bg: #eff6ff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* --- CSS 变量定义 --- */
:root {
    --primary-color: #1e293b; /* Slate 800 */
    --primary-hover: #334155; /* Slate 700 */
    --bg-color: #F2F5F9;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-blue-bg: #eff6ff;
    --border-color: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-full: 9999px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
}

/* --- 全局重置 --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- 布局工具类 --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 0;
}
@media (min-width: 1024px) {
    .grid-layout { grid-template-columns: 8fr 4fr; }
}

/* --- 顶部导航栏 --- */
.navbar {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    display: flex;
    align-items: center;
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}
.logo {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 14px;
}
.desktop-menu { display: none; gap: 32px; align-items: center; }
.desktop-menu a { font-size: 14px; font-weight: 500; color: var(--text-secondary); position: relative; }
.desktop-menu a:hover, .desktop-menu a.active { color: var(--primary-color); }
.mobile-menu-btn { display: block; background: none; border: none; font-size: 20px; color: var(--text-secondary); cursor: pointer; }
@media (min-width: 768px) {
    .desktop-menu { display: flex; }
    .mobile-menu-btn { display: none; }
}

/* --- 卡片通用样式 --- */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* --- 文章卡片 --- */
.post-card { padding: 24px; }
.post-header { display: flex; align-items: center; margin-bottom: 16px; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background-color: #f3f4f6; border: 2px solid white;
    margin-right: 12px;
}
.author-name { font-size: 14px; font-weight: 700; color: var(--text-main); }
.post-meta { font-size: 12px; color: var(--text-light); display: flex; align-items: center; gap: 6px; }
.category-tag {
    color: var(--accent-blue); background-color: var(--accent-blue-bg);
    padding: 2px 6px; border-radius: 4px; font-weight: 500;
}
.post-content {
    color: var(--text-secondary); font-family: var(--font-serif);
    font-size: 16px; line-height: 1.75; text-align: justify; margin-bottom: 16px;
}
.post-image-container {
    width: 100%; height: auto; margin-bottom: 20px;
    border-radius: 12px; overflow: hidden;
}
.post-footer {
    border-top: 1px solid var(--border-color); padding-top: 16px;
    display: flex; gap: 16px;
}
.stat-item {
    display: flex; align-items: center; font-size: 12px; color: var(--text-light);
    background-color: #f9fafb; padding: 4px 8px; border-radius: 6px; gap: 6px;
}

/* --- 侧边栏 --- */
.profile-cover {
    height: 120px; background-color: #cbd5e1; background-size: cover; background-position: center;
}
.profile-info { padding: 0 24px 24px; text-align: center; }
.profile-avatar {
    width: 96px; height: 96px; border-radius: 50%; border: 4px solid white;
    background-color: white; margin-top: -48px; margin-bottom: 12px;
}
.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.profile-bio { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
.tags-container { padding: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    display: inline-flex; align-items: center; background-color: #f9fafb;
    color: var(--text-secondary); font-size: 12px; padding: 4px 10px;
    border-radius: 8px; transition: all 0.2s;
}
.tag:hover { background-color: var(--primary-color); color: white; }

/* --- 分页与加载更多 --- */
.load-more-container { text-align: center; padding: 24px 0; }
.btn-load-more {
    display: inline-block; background-color: white; color: var(--text-secondary);
    border: 1px solid #e5e7eb; padding: 10px 24px; border-radius: var(--radius-full);
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s;
}
.btn-load-more:hover { background-color: var(--primary-color); color: white; }
.page-navigator { list-style: none; display: flex; justify-content: center; gap: 10px; }
.page-navigator li a { padding: 8px 16px; background: white; border-radius: 20px; }
.page-navigator .current a { background: var(--primary-color); color: white; }
/* --- 全局重置 --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--primary-color); }
ul { list-style: none; }
img { max-width: 100%; display: block; height: auto; }

/* --- 布局工具类 --- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.grid-layout { display: grid; grid-template-columns: 1fr; gap: 32px; padding: 32px 0; }
@media (min-width: 1024px) { .grid-layout { grid-template-columns: 8fr 4fr; } }

/* --- 顶部导航栏 --- */
.navbar {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 100; height: 64px; display: flex; align-items: center;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.logo {
    background-color: var(--primary-color); color: white; padding: 8px 20px;
    border-radius: 9999px; font-weight: 700; font-size: 14px;
}
.desktop-menu { display: none; gap: 32px; align-items: center; }
.desktop-menu a { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.desktop-menu a:hover { color: var(--primary-color); font-weight: 600; }
.mobile-menu-btn { display: block; background: none; border: none; font-size: 20px; color: var(--text-secondary); cursor: pointer; }
@media (min-width: 768px) { .desktop-menu { display: flex; } .mobile-menu-btn { display: none; } }

/* --- 通用卡片 --- */
.card {
    background-color: var(--card-bg); border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); box-shadow: var(--shadow-sm);
    overflow: hidden; margin-bottom: 24px;
}
.post-card { padding: 32px; }

/* --- 友情链接页专用样式 (Grid 卡片布局) --- */
.links-grid {
    display: grid;
    /* 响应式网格：PC端每行约3-4个，手机端每行1-2个 */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.link-card {
    display: flex !important;
    align-items: center;
    background: #ffffff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    text-decoration: none !important;
    height: 90px; /* 固定高度，确保整齐 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
    z-index: 10;
}

.link-avatar {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50%;
    object-fit: cover; /* 防止图片变形 */
    margin: 0 15px 0 0 !important;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #f1f5f9;
    flex-shrink: 0; /* 防止头像被挤压 */
    transition: transform 0.4s ease;
}

.link-card:hover .link-avatar {
    transform: rotate(360deg);
}

.link-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden; /* 超出隐藏 */
    min-width: 0; /* 关键：修复Flex子元素文字截断失效的问题 */
}

.link-title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-desc {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* 侧边栏等其他样式保持兼容 */
.profile-cover { height: 120px; background-color: #cbd5e1; background-size: cover; }
.profile-info { padding: 0 24px 24px; text-align: center; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; border: 4px solid white; background-color: white; margin-top: -48px; margin-bottom: 12px; }
.tags-container { padding: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; background-color: #f9fafb; color: var(--text-secondary); padding: 4px 10px; border-radius: 8px; font-size: 12px; }
.post-content { font-size: 16px; line-height: 1.8; color: var(--text-main); }
.post-content a { color: var(--accent-blue); }

/* --- 评论区精致样式 --- */
#comments { padding-top: 10px; }

/* 评论区标题 */
.comments-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.comments-header i { margin-right: 10px; color: var(--accent-blue); }

/* 评论输入区域 */
.comment-form {
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    border: 1px dashed var(--border-color);
    transition: all 0.3s ease;
}
.comment-form:focus-within {
    background-color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px var(--accent-blue-bg);
}

.comment-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
@media (max-width: 640px) { .comment-form-grid { grid-template-columns: 1fr; } }

.comment-input, .comment-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: #fff;
    font-size: 14px;
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
    font-family: var(--font-sans);
}

.comment-input:focus, .comment-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

.comment-textarea {
    min-height: 120px;
    resize: vertical;
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 32px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(30, 41, 59, 0.2);
    margin-top: 15px;
}
.submit-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(30, 41, 59, 0.3);
}

/* 评论列表 */
.comment-list { margin-top: 20px; }
.comment-list ol { list-style: none; padding-left: 0; }
.comment-list li { margin-bottom: 20px; }

/* 评论主体卡片 */
.comment-body {
    position: relative;
    padding: 20px 24px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}
.comment-body:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border-color: #e2e8f0;
    transform: translateX(4px);
}

/* 评论者信息栏 */
.comment-author {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
}

.comment-author .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-right: 14px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.comment-author .fn {
    font-style: normal;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    margin-right: 10px;
}

.comment-meta {
    font-size: 12px;
    color: var(--text-light);
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 6px;
}
.comment-meta a { color: inherit; }

/* 评论内容排版 */
.comment-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-left: 56px; /* 与头像对齐 */
    margin-bottom: 12px;
}
.comment-content p { margin-bottom: 0.8em; }
.comment-content p:last-child { margin-bottom: 0; }

/* 回复按钮 */
.comment-reply {
    text-align: right;
    margin-top: -10px; 
}
.comment-reply a {
    display: inline-block;
    font-size: 12px;
    color: var(--accent-blue);
    padding: 4px 12px;
    background: var(--accent-blue-bg);
    border-radius: 20px;
    font-weight: 500;
    opacity: 0.8;
    transition: all 0.2s;
}
.comment-reply a:hover {
    opacity: 1;
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* 嵌套评论 (层级) */
.comment-children {
    margin-left: 20px;
    margin-top: 20px;
    padding-left: 20px;
    border-left: 2px solid #f1f5f9; /* 左侧连接线 */
}

@media (min-width: 640px) {
    .comment-children { margin-left: 56px; }
}

/* 分页 */
.load-more-container { text-align: center; padding: 24px 0; }
.page-navigator { list-style: none; display: flex; justify-content: center; gap: 10px; }
.page-navigator li a { padding: 8px 16px; background: white; border-radius: 20px; border: 1px solid var(--border-color); font-size: 13px; color: var(--text-secondary); transition: all 0.2s; }
.page-navigator li a:hover { border-color: var(--primary-color); color: var(--primary-color); }
.page-navigator .current a { background: var(--primary-color); color: white; border-color: var(--primary-color); }