/* ============================================================
   知讯网 · 全站样式
   设计：浅色资讯门户 / 卡片式布局 / 移动优先响应式
   作者：站点默认模板，可自由修改
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root {
  --primary: #2563eb;        /* 主色：蓝 */
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #f59e0b;         /* 强调：橙（广告/热门标记） */
  --accent-dark: #d97706;
  --ink: #1f2937;            /* 主文字 */
  --ink-2: #4b5563;          /* 次文字 */
  --muted: #9ca3af;          /* 辅助文字 */
  --line: #e5e7eb;           /* 描边 */
  --bg: #f5f7fa;             /* 页面背景 */
  --card: #ffffff;           /* 卡片背景 */
  --ad-bg: #fffbeb;          /* 广告位底色 */
  --ad-line: #fcd34d;        /* 广告位虚线 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-hover: 0 10px 28px rgba(37, 99, 235, .12);
  --maxw: 1200px;
  --header-h: 64px;
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
button, input { font-family: inherit; }
.container { width: min(calc(100% - 32px), var(--maxw)); margin: 0 auto; }

/* ---------- 3. 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: 24px;
  width: min(calc(100% - 32px), var(--maxw)); margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 800; letter-spacing: -.5px; flex-shrink: 0; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 19px; font-weight: 900;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.logo-text em { color: var(--primary); font-style: normal; }

.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav a {
  padding: 8px 13px; border-radius: 8px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); transition: .2s; white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { color: var(--primary); background: var(--primary-light); }

.header-search { display: flex; align-items: center; position: relative; flex-shrink: 0; }
.header-search input {
  width: 190px; height: 38px; padding: 0 14px 0 36px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg); font-size: 14px; outline: none; transition: .2s;
}
.header-search input:focus { width: 220px; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.header-search .search-icon { position: absolute; left: 12px; color: var(--muted); font-size: 15px; pointer-events: none; }

.menu-toggle { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--ink); padding: 4px; }

/* ---------- 4. 通用区块标题 ---------- */
.section { margin: 34px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; }
.section-title::before { content: ""; width: 4px; height: 20px; border-radius: 3px; background: var(--primary); }
.section-title small { font-size: 13px; color: var(--muted); font-weight: 500; }
.section-more { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; transition: .2s; }
.section-more:hover { color: var(--primary); gap: 8px; }

