/* Conteneur grille — override sur le .grid global (style.css est bundlé via django-compressor) */
.grid {
  margin: 20px 15px !important;
  padding: 0 !important;
  max-width: 1600px;
}
@media (min-width: 1630px) {
  .grid { margin-left: auto !important; margin-right: auto !important; }
}

/* Item — override la largeur fixe 300px du bundle */
/* padding-bottom : inclus dans outerHeight mesuré par Masonry → espacement vertical entre items.
   (les margins sont ignorées en position: absolute) */
.grid-item {
  width: calc((100% - 30px) / 4) !important;
  margin-bottom: 0 !important;
  padding-bottom: 15px;
  position: relative;
}

/* Image — override max-height: 600px du bundle */
.grid-item img {
  width: 100%;
  height: auto;
  max-height: none !important;
  image-orientation: from-image;
  transform: rotate(0deg);
}

.grid-item picture {
  display: block;
  width: 100%;
}

/* Responsive : nombre de colonnes selon le viewport */
@media (max-width: 1199px) {
  .grid-item { width: calc((100% - 20px) / 3) !important; }
}
@media (max-width: 767px) {
  .grid-item { width: calc((100% - 10px) / 2) !important; }
}
@media (max-width: 479px) {
  .grid-item { width: 100% !important; }
}

/* Forcer l'orientation EXIF sur mobile (workaround Safari/iOS) */
@media (max-width: 768px) {
  .grid-item img {
    image-orientation: from-image;
    transform: rotate(0deg) !important;
  }
}

/* Indicateurs infinite scroll */
#loading-indicator,
#no-more-photos {
  display: none;
  text-align: center;
  padding: 20px;
}

#no-more-photos {
  color: #888;
}

/* Indicateur génération images dans la grille */
.grid-item-status {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  pointer-events: none;
}
