/* --- 1. 基础复位与全局变量 --- */
:root {
    --primary-color: #0c0c0c;
    --success-color: #22863a;
    --warning-color: #fa8c16;
    --error-color: #f5222d;
    --border-color: #f0f0f0;
    --bg-light: #fafafa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif; background-color: #ffffff; display: flex; min-height: 100vh; color: #333; -webkit-font-smoothing: antialiased; }

/* --- 2. 侧边栏 --- */
aside { width: 260px; background-color: #ffffff; border-right: 1px solid var(--border-color); padding: 25px 20px; position: fixed; height: 100vh; display: flex; flex-direction: column; z-index: 100; }
aside h2 a { font-size: 1.4rem; color: #333; text-decoration: none; font-weight: bold; transition: color 0.3s; }
aside h2 a:hover { color: var(--primary-color); }

.nav-group { list-style: none; padding: 0; margin: 10px 0; }
.nav-group li { margin: 5px 0; }
.nav-group li a { text-decoration: none; color: #444; font-size: 14px; display: flex; align-items: center; padding: 8px 12px; border-radius: 6px; transition: all 0.2s ease; }
.nav-group li a i { width: 20px; margin-right: 10px; text-align: center; color: var(--primary-color); font-size: 15px; }
.nav-group li a:hover { background-color: #f0f7ff; color: var(--primary-color); transform: translateX(3px); }

.footer-info { margin-top: auto; padding-bottom: 10px; font-size: 12px; color: #888; line-height: 1.8; text-align: center; border-top: 1px solid var(--border-color); padding-top: 15px; }
.footer-info a { color: #888; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.footer-info a:hover { color: var(--primary-color); }

/* --- 3. 主内容区 --- */
main { flex: 1; margin-left: 260px; padding: 20px 40px; max-width: 1000px; }
.breadcrumb { font-size: 13px; color: #999; margin-bottom: 15px; }
.post-header h1 { font-size: 30px; color: #222; margin-bottom: 15px; letter-spacing: -0.5px; }
.post-meta { font-size: 13px; color: #999; line-height: 1.6; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }

.archive-title { font-size: 32px; font-weight: bold; color: #222; margin: 10px 0 25px 0; }

.time-label { font-size: 13px; color: var(--primary-color); margin: 30px 0 15px 0; display: flex; align-items: center; }
.time-label b { font-size: 20px; font-weight: bold; margin-right: 10px; }
.time-label::after { content: ""; flex: 1; height: 1px; margin-left: 15px; background: linear-gradient(to right, #ccc 40px, var(--border-color) 40px); }

/* --- 4. 文章列表 --- */
.article-item { display: flex; padding: 25px 0; border-bottom: 1px solid #f5f5f5; text-decoration: none; color: inherit; transition: all 0.3s; }
.article-item:hover { background-color: #fcfdfe; transform: translateX(5px); }
.article-left { width: 200px; margin-right: 25px; flex-shrink: 0; }
.thumb { width: 100%; height: 130px; border-radius: 8px; object-fit: cover; background: #f9f9f9; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.article-right { flex: 1; position: relative; display: flex; flex-direction: column; }
.article-title { font-size: 20px; color: #222; margin-bottom: 12px; font-weight: bold; padding-right: 60px; }
.article-excerpt { font-size: 14px; color: #666; line-height: 1.8; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.comment-badge { position: absolute; right: 0; top: 0; background: #eef4ff; color: var(--primary-color); padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }

/* --- 5. 文章详情 --- */
.post-content { font-size: 16px; line-height: 1.85; margin: 30px 0; color: #3c3c3c; }
.post-content img { max-width: 90%; height: auto; display: block; margin: 25px auto; border-radius: 10px; transition: all 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.post-content img:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }

.update-alert { background-color: #fff9eb; border: 1px solid #ffe58f; color: #856404; padding: 14px 20px; border-radius: 8px; font-size: 14px; margin: 25px 0; display: flex; align-items: center; }
.update-alert i { margin-right: 12px; font-size: 18px; color: var(--warning-color); }

/* --- 6. 代码块与行内代码 --- */
pre[class*="language-"] { background: #fdfdfd !important; border: 1px solid #e1e4e8 !important; border-radius: 10px !important; padding: 40px 15px 15px !important; margin: 25px 0 !important; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); position: relative; }
pre[class*="language-"]::before { content: ""; position: absolute; top: 15px; left: 15px; width: 10px; height: 10px; background: #ff5f56; border-radius: 50%; box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f; z-index: 2; }
code[class*="language-"] { font-family: "SF Mono", Consolas, monospace !important; font-size: 13.5px !important; }
:not(pre) > code { background: #fff5f5 !important; color: #eb5757 !important; padding: 2px 5px !important; border-radius: 4px !important; border: 1px solid #ffe8e8 !important; font-size: 13px !important; margin: 0 3px; }

/* --- 7. 短代码组件 (通用) --- */
.sc-box { padding: 15px 20px; border-radius: 8px; margin: 20px 0; font-size: 14px; border: 1px solid transparent; display: flex; align-items: flex-start; }
.sc-box-info { background: #f0f7ff; border-color: #d1e9ff; color: #005cc5; }
.sc-box-success { background: #f6ffed; border-color: #b7eb8f; color: var(--success-color); }
.sc-box-warning { background: #fffbe6; border-color: #ffe58f; color: #856404; }
.sc-box-error { background: #fff1f0; border-color: #ffa39e; color: var(--error-color); }

.sc-row { display: flex; gap: 10px; margin: 20px 0; width: 100%; align-items: stretch; }
.sc-col { 
    flex: 1; 
    min-width: 0; /* 必须为0，否则图片会撑开容器导致换行 */
    background: var(--bg-light); 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
    overflow: hidden; /* 确保内部图片不超出圆角 */
    display: flex;
    flex-direction: column;
}
/* 针对网格内的图片进行强制适配 */
.sc-col img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover; /* 核心：图片自动裁剪填充，不会变形 */
    margin: 0 !important; /* 去除文章全局图片的外边距 */
    display: block;
    border-radius: 0; /* 既然外层有圆角了，内层就不重复加了 */
}

.sc-progress-wrapper { margin: 20px 0; }
.sc-progress-title { font-size: 13px; color: #666; margin-bottom: 6px; }
.sc-progress { height: 10px; background: #eee; border-radius: 20px; overflow: hidden; }
.sc-progress-inner { height: 100%; transition: width 0.8s cubic-bezier(0.17, 0.67, 0.83, 0.67); }

.sc-collapse { border: 1px solid var(--border-color); border-radius: 10px; margin: 15px 0; overflow: hidden; transition: all 0.3s; }
.sc-collapse summary { background: #fcfcfc; padding: 12px 18px; cursor: pointer; font-weight: bold; font-size: 14px; outline: none; }
.sc-collapse-content { padding: 15px 18px; border-top: 1px solid var(--border-color); font-size: 14px; line-height: 1.7; background: #fff; }

.sc-card { border: 1px solid var(--border-color); border-radius: 10px; margin: 20px 0; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.04); }
.sc-card .card-header { padding: 12px 18px; font-weight: bold; color: #fff; font-size: 15px; }
.sc-card .card-body { padding: 18px; background: #fff; font-size: 14px; line-height: 1.6; }
.sc-card-blue { border-color: var(--primary-color); } .sc-card-blue .card-header { background: var(--primary-color); }
.sc-card-red { border-color: var(--error-color); } .sc-card-red .card-header { background: var(--error-color); }

.sc-step, .sc-timeline-item { position: relative; padding-left: 32px; margin-bottom: 0; border-left: 2px solid #f0f0f0; margin-left: 10px; }
.sc-step::before, .sc-timeline-item::after { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--primary-color); border-radius: 50%; z-index: 1; }
.sc-step .step-content, .sc-timeline-item .timeline-content { padding-bottom: 25px; font-size: 14px; color: #555; }
.sc-step:last-child, .sc-timeline-item:last-child { border-left-color: transparent; }

.sc-mark-yellow { background: #fff3bf; padding: 2px 4px; border-radius: 3px; font-weight: 500; }
.sc-mark-green { background: #d3f9d8; padding: 2px 4px; border-radius: 3px; font-weight: 500; }

.sc-down-card { display: flex; align-items: center; background: #f6ffed; border: 1px dashed var(--success-color); border-radius: 10px; padding: 18px; margin: 25px 0; }
.down-info { flex: 1; }
.down-name { font-weight: bold; color: #2c3e50; font-size: 16px; margin-bottom: 5px; }
.down-pwd { font-size: 13px; color: #666; }
.down-pwd span { color: var(--error-color); font-weight: bold; background: #fff; padding: 2px 6px; border-radius: 4px; border: 1px solid #eee; margin-left: 5px; }
.down-btn { background: var(--success-color); color: #fff !important; padding: 10px 22px; border-radius: 6px; text-decoration: none !important; font-weight: bold; transition: 0.3s; }
.down-btn:hover { background: #27ae60; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(46, 204, 113, 0.2); }

.sc-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin: 5px;
    line-height: 1.5;
    border: 1px solid transparent;
}

/* 蓝色标签 */
.sc-tag-blue { 
    background: #e6f7ff; 
    color: #1890ff; 
    border-color: #91d5ff; 
}

/* 绿色标签 */
.sc-tag-green { 
    background: #f6ffed; 
    color: #52c41a; 
    border-color: #b7eb8f; 
}

/* 黄色标签 */
.sc-tag-yellow { 
    background: #fffbe6; 
    color: #faad14; 
    border-color: #ffe58f; 
}

/* 红色标签 */
.sc-tag-red { 
    background: #fff1f0; 
    color: #f5222d; 
    border-color: #ffa39e; 
}

/* 灰色标签 */
.sc-tag-gray { 
    background: #f5f5f5; 
    color: #666; 
    border-color: #d9d9d9; 
}

/* --- 8. 彩色按钮系列 --- */
.sc-btn { display: inline-block; padding: 8px 22px; border-radius: 6px; text-decoration: none !important; font-size: 14px; font-weight: 500; margin: 5px; transition: all 0.3s ease; cursor: pointer; border: none; }
.sc-btn-blue { background: #4a90e2; color: #fff !important; box-shadow: 0 4px 10px rgba(74, 144, 226, 0.2); }
.sc-btn-blue:hover { background: #357abd; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(74, 144, 226, 0.3); }
.sc-btn-green { background: #2ecc71; color: #fff !important; box-shadow: 0 4px 10px rgba(46, 204, 113, 0.2); }
.sc-btn-green:hover { background: #27ae60; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(46, 204, 113, 0.3); }
.sc-btn-yellow { background: #f1c40f; color: #fff !important; box-shadow: 0 4px 10px rgba(241, 196, 15, 0.2); }
.sc-btn-yellow:hover { background: #f39c12; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(241, 196, 15, 0.3); }
.sc-btn-red { background: #e74c3c; color: #fff !important; box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2); }
.sc-btn-red:hover { background: #c0392b; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(231, 76, 60, 0.3); }
.sc-btn-outline { background: transparent; border: 1px solid #ddd; color: #666 !important; }
.sc-btn-outline:hover { border-color: #4a90e2; color: #4a90e2 !important; background: #f0f7ff; }

/* --- 9. 文章底部：标签与相关推荐 --- */
.post-tags { margin: 40px 0 20px; padding: 15px 20px; background: #fcfcfc; border-radius: 10px; border-left: 4px solid var(--primary-color); }
.post-tags a { display: inline-block; background: #fff; border: 1px solid #e5e5e5; padding: 5px 15px; margin: 5px; border-radius: 25px; font-size: 12px; color: #666 !important; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.post-tags a:hover { background: var(--primary-color); color: #fff !important; border-color: var(--primary-color); transform: scale(1.05); box-shadow: 0 4px 10px rgba(74, 144, 226, 0.15); }

.post-related { margin-top: 50px; }
.post-related h3 { font-size: 19px; margin-bottom: 25px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; position: relative; }
.post-related h3::after { content: ""; position: absolute; bottom: -1px; left: 0; width: 50px; height: 2px; background: var(--primary-color); }

/* 容器 */
.related-posts-wrapper { margin-top: 30px; }
.related-main-title { font-size: 18px; margin-bottom: 15px; color: #444; }

.related-posts-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); /* 纯文字可以宽一点 */
    gap: 15px;
}

/* 文字卡片基础样式 */
.related-text-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    align-items: center;
}

/* 标题：大字号、无下划线 */
.related-title {
    font-size: 16px; /* 调大字号 */
    font-weight: 600;
    line-height: 1.5;
    color: #333;
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 悬停效果：取消下划线，保留你的位移和阴影 */
.related-posts-list a {
    text-decoration: none !important;
    outline: none;
}

.related-posts-list a:hover .related-text-card {
    transform: translateY(-5px);
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.related-posts-list a:hover .related-title {
    color: #007bff; /* 悬停颜色稍微变蓝，增加交互感 */
}

/* --- 10. 分页与辅助 --- */
#back-to-top { position: fixed; right: 30px; bottom: 40px; width: 44px; height: 44px; background: #fff; border: 1px solid #eee; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.1); opacity: 0; visibility: hidden; transition: 0.3s; z-index: 999; }
#back-to-top.show { opacity: 1; visibility: visible; }
#back-to-top:hover { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
#back-to-top:hover i { color: #fff; }

.pagination-list { display: flex; list-style: none; gap: 8px; margin-top: 40px; }
.pagination-list a, .pagination-list span { padding: 8px 16px; background: #fff; border: 1px solid var(--border-color); border-radius: 6px; font-size: 14px; text-decoration: none; color: #555; transition: 0.2s; }
.pagination-list .active a { background: var(--primary-color); border-color: var(--primary-color); color: #fff; font-weight: bold; }

/* --- 11. 响应式适配 --- */
@media (max-width: 950px) {
    aside { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border-color); padding: 20px; }
    main { margin-left: 0; padding: 20px; }
    .article-item { flex-direction: column; }
    .article-left { width: 100%; margin-bottom: 15px; }
    .article-left .thumb { height: 180px; }
    .related-posts-list li { width: 50%; }
}
@media (max-width: 500px) {
    .related-posts-list li { width: 100%; }
    .post-header h1 { font-size: 24px; }
}



/* --- 评论区整体容器 --- */
.comment-area {
    margin: 60px auto;
    max-width: 100%;
    color: #333;
    line-height: 1.6;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 30px;
    border-left: 4px solid #000;
    padding-left: 15px;
}

/* --- 输入表单 (三个框并排) --- */
.comment-info-input {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .comment-info-input { grid-template-columns: 1fr; }
}

.comment-info-input input, 
.comment-form textarea {
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.comment-info-input input:focus, 
.comment-form textarea:focus {
    background: #fff;
    border-color: #000;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.comment-form textarea {
    width: 100%;
    height: 150px;
    resize: none;
    box-sizing: border-box;
    display: block;
}

/* --- 按钮与取消回复 --- */
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.submit-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* 取消回复链接美化 */
.form-footer a[id*="cancel-comment-reply-link"] {
    font-size: 14px;
    color: #ff4d4f;
    text-decoration: none !important;
    border-bottom: 1px dashed #ff4d4f;
    padding-bottom: 2px;
}

/* --- 动态分割线 --- */
.dynamic-hr {
    height: 1px;
    background: #eee;
    margin: 50px 0;
    position: relative;
    overflow: hidden;
}

.dynamic-hr::after {
    content: "";
    position: absolute;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, #000, transparent);
    animation: flowLine 4s infinite linear;
}

@keyframes flowLine {
    0% { left: -100px; }
    100% { left: 100%; }
}

/* --- 评论列表美化 --- */
.comment-item {
    padding: 30px 0;
    border-bottom: 1px solid #f2f2f2;
}

/* 名字点击后不变色逻辑 */
.author-name, .author-name a {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a !important; /* 强制黑色 */
    text-decoration: none !important; /* 去掉所有下划线 */
    cursor: default;
}

.author-name a:hover {
    color: #1a1a1a !important; /* 悬停也不变色 */
}

/* 评论正文：大字号、去下划线 */
.comment-text {
    font-size: 17px;
    line-height: 1.8;
    color: #444;
    margin: 15px 0;
    text-decoration: none !important;
}

.comment-text a {
    color: #666;
    text-decoration: none !important;
    border-bottom: 1px solid #ccc;
}

.comment-date {
    color: #999;
    font-size: 13px;
    margin-left: 12px;
    font-weight: normal;
}

/* --- 勋章样式 --- */
.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-admin { background: #000; color: #fff; }
.badge-visitor { background: #eee; color: #777; }

/* --- 回复链接改为胶囊按钮 --- */
.comment-action {
    text-align: right;
    margin-top: 10px;
}

.comment-action a {
    display: inline-block;
    font-size: 12px;
    color: #888;
    text-decoration: none !important;
    background: #fff;
    border: 1px solid #eee;
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.2s;
}

.comment-action a:hover {
    border-color: #000;
    color: #000;
}

/* 分页导航 */
.comment-page-nav { padding: 40px 0; }
.comment-page-nav ol { list-style: none; display: flex; gap: 10px; padding: 0; }
.comment-page-nav a { 
    text-decoration: none !important; 
    color: #000; 
    padding: 8px 16px; 
    background: #f5f5f5; 
    border-radius: 8px;
}

aside {
    position: fixed;   /* 确保侧边栏固定 */
    top: 0;
    left: 0;
    bottom: 0;         /* 撑满垂直高度 */
    width: 260px;      /* 这里改为你侧边栏的实际宽度 */
    
    /* 关键属性：处理溢出 */
    overflow-y: auto;  /* 当内容超出高度时显示垂直滚动条 */
    overflow-x: hidden;/* 隐藏水平滚动条 */
    
    display: flex;
    flex-direction: column;
}

/* 优化滚动条样式（可选，让侧边栏看起来更精致） */
aside::-webkit-scrollbar {
    width: 4px;
}
aside::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
aside::-webkit-scrollbar-track {
    background: transparent;
}