.portfolio-page {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  margin: 0 auto;
  padding: 120px 40px 100px;
}

.portfolio-hero {
  padding: 40px 0 60px;
}

.portfolio-hero-content {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.portfolio-hero-content h1 {
  margin: 0 0 20px;
  font-family: "Montserrat", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

.portfolio-intro {
  font-family: "Poppins", sans-serif;
  font-size: 1.08rem;
  font-weight: 300;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.78);
}

.portfolio-slider-section {
  margin-top: 50px;
}

.portfolio-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 24px;
}

.portfolio-section-head h2 {
  font-family: "Montserrat", sans-serif;
  font-size: 2.4rem;
  color: #fff;
}

.portfolio-note {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.62);
}

/* CAROUSEL */
.portfolio-carousel {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 6px 20px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 6px;
}

.portfolio-carousel::-webkit-scrollbar {
  display: none;
}

/* WEB PROJECTS */
.project-slide {
  flex: 0 0 calc((100% - 48px) / 3);
  min-width: calc((100% - 48px) / 3);
  max-width: calc((100% - 48px) / 3);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  overflow: hidden;
  scroll-snap-align: start;
  position: relative;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(5, 151, 242, 0.08);
  transition:
    transform 0.45s ease,
    box-shadow 0.45s ease;
  will-change: transform;
}

.project-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 24px;
  background: linear-gradient(
    120deg,
    rgba(111, 4, 217, 0.45),
    rgba(56, 102, 242, 0.55),
    rgba(5, 199, 242, 0.45)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.project-slide:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 36px rgba(5, 151, 242, 0.14),
    0 0 24px rgba(111, 4, 217, 0.1);
}

.project-slide img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  filter: brightness(0.8);
  transition: filter 0.45s ease;
  will-change: transform;
}

.project-slide-content {
  padding: 22px;
}

.project-tag {
  display: inline-block;
  margin-bottom: 12px;
  font-family: "Poppins", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(142, 162, 255, 0.9);
}

.project-slide-content h3 {
  font-family: "Montserrat", sans-serif;
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 12px;
}

.project-slide-content p {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 20px;
}

.portfolio-btn {
  width: 100%;
  margin-top: 0;
  font-size: 1rem;
  padding: 14px 22px;
}

/* ARROWS */
.carousel-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
}

.carousel-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 0 12px rgba(5, 199, 242, 0.12),
    0 0 24px rgba(111, 4, 217, 0.08);
  transition:
    transform 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.carousel-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(
    135deg,
    rgba(111, 4, 217, 1),
    rgba(5, 199, 242, 1)
  );
  box-shadow:
    0 0 18px rgba(5, 199, 242, 0.22),
    0 0 30px rgba(111, 4, 217, 0.14);
}

/* GRAPHIC DESIGN */
.graphic-carousel {
  padding-bottom: 12px;
}

.graphic-slide {
  position: relative;
  flex: 0 0 calc((100% - 48px) / 3);
  min-width: calc((100% - 48px) / 3);
  max-width: calc((100% - 48px) / 3);
  height: 360px;
  border-radius: 24px;
  overflow: hidden;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(5, 151, 242, 0.08);
  transition:
    transform 0.45s ease,
    box-shadow 0.45s ease;
  cursor: pointer;
  will-change: transform;
}

.graphic-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 24px;
  background: linear-gradient(
    120deg,
    rgba(111, 4, 217, 0.35),
    rgba(56, 102, 242, 0.5),
    rgba(5, 199, 242, 0.35)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
}

.graphic-slide:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 36px rgba(5, 151, 242, 0.14),
    0 0 22px rgba(111, 4, 217, 0.08);
}

.graphic-slide:focus-visible {
  outline: 2px solid #05c7f2;
  outline-offset: 4px;
}

.graphic-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.78);
  transition:
    transform 0.45s ease,
    filter 0.45s ease;
  will-change: transform;
}

.graphic-slide:hover img {
  transform: scale(1.03);
  filter: brightness(0.55);
}

.graphic-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 24px 20px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88),
    rgba(0, 0, 0, 0.3),
    rgba(0, 0, 0, 0.08)
  );
  opacity: 0.9;
  transition:
    opacity 0.4s ease,
    background 0.4s ease;
}

.graphic-slide:hover .graphic-overlay {
  opacity: 1;
}

.graphic-view {
  align-self: center;
  margin-top: auto;
  margin-bottom: auto;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(111, 4, 217, 0.95) 0%,
    rgba(56, 102, 242, 0.95) 55%,
    rgba(5, 199, 242, 0.95) 100%
  );
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 14px rgba(5, 199, 242, 0.2),
    0 0 30px rgba(111, 4, 217, 0.16);
  transform: translateY(10px);
  opacity: 0;
  transition:
    transform 0.4s ease,
    opacity 0.4s ease;
}

