/* 基础变量定义 - 调整为58fit风格 */
:root {
    --primary-color: #1e40af; /* 深蓝色，作为主色调 */
    --primary-dark: #f97316; /* 用于按钮和链接的悬停状态 */
    --secondary-color: #3b82f6; /* 调整为更协调的亮蓝色，用于强调 */
    --text-color: #1c1c1c; /* 基础文本颜色 */
    --text-light: #6b7280; /* 优化辅助文本颜色，提升可读性 */
    --text-lighter: #9ca3af; /* 更浅的文本颜色，用于次要信息 */
    --background-color: #ffffff;
    --background-light: #f3f4f6; /* 调整为更柔和的浅背景 */
    --border-color: #e5e7eb; /* 优化边框色，与整体风格协调 */
    --border-dark: #d1d5db; /* 深色边框，用于需要突出的分隔 */
    --success-color: #10b981; /* 成功状态颜色 */
    --warning-color: #f59e0b; /* 警告状态颜色 */
    --error-color: #ef4444; /* 错误状态颜色 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 6px 10px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1); /* 增加大阴影选项 */
    --radius: 6px; /* 略微增大圆角，使设计更柔和 */
    --radius-sm: 4px; /* 小尺寸圆角 */
    --radius-lg: 8px; /* 大尺寸圆角 */
    --transition: all 0.3s ease;
    --transition-fast: all 0.2s ease; /* 快速过渡效果 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;
    --spacing-xxxl: 64px; /* 增加更大间距选项 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-size-sm: 14px; /* 小字体 */
    --font-size-md: 16px; /* 中等字体 */
    --font-size-lg: 18px; /* 大字体 */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 600; /* 加粗字体权重 */
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局样式 */
body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* 新增：链接访问状态样式 */
a:visited {
    color: #5b21b6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* 新增：图片防错位处理 */
    object-fit: cover;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

/* 容器样式 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* 核心修复：确保两栏布局基础设置正确 */
.content-wrapper {
    display: flex;
    gap: var(--spacing-xl);
    width: 100%;
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    /* 新增：极端情况允许换行 */
    flex-wrap: wrap;
}

/* 主内容区设置固定比例 */
.blog-post {
    flex: 3;
    min-width: 0;
    content-visibility: auto;
    contain-intrinsic-size: 1000px;
}

/* 侧边栏设置固定比例 */
.sidebar {
    flex: 1;
    min-width: 280px;
    flex-shrink: 0;
}

/* 页面头部样式 */
.site-header {
    background-color: var(--background-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    isolation: isolate;
    transform: translateZ(0);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.site-logo img {
    height: 40px;
}

.main-nav ul {
    display: flex;
    gap: var(--spacing-lg);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-color);
    font-weight: 500;
    padding: var(--spacing-sm) 0;
    position: relative;
    will-change: transform, opacity;
}

.nav-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    position: relative;
}

.mobile-menu-btn .icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mobile-menu-btn .icon::before,
.mobile-menu-btn .icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    left: 0;
}

.mobile-menu-btn .icon::before {
    top: -8px;
}

.mobile-menu-btn .icon::after {
    bottom: -8px;
}

/* 新增：移动端菜单激活状态 */
.mobile-menu-btn.active .icon {
    background-color: transparent;
}

.mobile-menu-btn.active .icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav {
    display: none;
    background-color: var(--background-color);
    border-top: 1px solid var(--border-color);
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    padding: var(--spacing-md) 0;
}

.mobile-nav li {
    margin-bottom: var(--spacing-sm);
}

.mobile-nav .nav-link {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* 主内容区样式 */
main {
    padding: var(--spacing-xxl) 0;
}

/* 文章头部样式 */
.post-header {
    margin-bottom: var(--spacing-xl);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
    font-size: 14px;
    /* 新增：小屏幕换行 */
    flex-wrap: wrap;
}

.category a {
    color: var(--secondary-color);
    background-color: var(--background-light);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.category a:hover {
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
}

.post-title {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: var(--spacing-lg);
    color: var(--primary-dark);
    /* 新增：长标题换行 */
    overflow-wrap: break-word;
}

.author-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.author-avatar {
    border-radius: 50%;
}

.author-name {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.author-bio {
    color: var(--text-light);
    font-size: 14px;
}

/* 文章特色图片 */
.post-featured-image {
    margin-bottom: var(--spacing-xl);
    /* 新增：图片容器稳定性 */
    position: relative;
    overflow: hidden;
}

.post-featured-image img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    will-change: transform;
}

.post-featured-image figcaption {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-top: var(--spacing-sm);
    /* 新增：说明文字溢出处理 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文章内容样式 */
.post-content {
    margin-bottom: var(--spacing-xxl);
}

.post-content p {
    margin-bottom: var(--spacing-lg);
}

.post-content h2 {
    font-size: 2rem;
    font-weight: 400;
    margin: var(--spacing-xl) 0 var(--spacing-lg);
    color: var(--primary-dark);
}

.post-content h3 {
    font-size: 1.6rem;
    font-weight: 400;
    margin: var(--spacing-lg) 0 var(--spacing-md);
    color: var(--text-color);
}

.post-image {
    margin: var(--spacing-xl) 0;
    /* 新增：图片容器稳定性 */
    position: relative;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    will-change: transform;
}

.post-image figcaption {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-top: var(--spacing-sm);
    /* 新增：说明文字溢出处理 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文章标签样式 */
.post-tags {
    margin-bottom: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.tag {
    display: inline-block;
    background-color: var(--background-light);
    color: var(--text-light);
    padding: 4px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-right: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    will-change: transform, opacity;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.tag:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    transform: scale(1.05);
    border-color: var(--primary-color);
}

/* 文章操作按钮 */
.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: none;
    border: none;
    color: var(--text-light);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius);
    transition: var(--transition);
    will-change: transform, opacity;
}

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

/* 新增：按钮焦点状态 */
.action-btn:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.action-btn .icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.like-btn .icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.34c-.516 0-.966.352-1.091.853l-1.243 6.226c-.11.55.458 1.037 1.001 1.037H17v5l-2 2v-5h4l-1.001-5h-4.768c-.559 0-1.001-.445-1.001-1.001 0-.558.442-1.001 1.001-1.001h6.938c1.1 0 2-.9 2-2z'/%3E%3C/svg%3E");
}

.bookmark-btn .icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

.share-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.share-btn {
    background-color: var(--background-light);
    border: none;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-light);
    transition: var(--transition);
    will-change: transform, opacity;
}

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

/* 新增：分享按钮焦点状态 */
.share-btn:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

/* 作者信息卡片 */
.author-card {
    display: flex;
    gap: var(--spacing-lg);
    background-color: var(--background-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-xxl);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.author-card-avatar {
    border-radius: 50%;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.author-card-content h3 {
    color: var(--primary-dark);
}

.author-card-bio {
    color: var(--text-light);
}

.author-card-link {
    display: inline-block;
    color: var(--secondary-color);
    font-weight: 500;
}

.author-card-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 相关文章 */
.related-posts {
    margin-bottom: var(--spacing-xxl);
}

.related-posts h2 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary-color);
    /* 新增：标题换行 */
    overflow-wrap: break-word;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--spacing-lg);
}

.related-post {
    background-color: var(--background-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    /* 新增：硬件加速 */
    transform: translateZ(0);
    /* 新增：延迟加载动画 */
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.related-post:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.related-post-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    will-change: transform;
}

.related-post-title {
    font-size: 1.1rem;
    padding: var(--spacing-md);
    color: var(--text-color);
    /* 新增：标题换行 */
    overflow-wrap: break-word;
}

.related-post-link:hover .related-post-title {
    color: var(--primary-color);
}

.related-post-date {
    display: block;
    padding: 0 var(--spacing-md) var(--spacing-md);
    color: var(--text-light);
    font-size: 13px;
}

/* 评论区样式 */
.comments-section {
    margin-top: var(--spacing-xxl);
}

.comments-section h2 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary-color);
    /* 新增：标题换行 */
    overflow-wrap: break-word;
}