/* ---------- 5. 广告位（替换真实广告代码即可） ---------- */
.ad-slot {
  position: relative;
  border: 1.5px dashed var(--ad-line);
  background: repeating-linear-gradient(45deg, var(--ad-bg), var(--ad-bg) 10px, #fffdf5 10px, #fffdf5 20px);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--accent-dark); overflow: hidden; text-align: center;
}
.ad-slot .ad-tag {
  position: absolute; top: 0; left: 0;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-bottom-right-radius: 6px; letter-spacing: .5px;
}
.ad-slot .ad-text { font-size: 13px; font-weight: 600; }
.ad-slot .ad-sub { font-size: 11px; opacity: .75; margin-top: 2px; }
.ad-banner { width: 100%; height: 100px; margin: 18px 0 4px; }
.ad-sidebar { width: 100%; height: 250px; margin-bottom: 24px; }
.ad-inline { width: 100%; height: 120px; margin: 24px 0; }

/* ---------- 6. 布局：主内容 + 侧栏 ---------- */
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.main-col { min-width: 0; }
.sidebar { position: sticky; top: calc(var(--header-h) + 16px); }

/* ---------- 7. 头条区 ---------- */
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.hero-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  min-height: 320px; display: flex; align-items: flex-end;
  background-size: cover; background-position: center;
  box-shadow: var(--shadow); transition: .3s;
}
.hero-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.hero-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.15) 60%, transparent 100%); }
.hero-card .hero-body { position: relative; z-index: 2; padding: 24px; color: #fff; }
.hero-card .hero-body h2 { margin: 10px 0 8px; font-size: 22px; line-height: 1.4; }
.hero-card:hover .hero-body h2 { text-decoration: underline; }
.hero-sub-grid { display: grid; grid-template-rows: 1fr 1fr; gap: 16px; }
.hero-mini {
  border-radius: var(--radius); overflow: hidden; background-size: cover; background-position: center;
  position: relative; display: flex; align-items: flex-end; min-height: 152px; transition: .3s; box-shadow: var(--shadow);
}
.hero-mini:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.hero-mini::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.8), transparent 75%); }
.hero-mini .hero-body { position: relative; z-index: 2; padding: 16px; color: #fff; }
.hero-mini h3 { margin: 6px 0 0; font-size: 15px; line-height: 1.45; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 5px; background: var(--primary); color: #fff; }
.badge.hot { background: #ef4444; }
.badge.new { background: var(--accent); }

/* ---------- 8. 文章卡片 ---------- */
.article-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: .3s; border: 1px solid rgba(0,0,0,.03);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-thumb { height: 165px; background-size: cover; background-position: center; position: relative; }
.card-thumb .cat-pill {
  position: absolute; left: 12px; top: 12px; z-index: 2;
  background: rgba(37, 99, 235, .92); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; backdrop-filter: blur(4px);
}
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 0 0 8px; font-size: 16.5px; line-height: 1.5; }
.card:hover .card-body h3 { color: var(--primary); }
.card-body p { margin: 0 0 14px; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); margin-top: auto; }
.card-meta .dot { display: inline-flex; align-items: center; gap: 4px; }

/* 文章列表（分类/搜索结果，横向卡片） */
.list-card {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px;
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); transition: .3s; border: 1px solid rgba(0,0,0,.03);
}
.list-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.list-card .list-thumb { height: 140px; border-radius: var(--radius-sm); background-size: cover; background-position: center; }
.list-card .list-body h3 { margin: 4px 0 8px; font-size: 18px; }
.list-card:hover .list-body h3 { color: var(--primary); }
.list-card .list-body p { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 9. 侧栏组件 ---------- */
.widget { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 24px; }
.widget-title { font-size: 16px; font-weight: 800; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.widget-title::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--accent); }
.hot-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.hot-list li:last-child { border-bottom: 0; }
.hot-list .rank { font-size: 18px; font-weight: 900; color: var(--line); min-width: 22px; font-style: italic; }
.hot-list li:nth-child(-n+3) .rank { color: var(--accent); }
.hot-list .hot-title { font-size: 13.5px; line-height: 1.5; }
.hot-list .hot-title:hover { color: var(--primary); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a { font-size: 12.5px; padding: 5px 11px; background: var(--bg); border-radius: 20px; color: var(--ink-2); transition: .2s; }
.tag-cloud a:hover { background: var(--primary); color: #fff; }

/* ---------- 10. 分页 ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 36px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 8px;
  display: grid; place-items: center; font-size: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); transition: .2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 11. 文章详情 ---------- */
.crumb { font-size: 13px; color: var(--muted); margin: 22px 0; }
.crumb a:hover { color: var(--primary); }
.crumb span { margin: 0 8px; }
.article-wrap { background: var(--card); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.article-head h1 { font-size: 30px; line-height: 1.4; margin: 14px 0 18px; }
.article-head .article-info { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.article-cover { width: 100%; height: 380px; border-radius: var(--radius-sm); background-size: cover; background-position: center; margin: 24px 0; }
.article-content { font-size: 16px; line-height: 1.95; color: #374151; }
.article-content h2 { font-size: 22px; margin: 36px 0 14px; padding-left: 12px; border-left: 4px solid var(--primary); }
.article-content p { margin: 0 0 20px; }
.article-content ul { list-style: disc; padding-left: 24px; margin: 0 0 20px; }
.article-content li { margin-bottom: 8px; }
.article-content blockquote { margin: 24px 0; padding: 16px 20px; background: var(--primary-light); border-left: 4px solid var(--primary); border-radius: 0 8px 8px 0; color: var(--primary-dark); }
.article-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.article-tags a { font-size: 13px; padding: 5px 12px; background: var(--bg); border-radius: 6px; color: var(--ink-2); }
.article-tags a:hover { background: var(--primary-light); color: var(--primary); }
.article-nav { display: flex; justify-content: space-between; gap: 16px; margin: 24px 0; }
.article-nav a { flex: 1; background: var(--card); padding: 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 14px; }
.article-nav a:last-child { text-align: right; }
.article-nav a span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.article-nav a:hover { color: var(--primary); }

/* 关于页 */
.about-hero { text-align: center; padding: 40px 20px; }
.about-hero h1 { font-size: 32px; margin: 0 0 12px; }
.about-hero p { color: var(--ink-2); font-size: 16px; max-width: 640px; margin: 0 auto; }
.about-card { background: var(--card); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); margin-bottom: 24px; }
.about-card h2 { font-size: 21px; margin: 0 0 16px; }
.about-card p { color: var(--ink-2); }
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.contact-item { text-align: center; padding: 24px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.contact-item .ci { font-size: 30px; margin-bottom: 10px; }
.contact-item h4 { margin: 0 0 6px; }
.contact-item p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

/* ---------- 12. 页脚 ---------- */
.site-footer { background: #111827; color: #9ca3af; margin-top: 60px; padding: 48px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding-bottom: 36px; }
.footer-about .logo-text { color: #fff; }
.footer-about p { font-size: 13.5px; margin-top: 14px; line-height: 1.8; }
.footer-col h4 { color: #fff; font-size: 14px; margin: 0 0 16px; }
.footer-col a { display: block; font-size: 13px; margin-bottom: 10px; transition: .2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1f2937; padding: 20px 0; text-align: center; font-size: 12.5px; }

/* ---------- 13. 返回顶部 & 移动搜索弹层 ---------- */
.back-top {
  position: fixed; right: 24px; bottom: 28px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--primary); color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .4);
  opacity: 0; visibility: hidden; transition: .3s;
}
.back-top.show { opacity: 1; visibility: visible; }
.back-top:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ---------- 14. 响应式 ---------- */
@media (max-width: 992px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar-inner { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .sidebar .ad-sidebar { margin-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .main-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 12px 16px; box-shadow: var(--shadow);
    transform: translateY(-150%); transition: transform .3s; opacity: 0;
  }
  .main-nav.open { transform: translateY(0); opacity: 1; }
  .main-nav a { padding: 11px 14px; }
  .menu-toggle { display: block; }
  .header-search input { width: 150px; }
  .header-search input:focus { width: 170px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 260px; }
  .hero-sub-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .article-grid { grid-template-columns: 1fr; }
  .list-card { grid-template-columns: 1fr; }
  .list-card .list-thumb { height: 180px; }
  .article-head h1 { font-size: 24px; }
  .article-cover { height: 240px; }
  .article-wrap { padding: 20px; }
  .article-content { font-size: 15.5px; }
  .sidebar-inner { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .article-nav { flex-direction: column; }
}
@media (max-width: 480px) {
  .header-search { display: none; }
  .hero-sub-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 19px; }
}

/* ---------- 15. 语言切换按钮 ---------- */
.lang-switch {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: .2s;
}
.lang-switch:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
@media (max-width: 480px) {
  .lang-switch { padding: 6px 9px; font-size: 11px; }
}
