/* ============================================================
   首页文章列表：单列列表流
   配合 themes/butterfly/_config.yml -> index_layout: 4
   无封面图场景下的最优阅读版式

   注意：主题选择器形如
   #recent-posts .recent-post-item > .recent-post-info > .article-title
   具体性为 (1,3,0)，本文件必须使用同级或更高级选择器才能覆盖。
   ============================================================ */

/* ---------- 卡片本体 ---------- */
#recent-posts > .recent-post-items > .recent-post-item {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  transition: transform .25s ease, box-shadow .25s ease;
}

/* 左侧分类色带 */
#recent-posts > .recent-post-items > .recent-post-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 4px;
  background: var(--home-accent, #49B1F5);
  transition: width .25s ease;
}

#recent-posts > .recent-post-items > .recent-post-item:hover {
  transform: translateY(-2px);
}

#recent-posts > .recent-post-items > .recent-post-item:hover::before {
  width: 6px;
}

/* ---------- 内容区 ---------- */
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info,
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info.no-cover {
  width: 100%;
  padding: 22px 26px 20px 30px;
}

/* ---------- 标题 ---------- */
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-title {
  font-size: 1.32em;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .2px;
  -webkit-line-clamp: 2;
  transition: color .2s ease;
}

/* ---------- 元信息行 ---------- */
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-meta-wrap {
  margin: 9px 0 11px;
  font-size: .82em;
  opacity: .72;
}

/* 分类做成彩色胶囊（选择器含 a 元素，高于主题 .article-meta-wrap a） */
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-meta-wrap a.article-meta__categories {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: .96em;
  line-height: 1.6;
  color: var(--home-accent, #49B1F5);
  background: color-mix(in srgb, var(--home-accent, #49B1F5) 12%, transparent);
  transition: background .2s ease, color .2s ease;
}

#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-meta-wrap a.article-meta__categories:hover {
  color: var(--home-accent, #49B1F5);
  background: color-mix(in srgb, var(--home-accent, #49B1F5) 22%, transparent);
  text-decoration: none;
}

/* ---------- 摘要 3 行 ---------- */
#recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .content {
  -webkit-line-clamp: 3;
  font-size: .92em;
  line-height: 1.78;
  opacity: .78;
}

/* ============================================================
   分类配色（:has 按分类链接设置 --home-accent）
   ============================================================ */

/* 大模型微调 -> 紫 */
#recent-posts .recent-post-item:has(a[href*="%E5%A4%A7%E6%A8%A1%E5%9E%8B%E5%BE%AE%E8%B0%83"]) {
  --home-accent: #9C6ADE;
}

/* 大模型部署 -> 橙 */
#recent-posts .recent-post-item:has(a[href*="%E5%A4%A7%E6%A8%A1%E5%9E%8B%E9%83%A8%E7%BD%B2"]) {
  --home-accent: #F5A623;
}

/* 数据分析 -> 青绿 */
#recent-posts .recent-post-item:has(a[href*="%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90"]) {
  --home-accent: #23B5A0;
}

/* AI辅助编程实战技巧 -> 蓝 */
#recent-posts .recent-post-item:has(a[href*="AI%E8%BE%85%E5%8A%A9%E7%BC%96%E7%A8%8B"]) {
  --home-accent: #49B1F5;
}

/* Dify -> 靛蓝 */
#recent-posts .recent-post-item:has(a[href*="/categories/Dify/"]) {
  --home-accent: #5B8FF9;
}

/* RAG -> 青 */
#recent-posts .recent-post-item:has(a[href*="/categories/RAG/"]) {
  --home-accent: #00C4B6;
}

/* ai资源整合 -> 玫红 */
#recent-posts .recent-post-item:has(a[href*="ai%E8%B5%84%E6%BA%90%E6%95%B4%E5%90%88"]) {
  --home-accent: #EF6C8E;
}

/* ============================================================
   移动端适配
   ============================================================ */
@media screen and (max-width: 768px) {
  #recent-posts > .recent-post-items > .recent-post-item > .recent-post-info,
  #recent-posts > .recent-post-items > .recent-post-item > .recent-post-info.no-cover {
    padding: 18px 18px 16px 22px;
  }

  #recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-title {
    font-size: 1.16em;
  }

  #recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .content {
    -webkit-line-clamp: 2;
    font-size: .9em;
  }
}

/* ============================================================
   暗色模式微调
   ============================================================ */
[data-theme="dark"] #recent-posts > .recent-post-items > .recent-post-item > .recent-post-info > .article-meta-wrap a.article-meta__categories {
  background: color-mix(in srgb, var(--home-accent, #49B1F5) 20%, transparent);
}
