/*
 * Plein écran d'une image (page d'un post ou d'une annonce) — core/static/js/plein_ecran.js.
 * Fond sombre, image ENTIÈRE (object-fit: contain), bouton Fermer 44 px sous la bande iPhone.
 */

/* Image de la page : invite à l'agrandir. */
.pd-visual__zoom {
  position: relative; display: block; width: 100%; height: 100%;
  cursor: zoom-in; color: inherit;
}
.pd-visual__zoom:focus-visible { outline: 3px solid #7cc4e0; outline-offset: -3px; }
.pd-visual__loupe {
  position: absolute; right: 10px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 999px;
  background: rgba(8, 20, 28, .72); color: #fff;
  font-size: 12.5px; font-weight: 600; line-height: 1; pointer-events: none;
}
.pd-visual__loupe svg { width: 16px; height: 16px; }

/* Pas de défilement de la page derrière. */
html.pe-ouvert, html.pe-ouvert body { overflow: hidden !important; }

dialog.pe {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(6, 10, 14, var(--pe-fond, .94));
  color: #fff;
  overscroll-behavior: contain;
}
/* Plein écran : passe avant le centrage des <dialog> modales (surcouches_mobile.css). */
html body dialog.pe:modal {
  inset: 0; transform: none; margin: 0 !important;
  width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden;
}
dialog.pe::backdrop { background: rgba(6, 10, 14, .6); }
dialog.pe:focus { outline: none; }

.pe__scene {
  margin: 0; width: 100%; height: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--pwa-offset, 0px) + 64px) 12px max(16px, env(safe-area-inset-bottom));
}
.pe__img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain;
  user-select: none; -webkit-user-select: none;
  transition: transform .2s ease, opacity .2s ease;
}
.pe__img.is-glisse { transition: none; }

.pe__fermer {
  position: absolute; z-index: 1;
  top: calc(var(--pwa-offset, 0px) + 10px);
  right: max(10px, env(safe-area-inset-right));
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .14); color: #fff;
  cursor: pointer;
}
.pe__fermer:hover { background: rgba(255, 255, 255, .26); }
.pe__fermer:focus-visible { outline: 3px solid #7cc4e0; outline-offset: 2px; }
.pe__fermer svg { width: 22px; height: 22px; }

@media (min-width: 768px) {
  .pe__scene { padding: calc(var(--pwa-offset, 0px) + 72px) 32px 32px; }
  .pe__fermer { top: calc(var(--pwa-offset, 0px) + 16px); right: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .pe__img { transition: none; }
}
