/* ============================================================
   首页分类磁贴（hexo-magnet-fomal）样式补丁
   移植自 hexo-theme-Fomalhaut：
     themes/butterfly/source/css/_custom/custom.css
   作用范围限定在 #recent-posts 内，不会影响文章正文 / 友链 / 标签云
   ============================================================ */

/* 磁贴外层容器（与 .recent-post-item 卡片留白对齐） */
#catalog_magnet {
  padding: 18px 18px 0 18px !important;
}

/* 磁贴之间的小间距 */
.magnet_item {
  margin-right: 5px !important;
}

@media screen and (max-width: 600px) {
  .magnet_item {
    margin-right: 0 !important;
  }
}

/* 磁贴文本单行显示，超出部分省略号截断
 * 完整收缩链路（自外向内，缺一层都会被内容撑开）：
 *   .magnet_item (flex 子项，min-width:0 允许收缩)
 *     > .magnet_link (block + 100%，不再是宽度自适应内容的 inline)
 *       > .magnet_link_context (flex 容器)
 *         > span:first-child (nowrap + ellipsis 截断) */
#recent-posts .magnet_item {
  min-width: 0 !important;
}

#recent-posts .magnet_link {
  display: block !important;
  width: 100% !important;
}

#recent-posts .magnet_link_context > span:first-child {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
}

/* 黑夜模式适配（背景 / 文字 / 圆角） */
[data-theme="dark"] .magnet_link_context {
  background: #1e1e1e;
  color: antiquewhite;
  border-radius: 6px;
}

[data-theme="dark"] .magnet_link_context:hover {
  background: var(--text-bg-hover) !important;
  color: #f2f2f2;
  border-radius: 6px;
}