/* Blog Specific Styles */
.blog-hero {
    padding: 25px 0; /* 再次压缩 */
    background: white;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px; /* 缩小与正文的距离 */
}

.blog-hero .hero-title {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.blog-hero p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 覆盖 .main-content-area 的默认样式，消除大红框区域的留白 */
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

.post-card {
    background: white;
    border-radius: 16px; /* 稍微减小圆角，更紧凑 */
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: grid;
    grid-template-columns: 210px 1fr; /* 再次压缩图片栏 */
    padding: 12px 10px; /* 压缩卡片左右留白 */
    gap: 15px; /* 文字与图片之间保留适度距离 */
    align-items: center;
    transition: all 0.3s ease;
}

.post-card:hover {
    transform: translateY(-2px); /* 减弱呼吸跳动感，从-5px调低至-2px */
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
}

.post-card.no-image {
    grid-template-columns: 1fr; /* 无图模式采用单列布局 */
    padding: 15px 20px; /* 无图模式保持适当宽度感 */
}

.post-card.no-image .post-img {
    display: none;
}

.post-card.no-image .post-content {
    padding: 0;
}

.post-img {
    width: 100%;
    height: 150px; /* 采用更精致的小尺寸缩略图感 */
    border-radius: 10px;
    overflow: hidden;
    position: relative; /* 为分页原点定位 */
}

/* 缩略图幻灯片样式 */
.post-slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-slider-track img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.post-slider-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dot.active {
    background: white;
    width: 12px;
    border-radius: 3px;
}

.post-card:hover .post-img img {
    transform: scale(1.03); /* 减弱图片的变大感，从1.05调低至1.03 */
}

.post-content {
    padding: 0 5px; /* 消除文字内容的冗余左右内边距 */
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scan & Wide Toggle Buttons - Discreet Capsule Style */
.qr-toggle, .wide-toggle {
    background: #f8fafc; /* 极淡的背景 */
    border: 1px solid #f1f5f9; /* 极细的边框 */
    padding: 5px 12px;
    border-radius: 50px; /* 恢复胶囊造型 */
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8; /* 进一步弱化字体颜色 */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.qr-toggle:hover, .wide-toggle:hover {
    background: #eff6ff; /* 悬停时轻微亮起 */
    color: var(--primary-color);
    border-color: #dbeafe;
}

.wide-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* QR Modal Specifics */
.qr-container {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: inline-block;
}

.qr-container img {
    display: block;
    width: 200px;
    height: 200px;
    animation: fade-in 0.5s ease;
}

/* QR Loading Spinner */
.qr-loading {
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner-spin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes spinner-spin {
    to { transform: rotate(360deg); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.post-meta i {
    color: var(--primary-color);
}

.post-title {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.read-more i {
    transition: none;
}

.read-more:hover {
    color: var(--primary-dark); /* 仅改变颜色，不再有位移 */
}

/* Search Highlights */
mark {
    background-color: rgba(59, 130, 246, 0.15); /* primary-color with opacity */
    color: var(--primary-color);
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Sidebar Sticky */
.sidebar {
    position: sticky;
    top: 160px; /* 调整为 160px，确保视觉比例最舒适 */
    align-self: start;
    transition: top 0.3s ease;
}

/* Sidebar Widgets */
.sidebar-box {
    background: white;
    padding: 15px; /* 降至 15px */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}
.widget-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.category-list li {
    margin-bottom: 12px;
}

.category-list li:last-child {
    margin-bottom: 0; /* 消除最下方分类多余的边距，配合容器内边距达到视觉平衡 */
}

/* Sub Category Dropdown — 纯 CSS 过渡，彻底消除弹跳 */
.sub-category-list {
    list-style: none;
    padding-left: 0; /* 移除容器缩进，确保子分类链接也能占满宽度 */
    padding-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding-top 0.3s ease;
}

.has-children.active > .sub-category-list {
    max-height: 300px;
    padding-top: 12px; /* 统一间距：一级到二级第一项 */
}

.sub-category-list li {
    margin-bottom: 12px; /* 统一间距：二级分类之间 */
}

.sub-category-list li:last-child {
    margin-bottom: 0; /* 最后一个子分类不需要底部间距，避免与下一个主分类之间出现双倍间距 */
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    position: relative;
    padding-left: 15px; /* 进一步缩小文字左边距 */
}

.category-link:hover {
    color: var(--primary-color);
}

/* 子分类链接增加内边距来实现缩进，这样 flex-between 仍然基于整行宽度对齐数字 */
.sub-category-list .category-link {
    padding-left: 35px; /* 15px 基础 + 20px 缩进 */
}

.toggle-icon {
    position: absolute; 
    left: -8px; /* 进一步向左偏移箭头 */
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    transition: transform 0.3s ease, color 0.3s ease;
    width: 18px;
    text-align: center;
    color: #cbd5e1;
}

.has-children.active > .category-link .toggle-icon {
    transform: translateY(-50%) rotate(90deg);
    color: var(--primary-color);
}

.sidebar-post {
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.sidebar-post .post-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-post .post-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.sidebar-post:hover .post-title {
    color: var(--primary-color);
    transform: translateX(5px); /* 像呼吸一样轻微右移 */
}

.sidebar-post:hover .post-meta {
    color: var(--text-primary);
    opacity: 0.8;
}

.category-count {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center; /* 确保内部文字和标签垂直居中 */
    gap: 10px;
}

.tag-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px; /* 结合 flex gap，实际空隙更紧凑 */
    margin-bottom: 30px;
}

.page-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.1);
}

.page-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #f8fafc;
}

/* Blog Detail Page Styles */
.breadcrumb {
    display: flex;
    align-items: center; /* 确保文字垂直居中 */
    gap: 10px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.article-container {
    background: white;
    border-radius: 16px;
    padding: 20px 25px; /* 继续下压间距 */
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.article-header {
    margin-bottom: 15px;
}

.article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-title {
    font-size: 2.1rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 20px;
    font-weight: 800;
}

.featured-image {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 8px; /* 缩小圆角以匹配紧凑布局 */
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    display: block;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #334155;
}

.article-content h2 {
    font-size: 1.8rem;
    margin: 40px 0 20px;
    color: var(--text-primary);
}

.article-content h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
}

.article-content p {
    margin-bottom: 25px;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    background: #f8fafc;
    padding: 20px 30px;
    margin: 30px 0;
    border-radius: 4px 12px 12px 4px; /* 让左侧边框也有圆角感 */
    font-style: italic;
    color: var(--text-secondary);
    position: relative;
}

.article-content ul, .article-content ol {
    margin-bottom: 25px;
    padding-left: 20px;
}

.article-content li {
    margin-bottom: 10px;
}

.article-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

.article-content pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.article-footer {
    padding-top: 30px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between; /* 左右分分布 */
    align-items: center;            /* 垂直居中 */
    flex-wrap: wrap;
    gap: 20px;
}

.share-buttons {
    display: flex;
    align-items: center; /* 确保“分享至”文字和图标垂直对齐 */
    gap: 15px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    text-decoration: none;
}

.share-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

/* Post Navigation */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.nav-box {
    background: white;
    padding: 18px 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center; /* 改为垂直居中，单行排列 */
    gap: 15px;
}

.nav-prev {
    justify-content: flex-start;
}

.nav-next {
    flex-direction: row-reverse; /* 下一篇的图标放在最右边 */
    justify-content: flex-start;
    text-align: right;
}

.nav-box:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.nav-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    white-space: nowrap; /* 确保“上一篇”不换行 */
    margin-bottom: 0; /* 移除之前的底边距 */
}

/* 箭头样式 */
.nav-box i {
    font-size: 0.7rem;
}

.nav-box:hover .nav-label {
    color: var(--primary-color);
}

.nav-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1; /* 占据剩余空间 */
}

/* Comments Section */
.comments-section {
    background: white;
    padding: 20px; /* 降至 20px */
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.comments-title {
    font-size: 1.5rem;
    margin-bottom: 20px; /* 从 30px 缩小 */
}

.comment-form textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    min-height: 120px;
    margin-bottom: 20px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.comment-form textarea:focus {
    border-color: var(--primary-color);
}

/* Comments System Styles */
.comment-list {
    margin-top: 30px;
    list-style: none;
    padding: 0;
}

.comment-item {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
}

.comment-avatar {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #f1f5f9;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-content-wrapper {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-author {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
}

.comment-author:hover {
    color: var(--primary-color);
}

.author-badge {
    font-size: 0.7rem;
    background: var(--primary-color);
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 15px;
}

.comment-action-btn {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.comment-action-btn:hover {
    color: var(--primary-color);
}

/* Nested Replies Style (Flat Two-Level) */
.comment-replies {
    margin-top: 15px;
    padding: 15px;
    background: #f8fafc; /* 浅灰色背景隔断 */
    border-radius: 8px;
    list-style: none;
}


.reply-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.reply-item:last-child {
    margin-bottom: 0;
}

.reply-avatar {
    width: 32px;
    height: 32px;
}

/* Load More Button */
.load-more-comments {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
}

.btn-load-more {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 10px 30px;
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-load-more:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* Reply Target Indicator */
.reply-target-bar {
    display: none;
    flex-direction: column; /* 改为垂直布局以显示预览 */
    gap: 4px;
    background: #f8fafc;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03);
}

.reply-target-bar.active {
    display: flex;
}

.reply-target-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.reply-text-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
    font-style: italic;
    opacity: 0.8;
}

.cancel-reply {
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s ease;
    font-size: 1rem;
}

.cancel-reply:hover {
    color: var(--primary-color);
}

/* Local Load More Replies Button */
.load-more-replies-btn {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s ease;
}

.load-more-replies-btn:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* @Mention Style */
.reply-mention {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-right: 4px;
}

.reply-mention:hover {
    text-decoration: underline;
}


