:root {
--primary-color: #00A600;
--primary-light: #4cff4c;
--primary-dark: #007a00;
--text-color: #333;
--light-gray: #f5f5f5;
--gray: #e0e0e0;
--white: #ffffff;
--shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
--transition: all 0.3s ease;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: var(--text-color);
background-color: var(--white);
}

a {
text-decoration: none;
color: inherit;
}

.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 15px;
}

/* 导航栏样式 */
header {
background-color: var(--primary-color);
color: var(--white);
position: sticky;
top: 0;
z-index: 1000;
box-shadow: var(--shadow);
}

.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
}

.logo {
font-size: 1.5rem;
font-weight: bold;
}

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

.nav-menu li {
margin-left: 25px;
}

.nav-menu a {
padding: 5px 10px;
border-radius: 3px;
transition: var(--transition);
}

.nav-menu a:hover {
background-color: var(--primary-dark);
}

.hamburger {
display: none;
cursor: pointer;
flex-direction: column;
justify-content: space-around;
width: 30px;
height: 21px;
}

.hamburger span {
height: 3px;
width: 100%;
background-color: var(--white);
border-radius: 3px;
transition: var(--transition);
}

/* 内容区块通用样式 */
section {
padding: 40px 0;
border-bottom: 1px solid var(--gray);
}

.section-title {
font-size: 1.8rem;
margin-bottom: 30px;
color: var(--primary-color);
text-align: center;
}

/* 最新文章列表 */
.latest-articles {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 30px;
}

.article-card {
background: var(--white);
border-radius: 8px;
overflow: hidden;
transition: var(--transition);
box-shadow: var(--shadow);
}

.article-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0, 166, 0, 0.2);
}

.article-content {
padding: 20px;
}

.article-title {
font-size: 1.2rem;
margin-bottom: 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.article-meta {
color: #666;
font-size: 0.9rem;
margin-bottom: 15px;
display: flex;
align-items: center;
}

.article-meta::before {
content: "📅";
margin-right: 5px;
}

.article-desc {
line-height: 1.6;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* 推荐文章图片列表 */
.featured-articles {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}

.featured-article {
height: 250px;
border-radius: 8px;
overflow: hidden;
position: relative;
background-size: cover;
background-position: center;
transition: var(--transition);
box-shadow: var(--shadow);
}

.featured-article:hover {
transform: scale(1.03);
box-shadow: 0 8px 20px rgba(0, 166, 0, 0.3);
}

.featured-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
color: var(--white);
}

.featured-title {
font-size: 1.1rem;
margin-bottom: 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.featured-desc {
font-size: 0.9rem;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* 热门文章列表 - 修复部分 */
.popular-articles {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 30px;
}

.popular-article {
display: flex;
background: var(--white);
border-radius: 8px;
overflow: hidden;
transition: var(--transition);
box-shadow: var(--shadow);
/* 添加最小宽度约束 */
min-width: 0;
}

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

.popular-content {
padding: 20px;
flex: 1;
/* 防止内容溢出 */
min-width: 0;
overflow: hidden;
}

.popular-title {
font-size: 1.1rem;
margin-bottom: 10px;
/* 修复: 移除nowrap，允许文本换行 */
overflow: hidden;
/* 使用ellipsis处理超长单词或URL */
text-overflow: ellipsis;
/* 添加单词断行规则 */
word-break: break-word;
/* 确保标题最多显示两行 */
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}

.popular-meta {
display: flex;
margin-bottom: 10px;
color: #666;
font-size: 0.9rem;
/* 确保元数据在小屏幕上也能适应 */
flex-wrap: wrap;
}

.popular-date::before {
content: "📅";
margin-right: 5px;
}

.popular-views::before {
content: "👁️";
margin-right: 5px;
margin-left: 15px;
}

.popular-desc {
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* 文字介绍部分 */
.intro-section {
background-color: var(--light-gray);
padding: 40px;
border-radius: 8px;
line-height: 1.8;
}

/* 友情链接 */
.links-section {
background-color: var(--light-gray);
padding: 30px;
border-radius: 8px;
}

.links-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
}

.link-item {
padding: 8px 12px;
background: var(--white);
border-radius: 4px;
text-align: center;
transition: var(--transition);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.link-item:hover {
background-color: var(--primary-light);
color: var(--white);
}

/* 底部样式 */
footer {
background-color: var(--primary-color);
color: var(--white);
text-align: center;
padding: 20px 0;
margin-top: 40px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
.hamburger {
display: flex;
}

.nav-menu {
position: fixed;
left: -100%;
top: 70px;
flex-direction: column;
background-color: var(--primary-color);
width: 100%;
text-align: center;
transition: 0.3s;
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
padding: 20px 0;
}

.nav-menu.active {
left: 0;
}

.nav-menu li {
margin: 15px 0;
}

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

.intro-section,
.links-section,
.copyright {
display: none;
}
}

@media (max-width: 768px) {
.latest-articles,
.popular-articles {
grid-template-columns: 1fr;
}

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

.popular-views::before {
margin-left: 0;
}

.popular-views {
margin-top: 5px;
}
}

@media (max-width: 500px) {
.featured-articles {
grid-template-columns: 1fr;
}

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

/* 在移动设备上进一步优化热门文章标题 */
.popular-title {
-webkit-line-clamp: 3;
}
}