/* ============================================================
   AI 资讯门户 · InfoQ 风格
   ============================================================ */
:root {
  --primary: #1a6dff;
  --primary-dark: #0e4fc0;
  --accent: #00c26f;
  --ink: #1d2129;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #e5e6eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --hot: #f53f3f;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
button { font-family: inherit; cursor: pointer; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
mark { background: #fff3bf; border-radius: 2px; }

/* ================= Header ================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 40, 60, .08);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 62px;
  display: flex; align-items: center; gap: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c4dff);
  color: #fff; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.brand-name em { font-style: normal; color: var(--primary); }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: -3px; }

.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.main-nav a {
  padding: 8px 13px; border-radius: 6px;
  font-size: 15px; color: var(--ink-2); white-space: nowrap;
}
.main-nav a:hover { background: var(--bg); color: var(--primary); }
.main-nav a.active { color: var(--primary); font-weight: 700; background: #edf3ff; }

.header-search { position: relative; flex-shrink: 0; }
.header-search input {
  width: 220px; height: 36px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0 38px 0 34px; font-size: 13px; outline: none;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.5' y2='16.5'/%3E%3C/svg%3E") 12px center no-repeat;
  transition: width .25s, border-color .2s, background-color .2s;
}
.header-search input:focus {
  width: 280px; border-color: var(--primary); background-color: #fff;
}
.search-pop {
  position: absolute; top: 44px; right: 0; width: 380px; z-index: 200;
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(30, 40, 60, .16);
  border: 1px solid var(--line);
}
.search-pop .sp-item {
  display: block; padding: 10px 16px;
  border-bottom: 1px solid #f2f3f5; cursor: pointer;
}
.search-pop .sp-item:hover { background: #f7f9ff; }
.search-pop .sp-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-pop .sp-meta { font-size: 12px; color: var(--ink-3); }
.search-pop .sp-more { padding: 9px; text-align: center; font-size: 13px; color: var(--primary); cursor: pointer; }
.search-pop .sp-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }

.gh-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  background: #1d2129; color: #fff; font-size: 13px; font-weight: 600;
}
.gh-btn:hover { background: var(--primary); color: #fff; }

/* ================= 分类条 ================= */
.subnav {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.subnav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 6px;
  height: 44px; overflow-x: auto;
}
.subnav .cat-link {
  padding: 5px 14px; border-radius: 999px; font-size: 13.5px;
  color: var(--ink-2); white-space: nowrap;
}
.subnav .cat-link:hover { background: var(--bg); color: var(--primary); }
.subnav .cat-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.subnav .divider { width: 1px; height: 16px; background: var(--line); margin: 0 8px; flex-shrink: 0; }
.subnav .tag-link {
  font-size: 12.5px; color: var(--ink-3); padding: 3px 10px;
  border-radius: 999px; border: 1px dashed transparent; white-space: nowrap;
}
.subnav .tag-link:hover { color: var(--primary); border-color: var(--primary); }

/* ================= 页面骨架 ================= */
.page { padding: 18px 0 50px; min-height: 60vh; }
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px; align-items: start;
}
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }

/* ================= 编辑推荐横排（日期块卡片） ================= */
.featured-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 18px; overflow: hidden;
}
@media (max-width: 1000px) { .featured-strip { grid-template-columns: repeat(2, 1fr); } }
.featured-cell {
  display: flex; gap: 12px; padding: 16px;
  border-right: 1px solid #f2f3f5; cursor: pointer;
  transition: background .15s;
  min-width: 0; /* 防止 nowrap 内容把 1fr 轨道撑爆 */
}
.featured-cell:last-child { border-right: 0; }
.featured-cell:hover { background: #f7faff; }
.date-block {
  flex-shrink: 0; width: 52px; text-align: center;
  border-right: 1px solid #f2f3f5; padding-right: 10px;
}
.date-block .d { font-size: 19px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.date-block .m { font-size: 11px; color: var(--ink-3); }
.featured-cell .t {
  font-size: 13.5px; font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-cell .s {
  margin-top: 4px; font-size: 12px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ================= 焦点 Banner ================= */
.hero-banner {
  position: relative; border-radius: 10px; overflow: hidden;
  background:
    radial-gradient(600px 260px at 88% -30%, rgba(124, 77, 255, .5), transparent),
    radial-gradient(700px 300px at 8% 120%, rgba(0, 194, 111, .35), transparent),
    linear-gradient(120deg, #0b2e8f 0%, #1a6dff 55%, #38bdf8 100%);
  color: #fff; padding: 30px 34px; cursor: pointer;
  margin-bottom: 20px;
}
.hero-banner .hb-chip {
  display: inline-block; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35);
  padding: 2px 12px; border-radius: 999px; margin-bottom: 12px;
}
.hero-banner h2 { font-size: 25px; line-height: 1.4; letter-spacing: .3px; }
.hero-banner .hb-summary {
  margin-top: 10px; max-width: 720px; color: rgba(255, 255, 255, .88);
  font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-banner .hb-meta { margin-top: 14px; font-size: 12.5px; color: rgba(255, 255, 255, .75); display: flex; gap: 16px; }
.hero-banner .hb-go {
  position: absolute; right: 30px; bottom: 26px;
  background: #fff; color: var(--primary-dark);
  font-size: 13px; font-weight: 700; padding: 8px 18px; border-radius: 999px;
}

/* ================= 区块标题 ================= */
.section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid #f2f3f5;
}
.section-head .bar { width: 4px; height: 16px; border-radius: 2px; background: var(--primary); }
.section-head h3 { font-size: 16.5px; }
.section-head .en { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.section-head .more { margin-left: auto; font-size: 12.5px; color: var(--ink-3); cursor: pointer; }
.section-head .more:hover { color: var(--primary); }

/* ================= 文章列表行 ================= */
.article-rows { padding: 4px 18px; }
.article-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 15px 0; border-bottom: 1px solid #f2f3f5; cursor: pointer;
}
.article-row:last-child { border-bottom: 0; }
.article-row:hover .ar-title { color: var(--primary); }
.ar-body { min-width: 0; flex: 1; }
.ar-title { font-size: 16px; font-weight: 600; line-height: 1.5; transition: color .15s; }
.ar-summary {
  margin-top: 5px; font-size: 13px; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ar-meta { margin-top: 7px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.cat-chip {
  font-size: 11.5px; font-weight: 600; color: #fff;
  padding: 1px 9px; border-radius: 4px;
}
.load-more {
  display: block; width: calc(100% - 36px); margin: 14px auto 16px;
  height: 38px; border: 1px dashed var(--line); border-radius: 8px;
  background: #fafbfc; color: var(--ink-2); font-size: 13.5px;
}
.load-more:hover { color: var(--primary); border-color: var(--primary); }

/* ================= 右侧栏 ================= */
.side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 76px; }
@media (max-width: 1000px) { .side { position: static; } }

.rank-list { padding: 6px 18px 12px; }
.rank-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f7f8fa; cursor: pointer; }
.rank-item:last-child { border-bottom: 0; }
.rank-no {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 3px;
  border-radius: 5px; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f2f3f5; color: var(--ink-3);
}
.rank-no.top1 { background: #feeccc; color: #f77234; }
.rank-no.top2 { background: #fde8e8; color: #f53f3f; }
.rank-no.top3 { background: #fdf0d4; color: #d25f00; }
.rank-item .rt {
  font-size: 13.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rank-item:hover .rt { color: var(--primary); }

.flash-list { padding: 6px 18px 12px; }
.flash-item { display: flex; gap: 10px; padding: 8px 0; cursor: pointer; }
.flash-dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; margin-top: 8px; }
.flash-item .ft {
  font-size: 13.5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.flash-item:hover .ft { color: var(--primary); }
.flash-item .fm { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.hot-tabs { display: flex; gap: 2px; margin-left: auto; background: var(--bg); border-radius: 999px; padding: 2px; }
.hot-tabs span { font-size: 12px; padding: 2px 12px; border-radius: 999px; color: var(--ink-3); cursor: pointer; }
.hot-tabs span.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.gh-card {
  border-radius: var(--radius); padding: 20px;
  background: linear-gradient(135deg, #24292f 0%, #1a6dff 160%);
  color: #fff;
}
.gh-card h4 { font-size: 15.5px; margin-bottom: 6px; }
.gh-card p { font-size: 12.5px; color: rgba(255,255,255,.75); margin-bottom: 14px; }
.gh-card a {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 12.5px; padding: 6px 14px; border-radius: 999px;
}
.gh-card a:hover { background: #fff; color: var(--ink); }

/* ================= 文章详情页 ================= */
.article-page {
  max-width: 820px; margin: 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 40px 36px;
}
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }
.crumbs a:hover { color: var(--primary); }
.article-page h1 { font-size: 26px; line-height: 1.45; margin-bottom: 14px; }
.article-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-3);
  padding-bottom: 18px; border-bottom: 1px solid #f2f3f5; margin-bottom: 20px;
}
.article-content p { font-size: 15.5px; line-height: 1.9; color: #2c3a47; margin: 14px 0; text-align: justify; }
.article-tags { margin-top: 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tags a, .article-tags span {
  font-size: 12px; color: var(--ink-2); background: var(--bg);
  padding: 3px 12px; border-radius: 999px;
}
.article-tags a:hover { color: var(--primary); }
.article-source {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 22px; padding: 9px 22px;
  background: var(--primary); color: #fff; border-radius: 999px; font-size: 13.5px; font-weight: 600;
}
.article-source:hover { background: var(--primary-dark); color: #fff; }
.back-blog { margin-left: 12px; font-size: 13px; color: var(--ink-3); }
.related { margin-top: 30px; border-top: 1px solid #f2f3f5; padding-top: 18px; }
.related h4 { font-size: 15px; margin-bottom: 8px; }
.related .rk { padding: 7px 0; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.related .rk:hover { color: var(--primary); }
.related .rk::before { content: "· "; color: var(--primary); font-weight: 800; }

/* ================= 搜索结果页 ================= */
.page-title { font-size: 21px; margin-bottom: 14px; }
.page-title em { font-style: normal; color: var(--primary); }
.result-count { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }

.empty { text-align: center; padding: 80px 0; color: var(--ink-3); }
.empty .icon { font-size: 40px; margin-bottom: 10px; }

/* ================= Footer ================= */
.site-footer {
  background: #fff; border-top: 1px solid var(--line);
  padding: 26px 0 34px; margin-top: 30px;
  color: var(--ink-3); font-size: 13px; text-align: center;
}
.site-footer .flinks { display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--primary); }

/* ================= 响应式 ================= */
@media (max-width: 780px) {
  .header-inner { gap: 12px; }
  .main-nav { display: none; }
  .header-search input { width: 150px; }
  .header-search input:focus { width: 190px; }
  .featured-strip { grid-template-columns: 1fr; }
  .featured-cell { border-right: 0; border-bottom: 1px solid #f2f3f5; }
  .hero-banner { padding: 22px; }
  .hero-banner h2 { font-size: 20px; }
  .article-page { padding: 24px 20px; }
}

/* ================= SSR：卡片级链接（<a> 代替 <div>，避免 hover 变色波及整卡） ================= */
a.hero-banner, a.hero-banner:hover { color: #fff; }
a.featured-cell, a.article-row, a.rank-item, a.flash-item { color: inherit; }
a.featured-cell:hover, a.article-row:hover, a.rank-item:hover, a.flash-item:hover { color: inherit; }

/* ================= 分页条 ================= */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 14px 18px 18px; border-top: 1px solid #f2f3f5;
}
.pager .pg {
  font-size: 13.5px; color: var(--ink-2);
  padding: 7px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fafbfc;
}
.pager .pg:hover { color: var(--primary); border-color: var(--primary); }
.pager .pg-info { font-size: 12.5px; color: var(--ink-3); }

/* ================= 正文 Markdown 排版 ================= */
.article-content.md h1, .article-content.md h2, .article-content.md h3,
.article-content.md h4, .article-content.md h5, .article-content.md h6 {
  color: var(--ink); line-height: 1.5; margin: 26px 0 12px; font-weight: 700;
}
.article-content.md h1 { font-size: 22px; }
.article-content.md h2 { font-size: 20px; padding-bottom: 8px; border-bottom: 1px solid #f2f3f5; }
.article-content.md h3 { font-size: 17.5px; }
.article-content.md h4, .article-content.md h5, .article-content.md h6 { font-size: 15.5px; }
.article-content.md a { color: var(--primary); }
.article-content.md a:hover { text-decoration: underline; }
.article-content.md strong { font-weight: 700; color: var(--ink); }
.article-content.md ul, .article-content.md ol { margin: 14px 0; padding-left: 26px; }
.article-content.md ul { list-style: disc; }
.article-content.md ol { list-style: decimal; }
.article-content.md li { font-size: 15px; line-height: 1.9; color: #2c3a47; margin: 6px 0; }
.article-content.md li::marker { color: var(--primary); }
.article-content.md blockquote {
  margin: 16px 0; padding: 10px 18px;
  border-left: 3px solid var(--primary); background: #f7f9ff;
  color: var(--ink-2); border-radius: 0 8px 8px 0;
}
.article-content.md blockquote p { margin: 4px 0; font-size: 14.5px; }
.article-content.md code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px; background: #f2f3f5; color: #d6336c;
  padding: 2px 6px; border-radius: 4px;
}
.article-content.md pre {
  margin: 16px 0; padding: 16px 18px; overflow-x: auto;
  background: #0f1722; border-radius: 10px; line-height: 1.7;
}
.article-content.md pre code { background: none; color: #dbe4f0; padding: 0; font-size: 13px; }
.article-content.md table {
  width: 100%; margin: 16px 0; border-collapse: collapse; font-size: 13.5px;
}
.article-content.md th, .article-content.md td {
  border: 1px solid var(--line); padding: 8px 12px; text-align: left;
}
.article-content.md th { background: var(--bg); font-weight: 600; }
.article-content.md img { max-width: 100%; border-radius: 8px; margin: 10px 0; }
.article-content.md hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
