.portfolio-section {
  width: 100vw;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 48px;
  background: transparent;
  position: relative;
  z-index: 2;
}

.portfolio-title-wrapper {
  width: 100vw;
  max-width: 1000px;
  height: 220px;
  margin: 96px auto 0 auto; /* was 50vh, now much closer */
  position: relative;
}

.portfolio-title-svg {
  width: 72vw;
  max-width: 1000px;
  height: 220px;
  opacity: 0.78;
  display: block;
  margin: 0 auto;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.portfolio-title-svg text {
  fill: none !important;
  paint-order: stroke;
}

.portfolio-intro {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-size: 36px;
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #43e97b 0%, #a17fe0 65%, #5d26c1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 12px rgba(93,38,193,0.10));
  text-align: center;
  pointer-events: none;
  margin: 0;
  width: max-content;
}

/* Hide intro on devices smaller than 1024px */
@media (max-width: 1023px) {
  .portfolio-intro {
    display: none !important;
  }
}

/* Responsive: hide SVG title on small screens if needed */
@media (max-width: 720px) {
  .portfolio-title-svg {
    height: 120px;
    width: 92vw;
    max-width: 900px;
  }
  .portfolio-title-wrapper {
    height: 120px;
    margin-top: 48px;
  }
  .portfolio-intro {
    font-size: 1.2rem;
  }
}

.carousel-3d {
  width: 100%;
  max-width: 900px;
  margin: 64px auto 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1800px;
  min-height: 480px;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: inherit;
  /* No overflow hidden so 3D effect is visible */
}

.carousel-link {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 520px;
  height: 340px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s cubic-bezier(.4,.2,.2,1),
    transform 0.7s cubic-bezier(.4,.2,.2,1),
    box-shadow 0.3s cubic-bezier(.4,.2,.2,1);
  z-index: 1;
}

.carousel-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: 0 12px 48px rgba(93,38,193,0.28);
  transition:
    box-shadow 0.3s cubic-bezier(.4,.2,.2,1),
    filter 0.3s cubic-bezier(.4,.2,.2,1),
    transform 0.7s cubic-bezier(.4,.2,.2,1);
}

.carousel-link.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
  transform: translate(-50%, -50%) scale(1.08) rotateY(0deg);
}

.carousel-link.left {
  opacity: 0.6;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%) scale(0.92) rotateY(-60deg);
}

.carousel-link.right {
  opacity: 0.6;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%) scale(0.92) rotateY(60deg);
}

.carousel-link:not(.active):not(.left):not(.right) {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.carousel-link:hover .carousel-img,
.carousel-link:focus .carousel-img {
  box-shadow: 0 16px 64px rgba(93,38,193,0.38); /* brighter glow, no border */
  filter: none;
  outline: none;
}

.carousel-arrow {
  background: rgba(21,24,34,0.7);
  border: none;
  color: #fff;
  font-size: 3.2rem;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  transition: background 0.2s;
  box-shadow: 0 2px 12px rgba(93,38,193,0.12);
}

.carousel-arrow.left { left: -32px; }
.carousel-arrow.right { right: -32px; }

.carousel-arrow:hover {
  background: linear-gradient(90deg, #43e97b 0%, #a17fe0 65%, #5d26c1 100%);
  color: #fff;
}

/* Modal styles */
.carousel-modal {
  display: none;
  position: fixed;
  z-index: 100000;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(21,24,34,0.95);
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
  pointer-events: auto;
}

.carousel-modal.active {
  display: flex;
}

.carousel-modal img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 32px;
  box-shadow: 0 12px 48px rgba(93,38,193,0.38);
  background: #181a24;
  z-index: 100001;
  pointer-events: none;
}

.carousel-modal-close {
  position: fixed;
  top: 32px;
  right: 48px;
  font-size: 3.2rem;
  color: #fff;
  cursor: pointer;
  z-index: 100002;
  background: none;
  border: none;
  outline: none;
  transition: color 0.2s;
  pointer-events: auto;
}

.carousel-modal-close:hover,
.carousel-modal-close:focus {
  color: #a17fe0;
}

/* Responsive */
@media (max-width: 900px) {
  .portfolio-section {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 24px;
  }
  .portfolio-title-wrapper {
    margin-top: 32px;
    margin-bottom: 0;
    height: auto;
    text-align: center;
  }
  .carousel-3d {
    max-width: 98vw;
    min-height: 220px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 32px auto 0 auto;
  }
  .carousel-track {
    height: 220px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
  .carousel-link {
    width: 92vw;
    max-width: 340px;
    height: 160px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .carousel-img {
    border-radius: 18px;
  }
  .carousel-arrow {
    font-size: 2rem;
    width: 38px;
    height: 38px;
    left: 0;
    right: 0;
  }
}
@media (max-width: 900px) {
  .carousel-3d {
    max-width: 98vw;
    min-height: 220px;
  }
  .carousel-track {
    height: 220px;
  }
  .carousel-link {
    width: 98vw;
    max-width: 340px;
    height: 180px;
  }
  .carousel-arrow {
    font-size: 2rem;
    width: 38px;
    height: 38px;
    left: 0;
    right: 0;
  }
}

/* Mobile carousel arrow layout */
@media (max-width: 900px) {
  .carousel-3d {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 98vw;
    min-height: 220px;
    margin: 32px auto 0 auto;
  }
  .carousel-arrows-mobile {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 12px;
  }
  .carousel-arrow {
    position: static !important;
    display: inline-block !important;
    margin: 0 18px !important;
    font-size: 2rem !important;
    width: 38px !important;
    height: 38px !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
  }
  /* Hide desktop arrows (those outside .carousel-arrows-mobile) */
  .carousel-3d > .carousel-arrow {
    display: none !important;
  }
}

/* Desktop: show side arrows, hide mobile arrows */
.carousel-3d > .carousel-arrow {
  display: block;
}
.carousel-arrows-mobile {
  display: none;
}

/* Mobile: show arrows below, hide side arrows */
@media (max-width: 900px) {
  .carousel-3d > .carousel-arrow {
    display: none !important;
  }
  .carousel-arrows-mobile {
    display: flex !important;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 12px;
  }
  .carousel-arrows-mobile .carousel-arrow {
    position: static !important;
    display: inline-block !important;
    margin: 0 18px !important;
    font-size: 2rem !important;
    width: 38px !important;
    height: 38px !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
  }
}
