/*
  =====================================================
  Fichier : clickable-images.css
  Fonction : Styles pour les images interactives
             - Lightbox pour les images zoomables (🔍)
             - Lien externe pour les images informatives (🛈ℹ️)
             - Pulsation subtile des icônes au survol
             - Adaptation mobile
  Auteur  : Erwan ROUJEAN - 7minutesdesciences.fr
  Version : 1.0
  Date    : 2025-11-02
  =====================================================
*/

/* =====================================================
 * 1) Bloc image + légende (optionnel .media-card)
 * ===================================================== */
.media-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.media-card .info-image,
.media-card .clickable-image {
  display: inline-block;         
  max-width: 100%;
  position: relative;
  max-width: 100%;
  border: none;
  margin: 0 auto;
  vertical-align: top;
}

.media-card img {
  display: block;
  max-width: 100%;
  height: auto;
}

.img-caption {
  text-align: center;
  font-style: italic;
  font-size: 10px;
  margin-top: 0px;
  line-height: 1.15;
}


/* Curseurs spécifiques */
.clickable-image { cursor: zoom-in; }
.info-image      { cursor: pointer; }

/* Icônes communes (position, style, ombre, etc.) */
.clickable-image::after,
.info-image::after {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10%;
  padding: 2px;
  font-size: 12pt;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
  pointer-events: none;
  transition: transform 0.2s ease;
}

/* Icône spécifique à chaque type */
.clickable-image::after { content: "🔍"; }
.info-image::after      { content: "ℹ️"; }

/* =====================================================
 * 3) Animation de pulsation des icônes
 * ===================================================== */
@keyframes pulseIcon {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.8; }
}

.clickable-image:hover::after,
.info-image:hover::after {
  animation: pulseIcon 0.6s ease-in-out;
}

/* =====================================================
 * 4) Lightbox
 * ===================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0,0,0,0.8);
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  display: block;
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
  transform: scale(0.8);
  opacity: 0;
  animation: zoomIn 0.35s ease forwards;
  border-radius: 6px;
  border: 2px solid white;
}

@keyframes zoomIn {
  to { transform: scale(1); opacity: 1; }
}

.close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1000;
}

/* =====================================================
 * 5) Responsive
 * ===================================================== */
@media (max-width: 600px) {
  .clickable-image::after,
  .info-image::after {
    font-size: 10pt;
    padding: 3px;
  }

  .clickable-image:hover::after,
  .info-image:hover::after {
    animation: pulseIcon 1.2s ease-in-out infinite;
  }
}
