/* ===== Horizontal Carousel (three rows) ===== */
.projects-carousel {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden;
  margin-top: 40px;
  padding: 20px 0 0;
  height: 600px;
  position: relative;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.projects-carousel.is-dragging {
  cursor: grabbing;
}

.projects-carousel::before,
.projects-carousel::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 3;
  pointer-events: none;
}

.projects-carousel::before {
  left: 0;
  background: linear-gradient(to right, var(--primary), transparent);
}

.projects-carousel::after {
  right: 0;
  background: linear-gradient(to left, var(--primary), transparent);
}

.carousel-rows {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.carousel-track {
  display: flex;
  gap: 14px;
  will-change: transform;
  padding: 0 20px;
  align-items: flex-start;
}

.carousel-card {
  flex-shrink: 0;
  width: 170px;
  height: 170px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(139, 149, 165, 0.08);
  cursor: pointer;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.carousel-card:hover {
  border-color: rgba(139, 149, 165, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(139, 149, 165, 0.08);
}

.carousel-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background-color: var(--surface);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s;
  filter: brightness(0.85) saturate(0.9);
}

.carousel-card:hover .carousel-card-image {
  transform: scale(1.12);
  filter: brightness(1) saturate(1);
}

.carousel-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(8, 8, 14, 0.1) 0%,
      rgba(8, 8, 14, 0.5) 45%,
      rgba(8, 8, 14, 0.92) 100%);
  transition: opacity 0.4s;
}

.carousel-card:hover .carousel-card-overlay {
  opacity: 0.85;
}

.carousel-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 2;
  transform: translateY(4px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-card:hover .carousel-card-info {
  transform: translateY(0);
}

.carousel-card-name {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-card-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 500;
  border: 1px solid rgba(139, 149, 165, 0.15);
  color: rgba(255, 255, 255, 0.5);
  background: rgba(139, 149, 165, 0.05);
  transition: all 0.2s ease;
  text-decoration: none;
}

a.project-badge:hover {
  background: rgba(139, 149, 165, 0.25);
  color: #fff;
  border-color: rgba(139, 149, 165, 0.4);
}

.project-badge img {
  width: 9px;
  height: 9px;
  opacity: 0.5;
  filter: brightness(0) invert(1);
}

.carousel-card-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm), var(--accent-secondary));
  opacity: 0;
  transition: opacity 0.3s;
}

.carousel-card:hover .carousel-card-bar {
  opacity: 1;
}

/* ===== Mobile ===== */
@media (max-width: 599px) {
  .projects-carousel {
    padding: 16px 0 0;
    margin-top: 24px;
    height: 340px;
  }

  .carousel-rows {
    gap: 14px;
  }

  .carousel-track {
    gap: 10px;
    padding: 0 12px;
  }

  .carousel-card {
    width: 95px;
    height: 95px;
    border-radius: 10px;
  }

  .carousel-card-info {
    padding: 4px 6px;
    gap: 2px;
  }

  .carousel-card-name {
    font-size: 8px;
  }

  .project-badge {
    font-size: 6px;
    padding: 1px 3px;
  }

  .project-badge img {
    width: 7px;
    height: 7px;
  }

  .projects-carousel::before,
  .projects-carousel::after {
    width: 30px;
  }
}

/* ===== Tablet ===== */
@media (min-width: 600px) and (max-width: 1099px) {
  .projects-carousel {
    padding: 18px 0 0;
    margin-top: 32px;
    height: 500px;
  }

  .carousel-rows {
    gap: 20px;
  }

  .carousel-track {
    gap: 12px;
  }

  .carousel-card {
    width: 150px;
    height: 150px;
    border-radius: 12px;
  }

  .carousel-card-info {
    padding: 8px 10px;
  }

  .carousel-card-name {
    font-size: 11px;
  }

  .projects-carousel::before,
  .projects-carousel::after {
    width: 80px;
  }
}