/* Page portfolio */
.portfolio-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Conteneur principal */
.portfolio-container {
  flex: 1;
  max-width: var(--page-max-width);
  margin: 0 auto;
  width: 100%;
  padding-inline: var(--page-side-margin);
  padding-bottom: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Titre */
.portfolio-main-title {
  margin: clamp(6rem, 12vw, 10.5rem) 0 2rem;
  text-align: center;
  font-family: "Raylig", serif;
  font-size: clamp(2.8rem, 8vw, 6rem);
  line-height: 0.9;
  color: var(--color-accent);
}

/* Switch projets / lab */
.portfolio-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: clamp(2rem, 6vw, 4.5rem);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.switch-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-text);
  opacity: 0.55;
  position: relative;
}

.switch-btn.active {
  opacity: 1;
}

.switch-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.375rem;
  height: 1px;
  background-color: var(--color-text);
}

.switch-separator {
  color: var(--color-text);
  opacity: 0.4;
}

/* Carrousel desktop */
.portfolio-projects {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 5rem;
}

.carousel {
  position: relative;
  width: 100%;
  max-width: 70vw;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.carousel-track {
  position: relative;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 16 / 9;
}

/* Items */
.carousel-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(60%, 70%, 720px);
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  filter: blur(3px) saturate(80%);
  pointer-events: none;
  transition: transform 0.6s ease, opacity 0.6s ease, filter 0.6s ease;
}

/* Image */
.carousel-image-wrapper {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.8),
              0 0 0 1px rgba(255, 255, 255, 0.06);
}

.carousel-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Meta */
.carousel-meta {
  text-align: center;
  margin-top: 1.5rem;
}

.carousel-meta h3 {
  margin: 0 0 0.5rem;
  font-family: "Raylig", serif;
  font-size: 1.5rem;
  color: var(--color-text);
}

.carousel-meta p {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* CTA */
.carousel-cta {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: var(--color-text);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 0.625rem 1.625rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.carousel-cta:hover {
  background: var(--color-text);
  color: #000;
  border-color: var(--color-text);
}

/* États du carrousel */
.carousel-item.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  filter: blur(0) saturate(115%);
  pointer-events: auto;
  z-index: 3;
}

.carousel-item.is-left {
  opacity: 0.55;
  transform: translate(calc(-50% - min(18vw, 260px)), -50%) scale(0.86);
  filter: blur(2px) saturate(90%);
  z-index: 2;
}

.carousel-item.is-right {
  opacity: 0.55;
  transform: translate(calc(-50% + min(18vw, 260px)), -50%) scale(0.86);
  filter: blur(2px) saturate(90%);
  z-index: 2;
}

/* Flèches */
.carousel-nav {
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.carousel-nav:hover {
  opacity: 1;
}

/* LAB */
.portfolio-lab {
  width: 100%;
  max-width: var(--page-max-width);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 1.125rem;
  cursor: pointer;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hover */
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
  filter: saturate(115%);
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Modal projet */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
}

.project-modal.is-open {
  display: block;
}

.project-modal_backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

.project-modal_dialog {
  position: relative;
  width: min(1000px, calc(100% - 40px));
  height: 88dvh;
  margin: 4vh auto 0;
  background: rgba(10, 10, 10, 0.92);
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.75),
              0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(1rem);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.project-modal.is-open .project-modal_dialog {
  transform: translateY(0);
  opacity: 1;
}

.project-modal_close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
}

.project-modal_header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.project-modal_title {
  margin: 0 0 0.375rem;
  font-family: "Raylig", serif;
  font-size: 1.625rem;
}

.project-modal_subtitle {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

.project-modal_content {
  height: calc(100% - 88px);
  overflow-y: auto;
}

.project-modal__document {
  width: min(920px, 100%);
  margin: 0 auto;
}

.project-slice {
  width: 100%;
  display: block;
}

/* Scrollbar modal */
.project-modal_content::-webkit-scrollbar {
  width: 0.625rem;
}

.project-modal_content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.625rem;
}

/* Lightbox */
.lab-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.lab-lightbox.is-open {
  display: block;
}

.lab-lightbox_backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
}

.lab-lightbox_content {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

/* Médias lightbox */
#labLightboxImg,
#labLightboxVideo {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 0.5rem;
  display: none;
  box-shadow: 0 40px 90px rgba(0,0,0,0.8),
              0 0 0 1px rgba(255,255,255,0.08);
  animation: labZoomIn 0.25s ease;
}

#labLightboxVideo {
  background: #000;
}

@keyframes labZoomIn {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lab-lightbox_close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.4);
  color: #fff;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 1200px) {
  .portfolio-main-title {
    margin-top: 8rem;
  }
}

@media (max-width: 1024px) {
  .carousel-item.is-left {
    transform: translate(calc(-50% - 200px), -50%) scale(0.86);
  }

  .carousel-item.is-right {
    transform: translate(calc(-50% + 200px), -50%) scale(0.86);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .portfolio-main-title {
    font-size: 3.5rem;
    margin-top: 6rem;
  }
}

@media (max-width: 768px) {
  .portfolio-container {
    padding-inline: 1.5rem;
  }

  .portfolio-main-title {
    font-size: 3rem;
    margin-top: 6rem;
  }

  .portfolio-switch {
    margin-bottom: 3rem;
  }

  .carousel-nav {
    display: none;
  }

  .carousel {
    max-width: 100%;
    width: 100%;
    display: block;
  }

  .carousel-track {
    display: flex;
    flex-direction: column;
    position: static;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12rem;
  }

  .carousel-meta {
    margin-top: 1rem;
  }

  .carousel-item,
  .carousel-item.is-active,
  .carousel-item.is-left,
  .carousel-item.is-right {
    position: static;
    transform: none;
    opacity: 1;
    filter: none;
    pointer-events: auto;
    width: 100%;
    max-width: 100%;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }
}
