/* ===== About Projects: clean version ===== */

body .cms-project-section {
  width: 100%;
  margin: 1.15rem 0 2.3rem !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* 
 * 左对齐：
 * - justify-content: start 保证 1 个 item 也靠左
 * - 固定小卡片宽度，避免被 grid 拉伸
 */
body .cms-project-grid {
  --project-card-width: 205px;
  --project-gap: 0.95rem;

  display: grid !important;
  grid-template-columns: repeat(auto-fill, var(--project-card-width)) !important;
  justify-content: start !important;
  align-items: start !important;
  gap: var(--project-gap) !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 项目独立容器 */
body .cms-project-card {
  display: flex !important;
  flex-direction: column !important;
  width: 205px !important;
  max-width: 205px !important;
  min-height: 258px !important;
  height: auto !important;
  overflow: hidden !important;
  border: 1px solid rgba(127, 127, 127, 0.24) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.045) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

body .cms-project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(48, 169, 222, 0.45) !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24) !important;
}

/* 封面：完整显示，不裁切 */
body .cms-project-cover {
  width: 100% !important;
  height: 78px !important;
  flex: 0 0 78px !important;
  overflow: hidden !important;
  background: rgba(0, 0, 0, 0.28) !important;
  box-sizing: border-box !important;
}

body .cms-project-cover img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* 内容区 */
body .cms-project-content {
  display: flex !important;
  flex: 1 !important;
  flex-direction: column !important;
  min-height: 0 !important;
  padding: 0.58rem 0.68rem 0.72rem !important;
  box-sizing: border-box !important;
}

/* 标题 + 状态 */
body .cms-project-header {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  margin: 0 0 0.28rem !important;
  min-width: 0 !important;
}

body .cms-project-title {
  margin: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: inherit !important;
  font-size: 0.88rem !important;
  line-height: 1.25 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body .cms-project-status {
  flex: none !important;
  padding: 0.08rem 0.34rem !important;
  border-radius: 999px !important;
  background: rgba(48, 169, 222, 0.16) !important;
  color: #30a9de !important;
  font-size: 0.58rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

/* 简介：最多两行 */
body .cms-project-description {
  display: -webkit-box !important;
  margin: 0.16rem 0 0.42rem !important;
  overflow: hidden !important;
  color: var(--sec-text-color, #718096) !important;
  font-size: 0.68rem !important;
  line-height: 1.4 !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

/* 标签：自然换行，不滚动 */
body .cms-project-tags {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.28rem !important;
  margin: 0.08rem 0 0.48rem !important;
  padding: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

body .cms-project-tag {
  display: inline-flex !important;
  align-items: center !important;
  flex: none !important;
  max-width: 100% !important;
  padding: 0.08rem 0.34rem !important;
  border-radius: 999px !important;
  background: rgba(127, 127, 127, 0.14) !important;
  color: var(--sec-text-color, #718096) !important;
  font-size: 0.58rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

/* 链接：不滚动，直接占内容空间 */
body .cms-project-links {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.38rem !important;
  margin-top: 0.42rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid rgba(127, 127, 127, 0.15) !important;
  max-height: none !important;
  overflow: visible !important;
}

/* 覆盖 Fluid 文章链接样式 */
body .cms-project-card .cms-project-link,
body .markdown-body .cms-project-card .cms-project-link,
body .post-content .cms-project-card .cms-project-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  min-height: 1.48rem !important;
  padding: 0.15rem 0.34rem !important;
  border-radius: 999px !important;
  background: rgba(3, 102, 214, 0.17) !important;
  color: #1589e9 !important;
  font-size: 0.6rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  text-decoration: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body .cms-project-card .cms-project-link:hover,
body .markdown-body .cms-project-card .cms-project-link:hover,
body .post-content .cms-project-card .cms-project-link:hover {
  background: rgba(3, 102, 214, 0.3) !important;
  color: #30a9de !important;
  text-decoration: none !important;
}

body .cms-project-empty {
  margin: 1rem 0 2rem !important;
  color: var(--sec-text-color, #718096) !important;
}

/* 中小屏：仍然左对齐 */
@media (max-width: 768px) {
  body .cms-project-grid {
    --project-card-width: 190px;
    grid-template-columns: repeat(auto-fill, var(--project-card-width)) !important;
    justify-content: start !important;
    gap: 0.85rem !important;
  }

  body .cms-project-card {
    width: 190px !important;
    max-width: 190px !important;
  }
}

/* 极窄屏：单列铺满，避免溢出 */
@media (max-width: 480px) {
  body .cms-project-grid {
    grid-template-columns: 1fr !important;
  }

  body .cms-project-card {
    width: 100% !important;
    max-width: none !important;
  }

  body .cms-project-links {
    grid-template-columns: 1fr !important;
  }
}
