/* Lightbox moderno para Insorock.es — estilos del visor de imágenes */

:root {
  --ilb-accent: #48a9cc;
}

/* Bloquea el scroll de fondo mientras el visor está abierto */
html.ilb-open,
html.ilb-open body {
  overflow: hidden;
}

.ilb-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 20, 30, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  box-sizing: border-box;
}

.ilb-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.ilb-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.ilb-img {
  display: block;
  /* Reserva ~84px de margen a cada lado para que la imagen nunca invada
     la zona de las flechas al estrechar la ventana */
  max-width: min(calc(100vw - 168px), 1200px);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  background: #0d1c28;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.ilb-overlay.is-visible .ilb-img {
  transform: scale(1);
  opacity: 1;
}

.ilb-overlay.is-loading .ilb-img {
  opacity: 0;
}

.ilb-caption {
  margin-top: 14px;
  max-width: min(92vw, 900px);
  color: #f2f6f8;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.ilb-counter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #cfe6ef;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

/* Botones (cerrar / anterior / siguiente) */
.ilb-btn {
  position: absolute;
  z-index: 2; /* siempre por encima de la imagen */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ilb-btn:hover,
.ilb-btn:focus-visible {
  background: var(--ilb-accent);
  color: #fff;
  outline: none;
}

.ilb-btn:active {
  transform: scale(0.92);
}

.ilb-close {
  top: 16px;
  right: 16px;
}

.ilb-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.ilb-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.ilb-prev:active,
.ilb-next:active {
  transform: translateY(-50%) scale(0.92);
}

/* Indicador de carga */
.ilb-spinner {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--ilb-accent);
  animation: ilb-spin 0.8s linear infinite;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.ilb-overlay.is-loading .ilb-spinner {
  opacity: 1;
}

@keyframes ilb-spin {
  to { transform: rotate(360deg); }
}

/* Móvil: botones más compactos y pegados a los bordes */
@media (max-width: 600px) {
  .ilb-overlay { padding: 12px; }

  .ilb-img {
    /* Reserva ~58px a cada lado para las flechas compactas de móvil */
    max-width: calc(100vw - 116px);
    max-height: 78vh;
  }

  .ilb-btn {
    width: 42px;
    height: 42px;
  }

  .ilb-prev { left: 6px; }
  .ilb-next { right: 6px; }
  .ilb-close { top: 10px; right: 10px; }
  .ilb-caption { font-size: 14px; }
}

/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .ilb-overlay,
  .ilb-img { transition: opacity 0.15s ease; }
  .ilb-img { transform: none; }
  .ilb-spinner { animation-duration: 1.4s; }
}
