/* Visor de imágenes con zoom (static/js/ubi-visor.js). Fondo oscuro en los
   dos temas: la imagen manda; sin backdrop-filter (STYLEGUIDE §2). */
.ubi-visor {
  position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15,23,42,.88); overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; animation: ubiVisorIn .18s ease both;
}
.ubi-visor[hidden] { display: none; }
.ubi-visor.is-cerrando { animation: ubiVisorOut .15s ease both; pointer-events: none; }
html.dark .ubi-visor { background: rgba(10,14,22,.9); }
html.ubi-visor-on, html.ubi-visor-on body { overflow: hidden; }

.ubi-visor-img {
  display: block; max-width: 100%; max-height: 100%; border-radius: 12px; transform-origin: 0 0;
  box-shadow: 0 20px 60px rgba(15,23,42,.45); cursor: zoom-in; opacity: 0; will-change: transform;
  -webkit-user-drag: none;
}
.ubi-visor-img.is-ok { opacity: 1; animation: ubiVisorImg .22s cubic-bezier(.16,1,.3,1); }
.ubi-visor-img.is-anim { transition: transform .26s cubic-bezier(.16,1,.3,1); }
.ubi-visor.is-zoom .ubi-visor-img { cursor: grab; border-radius: 0; }
.ubi-visor.is-arrastrando .ubi-visor-img { cursor: grabbing; }

.ubi-visor-x {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 1; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: rgba(15,23,42,.62); color: #c4cbd6;
  cursor: pointer; transition: background-color .15s, transform .1s;
}
.ubi-visor-x:hover { background: rgba(30,37,51,.92); }
.ubi-visor-x:active { transform: scale(.94); }
.ubi-visor-x:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(55,169,251,.55); }

/* Mientras carga: spinner centrado (la imagen anterior ya no se ve) */
.ubi-visor-spin {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 999px;
  border: 3px solid rgba(238,241,246,.85); border-right-color: transparent; opacity: 0; pointer-events: none;
  animation: ubiVisorGiro .7s linear infinite;
}
.ubi-visor.is-cargando .ubi-visor-spin { opacity: 1; transition: opacity .15s .12s; }

@keyframes ubiVisorIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes ubiVisorOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes ubiVisorImg { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ubiVisorGiro { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .ubi-visor { padding: 12px; } }
@media (prefers-reduced-motion: reduce) {
  .ubi-visor, .ubi-visor.is-cerrando, .ubi-visor-img.is-ok { animation: none; }
  .ubi-visor-img.is-anim { transition: none; }
}
