/* --- CSS 样式 --- */
:root {
  --primary-color: #ff3e6c;
  --secondary-color: #2d3436;
  --bg-color: #f4f7f6;
  --text-color: #333;
  --card-white: #ffffff;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Microsoft YaHei','Helvetica Neue', Helvetica, 'PingFang SC', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
}

a {
  text-decoration: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏 */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 2000;
  box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.nav-content {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  height: 100%;
  margin-right: 25px;
}

.logo-img {
  height: 70px;
  width: auto;
  display: block;
  transition: var(--transition);
}

.logo-img:hover {
  opacity: 0.8;
}

/* 针对页脚 Logo 的适配（页脚通常较黑，如果需要不同 Logo 可在此调整） */
footer .logo {
  height: 65%;
  justify-content: center;
}

footer .logo-img {
  height: 100px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 30px;
}

.nav-links a {
  text-decoration: none;
  color: var(--secondary-color);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

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

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--secondary-color);
}

/* Hero Section 样式 */
.hero-section {
  padding: 0px 20px;
  margin-bottom: 30px;
  margin-top: 30px;
}

.swiper {
  width: 100%;
  height: 480px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.swiper-slide {
  position: relative;
  overflow: hidden;
  height: 100%;
}

/* 轮播图链接容器，铺满全屏 */
.slide-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: white;
  background-size: cover;
  background-position: center;
}

.slide-link:hover .carousel-caption h1 {
  color: var(--primary-color);
  transition: color 0.3s ease;
}

/* 调整按钮样式以适配 Swiper */
.swiper-button-next, .swiper-button-prev {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  width: 50px !important;
  height: 50px !important;
  border-radius: 50%;
}

.swiper-button-next::after, .swiper-button-prev::after {
  font-size: 20px !important;
}

.swiper-pagination-bullet-active {
  background: var(--primary-color) !important;
}

.carousel-overlay {
  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) 60%);
  z-index: 1;
}

.carousel-caption {
  position: absolute;
  bottom: 50px;
  /* 距离底部距离 */
  left: 40px;
  /* 距离左侧距离 */
  right: 40px;
  z-index: 2;
  max-width: 800px;
  animation: fadeInUp 0.8s ease;
  text-align: left;
  /* 确保文字左对齐 */
}

