/* ============================================================
   LOS CARTELES — la ventana flotante

   Sale delante de todo al abrir la aplicación, en computadora y en
   teléfono. Es la MISMA ventana en los dos: en pantalla grande se queda
   en 520px de ancho y centrada; en el teléfono ocupa el ancho con un
   margen para que se vea que es una ventana y no una página.

   La imagen se enseña ENTERA (object-fit: contain): un cartel recortado
   puede perder justo el texto que importa. Cualquier proporción cabe;
   la ventana se ajusta a ella y nunca pasa del alto de la pantalla.

   Sin sombras y sin franjas de color, como el resto del proyecto. Por
   debajo del aviso a clientes (9990): si los dos coincidieran, el aviso
   manda, y de todas formas el módulo espera a que se cierre.
============================================================ */

html.ctl-abierto,
html.ctl-abierto body { overflow: hidden; }

.ctl-fondo {
  position: fixed;
  inset: 0;
  z-index: 9985;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(20, 29, 28, .74);
  animation: ctl-entra-fondo .22s ease-out;
}

.ctl-ventana {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  border-radius: 16px;
  background: var(--c-surface, #fff);
  overflow: hidden;
  animation: ctl-entra-ventana .26s cubic-bezier(.16, 1, .3, 1);
}

/* Todas las láminas en la misma celda: la ventana mide lo que la más
   alta y no salta al pasar de una a otra. */
.ctl-marco {
  position: relative;
  display: grid;
  min-height: 0;
  background: var(--c-bg, #f3f3f3);
}
.ctl-lamina {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}
.ctl-lamina.esta-visible {
  opacity: 1;
  visibility: visible;
}
.ctl-lamina.tiene-enlace { cursor: pointer; }
.ctl-lamina img {
  display: block;
  width: 100%;
  height: auto;
  /* Deja sitio a los puntos y al margen de la ventana. */
  max-height: calc(100dvh - 96px);
  object-fit: contain;
}

/* La equis, siempre legible encima de cualquier imagen: círculo oscuro
   y trazo blanco. 40px, que se toca con el dedo sin apuntar. */
.ctl-cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 29, 28, .78);
  color: #fff;
  cursor: pointer;
}
.ctl-cerrar svg { width: 20px; height: 20px; }
.ctl-cerrar:hover { background: rgba(20, 29, 28, .92); }
.ctl-cerrar:focus-visible { outline: 2px solid var(--c-accent, #8fc72e); outline-offset: 2px; }

.ctl-flecha {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 29, 28, .62);
  color: #fff;
  cursor: pointer;
}
.ctl-flecha svg { width: 20px; height: 20px; }
.ctl-flecha:hover { background: rgba(20, 29, 28, .85); }
.ctl-flecha-izq { left: 10px; }
.ctl-flecha-der { right: 10px; }

/* Los puntos van DEBAJO de la imagen, no encima: sobre un cartel claro
   o con texto abajo se perderían. */
.ctl-puntos {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  background: var(--c-surface, #fff);
}
.ctl-punto {
  width: 24px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--c-border, #dcdcdc);
  cursor: pointer;
}
.ctl-punto.esta-activo { background: var(--c-accent, #8fc72e); }

@keyframes ctl-entra-fondo {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ctl-entra-ventana {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ctl-fondo,
  .ctl-ventana { animation: none; }
  .ctl-lamina { transition: none; }
}

/* En el teléfono: más ancho útil y los controles un poco más grandes. */
@media (max-width: 768px) {
  .ctl-fondo { padding: 12px; }
  .ctl-ventana {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 14px;
  }
  .ctl-lamina img { max-height: calc(100dvh - 84px); }
  .ctl-cerrar { width: 44px; height: 44px; }
}
