/* ══════════════════════════════════════════
   LIGHTBOX — FULLSCREEN PREMIUM
   v2 — Galerías por sección + modo single
   Usado en: espacios.php, tipologias.php
══════════════════════════════════════════ */

.lb {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10,10,10,0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, background 0.4s ease;
}

.lb.lb--open {
  opacity: 1;
  pointer-events: all;
  background: rgba(10,10,10,0.96);
}

/* Imagen principal */
.lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 8rem;
}

.lb-img-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img {
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  object-fit: contain;
  display: block;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.lb-img.lb-img--loaded {
  opacity: 1;
  transform: scale(1);
}

/* Loader */
.lb-loader {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(200,169,126,0.2);
  border-top-color: var(--dorado);
  border-radius: 50%;
  animation: lbSpin 0.8s linear infinite;
}

@keyframes lbSpin { to { transform: rotate(360deg); } }

/* Barra superior */
.lb-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 10;
}

.lb-brand {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(244,241,236,0.35);
}

.lb-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: rgba(244,241,236,0.4);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.lb-counter span {
  color: var(--dorado);
}

.lb-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: rgba(244,241,236,0.5);
  transition: color 0.2s ease;
  padding: 0;
}

.lb-close:hover { color: var(--crema); }

.lb-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* Flechas de navegación */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(28,28,28,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(200,169,126,0.15);
  cursor: pointer;
  color: var(--crema-dim);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.lb-nav:hover {
  background: rgba(200,169,126,0.15);
  border-color: rgba(200,169,126,0.4);
  color: var(--dorado);
}

.lb-nav svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.lb-prev {
  left: 2rem;
  transform: translateY(-50%);
}

.lb-prev:hover { transform: translateY(-50%) translateX(-2px); }

.lb-next {
  right: 2rem;
  transform: translateY(-50%);
}

.lb-next:hover { transform: translateY(-50%) translateX(2px); }

/* Barra inferior — caption + thumbnails */
.lb-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.5rem 2.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  z-index: 10;
}

.lb-caption {
  flex: 1;
}

.lb-caption-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--crema);
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.lb-caption-sub {
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dorado-dim);
}

/* Thumbnails strip */
.lb-thumbs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lb-thumb {
  width: 52px;
  height: 38px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lb-thumb:hover { opacity: 0.7; }
.lb-thumb.lb-thumb--active {
  opacity: 1;
  border-color: var(--dorado);
}

/* Hint ESC */
.lb-hint {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: rgba(184,178,168,0.3);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Swipe indicator en mobile */
.lb-swipe-hint {
  display: none;
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(184,178,168,0.3);
  text-align: center;
}

/* ── Modo single (planos — sin nav/thumbs/counter) ── */
.lb--single .lb-prev,
.lb--single .lb-next,
.lb--single .lb-thumbs,
.lb--single .lb-counter { display: none !important; }
.lb--single .lb-img { max-width: 400px; width: 100%; }
.lb--single .lb-stage { padding: 5rem 2rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .lb-thumbs { display: none; }
  .lb-stage { padding: 5rem 5rem; }
  .lb-prev { left: 1rem; }
  .lb-next { right: 1rem; }
}

@media (max-width: 768px) {
  .lb-stage { padding: 4rem 1rem; }
  .lb-nav { width: 44px; height: 44px; }
  .lb-bottom { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; }
  .lb-hint { display: none; }
  .lb-swipe-hint { display: block; }
}