.carousel-caption h1 {
  font-size: 36px;
  margin-bottom: 15px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.carousel-caption p {
  font-size: 18px;
  opacity: 0.9;
  text-shadow: 0 1px 5px rgba(0,0,0,0.5);
}

.badge {
  background: var(--primary-color);
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 14px;
  margin-bottom: 15px;
  display: inline-block;
}

@media (max-width: 768px) {
  .swiper {
    height: 350px;
    /* 缩小手机端高度 */
  }

  .carousel-caption {
    bottom: 30px;
    left: 20px;
    right: 20px;
  }

  .carousel-caption h1 {
    font-size: 20px;
  }

  .carousel-caption p {
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* 横向卡片资讯组 */
.news-grid-horizontal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* 4列布局 */
  gap: 20px;
  margin-bottom: 40px;
}

.grid-card {
  background: var(--card-white);
  border-radius: 8px;
  /* 较小的圆角 */
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.grid-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.grid-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  /* 保持图片比例一致 */
  overflow: hidden;
}

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

a.grid-card {
  text-decoration: none;
  /* 去除下划线 */
  color: inherit;
  /* 继承文字颜色 */
  display: flex;
  flex-direction: column;
}

/* 悬停时标题变色，增强交互感 */
.grid-card:hover h4 {
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.grid-content {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.grid-content h4 {
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  margin-bottom: 12px;
  /* 稍微缩小底部间距 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 响应式适配：手机端显示 2 列或 1 列 */
@media (max-width: 768px) {
  .news-grid-horizontal {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .news-grid-horizontal {
    grid-template-columns: 1fr;
  }
}

/* 3. 主布局与新闻信息流 */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 30px;
  margin-top: 30px;
}

/* 设置 main 容器背景为白色并添加内边距 */
main {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

/* 最新资讯标题栏高大上样式 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 30px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.section-title-wrapper {
  position: relative;
}

.section-title-wrapper h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--secondary-color);
  margin: 0;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

/* 标题装饰背景字 */
.section-title-wrapper::before {
  content: "NEWS FEED";
  position: absolute;
  top: -15px;
  left: 0;
  font-size: 40px;
  font-weight: 900;
  color: rgba(0,0,0,0.03);
  z-index: 0;
  white-space: nowrap;
}

/* 动态下划线 */
.section-title-wrapper::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), transparent);
  border-radius: 2px;
}

.section-more-link {
  text-decoration: none;
  color: #999;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.section-more-link i {
  font-size: 12px;
}

/* 资讯列表容器 */
.news-info {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* 单个资讯条目 */
.news-item {
  display: flex;
  gap: 20px;
  text-decoration: none;
  color: inherit;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: var(--transition);
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover .news-item-title {
  color: var(--primary-color);
}

/* 左侧图片区域 */
.news-item-img {
  width: 240px;
  height: 150px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
}

.news-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.news-item:hover .news-item-img img {
  transform: scale(1.05);
}

/* 右侧文字内容区域 */
.news-item-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* 确保上中下分布 */
  flex-grow: 1;
}

.news-item-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--secondary-color);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

/* 底部元数据（时间+栏目） */
.news-item-meta {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 13px;
  color: #999;
}

.news-item-category {
  color: var(--primary-color);
  font-weight: 500;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .news-item {
    flex-direction: column;
  }

  .news-item-img {
    width: 100%;
    height: 200px;
  }

  .news-item-title {
    font-size: 18px;
    margin-top: 10px;
  }
}

/* 侧边栏 widget */
.side-widget {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.side-widget h3 {
  margin-bottom: 20px;
  font-size: 18px;
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
}

/* 焦点推荐 */
.hot-list {
  list-style: none;
}

.hot-item {
  padding: 0;
  border-bottom: 1px solid #f0f0f0;
}

.hot-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 0;
  /* 将内边距移到 a 标签上，扩大点击区域 */
  width: 100%;
  transition: var(--transition);
}

.hot-link:hover {
  color: var(--primary-color);
  transform: translateX(5px);
  /* 悬停时稍微右移，增加交互感 */
}

.num {
  font-weight: 800;
  font-style: italic;
  color: #ddd;
  font-size: 20px;
}

.hot-item:nth-child(-n+3) .num {
  color: var(--primary-color);
}

/* 每日推荐 */
.express {
  display: flex;
  flex-direction: column;
  gap: 15px;
  /* 卡片间距 */
}

.express-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: #fdfdfd;
  transition: var(--transition);
  border: 1px solid #f0f0f0;
  cursor: pointer;
}

.express-item:hover {
  background: #fff;
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(255, 62, 108, 0.08);
  border-color: rgba(255, 62, 108, 0.2);
}

.express-img {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.express-title {
  font-size: 14px;
  line-height: 1.4;
  color: var(--secondary-color);
  font-weight: 500;
  /* 限制标题显示两行，超出省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.express-item:hover .express-title {
  color: var(--primary-color);
}

/* 热门分享样式 */
.hot-share-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.hot-share-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 8px;
  border-radius: 10px;
  transition: var(--transition);
}

.hot-share-item:hover {
  background: rgba(255, 62, 108, 0.05);
}

.hot-share-img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.hot-share-text {
  font-size: 14px;
  color: var(--secondary-color);
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: var(--transition);
}

.hot-share-item:hover .hot-share-text {
  color: var(--primary-color);
}

/* 文章内页专用样式 */
.breadcrumb {
  font-size: 14px;
  color: #888;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb a {
  color: #666;
  transition: var(--transition);
}

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

.article-header {
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.article-title {
  font-size: 32px;
  line-height: 1.3;
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-weight: 700;
}

.article-meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #999;
}

.meta-item i {
  margin-right: 5px;
}

.article-content {
  line-height: 1.8;
  font-size: 17px;
  color: #444;
}

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

.article-image {
  margin: 30px 0;
  text-align: center;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 20px auto;
  transition: transform 0.5s ease;
  cursor: pointer;
}

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

.img-caption {
  font-size: 14px;
  color: #999;
  margin-top: 10px;
  font-style: italic;
}

.article-footer {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px dashed #eee;
}

.tags {
  display: flex;
  gap: 10px;
}

.tag {
  background: #f0f0f0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: var(--transition);
}

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

.article-widget {
  background: white;
  padding: 25px 0;
  border-radius: 15px;
}

.article-widget h3 {
  margin-bottom: 20px;
  font-size: 18px;
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
}

/* 适配移动端 */
@media (max-width: 768px) {
  .article-title {
    font-size: 24px;
  }

  .article-meta {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* --- 相关新闻容器 --- */
.relatenews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px 20px;
  margin-top: 20px;
}

/* 基础卡片样式 */
.relate-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

/* 图片容器：处理溢出隐藏，保证放大时不超出边界 */
.relate-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #eee;
  flex-shrink: 0;
}

/* 图片：增加过渡动画 */
.relate-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  /* 关键：平滑放大 */
}

/* 悬浮效果：标题变色 + 图片放大 */
.relate-item:hover .relate-img img {
  transform: scale(1.1);
}

.relate-item:hover .relate-title {
  color: var(--primary-color);
}

.relate-content {
  display: flex;
  flex-direction: column;
}

.relate-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--secondary-color);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  height: 45px;
}

