You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

554 lines
10 KiB

/**
* 单页文章侧边栏样式
* Single Page Article Sidebar Styles
*/
/* 重置和基础样式 */
.single-page-container,
.single-page-container * {
box-sizing: border-box;
}
/* 确保不受全局样式影响 */
.single-page-container {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.single-page-container a {
color: inherit;
text-decoration: none;
}
.single-page-container img {
max-width: 100%;
height: auto;
display: block;
}
/* 主容器布局 */
.single-page-container {
display: flex;
max-width: 1400px;
margin: 0 auto;
gap: 40px;
padding: 20px;
min-height: calc(100vh - 200px);
position: relative;
z-index: 1;
background: transparent;
align-items: flex-start;
}
/* 左侧侧边栏 */
.sidebar-left {
width: 20%;
flex-shrink: 0;
border-radius: 12px;
padding: 24px;
height: fit-content;
position: sticky;
top: 20px;
min-width: 280px;
}
/* 侧边栏头部 */
.sidebar-header {
margin-bottom: 24px;
padding-bottom: 16px;
border-bottom: 1px solid #e5e7eb;
}
.sidebar-left .back-link {
display: inline-flex;
align-items: center;
gap: 8px;
color: #6b7280 !important;
text-decoration: none !important;
font-size: 14px;
font-weight: 500 !important;
transition: color 0.3s ease;
}
.sidebar-left .back-link:hover {
color: #3b82f6 !important;
font-weight: 500 !important;
}
.back-link svg {
transition: transform 0.3s ease;
}
.back-link:hover svg {
transform: translateX(-2px);
}
/* 文章列表容器 */
.recent-articles {
display: flex;
flex-direction: column;
gap: 6px;
width: 100%;
overflow: hidden;
}
/* 文章项目 */
.sidebar-left .article-item {
display: block;
padding: 8px;
border-radius: 6px;
transition: all 0.3s ease;
cursor: pointer;
border: 1px solid transparent;
width: 100%;
box-sizing: border-box;
}
.sidebar-left .article-item:hover {
background: #f8fafc;
border-color: #e2e8f0;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
/* 文章内容 */
.sidebar-left .article-content {
width: 100%;
display: flex;
flex-direction: column;
gap: 3px;
}
.sidebar-left .article-title {
margin: 0;
font-size: 14px;
font-weight: 500;
line-height: 1.4;
color: #333;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
}
.sidebar-left .article-title a {
color: inherit !important;
text-decoration: none !important;
transition: color 0.3s ease;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
font-weight: inherit !important;
}
.sidebar-left .article-title a:hover {
color: #3b82f6 !important;
font-weight: 600 !important;
}
.sidebar-left .article-date {
margin: 0;
font-size: 12px;
color: #666;
font-weight: 400;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 右侧主要内容区域 */
.main-content {
width: 80%;
flex: 0 0 80%;
min-width: 0;
}
.main-content .article-c {
background: #ffffff;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
padding: 40px;
width: 100%;
box-sizing: border-box;
}
.main-content .article-content {
padding: 70px;
width: 100%;
box-sizing: border-box;
}
/* 文章头部 */
.article-header {
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 1px solid #e5e7eb;
}
.article-header .article-title {
margin: 0 0 15px 0;
font-size: 28px;
font-weight: 700;
line-height: 1.3;
color: #1f2937;
}
.article-meta {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: wrap;
}
.article-meta .article-time {
margin: 0;
font-size: 14px;
color: #6b7280;
font-weight: 400;
}
.article-categories {
font-size: 14px;
color: #6b7280;
}
.article-categories a {
color: #3b82f6;
text-decoration: none;
transition: color 0.2s ease;
}
.article-categories a:hover {
color: #1d4ed8;
}
/* 文章主体内容 */
.article-body {
line-height: 1.8;
color: #374151;
}
/* 文章底部 */
.article-footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #e5e7eb;
}
.article-tags {
font-size: 14px;
color: #6b7280;
}
.tags-label {
font-weight: 500;
margin-right: 8px;
}
.article-tags a {
color: #3b82f6;
text-decoration: none;
transition: color 0.2s ease;
}
.article-tags a:hover {
color: #1d4ed8;
}
/* 无障碍访问 */
.screen-reader-text {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}
/* 无文章提示 */
.no-articles {
text-align: center;
color: #6b7280;
font-style: italic;
padding: 20px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.single-page-container {
gap: 30px;
padding: 15px;
}
.sidebar-left {
width: 25%;
min-width: 260px;
top: auto;
}
.sidebar-left .article-image {
width: 50px;
height: 38px;
}
.sidebar-left .article-content {
min-height: 38px;
}
.sidebar-left .article-title {
font-size: 12px;
line-height: 1.2;
}
.sidebar-left .article-date {
font-size: 10px;
}
.main-content {
width: 75%;
flex: 0 0 75%;
}
.main-content .article-c {
padding: 30px;
}
}
@media (max-width: 991.98px) {
.single-page-container {
flex-direction: column;
gap: 20px;
padding: 15px;
min-height: auto;
}
.sidebar-left {
width: 100%;
position: static;
order: 2;
margin-top: 20px;
top: auto;
}
.main-content {
order: 1;
width: 100%;
}
.main-content .article-content {
width: 100%;
padding: 25px;
}
.article-header .article-title {
font-size: 24px;
}
.article-meta {
gap: 15px;
}
.recent-articles {
gap: 8px;
}
.sidebar-left .article-item {
gap: 6px;
padding: 6px;
}
.sidebar-left .article-image {
width: 45px;
height: 34px;
}
.sidebar-left .article-content {
min-height: 34px;
}
.sidebar-left .article-title {
font-size: 11px;
line-height: 1.2;
-webkit-line-clamp: 1;
}
.sidebar-left .article-date {
font-size: 9px;
}
.recent-articles {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 12px;
}
.sidebar-left .article-item {
flex-direction: column;
text-align: center;
}
.sidebar-left .article-image {
width: 100%;
height: 120px;
margin-bottom: 8px;
}
.sidebar-left .article-content {
min-height: auto;
}
}
@media (max-width: 576px) {
.single-page-container {
padding: 15px;
min-height: auto;
}
.sidebar-left {
width: 100%;
position: static;
margin-bottom: 20px;
padding: 15px;
}
.main-content {
width: 100%;
padding: 20px;
}
.main-content .article-content {
width: 100%;
padding: 20px;
}
.article-header {
margin-bottom: 20px;
padding-bottom: 15px;
}
.article-header .article-title {
font-size: 20px;
line-height: 1.4;
}
.article-meta {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.article-footer {
margin-top: 30px;
padding-top: 15px;
}
.recent-articles {
grid-template-columns: 1fr;
}
.sidebar-left .article-title {
font-size: 13px;
}
}
/* 加载动画 */
.sidebar-left .article-item {
opacity: 0;
transform: translateY(10px);
animation: fadeInUp 0.5s ease forwards;
}
.sidebar-left .article-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar-left .article-item:nth-child(2) { animation-delay: 0.2s; }
.sidebar-left .article-item:nth-child(3) { animation-delay: 0.3s; }
.sidebar-left .article-item:nth-child(4) { animation-delay: 0.4s; }
.sidebar-left .article-item:nth-child(5) { animation-delay: 0.5s; }
.sidebar-left .article-item:nth-child(6) { animation-delay: 0.6s; }
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* 滚动条样式 */
.sidebar-left::-webkit-scrollbar {
width: 4px;
}
.sidebar-left::-webkit-scrollbar-track {
background: #f1f5f9;
border-radius: 2px;
}
.sidebar-left::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 2px;
}
.sidebar-left::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
/* 搜索功能兼容性 */
.single-page-container {
isolation: isolate;
}
/* 确保不与搜索模块冲突 */
.news-search-section + .single-page-container,
.search-results + .single-page-container {
margin-top: 30px;
clear: both;
background: #fff;
}
/* 搜索模块后的容器样式重置 */
.news-search-section + .single-page-container {
position: relative;
z-index: auto;
}
/* 防止与其他模块的样式冲突 */
.single-page-container .article-item {
position: relative;
z-index: auto;
}
.single-page-container .article-item:hover {
z-index: 1;
}
/* 确保容器不会溢出 */
.single-page-container {
overflow-x: hidden;
}
/* 修复可能的浮动问题 */
.single-page-container::after {
content: "";
display: table;
clear: both;
}
/* 确保主内容区域的标题样式 */
.main-content .article-c h1 {
margin-top: 0;
margin-bottom: 20px;
font-size: 28px;
font-weight: 700;
line-height: 1.3;
color: #1f2937;
}
.main-content .article-c .article-time {
margin-bottom: 30px;
color: #6b7280;
font-size: 14px;
}