.projects-section {
  margin-bottom: 40px;
  animation: fadeInUp 0.8s ease-out 0.2s both;
  padding: 24px;
  border: 2px solid var(--accent-alpha-30);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px var(--accent-alpha-10);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 标题和按钮容器 */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-icon {
  font-size: 36px;
  display: inline-block;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 分类按钮容器 */
.category-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 分类按钮 */
.category-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 2px solid var(--accent-alpha-30);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.category-btn:hover {
  background: var(--accent-alpha-20);
  border-color: var(--accent-alpha-50);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-alpha-30);
}

.category-btn.active {
  background: var(--accent-gradient);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 16px var(--accent-alpha-40);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  justify-items: stretch;
  gap: 16px;
}

.project-card {
  position: relative;
  z-index: 0;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  /* 当前页所有卡片跟随最大 Grid 行高，填满单元格。 */
  height: 100%;
  align-self: stretch;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(
    145deg,
    rgba(255, 242, 236, 0.44) 0%,
    rgba(255, 255, 255, 0.22) 52%,
    rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.08) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient-90);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  z-index: 0;
  pointer-events: none;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  transform: translateY(-5px);
  background: linear-gradient(
    145deg,
    rgba(255, 228, 232, 0.52) 0%,
    rgba(255, 255, 255, 0.32) 52%,
    rgba(var(--accent-r), var(--accent-g), var(--accent-b), 0.14) 100%
  );
  border-color: rgba(255, 230, 235, 0.82);
  box-shadow:
    0 14px 36px var(--warm-deep-alpha-12),
    0 1px 0 rgba(255, 248, 246, 0.78) inset;
}

.project-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.project-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.4) inset;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.35);
}

.project-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
  flex: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.project-description {
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
  margin-bottom: 12px;
  min-height: 0;
  flex: 1 1 auto;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  height: 27px;
  min-height: 27px;
  margin-bottom: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.project-tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

/* 业务/分类标签：背景/文字/边框由 ProjectsSection 内联按标签名哈希着色 */
.project-tag--category {
  border-style: solid;
}

/* 与技术栈板块中的名称对齐的条目（无图标配置时的回退） */
.project-tag--tech {
  background: linear-gradient(135deg, rgba(66, 153, 225, 0.22), rgba(129, 178, 245, 0.12));
  color: #2c5282;
  border-color: rgba(66, 153, 225, 0.4);
}

/* 与 TechStackSection 中 .badge-icon img 一致：36×36 */
.project-tech-icons {
  display: flex;
  flex-wrap: wrap-reverse;
  align-content: flex-start;
  align-items: center;
  gap: 4px;
  height: 76px;
  min-height: 76px;
  margin-bottom: 8px;
  flex-shrink: 0;
  overflow: hidden;
}

.project-tech-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  flex-shrink: 0;
}

.project-tech-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.project-link-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--accent-link);
  font-weight: 600;
  font-size: 13px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.arrow {
  transition: transform 0.3s ease;
  font-size: 18px;
}

.project-card:hover .arrow {
  transform: translateX(4px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .projects-section {
    padding: 16px 10px;
  }

  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .section-title {
    font-size: 28px;
  }

  .category-buttons {
    gap: 8px;
    width: 100%;
  }

  .category-btn {
    padding: 8px 14px;
    font-size: 13px;
    flex: 1;
    justify-content: center;
  }
  
  .project-card {
    padding: 14px 11px;
  }
  
  .project-header {
    gap: 10px;
    margin-bottom: 10px;
  }
  
  .project-icon {
    width: 36px;
    height: 36px;
  }
  
  .project-title {
    font-size: 16px;
  }
  
  .project-description {
    font-size: 13px;
  }
  
  .project-tag {
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 5px;
  }

  /* 移动端略小于桌面，仍接近上方技术栈徽章的可读尺寸 */
  .project-tech-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 4px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 分页指示器样式 */
.pagination-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  padding: 20px 0;
}

.pagination-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  outline: none;
}

.pagination-dot:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.2);
}

.pagination-dot.active {
  background: var(--accent);
  width: 14px;
  height: 14px;
  box-shadow: 0 0 10px var(--accent-alpha-50);
}

.pagination-dot:focus {
  outline: 2px solid var(--accent-alpha-50);
  outline-offset: 2px;
}