.relate-meta {
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 5px;
}

.relate-meta i {
  font-size: 11px;
}

/* --- 移动端适配 (768px 以下) --- */
@media (max-width: 768px) {
  .relatenews {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .relate-item {
    flex-direction: row;
    /* 横向排列 */
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
  }

  .relate-item:last-child {
    border-bottom: none;
  }

  .relate-img {
    width: 120px;
    height: 80px;
    margin-bottom: 0;
    margin-right: 15px;
    /* 修正点：增加图片与标题的间距 */
  }

  .relate-title {
    font-size: 14px;
    height: auto;
    margin-bottom: 5px;
  }
}

/* --- 分页器样式 --- */
.fenye {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 20px;
  padding: 20px 0;
  flex-wrap: wrap;
  /* 确保手机端能自动换行 */
}

.fenye a, .fenye span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  color: #666;
  background: #fff;
  border: 1px solid #eee;
  text-decoration: none;
}

/* 鼠标悬停效果 */
.fenye a:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: rgba(255, 62, 108, 0.05);
  transform: translateY(-2px);
}

/* 当前选中页码样式 */
.fenye span {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 4px 10px rgba(255, 62, 108, 0.2);
}

/* 特殊处理“上一页”、“下一页”和“总条数” */
.fenye .a1 {
  background: #f8f9fa;
  border-color: #eee;
  padding: 0 15px;
}

/* “327条”文字不显示点击效果 */
.fenye a.a1:first-child {
  cursor: default;
  background: transparent;
  border: none;
  color: #999;
}

/* 移动端适配：缩小间距 */
@media (max-width: 768px) {
  .fenye {
    gap: 5px;
  }

  .fenye a, .fenye span {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
    padding: 0 5px;
  }
}

/* 4. 页脚 (更新版) */
footer {
  background: #1a1a1a;
  color: #888;
  padding: 40px 0; /* 调整上下内边距 */
  margin-top: 80px;
}

/* 新的布局容器：Flex 布局实现左右对齐 */
.footer-inner {
  display: flex;
  justify-content: flex-start; 
  align-items: center; /* 垂直居中 */
  flex-wrap: wrap; /* 允许换行，适配移动端 */
  gap: 20px;
}

/* 左侧 Logo 区域 */
.footer-left .footer-logo-img {
  height: 100px; /* 控制底部 Logo 大小 */
  width: auto;
  display: block;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.footer-left .footer-logo-img:hover {
  opacity: 1;
}

/* 右侧文字区域 */
.footer-right {
  text-align: left; 
  font-size: 13px;
  line-height: 1.8; /* 增加两行文字的间距 */
}

.footer-right p {
  margin: 0;
}

.footer-right a {
  color: #888;
  text-decoration: none;
  margin-left: 5px;
  transition: color 0.3s;
}

.footer-right a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* 移动端适配：小于 768px 时变成垂直排列居中 */
@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column; /* 垂直排列 */
    justify-content: center;
    text-align: center;
  }
  
  .footer-right {
    text-align: center; /* 移动端文字居中 */
  }
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 62, 108, 0.3);
  z-index: 1000;
  opacity: 0;
  /* 默认隐藏 */
  visibility: hidden;
  transition: all 0.4s ease;
  border: none;
  outline: none;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
  background-color: #e63762;
  /* 略深一点的粉色 */
}

/* 移动端适配：稍微调小一点 */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}

/* 移动端适配响应式 */
@media (max-width: 992px) {
  .nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .menu-toggle {
    display: block;
    order: 2;
  }

  .logo {
    order: 1;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .carousel-container {
    height: 350px;
    border-radius: 0;
  }

  .carousel-caption h1 {
    font-size: 24px;
  }

  /* 导航展开逻辑 */
  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    transition: 0.4s ease-in-out;
    box-shadow: 0 10px 10px rgba(0,0,0,0.1);
  }

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

  .news-card {
    flex-direction: column;
  }

  .news-img {
    width: 100%;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
