/* ── OVERLAY ── */
.preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.preview-modal.activo {
  display: flex;
  animation: fadeOverlay 0.22s ease;
}
@keyframes fadeOverlay {
  from { opacity: 0; } to { opacity: 1; }
}

/* ── PANEL ── */
.preview-modal-inner {
  background: #f7f7f7;
  border-radius: 20px;
  width: 96%;
  max-width: 1600px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.25);
  position: relative;
  animation: slideUp 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
/* Proyectos con portadas cuadradas: modal más estrecho para evitar
   grandes franjas blancas a los lados */
.preview-modal-inner.cuadrado {
  max-width: 760px;
}
@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── HEADER ── */
.preview-titulo-wrap {
  padding: 18px 56px 18px 26px;
  border-bottom: 1px solid #e4e4e4;
  background: #fff;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.preview-titulo {
  font-size: 15px;
  font-weight: 800;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}
.preview-cerrar {
  position: absolute;
  top: 12px;
  right: 14px;
  background: #ebebeb;
  border: none;
  color: #444;
  font-size: 15px;
  cursor: pointer;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s;
  line-height: 1;
}
.preview-cerrar:hover { background: #111; color: #fff; }

/* ── SCROLL ── */
.preview-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: #ccc #f7f7f7;
}
.preview-scroll::-webkit-scrollbar { width: 5px; }
.preview-scroll::-webkit-scrollbar-track { background: #f7f7f7; }
.preview-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── IMAGEN EN SCROLL (sin recorte) ── */
.pv-item {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0;
  overflow: hidden;
  cursor: zoom-in;
  line-height: 0;
}

.pv-img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  /* Cada imagen cabe entera en pantalla sin importar su proporción:
     los banners anchos se limitan por el ancho y las portadas cuadradas
     por el alto */
  max-height: 82vh;
  user-select: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  transition: box-shadow 0.2s;
}
.pv-img:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.14); }

/* ── FOOTER ── */
.preview-footer {
  padding: 14px 24px;
  border-top: 1px solid #e4e4e4;
  display: flex;
  justify-content: center;
  background: #fff;
  flex-shrink: 0;
}
.preview-behance-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  padding: 11px 28px;
  border-radius: 50px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.5px;
}
.preview-behance-btn:visited {
  color: #fff;
}
.preview-behance-btn:hover,
.preview-behance-btn:visited:hover {
  background: #053eff;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5,62,255,0.3);
}
.ver-preview-btn {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── LIGHTBOX ── */
.pv-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.93);
  align-items: center;
  justify-content: center;
  overflow: hidden; /* impide que la imagen salga de la pantalla */
}
.pv-lightbox.activo {
  display: flex;
  animation: fadeOverlay 0.18s ease;
}

#pv-lb-img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 8px;
  cursor: grab;
  transform-origin: center center;
  user-select: none;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}

/* ── BARRA DE CONTROLES DEL LIGHTBOX ── */
.pv-lb-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50px;
  padding: 8px 14px;
  z-index: 100000;
}
.pv-lb-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.pv-lb-btn:hover { background: rgba(255,255,255,0.3); }
.pv-lb-cerrar { font-size: 15px; margin-left: 4px; }
.pv-lb-label {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.5px;
}

@media (max-width: 600px) {
  .preview-modal { padding: 12px; }
  .preview-modal-inner { max-height: 95vh; border-radius: 16px; }
  .preview-titulo { font-size: 13px; }
  #pv-lb-img { max-width: 98vw; max-height: 78vh; }
}
