/* ===============================
   全局重置与基础样式
================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f9f9f9;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* ===============================
   HEADER
================================ */
header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
}
.logo a {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}
.main-nav { display: flex; align-items: center; gap: 20px; position: relative; }
.nav-menu { display: flex; gap: 15px; list-style: none; }
.nav-menu li a {
    padding: 8px 10px;
    font-weight: 500;
    transition: 0.3s;
}
.nav-menu li a:hover { color: #007bff; }
.mobile-toggle { display: none; font-size: 26px; cursor: pointer; }

/* 搜索框 */
.search-wrapper { margin-left: auto; }
.search-form input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ===============================
   文章列表 & 卡片
================================ */

/* 分类标题 */
.category-page h1 {
    font-size: 2rem;
    margin: 20px 0;
    text-align: center;
}

/* 文章列表 */
.articles-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* 文章卡片 */
.articles-list article {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.3s;
}

.articles-list article:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.articles-list article img {
    width: 100%;
    height: 200px;
    object-fit: cover; /* 保持比例裁剪 */
    display: block;
}

.articles-list article h3 {
    font-size: 1.2rem;
    margin: 10px;
    color: #333;
}

.articles-list article p {
    font-size: 0.95rem;
    margin: 0 10px 10px;
    color: #666;
}

/* 分页 */
.pagination {
    text-align: center;
    margin: 30px 0;
    font-size: 1rem;
}

.pagination a {
    display: inline-block;
    margin: 0 5px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #007bff;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #007bff;
    color: #fff;
}

.pagination span.current {
    display: inline-block;
    margin: 0 5px;
    padding: 8px 12px;
    border: 1px solid #007bff;
    border-radius: 4px;
    background: #007bff;
    color: #fff;
}

/* ===============================
   文章详情页
================================ */
.article-detail {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.article-detail img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 16/9;
    margin-bottom: 15px;
    border-radius: 6px;
}
.article-detail h1 { font-size: 28px; margin-bottom: 15px; }
.article-detail p { margin-bottom: 15px; line-height: 1.7; }

/* ===============================
   BANNER 轮播
================================ */
.banner-slider {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-height: 450px;
    margin-bottom: 30px;
    border-radius: 10px;
}

.banner-slide {
    position: relative;
    display: none;
    width: 100%;
    height: 450px;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持比例填充 */
    border-radius: 10px;
    transition: transform 0.5s ease;
}

.banner-slide:hover img {
    transform: scale(1.05);
}

.banner-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.5);
    padding: 15px 25px;
    border-radius: 8px;
}

.banner-overlay h2 {
    color: #fff;
    font-size: 28px;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

/* 箭头按钮 */
.banner-prev, .banner-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    border: none;
    color: #fff;
    font-size: 30px;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    transition: background 0.3s ease;
}

.banner-prev:hover, .banner-next:hover {
    background: rgba(0,0,0,0.7);
}

.banner-prev { left: 15px; }
.banner-next { right: 15px; }



