/* ========================================
   LIGHTBOX - Simple & Professional
   ======================================== */

/* Lightbox Overlay */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* Overlay sombre avec flou */
.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  cursor: pointer;
}

/* Contenu de la lightbox */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 10000;
  animation: zoomIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Image */
.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

/* Desktop : Taille optimale */
@media (min-width: 769px) {
  .lightbox-content {
    max-width: 1200px;
    max-height: 85vh;
  }

  .lightbox-image {
    max-height: 70vh;
    max-width: 1200px;
  }

  .lightbox-info {
    max-width: 1200px;
  }
}

/* Informations projet */
.lightbox-info {
  background: transparent;
  padding: 25px 30px;
  border-radius: 0 0 8px 8px;
  max-width: 100%;
}

.lightbox-title {
  margin: 0 0 12px 0;
  font-size: 28px;
  font-weight: 700;
  color: #e8b377;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.lightbox-description {
  margin: 0;
  font-size: 17px;
  line-height: 1.7;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  max-width: 800px;
  margin: 0 auto;
}

/* Bouton fermer */
.lightbox-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  border-radius: 8px;
  z-index: 10001;
  width: 48px;
  height: 48px;
}

.lightbox-close:hover {
  background-color: rgba(232, 179, 119, 0.9);
  transform: scale(1.1);
}

.lightbox-close:focus {
  outline: 2px solid #e8b377;
  outline-offset: 2px;
}

.lightbox-close svg {
  display: block;
  width: 24px;
  height: 24px;
}

/* Curseur sur les images cliquables */
.project-image {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.project-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(232, 179, 119, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.project-image:hover::after {
  background: rgba(232, 179, 119, 0.15);
}

.project-image:hover {
  transform: scale(1.02);
}

/* Focus visible pour accessibilité clavier */
.project-image:focus {
  outline: 3px solid #e8b377;
  outline-offset: 3px;
}

.project-image:focus-visible {
  outline: 3px solid #e8b377;
  outline-offset: 3px;
}

/* Indicateur de zoom sur l'image */
.project-image::before {
  content: "🔍";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 48px;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.project-image:hover::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.9;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .lightbox-content {
    max-width: 98vw;
    max-height: 95vh;
    margin: 0 1vw;
    display: flex;
    flex-direction: column;
  }

  .lightbox-image {
    max-height: 60vh;
    border-radius: 4px 4px 0 0;
  }

  .lightbox-info {
    padding: 15px 18px;
    border-radius: 0 0 4px 4px;
  }

  .lightbox-title {
    font-size: 18px;
    margin-bottom: 8px;
    text-align: center;
  }

  .lightbox-description {
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
  }

  .lightbox-close {
    top: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .lightbox-close svg {
    width: 18px;
    height: 18px;
  }

  .project-image::before {
    font-size: 36px;
  }
}

/* Désactivation du scroll quand lightbox active */
body.lightbox-active {
  overflow: hidden;
}

/* Animation de fermeture */
.lightbox.closing {
  animation: fadeOut 0.3s ease forwards;
}

.lightbox.closing .lightbox-content {
  animation: zoomOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes zoomOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.8);
    opacity: 0;
  }
}

/* Performance optimizations */
.lightbox {
  will-change: opacity, visibility;
}

.lightbox-content {
  will-change: transform;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .lightbox-overlay {
    background-color: rgba(0, 0, 0, 0.95);
  }
}

/* Reduced motion pour accessibilité */
@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-content,
  .lightbox-close,
  .project-image {
    transition: none;
    animation: none;
  }

  .lightbox.active {
    opacity: 1;
    visibility: visible;
  }
}
