/* ASCII Reveal Gallery – Frontend v2 */

/* ── Quitar padding de Elementor para full-width ─────────────────*/
.elementor-widget-shortcode .elementor-widget-container,
.elementor-widget-shortcode .elementor-shortcode {
  padding: 0 !important;
  margin:  0 !important;
}

/* ── Galería ─────────────────────────────────────────────────────*/
.asc-gallery {
  width: 100%;
  background: var(--bg, #111);
  padding: var(--pad, 24px);
  display: grid;
  grid-template-columns: repeat(var(--cols-d, 8), 1fr);
  gap: var(--gap, 24px);
  box-sizing: border-box;
  /* Filas de altura igual (misma relación 4:5 que los items) */
  grid-auto-rows: auto;
}

/* Mobile: grid auto-placement (posiciones dispersas solo se aplican en desktop via @media en PHP) */
@media (max-width: 768px) {
  .asc-gallery {
    grid-template-columns: repeat(var(--cols-m, 2), 1fr) !important;
  }
}

/* ── Item ────────────────────────────────────────────────────────*/
.asc-item {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg, #111);
  cursor: pointer;
}

/* Imagen real (oculta hasta el reveal) */
.asc-item .asc-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  transition: transform 0.4s ease, filter 0.3s ease;
}
.asc-item:hover .asc-img {
  transform: scale(1.03);
  filter: brightness(1.05);
}

/* Canvas ASCII */
.asc-item canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* Estado revealed */
.asc-item.revealed canvas  { display: none; }
.asc-item.revealed .asc-img { display: block; }

/* Cursor en revealed */
.asc-item.revealed { cursor: zoom-in; }

/* ══════════════════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════════════════ */
.asc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.asc-lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.asc-lb-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.asc-lb-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 88vh;
}

.asc-lb-img {
  max-width:  90vw;
  max-height: 88vh;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: 2px;
  position: relative;
  z-index: 1;
}
.asc-lb-img.loaded { opacity: 1; }

.asc-lb-loader {
  position: absolute;
  width: 30px; height: 30px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: rgba(255,255,255,.8);
  border-radius: 50%;
  animation: asc-spin .7s linear infinite;
  opacity: 0;
  transition: opacity .2s;
  z-index: 2;
}
.asc-lb-loader.show { opacity: 1; }
@keyframes asc-spin { to { transform: rotate(360deg); } }

/* Botones nav */
.asc-lb-close,
.asc-lb-prev,
.asc-lb-next {
  position: absolute;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  line-height: 1;
  padding: 8px 12px;
  transition: color .2s;
  font-family: sans-serif;
}
.asc-lb-close:hover,
.asc-lb-prev:hover,
.asc-lb-next:hover { color: #fff; }

.asc-lb-close { top: 20px; right: 20px; font-size: 26px; }
.asc-lb-prev  { left: 16px;  top: 50%; transform: translateY(-50%); font-size: 56px; }
.asc-lb-next  { right: 16px; top: 50%; transform: translateY(-50%); font-size: 56px; }

.asc-lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.4);
  font-size: 12px;
  font-family: monospace;
  letter-spacing: .1em;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 768px) {
  .asc-lb-prev  { left: 6px;  font-size: 40px; }
  .asc-lb-next  { right: 6px; font-size: 40px; }
}