/* 评论表单 */
.comment-form {
    background-color: var(--background-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-xl);
}

.comment-form h3 {
    margin-bottom: var(--spacing-lg);
    font-size: 1.4rem;
    color: var(--primary-dark);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.2);
}

/* 新增：输入框焦点样式统一 */
.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.form-group textarea {
    resize: vertical;
}

.submit-comment {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.submit-comment:hover {
    background-color: var(--primary-dark);
}

/* 新增：提交按钮焦点和禁用状态 */
.submit-comment:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.submit-comment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--border-color);
    color: var(--text-lighter);
}

/* 评论列表 */
.comments-list {
    margin-bottom: var(--spacing-lg);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.comment {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border-color);
    /* 新增：最小高度避免抖动 */
    min-height: 100px;
    contain: layout;
    /* 新增：hover效果 */
    transition: var(--transition);
}

.comment:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

.comment:last-child {
    border-bottom: none;
}

.comment-avatar {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.comment-author {
    font-weight: 500;
    font-size: 15px;
}

.author-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 5px;
}

.comment-time {
    color: var(--text-light);
    font-size: 13px;
}

.reply-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    padding: 0;
    margin-left: auto;
}

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

/* 新增：回复按钮焦点状态 */
.reply-btn:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.comment-text {
    color: var(--text-color);
}

