/* 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;
}

/* ---------------------------------------------------------------------------
 * Bouton flottant « Ajouter une photo » (motif Pinterest)
 *
 * ⚠️ EN BAS À DROITE, et non plus en haut. L'ancien (`.upload-btn-wrapper`)
 * était calé sur `top: 90px` / `60px` en mobile — des valeurs héritées de la
 * navbar FIXE de 60px supprimée en 2026-08. Depuis, l'en-tête est une carte
 * dans le flux qui descend jusqu'à 94px (78 en mobile) : le bouton la
 * RECOUVRAIT, et son empilement le faisait passer DERRIÈRE elle, incliquable.
 * En bas, il ne peut plus entrer en conflit avec l'en-tête, quelle que soit
 * l'évolution de sa hauteur.
 *
 * Un lien et non un bouton piloté en JS : il marche sans script, s'ouvre au
 * clic du milieu, et n'a pas besoin d'être re-câblé après les swaps HTMX du
 * conteneur de photos (ce que l'ancien `onclick` exigeait).
 * ------------------------------------------------------------------------ */
.photo-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  /* Sous les toasts (1080) : un toast qui passe par-dessus quelques secondes
     est le comportement attendu, l'inverse masquerait l'information. */
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--vefa-accent, #ff4000);
  color: var(--vefa-text-on-primary);
  font-size: 22px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24), 0 2px 4px rgba(15, 23, 42, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.photo-fab:hover,
.photo-fab:focus-visible {
  background: var(--vefa-accent-dark, #d93600);
  color: var(--vefa-text-on-primary);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.3), 0 3px 6px rgba(15, 23, 42, 0.14);
}

.photo-fab:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .photo-fab,
  .photo-fab:hover,
  .photo-fab:focus-visible {
    transition: none;
    transform: none;
  }
}

/* Mobile : dégager la barre du bas (65px, `mobile_bottom_nav.css`).
   ⚠️ Décalage INCONDITIONNEL alors que cette barre n'existe que pour les
   CONNECTÉS : une feuille de page ne peut pas lire l'état de connexion, et le
   seul coût pour un anonyme est un bouton qui flotte 65px plus haut. L'erreur
   inverse — le bouton à moitié caché derrière la barre — serait un vrai défaut. */
@media (max-width: 767px) {
  .photo-fab {
    right: 16px;
    bottom: calc(65px + 16px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
    font-size: 20px;
  }
}
