/* Posts页面卡片布局修复 - 2025-08-28 */

/* 文章列表容器修复 */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* 响应式网格布局 */
@media (max-width: 640px) {
  .post-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1025px) and (max-width: 1280px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
  }
}

@media (min-width: 1281px) {
  .post-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
}

/* 文章卡片基础样式修复 */
.post-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.25s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 2;
}

/* 图片容器修复 */
.post-card-image-container {
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card-image {
  transform: scale(1.05);
}

/* 内容区域修复 */
.post-card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 0.75rem;
  box-sizing: border-box;
}

/* 分类标签修复 */
.post-card .categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.post-card .category {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background-color: #ecfdf5;
  color: #047857;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.post-card .category:hover {
  background-color: #d1fae5;
}

/* 标题修复 */
.post-card-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  flex-shrink: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-card-content h2 a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s ease;
  display: block;
}

.post-card-content h2 a:hover {
  color: #047857;
}

/* 元数据修复 */
.post-card .meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.post-card .meta time,
.post-card .meta .reading-time {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.post-card .meta svg {
  width: 1rem;
  height: 1rem;
  margin-right: 0.375rem;
  color: #9ca3af;
  flex-shrink: 0;
}

/* 文章摘要修复 - 设置固定高度和省略号 */
.post-card .summary {
  color: #4b5563;
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  flex-grow: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  height: 4.5rem;
  min-height: 4.5rem;
  max-height: 4.5rem;
}

/* 阅读更多链接修复 */
.post-card .read-more {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #047857;
  transition: all 0.2s ease;
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 0.5rem;
}

.post-card .read-more:hover {
  color: #065f46;
}

.post-card .read-more svg {
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.post-card .read-more:hover svg {
  transform: translateX(3px);
}

/* 防止文字重叠的关键样式 */
.post-card * {
  max-width: 100%;
  box-sizing: border-box;
}

/* 确保卡片内容不会重叠 */
.post-card > * {
  position: relative;
  z-index: 1;
}

/* 移动端特殊优化 */
@media (max-width: 768px) {
  .post-card-image-container {
    height: 200px;
  }
  
  .post-card-content {
    padding: 1rem;
  }
  
  .post-card-content h2 {
    font-size: 1.125rem;
  }
  
  .post-card .meta {
    font-size: 0.75rem;
    gap: 0.75rem;
  }
  
  .post-card .summary {
    font-size: 0.875rem;
    -webkit-line-clamp: 4;
    height: 5.25rem;
    min-height: 5.25rem;
    max-height: 5.25rem;
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  .post-card-content {
    padding: 0.875rem;
  }
  
  .post-card-content h2 {
    font-size: 1rem;
  }
  
  .post-card .meta {
    font-size: 0.6875rem;
    gap: 0.5rem;
  }
  
  .post-card .summary {
    font-size: 0.8125rem;
    -webkit-line-clamp: 5;
    height: 5.625rem;
    min-height: 5.625rem;
    max-height: 5.625rem;
  }
  
  .post-card .category {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.625rem;
    max-width: 100px;
  }
}

/* 确保分页控件正确显示 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

/* 修复可能的容器问题 */
.container.max-w-screen-xl {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container.max-w-screen-xl {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container.max-w-screen-xl {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
