/* Portfolio Page Enhancements */

/* 全局动画设置 */
* {
  transition: all 0.3s ease;
}

/* 滚动动画基础类 */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.fade-in-up.animate {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s ease;
}

.fade-in-left.animate {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s ease;
}

.fade-in-right.animate {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s ease;
}

.scale-in.animate {
  opacity: 1;
  transform: scale(1);
}

/* Portfolio Hero 区域美化 */
.portfolio-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  /* overflow: hidden; -- Removed to prevent clipping animation */
}

.portfolio-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="portfolio-grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.15"/><circle cx="20" cy="60" r="0.5" fill="white" opacity="0.15"/><circle cx="80" cy="40" r="0.5" fill="white" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23portfolio-grain)"/></svg>');
  pointer-events: none;
}

.portfolio-hero .container {
  position: relative;
  z-index: 2;
}

.portfolio-hero h1 {
  color: white !important;
}

.portfolio-hero p {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* 过滤器按钮美化 */
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 50px;
}

.portfolio-filter {
  position: relative;
  overflow: hidden;
  background: #f1f3f5; /* Light gray background */
  border: 1px solid #dee2e6;
  color: #212529 !important; /* Dark text, important to override other styles */
  padding: 8px 20px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.portfolio-filter::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.portfolio-filter:hover::before {
  left: 100%;
}

.portfolio-filter:hover {
  background: #e9ecef;
  border-color: #ced4da;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.portfolio-filter.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  border-color: transparent;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}

/* 作品卡片美化 - 全新设计 */
.portfolio-item {
  margin-bottom: 40px;
  transition: all 0.3s ease;
}

.portfolio-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  height: 100%;
  border: 1px solid #e9ecef;
}

.portfolio-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 20px;
  z-index: 0; /* keep overlay below real content to avoid masking white border */
}

/* ensure real content stays above the hover overlay */
.portfolio-image,
.portfolio-content { 
  position: relative; 
  z-index: 1; 
}

.portfolio-mockup { 
  position: relative; 
  z-index: 2; 
}

.portfolio-card:hover::before {
  opacity: 0; /* Keep overlay transparent on hover */
}

