#container-col-margin {
  width: 100%;
  height: auto;
  overflow: visible;
  margin: 15px;
  box-sizing: border-box; /* Inclut le padding et les bordures dans les dimensions */
}

.container {
  display: grid;
  grid-template-columns: 3fr 1fr; /* Image principale occupe 3/4 de la largeur, vignettes 1/4 */
  grid-template-rows: auto;
  gap: 15px; /* Espace entre les vignettes et l'image principale */
  width: 100%;
  max-width: 1000px; /* Largeur maximale du conteneur */
  margin: 0 auto;
  grid-template-areas:
    "image-principale thumbnail-container"
    "image-principale thumbnail-container"
    "image-principale thumbnail-container";
  box-sizing: border-box;
}

.image-principale {
  grid-area: image-principale;
  background-size: cover; /* Assure que l'image couvre toute la div */
  background-position: center; /* Centre l'image dans la div */
  background-repeat: no-repeat; /* Évite la répétition de l'image */
  border-radius: 7px; /* Coins arrondis */
  width: 100%;
  aspect-ratio: 1 / 1; /* Maintient un ratio carré */
  box-sizing: border-box;
}

.thumbnail-container {
  grid-area: thumbnail-container;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-sizing: border-box;
}

.thumbnail {
  background-size: cover; /* Assure que l'image couvre toute la div */
  background-position: center; /* Centre l'image dans la div */
  width: 100%;
  height: 33.33%; /* Hauteur fixe pour les vignettes en mode desktop */
  cursor: pointer; /* Change le curseur pour indiquer que c'est cliquable */
  box-sizing: border-box;
  border-radius: 7px; /* Coins arrondis pour les vignettes */
}

/* Masquer les vignettes sans image */
.thumbnail-empty {
  opacity: 0; /* Masque les vignettes sans image */
  pointer-events: none; /* Ignore les événements de clic */
}

/* Réaffiche les vignettes avec des images */
.thumbnail:not(.thumbnail-empty) {
  opacity: 1;
  pointer-events: auto;
}

/* Assurez-vous que la vignette principale est toujours visible */
.thumbnail-main {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
  #container-col-margin {
    padding: 0;
  }

  .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "image-principale"
      "thumbnail-container";
  }

  .image-principale {
    width: 100%;
    aspect-ratio: 1 / 1; /* Maintient un ratio carré */
  }

  .thumbnail-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-top: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
    box-sizing: border-box;
  }

  .thumbnail {
    width: calc(33.33% - 10px); /* Ajustement pour l'espace */
    height: 100px; /* Hauteur fixe pour les vignettes en mode mobile */
  }
}
