/* Modal Advert — componente de la biblioteca-secciones. */
.modal-advert {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  /* `safe center`: centra si cabe, y si no cabe NO recorta por arriba al hacer scroll */
  align-items: safe center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
  /* Punto de partida del fundido. Mientras corre el retardo el modal ya está */
  visibility: hidden;
  opacity: 0;
}
.modal-advert.activo {
  display: flex;
  animation: modal-advert-entrada var(--advert-fundido, 2s)
    var(--advert-retardo, 3s) forwards;
}
@keyframes modal-advert-entrada {
  from {
    visibility: visible;
    opacity: 0;
  }
  to {
    visibility: visible;
    opacity: 1;
  }
}
/* Salida: va DESPUÉS de .activo para ganarle el `animation` a igual especificidad */
.modal-advert.activo.cerrando {
  animation: modal-advert-salida var(--advert-fundido-salida, 0.4s) forwards;
}
@keyframes modal-advert-salida {
  from {
    visibility: visible;
    opacity: 1;
  }
  to {
    visibility: visible;
    opacity: 0;
  }
}
/* --advert-alto-max: ponlo en `none` si la promo es un cartel vertical largo (se lee con scroll) */
.modal-advert__contenido {
  position: relative;
  max-width: 90%;
  max-height: var(--advert-alto-max, 85dvh);
}
.modal-advert__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: var(--advert-alto-max, 85dvh);
  object-fit: contain;
  border-radius: var(--border-radius);
}
.modal-advert__cerrar {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: var(--color-primario);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--sombra);
}