.graphic-slide:hover .graphic-view {
  transform: translateY(0);
  opacity: 1;
}

.graphic-overlay h3 {
  font-family: "Montserrat", sans-serif;
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 6px;
}

.graphic-overlay p {
  font-family: "Poppins", sans-serif;
  font-size: 0.92rem;
  color: rgba(142, 162, 255, 0.9);
}

/* GALLERY MODAL */
.gallery-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.gallery-modal.open {
  display: block;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gallery-box {
  position: relative;
  z-index: 2;
  width: min(1100px, 94vw);
  height: min(88vh, 820px);
  margin: 5vh auto;
  border-radius: 28px;
  background: rgba(10, 10, 26, 0.88);
  border: 1px solid rgba(94, 180, 255, 0.2);
  box-shadow:
    0 0 30px rgba(5, 199, 242, 0.12),
    0 0 60px rgba(111, 4, 217, 0.08);
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.gallery-image-wrap {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 20px;
}

.gallery-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 18px;
  box-shadow:
    0 0 20px rgba(5, 199, 242, 0.15),
    0 0 40px rgba(111, 4, 217, 0.08);
}

.gallery-footer {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 28px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-title {
  font-family: "Montserrat", sans-serif;
  font-size: 1.2rem;
  color: #fff;
}

.gallery-counter {
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
  color: rgba(142, 162, 255, 0.9);
}

.gallery-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.25s ease,
    background 0.25s ease;
}

.gallery-close:hover {
  transform: scale(1.08);
  background: linear-gradient(
    135deg,
    rgba(111, 4, 217, 1),
    rgba(5, 199, 242, 1)
  );
}

.gallery-close:focus-visible {
  outline: 2px solid #05c7f2;
  outline-offset: 4px;
}

.gallery-arrow {
  align-self: center;
  justify-self: center;
  width: 54px;
  height: 54px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.25s ease,
    background 0.25s ease;
}

.gallery-arrow:hover {
  transform: scale(1.08);
  background: linear-gradient(
    135deg,
    rgba(111, 4, 217, 1),
    rgba(5, 199, 242, 1)
  );
}

.gallery-arrow:focus-visible {
  outline: 2px solid #05c7f2;
  outline-offset: 4px;
}

.gallery-prev {
  grid-column: 1;
  grid-row: 1;
}

.gallery-next {
  grid-column: 3;
  grid-row: 1;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .project-slide {
    flex: 0 0 calc((100% - 24px) / 2);
    min-width: calc((100% - 24px) / 2);
    max-width: calc((100% - 24px) / 2);
  }

  .graphic-slide {
    flex: 0 0 calc((100% - 24px) / 2);
    min-width: calc((100% - 24px) / 2);
    max-width: calc((100% - 24px) / 2);
  }
}

@media (max-width: 900px) {
  .portfolio-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-slide {
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
  }

  .graphic-slide {
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
    height: 320px;
  }

  .gallery-box {
    grid-template-columns: 56px 1fr 56px;
    width: min(96vw, 1100px);
    height: min(90vh, 820px);
  }
}

@media (max-width: 820px) {
  .portfolio-page {
    padding: 110px 24px 80px;
  }

  .portfolio-hero {
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .portfolio-section-head h2 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .project-slide {
    flex: 0 0 86%;
    min-width: 86%;
    max-width: 86%;
  }

  .graphic-slide {
    flex: 0 0 86%;
    min-width: 86%;
    max-width: 86%;
    height: 300px;
  }

  .project-slide-content {
    padding: 18px;
  }

  .carousel-controls {
    margin-top: 18px;
  }

  .carousel-btn {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  .gallery-box {
    width: 96vw;
    height: 86vh;
    margin: 7vh auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    padding-top: 60px;
  }

  .gallery-image-wrap {
    grid-column: 1;
    grid-row: 2;
    padding: 12px 16px;
  }

  .gallery-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px 20px;
  }

  .gallery-close {
    top: 12px;
    right: 12px;
    width: 46px;
    height: 46px;
    font-size: 1.7rem;
  }

  .gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  .gallery-prev {
    left: 10px;
  }

  .gallery-next {
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-carousel {
    scroll-behavior: auto;
  }

  .project-slide,
  .project-slide img,
  .graphic-slide,
  .graphic-slide img,
  .graphic-overlay,
  .graphic-view,
  .carousel-btn,
  .gallery-close,
  .gallery-arrow {
    transition: none !important;
  }
}

@media (max-width: 768px) {
  .gallery-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-footer-text {
    max-width: 100%;
  }
}

.gallery-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 18px 22px 22px;
}

.gallery-footer-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 85%;
}

.gallery-title {
  margin: 0;
  color: #ffffff;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.gallery-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.98rem;
  line-height: 1.6;
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.gallery-counter {
  margin: 0;
  color: #cfd8ff;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}