/* Case Studies section styling with modern tech aesthetic */

.portfolio-section {
  padding: 4rem 1rem;
  position: relative;
  overflow: hidden;
}

/* Add subtle tech background elements */
.portfolio-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 70% 30%, rgba(91, 152, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 30% 70%, rgba(56, 214, 174, 0.05) 0%, transparent 50%);
  z-index: -1;
}

/* Tech-inspired heading with gradient */
.portfolio-section .section-title {
  background: linear-gradient(90deg, #5B98FF 0%, #38D6AE 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
}

/* Carousel container with subtle effects */
.carousel-container {
  position: relative;
  width: 100%;
  margin-top: 3rem;
  padding-bottom: 1.5rem;
}

/* Hint animation for scrolling */
.carousel-hint {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 152, 255, 0.1);
  border-radius: 50%;
  z-index: 10;
  opacity: 0.5;
  animation: hintPulse 2s infinite alternate;
  pointer-events: none;
}

.carousel-hint i {
  color: var(--bs-accent);
  font-size: 1.5rem;
}

@keyframes hintPulse {
  0% {
    opacity: 0.3;
    transform: translateY(-50%) translateX(0);
  }
  100% {
    opacity: 0.8;
    transform: translateY(-50%) translateX(10px);
  }
}

/* Horizontal scrolling carousel */
.case-studies-carousel {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 1rem 0.5rem;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scroll-snap-type: x mandatory;
  cursor: grab;
}

.case-studies-carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.case-studies-carousel.dragging {
  cursor: grabbing;
  scroll-behavior: auto; /* Disable smooth scrolling during drag for better performance */
}

/* Prevent click events on cards while dragging */
.case-studies-carousel.dragging .case-study-card {
  pointer-events: none;
}

/* Project card styling */
.case-study-card {
  flex: 0 0 auto;
  width: 300px;
  height: 375px; /* 4:5 ratio */
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  scroll-snap-align: start;
  background-color: var(--bs-light-bg);
}

.case-study-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

/* Card background image with mask */
.card-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: all 0.3s ease;
}

/* Gradient mask overlay */
.card-background::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(28, 31, 38, 0.5) 0%,
    rgba(28, 31, 38, 0.8) 60%,
    rgba(28, 31, 38, 0.95) 100%
  );
  z-index: 1;
}

.case-study-card:hover .card-background {
  transform: scale(1.05);
  filter: brightness(0.8) contrast(1.1);
}

/* Card content */
.card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem;
  z-index: 2;
  transition: all 0.3s ease;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
  position: relative;
  transition: transform 0.3s ease;
}

.card-description {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
}

.case-study-card:hover .card-description {
  max-height: 100px;
  opacity: 1;
  margin-bottom: 1rem;
}

/* Tags container */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
}

.case-study-card:hover .card-tags {
  max-height: 50px;
  opacity: 1;
  margin-bottom: 1rem;
}

/* Tag styling */
.card-tag {
  display: inline-block;
  background-color: rgba(91, 152, 255, 0.2);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* View details button */
.card-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(91, 152, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(91, 152, 255, 0.4);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card-button::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bs-accent));
  transition: width 0.5s ease;
}

.card-button:hover::before {
  width: calc(100% + 4px);
}

.card-button i {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.card-button:hover i {
  transform: translateX(5px);
}

.case-study-card:hover .card-button {
  opacity: 1;
  transform: translateY(0);
}

.card-button:hover {
  background-color: var(--bs-accent);
  border-color: var(--bs-accent);
  color: #fff;
}

/* Industry label */
.card-industry {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bs-accent);
  margin-bottom: 0.5rem;
}

/* Circuit pattern for tech aesthetic */
.card-circuit {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 50px;
  height: 50px;
  opacity: 0.4;
  transition: all 0.5s ease;
  z-index: 1;
}

.case-study-card:hover .card-circuit {
  opacity: 0.7;
  transform: rotate(45deg) scale(1.2);
}

.circuit-line {
  stroke: var(--bs-accent);
  stroke-width: 1;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  transition: all 1s ease;
}

.case-study-card:hover .circuit-line {
  stroke-dashoffset: 0;
}

.circuit-dot {
  fill: var(--bs-accent);
  opacity: 0;
  transform-origin: center;
  transition: all 0.5s ease;
}

.case-study-card:hover .circuit-dot {
  opacity: 1;
  animation: pulseDot 1.5s infinite alternate;
}

@keyframes pulseDot {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.3);
    opacity: 1;
  }
}

/* Navigation controls */
.carousel-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.carousel-control {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bs-light-bg);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.carousel-control:hover {
  background-color: var(--bs-accent);
  transform: scale(1.1);
}

/* Disabled button state */
.carousel-control.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: scale(1);
  background-color: var(--bs-light-bg);
}

.carousel-control.disabled:hover {
  background-color: var(--bs-light-bg);
}

/* Add ripple effect for the controls */
.carousel-control::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s ease;
}

.carousel-control:active::after {
  opacity: 1;
  transform: scale(2);
  transition: 0s;
}

/* Progress indicators for carousel */
.carousel-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.progress-dot.active {
  background-color: var(--bs-accent);
  transform: scale(1.25);
}

.progress-dot:hover::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 1px solid rgba(91, 152, 255, 0.4);
  animation: pulseAnimation 1.5s infinite;
}

@keyframes pulseAnimation {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Lazy loading animation for cards */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.case-study-card {
  animation: cardEntrance 0.5s ease-out forwards;
  animation-delay: calc(var(--card-index, 0) * 0.1s);
}

/* Responsive styles */
@media (max-width: 991px) {
  .portfolio-section {
    padding: 3rem 1rem;
  }
  
  .carousel-hint {
    display: none;
  }
}

@media (max-width: 767px) {
  .portfolio-section {
    padding: 2.5rem 1rem;
  }
  
  .case-study-card {
    width: 260px;
    height: 325px;
  }
  
  .card-title {
    font-size: 1.3rem;
  }
}