/* ===== INFINITE CAROUSEL - COMPLETE CSS ===== */

.featured-projects {
  background: linear-gradient(180deg, #0a0a0a 0%, #000 100%);
  padding: 8rem 0 6rem;
  position: relative;
  overflow: hidden;
}

.featured-projects::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 30% 20%,
      rgba(142, 252, 0, 0.05) 0%,
      transparent 60%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(142, 252, 0, 0.03) 0%,
      transparent 60%
    );
  pointer-events: none;
}

.projects-header {
  text-align: center;
  margin-bottom: 5rem;
  position: relative;
  z-index: 2;
}

.projects-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(
    135deg,
    #fff 0%,
    var(--highlight-color) 50%,
    #fff 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.projects-subtitle {
  font-size: 1.5rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
}

.projects-count {
  font-size: 3rem;
  font-weight: 700;
  color: var(--highlight-color);
  text-shadow: 0 0 30px rgba(142, 252, 0, 0.3);
  margin-bottom: 1rem;
}

/* ===== INFINITE CAROUSEL CONTAINER ===== */
.carousel-container {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  z-index: 2;
}

.carousel-wrapper {
  overflow: hidden;
  border-radius: 2rem;
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-white);
  padding: 2.5rem 0;
  /* Performance optimizations */
  contain: layout style paint;
  transform: translateZ(0);
}

.carousel-track {
  display: flex;
  gap: 2rem;
  align-items: center;
  cursor: default;
  user-select: none;
  will-change: transform;
  white-space: nowrap;
  /* Ensure proper width calculation for infinite scroll */
  width: max-content;
  /* Key for infinite scroll - duplicate content */
  animation: infiniteScroll var(--animation-duration, 30s) linear infinite;
  /* Optimize for smoother animation */
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
}

/* ===== INFINITE SCROLL ANIMATION ===== */
@keyframes infiniteScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-100% / 2));
  }
}

/* Pause animation when manually interacting */
.carousel-track.paused {
  animation-play-state: paused;
}

/* Individual card hover to pause animation - handled by JavaScript */

/* ===== PROJECT CARDS ===== */
.project-card {
  flex: 0 0 280px;
  height: 200px;
  border: 1px solid rgba(142, 252, 0, 0.2);
  border-radius: 1.2rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  user-select: none;
  min-width: 280px;
  /* Ensure cards don't shrink and maintain consistent width */
  flex-shrink: 0;
  box-sizing: border-box;
  /* Optimize for better performance */
  will-change: transform;
  transform: translateZ(0);
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(142, 252, 0, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

.project-card:hover::before {
  left: 100%;
}

.project-card:hover {
  transform: translateY(-6px) scale(1.03) translateZ(0);
  border-color: var(--highlight-color);
  box-shadow: 0 15px 30px rgba(142, 252, 0, 0.15);
  background: linear-gradient(
    135deg,
    rgba(142, 252, 0, 0.08) 0%,
    rgba(22, 22, 22, 0.95) 100%
  );
}

.project-card:active {
  transform: translateY(-4px) scale(1.02);
}

.project-card:focus {
  outline: 2px solid var(--highlight-color);
  outline-offset: 2px;
}

.project-logo {
  width: 80px;
  height: 130px;
  border-radius: 16px;
  background: rgba(20, 20, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  /* Performance optimizations */
  will-change: transform;
  transform: translateZ(0);
}

.project-logo:hover {
  transform: translateY(-2px) translateZ(0);
  border-color: var(--highlight-color);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
}

.project-logo img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.project-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: white;
}

.project-type {
  font-size: 0.85rem;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ===== SPEED CONTROL CLASSES ===== */
.carousel-fast {
  --animation-duration: 20s;
}

.carousel-normal {
  --animation-duration: 30s;
}

.carousel-slow {
  --animation-duration: 40s;
}

/* Reverse direction option */
.carousel-reverse .carousel-track {
  animation-direction: reverse;
}

/* ===== GRADIENT MASKS FOR SMOOTH EDGES ===== */
.carousel-wrapper::before,
.carousel-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100px;
  z-index: 10;
  pointer-events: none;
}

.carousel-wrapper::before {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 1) 0%, transparent 100%);
}

.carousel-wrapper::after {
  right: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 1) 100%);
}

/* ===== STATS BANNER ===== */
.stats-banner {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--highlight-color);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.5rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .featured-projects {
    padding: 4rem 0;
  }

  .carousel-container {
    padding: 0 1rem;
  }

  .project-card {
    flex: 0 0 220px;
    height: 200px;
    padding: 1rem;
  }

  .project-logo {
    width: 80px;
    height: 80px;
    font-size: 1.2rem;
  }

  .stats-banner {
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
  }

  .carousel-track {
    /* Slower animation on mobile for better experience */
    --animation-duration: 25s;
  }

  /* Remove gradient masks on mobile for more visible content */
  .carousel-wrapper::before,
  .carousel-wrapper::after {
    display: none;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    animation-play-state: paused;
  }
}

/* Focus management for keyboard navigation */
.carousel-track:focus-within {
  animation-play-state: paused;
}