/* ===============================
   FOOTER
================================ */
footer {
    background: #333;
    color: #fff;
    padding: 25px 15px;
    text-align: center;
}
footer a { color: #fff; transition: 0.3s; }
footer a:hover { color: #007bff; }
.footer-menu { list-style: none; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 10px; }

/* ===============================
   BUTTONS
================================ */
button, .btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background: #007bff;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
}
button:hover, .btn:hover { background: #0056b3; }


.category-section { margin:40px 0; }
.category-section h2 { font-size:24px; margin-bottom:15px; border-bottom:2px solid #007bff; display:inline-block; padding-bottom:5px; }
.articles.category-style-recipe article { border-left:5px solid #ff7f50; }
.articles.category-style-travel article { border-left:5px solid #20c997; }
.articles.category-style-culture article { border-left:5px solid #6f42c1; }
.read-more { text-align:right; margin-top:10px; }
.read-more a { color:#007bff; font-weight:bold; }
.read-more a:hover { text-decoration:underline; }



/* ======= 文章列表容器 ======= */
.articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* ======= 单篇文章卡片 ======= */
.articles article {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.articles article:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* ======= 文章图片 ======= */
.articles article img {
    width: 100%;
    height: 180px;
    object-fit: cover; /* 保持比例填充，不变形 */
    transition: transform 0.3s;
}
.articles article:hover img {
    transform: scale(1.05);
}

/* ======= 文章内容 ======= */
.articles article h3 {
    font-size: 18px;
    margin: 12px 15px 8px;
    color: #222;
    line-height: 1.3;
    transition: color 0.3s;
}
.articles article h3:hover {
    color: #007bff;
}

.articles article p {
    font-size: 14px;
    color: #555;
    padding: 0 15px 15px;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* 显示4行摘要，多余省略 */
    -webkit-box-orient: vertical;
}

/* ======= 文章链接覆盖整个卡片 ======= */
.articles article a {
    color: inherit;
    text-decoration: none;
}



/* ===============================
   文章详情页容器调整
================================ */
main.container  article{
    max-width: 800px;      /* 最大宽度 */
    margin: 0 auto;         /* 居中 */
    padding: 20px;          /* 内边距 */
    box-sizing: border-box;
}

/* 文章标题 */
main.container h1 {
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
}

/* 文章内容段落和列表 */
main.container p {
    margin-bottom: 15px;
}
main.container ul {
    padding-left: 20px;
    margin-bottom: 15px;
}
main.container li {
    margin-bottom: 8px;
}

/* 文章内图片自适应 */
main.container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border-radius: 6px;
}

/* 广告居中 */
main.container .ads {
    text-align: center;
    margin: 20px 0;
}

/* 日期 */
main.container p.date {
    font-size: 0.9em;
    color: #777;
    text-align: right;
    margin-top: 30px;
}



/* ===== .related 容器 ===== */
  .related {
    max-width: 1200px;
    margin: 40px auto;
    padding: 32px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
  }

  .related h3 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 28px;
    padding-left: 20px;
    border-left: 5px solid #3b82f6;
    display: inline-block;
  }

  /* ===== .related_ul 列表 ===== */
  .related_ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
  }

  /* ===== 每一项：核心设计 ===== */
  .related_ul li {
    text-align: center;
  }

  .related_ul li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #111827;
    transition: all 0.3s ease;
    padding: 16px;
    border-radius: 18px;
    background: #fafafa;
    border: 1px solid #e0e5eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  }

  .related_ul li a:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border-color: #dbeafe;
    background: #f8f9ff;
  }

  .related_ul li a img {
    width: 80px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 12px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
  }

  .related_ul li a:hover img {
    transform: scale(1.05);
    border-color: #3b82f6;
  }

  .related_ul li a span {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* ===== 手机端优化：让标题换行，不被截断 ===== */
  @media (max-width: 767px) {
    .related_ul li a {
      padding: 20px 16px;
    }

    .related_ul li a img {
      margin-bottom: 10px;
    }

    .related_ul li a span {
      font-size: 15px;
      white-space: normal;
      word-wrap: break-word;
      text-align: center;
    }
  }

  /* ===== 暗色模式 ===== */
  @media (prefers-color-scheme: dark) {
    body {
      /*background-color: #111827;*/
    }

    .related {
      background: #1f2937;
      border-color: #374151;
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    }

    .related h3 {
      color: #f3f4f6;
      border-left-color: #60a5fa;
    }

    .related_ul li a {
      background: #111827;
      border-color: #374151;
      color: #e5e7eb;
    }

    .related_ul li a:hover {
      background: #1e293b;
      border-color: #93c5fd;
    }

    .related_ul li a img {
      border-color: #475569;
    }
  }



  /* ===== 超大屏优化：4列 ===== */
  @media (min-width: 1400px) {
    .related_ul {
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 32px;
    }
  }






/* ===============================
   RESPONSIVE
================================ */
@media (max-width: 1024px) {
    .article-card .content h2 { font-size: 18px; }
    .article-detail h1 { font-size: 24px; }
    
    .articles article img {
        height: 160px;
    }
    .articles article h3 {
        font-size: 17px;
    }
}
@media (max-width: 768px) {
    .header-container { flex-wrap: wrap; }
    .nav-menu {
        display: none;
        flex-direction: column;
        background: #fff;
        position: absolute;
        top: 60px;
        right: 15px;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 6px;
        width: 150px;
    }
    .nav-menu.active { display: flex; }
    .mobile-toggle { display: block; }
    .search-wrapper { width: 100%; margin-top: 10px; }
    
    .articles {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    .articles article img {
        height: 140px;
    }
    .articles article h3 {
        font-size: 16px;
    }
    
    .banner-slide { height: 250px; }
    .banner-overlay h2 { font-size: 18px; }
}
@media (max-width: 480px) {
    .article-card .content h2 { font-size: 16px; }
    .search-form input { width: 100%; }
    
    .articles {
        grid-template-columns: 1fr;
    }
    .articles article img {
        height: 200px;
    }
    .articles article h3 {
        font-size: 18px;
    }
}

/* 响应式 */
@media (max-width: 992px) {
    .articles-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .articles-list article img {
        height: 180px;
    }
    
    main.container h3 + ul li {
        flex: 1 1 100%;
    }
    main.container h1 {
        font-size: 1.6em;
    }
    main.container p, main.container li {
        font-size: 0.95em;
    }
    
   .article > div:last-child ul li {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .article > .content h1 {
        font-size: 24px;
    }

    .article > .content h3 {
        font-size: 18px;
    }
    
}