.comment-replies {
    margin-left: var(--spacing-xl);
    margin-top: var(--spacing-md);
}

.comment.reply {
    padding: var(--spacing-md) 0;
}

/* 加载更多评论 */
.load-more-comments {
    display: block;
    width: 100%;
    background-color: var(--background-light);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

.load-more-comments:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.load-more-comments:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 新增：加载更多按钮焦点状态 */
.load-more-comments:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

/* 侧边栏样式 */
.sidebar-widget {
    background-color: var(--background-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    content-visibility: auto;
    contain-intrinsic-size: 500px;
    /* 新增：延迟加载动画 */
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
}

.widget-title {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary-color);
    /* 新增：标题换行 */
    overflow-wrap: break-word;
}

/* 搜索框 */
.search-form {
    display: flex;
}

.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 15px;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    /* 新增：焦点样式统一 */
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: -1px;
}

.search-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 var(--spacing-md);
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: var(--transition);
}

.search-form button:hover {
    background-color: var(--primary-dark);
}

/* 新增：搜索按钮焦点状态 */
.search-form button:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

/* 分类列表 */
.categories-list li {
    margin-bottom: var(--spacing-sm);
}

.categories-list a {
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
}

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

.count {
    background-color: var(--background-light);
    color: var(--text-light);
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
}

/* 热门文章 */
.popular-post {
    margin-bottom: var(--spacing-md);
    /* 新增：最小高度避免抖动 */
    min-height: 100px;
    contain: layout;
}

.popular-post:last-child {
    margin-bottom: 0;
}

.popular-post a {
    display: flex;
    gap: var(--spacing-md);
    color: var(--text-color);
}

.popular-post a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.popular-post-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.popular-post-title {
    font-size: 15px;
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

.popular-post-date {
    color: var(--text-light);
    font-size: 12px;
}

/* 标签云 */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.tags-widget .tag {
    background-color: var(--background-light);
    color: var(--text-light);
    transition: var(--transition);
}

.tags-widget .tag:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* 订阅表单 */
.subscribe-widget p {
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
}

.subscribe-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.subscribe-form input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
}

.subscribe-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    /* 新增：焦点样式统一 */
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.subscribe-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.subscribe-form button:hover {
    background-color: var(--primary-dark);
}

/* 新增：订阅按钮焦点和禁用状态 */
.subscribe-form button:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.subscribe-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--border-color);
    color: var(--text-lighter);
}

/* 页脚样式 */
.site-footer {
    background-color: var(--text-color);
    color: white;
    padding: var(--spacing-xxl) 0 var(--spacing-lg);
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-lg);
    position: relative;
    padding-bottom: var(--spacing-sm);
    /* 新增：标题换行 */
    overflow-wrap: break-word;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-column p {
    color: #b0b0b0;
    margin-bottom: var(--spacing-md);
}

.footer-links li {
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    color: #b0b0b0;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
    text-decoration: none;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
    /* 新增：兼容旧浏览器 */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    flex-wrap: wrap;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    transition: var(--transition);
    will-change: transform, opacity;
    /* 新增：硬件加速 */
    transform: translateZ(0);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

/* 新增：社交链接焦点状态 */
.social-links a:focus {
    outline: 2px solid rgba(30, 64, 175, 0.5);
    outline-offset: 2px;
}

.copyright {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #b0b0b0;
    font-size: 14px;
}

/* 返回顶部按钮（修复未闭合问题） */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 99;
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
}

/* 新增：返回顶部按钮焦点状态 */
#backToTop:focus {
    outline: 2px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

/* 响应式适配 - 平板横向 */
@media (max-width: 1024px) {
    .content-wrapper {
        gap: var(--spacing-lg);
    }
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* 响应式适配 - 平板纵向 */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    .sidebar {
        min-width: auto;
        order: -1; /* 侧边栏在移动端置顶 */
    }
    .main-nav {
        display: none;
    }
    .mobile-menu-btn {
        display: block;
    }
    .post-title {
        font-size: 2rem;
    }
    .author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-columns {
        grid-template-columns: 1fr 1fr;
    }
}

/* 响应式适配 - 手机端 */
@media (max-width: 640px) {
    main {
        padding: var(--spacing-xl) 0;
    }
    .post-meta {
        flex-wrap: wrap;
    }
    .post-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
    .share-buttons {
        width: 100%;
        justify-content: space-between;
    }
    .comment {
        flex-direction: column;
    }
    .comment-replies {
        margin-left: var(--spacing-md);
    }
    .footer-columns {
        grid-template-columns: 1fr;
    }
    .related-posts h2,
    .comments-section h2 {
        font-size: 1.5rem;
    }
}