/* GalleryInsert - styles publics par défaut (personnalisables via la configuration du plugin) */

ul.galleryinsert {
  --gi-gap: 10px;
  --gi-radius: 12px;
  --gi-tile: 160px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--gi-tile), 1fr));
  gap: var(--gi-gap);
  list-style: none;
  margin: 1.5em 0;
  padding: 0;
}

ul.galleryinsert li {
  list-style: none;
  margin: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--gi-radius);
  overflow: hidden;
  background: #eee;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

ul.galleryinsert li:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16), 0 10px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
}

ul.galleryinsert a.galleryinsert-link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

ul.galleryinsert li img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

ul.galleryinsert li:hover img {
  transform: scale(1.08);
}

ul.galleryinsert li.private {
  outline: 2px dashed rgba(200, 60, 60, 0.6);
  outline-offset: -2px;
}

ul.galleryinsert li.private::after {
  content: '\1F512';
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  pointer-events: none;
}

/* Formulaire de révélation des images privées */
.galleryinsert-toggle-private {
  display: inline-block;
  margin: 0.4em 0;
  font-size: 0.95em;
}

form[id^='ShowPrivatePicture'] p,
form[id^='HidePrivatePicture'] p {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 0.8em 1em;
  margin: 0.5em 0 1em;
}

/* -------------------------------------------------- */
/* Visionneuse (lightbox)                              */
/* -------------------------------------------------- */

.galleryinsert-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 14, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  z-index: 10000;
}

.galleryinsert-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.galleryinsert-overlay figure {
  margin: 0;
  max-width: 92vw;
  max-height: 92vh;
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.galleryinsert-overlay.open figure {
  transform: scale(1);
}

.galleryinsert-overlay img {
  max-width: 92vw;
  max-height: 80vh;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.galleryinsert-overlay figcaption {
  color: #f1f1f1;
  margin-top: 0.9em;
  font-size: 0.9em;
  letter-spacing: 0.01em;
  opacity: 0.85;
}

.galleryinsert-overlay button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4em;
  height: 2.4em;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1.3em;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
}

.galleryinsert-overlay button:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.06);
}

.galleryinsert-overlay .gi-close {
  top: 20px;
  right: 20px;
}

.galleryinsert-overlay .gi-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.galleryinsert-overlay .gi-prev:hover {
  transform: translateY(-50%) scale(1.06);
}

.galleryinsert-overlay .gi-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.galleryinsert-overlay .gi-next:hover {
  transform: translateY(-50%) scale(1.06);
}

body.galleryinsert-lock-scroll {
  overflow: hidden;
}

/* Petits écrans : tuiles plus petites, boutons resserrés */
@media (max-width: 480px) {
  ul.galleryinsert {
    --gi-tile: 110px;
    --gi-gap: 6px;
  }

  .galleryinsert-overlay button {
    width: 2em;
    height: 2em;
    font-size: 1.1em;
  }

  .galleryinsert-overlay .gi-close {
    top: 10px;
    right: 10px;
  }

  .galleryinsert-overlay .gi-prev {
    left: 8px;
  }

  .galleryinsert-overlay .gi-next {
    right: 8px;
  }
}
