/* === BOUNCE SLIDE SYSTEM - CONTAINER LIMITATO === */

.projects-wrapper {
  width: 100%;
  overflow: auto;
  margin: 2rem auto; /* Centra il container */
  min-height: 500px;
  position: relative;
  display: flex;
  justify-content: center; /* Centra il contenuto */
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: fit-content; /* Si adatta al contenuto */
  height: 100%;
  align-items: center; /* Centra le righe */
}

.projects-row-1,
.projects-row-2 {
  display: flex;
  gap: 2rem;
  width: fit-content; /* Esattamente 3 card + gap */
  position: relative;
  will-change: transform;
  justify-content: center; /* Centra le 3 card */
}

/* ANIMAZIONE BOUNCE - PRIMA FILA */
.projects-row-1 {
  animation: bounceRight 15s ease-in-out infinite;
}

/* ANIMAZIONE BOUNCE - SECONDA FILA */
.projects-row-2 {
  animation: bounceLeft 10s ease-in-out infinite;
}

/* KEYFRAMES BOUNCE - MOVIMENTO LIMITATO A 100PX */
@keyframes bounceRight {
  0% { transform: translateX(0); }
  50% { transform: translateX(-100px); } /* Max 100px a sinistra */
  100% { transform: translateX(0); }
}

@keyframes bounceLeft {
  0% { transform: translateX(-100px); } /* Inizia spostata */
  50% { transform: translateX(0); } /* Centra */
  100% { transform: translateX(-100px); } /* Torna spostata */
}

/* PAUSE ON HOVER */
.projects-row-1:hover,
.projects-row-2:hover {
  animation-play-state: paused;
}

/* CARDS STYLING - QUADRATE */
.project-card {
  min-width: 250px;
  width: 250px;
  height: 250px;
  min-height: 250px;
  max-height: 250px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: var(--spacing-md);
  color: white;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  justify-content: space-between;
  overflow: hidden;
}

/* Animated border elements for hover effect */
.project-card::before,
.project-card::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Top border */
.project-card::before {
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: left center;
}

/* Right border */
.project-card::after {
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  transform: scaleY(0);
  transform-origin: center top;
}

.project-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 
    inset 0 -1px 0 rgba(255, 255, 255, 0.8), /* Bottom border */
    inset 1px 0 0 rgba(255, 255, 255, 0.8);   /* Left border */
}

/* Hover animation - animated borders */
.project-card:hover::before {
  opacity: 1;
  transform: scaleX(1);
  transition-delay: 0s;
}

.project-card:hover::after {
  opacity: 1;
  transform: scaleY(1);
  transition-delay: 0.1s;
}

/* NASCONDI DESCRIZIONE */
.project-description {
  display: none;
}

/* LAYOUT OTTIMIZZATO PER FORMATO QUADRATO */
.project-header {
  flex-shrink: 0;
  margin-bottom: var(--spacing-xs); /* Ridotto da var(--spacing-sm) */
}

.project-title {
  font-size: 1.1rem;
  line-height: 1.2;
  margin-bottom: 0.15rem; /* Ridotto da 0.25rem */
}

.project-subtitle {
  font-size: 0.8rem;
  line-height: 1.3;
  opacity: 0.8;
}

/* FEATURE TAGS - Compatti per formato quadrato */
.project-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: var(--spacing-xs) 0; /* Ridotto da var(--spacing-sm) */
  flex: 0 1 auto; /* Non occupa tutto lo spazio disponibile */
  align-content: flex-start;
  max-height: 50px; /* Ridotto da 60px per più compattezza */
  overflow: hidden; /* Nasconde i tag in eccesso */
}

.feature-tag {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  line-height: 1.2;
}

/* PROGRESS BAR - Compatta */
.project-progress {
  margin: var(--spacing-xs) 0 0 0; /* Ridotto margine top, eliminato bottom */
  flex-shrink: 0;
  margin-top: auto; /* Spinge verso il basso */
}

.progress-bar {
  height: 3px;
  margin-bottom: 0.25rem; /* Spazio ridotto tra barra e testo */
}

.progress-text {
  font-size: 0.65rem;
}

/* BUTTON - Compatto */
.project-btn {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  margin-top: 0.5rem; /* Ridotto da var(--spacing-xs) */
  flex-shrink: 0;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .projects-wrapper {
    width: 95%; /* Più larghezza su mobile */
  }
  
  .project-card {
    min-width: 220px; /* Card più piccole su mobile */
    width: 220px;
    height: 220px;
    min-height: 220px;
    max-height: 220px;
  }
  
  .projects-row-1,
  .projects-row-2 {
    gap: 1rem; /* Gap ridotto su mobile */
  }
  
  .project-title {
    font-size: 1rem;
  }
  
  .project-subtitle {
    font-size: 0.75rem;
  }
  
  .feature-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
  }
  
  .project-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }

  .projects-row-1 {
    animation-duration: 30s; /* Più lenti su mobile */
  }
  
  .projects-row-2 {
    animation-duration: 35s;
  }
  
  /* Movimento ridotto a 50px su mobile */
  @keyframes bounceRight {
    0% { transform: translateX(0); }
    50% { transform: translateX(-50px); }
    100% { transform: translateX(0); }
  }

  @keyframes bounceLeft {
    0% { transform: translateX(-50px); }
    50% { transform: translateX(0); }
    100% { transform: translateX(-50px); }
  }
}