.portfolio-card:hover {
  /* Animation removed as per request */
  transform: none;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

/* 作品图片容器 - 简化设计 */
.portfolio-image {
  position: relative;
  overflow: hidden;
  height: 200px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.portfolio-card:hover .portfolio-image img {
  transform: scale(1.02);
}

.portfolio-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio-card:hover .portfolio-overlay {
  opacity: 1;
}

/* 作品内容区域 - 重新设计 */
.portfolio-content {
  padding: 30px 25px;
  position: relative;
}

.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.portfolio-category {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 6px 14px;
  border-radius: 25px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.portfolio-year {
  color: #999;
  font-size: 12px;
  font-weight: 500;
}

.portfolio-title {
  font-size: 20px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 12px;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.portfolio-card:hover .portfolio-title {
  color: #667eea;
}

.portfolio-description {
  color: #6c757d;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.portfolio-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 25px;
}

.tech-tag {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

.portfolio-card:hover .tech-tag {
  background: rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.portfolio-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.portfolio-duration {
  color: #999;
  font-size: 12px;
  font-weight: 500;
}

.portfolio-links {
  display: flex;
  gap: 10px;
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 14px;
}

.portfolio-link.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.portfolio-link.secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.portfolio-link:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.portfolio-link.secondary:hover {
  background: #667eea;
  color: white;
}

/* 特色项目标识 */
.portfolio-card.featured::after {
  content: '精选';
  position: absolute;
  top: 15px;
  right: 15px;
  background: linear-gradient(45deg, #ff6b6b, #ffa500);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 3;
  box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 不同类型项目的背景渐变 */
.portfolio-card[data-category="education"] .portfolio-image {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.portfolio-card[data-category="ecommerce"] .portfolio-image {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.portfolio-card[data-category="corporate"] .portfolio-image {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.portfolio-card[data-category="enterprise"] .portfolio-image {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* 不同类型项目的分类标签颜色 */
.portfolio-card[data-category="education"] .portfolio-category {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.portfolio-card[data-category="ecommerce"] .portfolio-category {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.portfolio-card[data-category="corporate"] .portfolio-category {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.portfolio-card[data-category="enterprise"] .portfolio-category {
  background: linear-gradient(135deg, #fa709a, #fee140);
}

/* 技术标签悬停效果增强 */
.portfolio-card[data-category="education"]:hover .tech-tag {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.3);
}

.portfolio-card[data-category="ecommerce"]:hover .tech-tag {
  background: rgba(79, 172, 254, 0.15);
  border-color: rgba(79, 172, 254, 0.3);
  color: #4facfe;
}

.portfolio-card[data-category="corporate"]:hover .tech-tag {
  background: rgba(67, 233, 123, 0.15);
  border-color: rgba(67, 233, 123, 0.3);
  color: #43e97b;
}

.portfolio-card[data-category="enterprise"]:hover .tech-tag {
  background: rgba(250, 112, 154, 0.15);
  border-color: rgba(250, 112, 154, 0.3);
  color: #fa709a;
}

/* Mockup 内容动画 */
.portfolio-mockup .mockup-line,
.portfolio-mockup .mockup-button {
  animation: mockup-load 2s ease-in-out infinite;
}

.portfolio-mockup .mockup-line:nth-child(1) { animation-delay: 0s; }
.portfolio-mockup .mockup-line:nth-child(2) { animation-delay: 0.2s; }
.portfolio-mockup .mockup-line:nth-child(3) { animation-delay: 0.4s; }
.portfolio-mockup .mockup-button { animation-delay: 0.6s; }

@keyframes mockup-load {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.portfolio-card:hover .mockup-line,
.portfolio-card:hover .mockup-button {
  animation: none;
  opacity: 1;
}

/* 项目链接按钮增强 */
.portfolio-card[data-category="education"] .portfolio-link.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.portfolio-card[data-category="ecommerce"] .portfolio-link.primary {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.portfolio-card[data-category="corporate"] .portfolio-link.primary {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.portfolio-card[data-category="enterprise"] .portfolio-link.primary {
  background: linear-gradient(135deg, #fa709a, #fee140);
}

/* 卡片加载动画 */
.portfolio-item.loading {
  opacity: 0;
  transform: translateY(30px) scale(0.9);
}

.portfolio-item.loaded {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 3D 效果增强 */
.portfolio-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}


.portfolio-mockup {
  transform-style: preserve-3d;
}

.portfolio-card:hover .portfolio-mockup {
  transform: none;
}

/* 响应式优化增强 */
@media (max-width: 992px) {
  .portfolio-card:hover {
    transform: none;
  }
  
  .portfolio-card:hover .portfolio-mockup {
    transform: none;
  }
}

@media (max-width: 576px) {
  .portfolio-card {
    margin-bottom: 25px;
  }
  
  .portfolio-content {
    padding: 20px;
  }
  
  .portfolio-image {
    height: 200px;
  }
  
  .portfolio-mockup {
    width: 160px;
    height: 120px;
    padding: 12px;
  }
  
  .portfolio-card:hover {
    transform: none;
  }
  
  .portfolio-card:hover .portfolio-mockup {
    transform: none;
  }
}

/* 加载状态 */
.portfolio-card.loading {
  opacity: 0.7;
  pointer-events: none;
}

.portfolio-card.loading .portfolio-mockup {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 统计数据美化 */
.stats-section {
  background: #f8f9fa;
}

.stats-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 16px 40px 0 rgba(31, 38, 135, 0.2);
}

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

.stats-number {
  font-size: 48px;
  font-weight: 700;
  background: #a5c33c;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.stats-card:hover .stats-number {
  transform: scale(1.1) rotate(-2deg);
}

.stats-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stats-description {
  font-size: 13px;
  color: #6c757d;
}

/* CTA 区域美化 */
.cta-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="cta-dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23cta-dots)"/></svg>');
  animation: float 6s ease-in-out infinite;
}

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

.cta-section .container {
  position: relative;
  z-index: 2;
}

.cta-section h2 {
  color: white !important;
}

.cta-section p {
  color: rgba(255, 255, 255, 0.9) !important;
}

.cta-section .btn {
  background: white;
  color: #667eea;
  border-radius: 50px;
  padding: 15px 40px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.cta-section .btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  color: #764ba2;
}

/* 加载更多按钮 */
.load-more-btn {
  position: relative;
  overflow: hidden;
}

.load-more-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.load-more-btn:hover::before {
  left: 100%;
}

/* 过滤动画 */
.portfolio-item.filtering {
  opacity: 0;
  transform: scale(0.8);
}

.portfolio-item.show {
  opacity: 1;
  transform: scale(1);
}

/* 响应式优化 */
@media (max-width: 768px) {
  .portfolio-filter-group {
    flex-direction: column;
    align-items: center;
  }
  
  .portfolio-card {
    margin-bottom: 20px;
  }
  
  .stats-number {
    font-size: 36px;
  }
  
  .portfolio-image {
    height: 180px;
  }
}

/* 滚动进度条 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* 加载动画 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 粒子背景效果 */
.particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  animation: float-particle 6s infinite linear;
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

/* 悬浮效果 */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/*
.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08); 
}
*/

/* 数字计数动画 */
.counter {
  font-weight: 700;
  background: #a5c33c;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 打字机效果 */
.typewriter {
  overflow: hidden;
  border-right: 2px solid white;
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: white }
}