/* Pièce jointe du composer : le bouton 📎, la puce, sa miniature et
   l'aperçu plein écran (v1.70.0). Un nom de photo ne dit rien
   (IMG_20260826.jpg) — la vignette, si.
   Fichier séparé : app.css est au ras de son cliquet (test_static_size_guard). */

#attach {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
@media (hover: hover) {
  #attach:hover { border-color: var(--accent); background: var(--accent-soft); }
}
#attach.busy { animation: pulse 1.3s ease-in-out infinite; cursor: default; }

#attachment-chip {
  max-width: 680px;
  margin: 0 auto 0.4rem;
  width: fit-content;
  display: none;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
}
#attachment-chip.visible { display: flex; }
/* Refus d'upload : le message du serveur s'affiche là où le
   fichier serait apparu, plutôt qu'un ⚠️ sans explication. */
#attachment-chip.error {
  max-width: 90vw;
  color: var(--danger, #c0392b);
  border-color: var(--danger, #c0392b);
  white-space: normal;
  text-align: left;
}
#attachment-chip button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.2rem;
}
/* La miniature : voir CE qu'on a joint, pas seulement son nom — une photo
   prise au téléphone porte un nom qui ne dit rien (IMG_20260826.jpg). */
#attachment-preview {
  padding: 0;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  flex: none;
}
#attachment-preview[hidden] { display: none; }
#attachment-thumb {
  display: block;
  width: 44px;   /* la cible tactile de 44 px de l'audit mobile */
  height: 44px;
  object-fit: cover;
  background: var(--bg);
}
@media (hover: hover) {
  #attachment-preview:hover { outline: 2px solid var(--accent); }
}

/* Aperçu plein écran : le dialog générique est une carte ; celui-ci
   n'est qu'une image posée sur le noir. */
#image-dialog {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  width: auto;
  max-width: 100vw;
  max-height: 100vh;
}
#image-dialog::backdrop { background: rgba(10, 10, 8, 0.85); backdrop-filter: blur(3px); }
#image-preview {
  display: block;
  max-width: 94vw;
  /* dvh : sur mobile la barre d'URL rétractable fausse vh et rogne l'image. */
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-out;
}
@media (hover: hover) {
  #attachment-chip button:hover { color: var(--text); }
}
