/* image-viewer.css — Visor fullscreen de imagen (producto y tienda)
 *
 * Compartido vía _head.ejs. Los overlays de las páginas lo usan:
 *   - /producto/:slug (galería principal + botón fullscreen al hover)
 *   - /tienda/:slug  (clic en la imagen de una tarjeta de producto)
 */

/* ═══ VISOR FULLSCREEN DE IMAGEN ═══ */
.pd-image-viewer {
  position: fixed; inset: 0; z-index: 400;
  display: none;
  align-items: center; justify-content: center;
  /* Edge-to-edge: respeta los insets seguros para que la barra de gestos del
   * teléfono no tape los controles de zoom/cerrar del visor. */
  padding: calc(var(--sat, env(safe-area-inset-top, 0px))) calc(env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px)) calc(env(safe-area-inset-left, 0px));
  background: rgba(4,4,6,0.94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.pd-image-viewer.open { display: flex; animation: fadeIn 0.2s ease; }
.pd-viewer-stage {
  position: relative;
  max-width: 92vw; max-height: 88vh;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.pd-viewer-stage:active { cursor: grabbing; }
.pd-viewer-stage img {
  display: block;
  max-width: 92vw; max-height: 88vh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
}
.pd-viewer-close {
  position: absolute; top: calc(18px + var(--sat, env(safe-area-inset-top, 0px))); right: calc(18px + env(safe-area-inset-right, 0px)); z-index: 5;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-light);
  background: rgba(24,24,27,0.8); color: var(--text);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.pd-viewer-close:hover { background: var(--purple); border-color: var(--purple); transform: rotate(90deg); }
.pd-viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--border-light);
  background: rgba(24,24,27,0.8); color: var(--text);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.pd-viewer-nav:hover { background: var(--purple); border-color: var(--purple); }
.pd-viewer-nav.prev { left: 18px; }
.pd-viewer-nav.next { right: 18px; }
.pd-viewer-zoom {
  position: absolute; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 100px;
  background: rgba(24,24,27,0.85);
  border: 1px solid var(--border);
}
.pd-viewer-zoom button {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-secondary);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.pd-viewer-zoom button:hover { background: var(--white-10); color: var(--text); }
.pd-viewer-zoom span {
  min-width: 48px; text-align: center;
  font-size: 12px; color: var(--text-muted); font-family: monospace;
}
.pd-viewer-hint {
  position: absolute; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,0.95);
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 7px 16px; border-radius: 100px;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  pointer-events: none; white-space: nowrap;
}
@media (max-width: 640px) {
  .pd-viewer-nav { width: 40px; height: 40px; }
  .pd-viewer-nav.prev { left: 10px; }
  .pd-viewer-nav.next { right: 10px; }
  .pd-viewer-close { top: calc(12px + var(--sat, env(safe-area-inset-top, 0px))); right: calc(12px + env(safe-area-inset-right, 0px)); width: 40px; height: 40px; }
  .pd-viewer-zoom { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .pd-viewer-hint { display: none; }
}

/* ═══ Botón fullscreen de la galería de producto (hover) ═══ */
.pd-fullscreen-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,10,0.55);
  color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
  z-index: 4;
}
.pd-fullscreen-btn svg { width: 24px; height: 24px; }
.pd-gallery-main:hover .pd-fullscreen-btn,
.pd-gallery-main:focus-within .pd-fullscreen-btn,
.pd-fullscreen-btn.show {
  opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1);
}
.pd-fullscreen-btn:hover { background: rgba(var(--purple-rgb),0.75); }
.pd-fullscreen-btn:active { transform: translate(-50%, -50%) scale(0.92); }

/* Cursor zoom-in en las imágenes de las tarjetas de la tienda */
#tienda-grid .product-card .product-image img { cursor: zoom-in; }

@media (prefers-reduced-motion: reduce) {
  .pd-image-viewer.open { animation: none; }
  .pd-fullscreen-btn, .pd-viewer-close, .pd-viewer-nav, .pd-viewer-zoom button { transition: none; }
}
