* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Arial', sans-serif;
}

body {
background-color: #f9f9f9;
color: #333;
line-height: 1.6;
overflow-x: hidden; /* 防止水平滚动 */
}

/* 导航栏样式 */
.navbar {
background-color: #4D0000;
padding: 1rem 0;
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nav-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}

.logo {
color: white;
font-size: 1.5rem;
font-weight: bold;
text-decoration: none;
}

.nav-menu {
display: flex;
list-style: none;
}

.nav-item {
margin-left: 1.5rem;
}

.nav-link {
color: white;
text-decoration: none;
transition: color 0.3s;
}

.nav-link:hover {
color: #ffcccb;
}

.hamburger {
display: none;
cursor: pointer;
color: white;
font-size: 1.5rem;
}

/* 内容区域通用样式 */
.container {
max-width: 1200px;
margin: 2rem auto;
padding: 0 1rem;
}

.section {
margin-bottom: 3rem;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
padding: 1.5rem;
overflow: hidden;
}

.section-title {
color: #4D0000;
margin-bottom: 1.5rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid #4D0000;
font-size: 1.5rem;
}

/* 最新文章样式 */
.latest-articles {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}

.latest-article {
padding: 1rem;
border: 1px solid #eee;
border-radius: 6px;
transition: transform 0.3s, box-shadow 0.3s;
max-width: 100%; /* 防止超出容器 */
overflow: hidden; /* 隐藏溢出内容 */
}

.latest-article:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(77, 0, 0, 0.1);
}

.latest-article h3 {
margin-bottom: 0.5rem;
}

.article-title {
color: #4D0000;
text-decoration: none;
font-size: 1.2rem;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%; /* 防止标题溢出 */
}

.article-meta {
color: #666;
font-size: 0.9rem;
margin-bottom: 0.5rem;
}

.article-description {
color: #444;
line-height: 1.5;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3; /* 限制显示行数 */
-webkit-box-orient: vertical;
}

/* 推荐文章样式 */
.featured-articles {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1rem;
}

.featured-article {
height: 250px;
background-size: cover;
background-position: center;
border-radius: 6px;
position: relative;
overflow: hidden;
transition: transform 0.3s;
}

.featured-article:hover {
transform: scale(1.03);
}

.featured-article::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
}

.featured-content {
position: absolute;
bottom: 0;
left: 0;
padding: 1rem;
color: white;
width: 100%;
}

.featured-title {
margin-bottom: 0.5rem;
}

.featured-title a {
color: white;
text-decoration: none;
font-size: 1.1rem;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.featured-description {
font-size: 0.9rem;
line-height: 1.4;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2; /* 限制显示行数 */
-webkit-box-orient: vertical;
}

/* 热门文章样式 */
.popular-articles {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}

.popular-article {
padding: 1rem;
border: 1px solid #eee;
border-radius: 6px;
transition: transform 0.3s, box-shadow 0.3s;
max-width: 100%; /* 防止超出容器 */
overflow: hidden; /* 隐藏溢出内容 */
}

.popular-article:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(77, 0, 0, 0.1);
}

.popular-article h3 {
margin-bottom: 0.5rem;
}

.popular-meta {
display: flex;
justify-content: space-between;
color: #666;
font-size: 0.9rem;
margin-bottom: 0.5rem;
}

.popular-description {
color: #444;
line-height: 1.5;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2; /* 限制显示行数 */
-webkit-box-orient: vertical;
}

/* 介绍文字样式 */
.intro-text {
line-height: 1.8;
color: #444;
}

/* 友情链接样式 */
.friend-links {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}

.friend-link {
color: #4D0000;
text-decoration: none;
padding: 0.3rem 0.8rem;
border: 1px solid #4D0000;
border-radius: 4px;
transition: all 0.3s;
font-size: 0.9rem;
}

.friend-link:hover {
background-color: #4D0000;
color: white;
}

/* 底部样式 */
footer {
background-color: #4D0000;
color: white;
text-align: center;
padding: 1.5rem;
margin-top: 2rem;
}

footer a {
color: white;
text-decoration: none;
}

footer a:hover {
color: #ffcccb;
}

/* 媒体查询 - 平板设备 */
@media (max-width: 1024px) {
.latest-articles,
.popular-articles {
grid-template-columns: 1fr;
}

.featured-articles {
grid-template-columns: repeat(2, 1fr);
}

.nav-menu {
display: none;
flex-direction: column;
width: 100%;
position: absolute;
top: 100%;
left: 0;
background-color: #4D0000;
padding: 1rem 0;
}

.nav-menu.active {
display: flex;
}

.nav-item {
margin: 0.5rem 0;
text-align: center;
}

.hamburger {
display: block;
}

/* 移动视图下完全隐藏友情链接 */
.intro-text,
.friend-links-section,
.copyright {
display: none;
}
}

/* 媒体查询 - 手机设备 */
@media (max-width: 768px) {
.featured-articles {
grid-template-columns: 1fr;
}

.popular-meta {
flex-direction: column;
}

.popular-meta span {
margin-bottom: 0.3rem;
}
}

/* 媒体查询 - 小屏幕手机 */
@media (max-width: 500px) {
.featured-articles {
grid-template-columns: 1fr;
}

.nav-container {
padding: 0 1rem;
}

/* 确保内容不超出屏幕 */
.container {
padding: 0 0.5rem;
}

.section {
padding: 1rem;
}
}

/* Emoji图标样式 */
.icon-author::before {
content: "👤 ";
}

.icon-date::before {
content: "📅 ";
}

.icon-views::before {
content: "👀 ";
}