/* ==============================================
   GALLERY ZOOM — Caixa Kennel
   Arquivo: /assets/css/gallery-zoom.css

   Regras para:
   - Lightbox (#gz-overlay)
   - Botão de zoom dentro dos modais (.gz-zoom-btn)
   Não altera nenhum seletor existente do projeto.
   ============================================== */

/* ────────────────────────────────────────────
   Lightbox overlay
──────────────────────────────────────────── */
#gz-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;     /* max CSS z-index — vence qualquer stacking context */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Escondido por padrão */
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

#gz-overlay.gz-visible {
  opacity: 1;
  pointer-events: all;
}

.gz-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
}

/* ────────────────────────────────────────────
   Stage (contém a imagem)
──────────────────────────────────────────── */
.gz-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

.gz-img {
  max-width: 90vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 0;
  transform-origin: center center;
  transition: transform 120ms ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  /* pointer-events e cursor APENAS quando o lightbox está visível */
  pointer-events: none;
  cursor: default;
}

#gz-overlay.gz-visible .gz-img {
  pointer-events: auto;
  cursor: zoom-in;
}

/* ────────────────────────────────────────────
   Botão fechar
──────────────────────────────────────────── */
.gz-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.gz-close:hover  { background: rgba(196, 0, 0, 0.80); border-color: #C40000; }
.gz-close:focus-visible {
  outline: 2px solid rgba(255,255,255,.6);
  outline-offset: 2px;
}

/* ────────────────────────────────────────────
   Navegação (anterior / próxima)
──────────────────────────────────────────── */
.gz-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.gz-prev { left: 10px; }
.gz-next { right: 10px; }

.gz-nav:hover  { background: rgba(255, 255, 255, 0.20); }
.gz-nav:focus-visible {
  outline: 2px solid rgba(255,255,255,.6);
  outline-offset: 2px;
}

/* ────────────────────────────────────────────
   Contador de fotos
──────────────────────────────────────────── */
.gz-counter {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
  font-family: var(--font-body, sans-serif);
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Hint / dica
──────────────────────────────────────────── */
.gz-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.75rem;
  font-family: var(--font-body, sans-serif);
  pointer-events: none;
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Botão zoom dentro dos modais (.gz-zoom-btn)
──────────────────────────────────────────── */
.gz-zoom-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 11;    /* acima do product-number-large (z-dropdown = 10) */
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0;
  color: #000;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

/* Mostrar ao hover no wrapper pai */
.produtos-gallery-main:hover .gz-zoom-btn,
.product-modal-image:hover .gz-zoom-btn {
  opacity: 1;
}

/* Sempre visível em touch (sem hover) */
@media (hover: none) {
  .gz-zoom-btn { opacity: 1; }
}

.gz-zoom-btn:hover  { background: #fff; }
.gz-zoom-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--color-primary, #C40000);
  outline-offset: 2px;
}

/* ────────────────────────────────────────────
   Mobile adaptações do lightbox
──────────────────────────────────────────── */
@media (max-width: 640px) {
  .gz-img {
    max-width: 96vw;
    max-height: 80vh;
  }

  .gz-nav {
    width: 40px;
    height: 52px;
  }

  .gz-prev { left: 4px; }
  .gz-next { right: 4px; }

  .gz-hint { display: none; }
}

/* ────────────────────────────────────────────
   Reduzir animações
──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #gz-overlay { transition: none; }
  .gz-img     { transition: none; }
  .gz-close,
  .gz-nav,
  .gz-zoom-btn { transition: none; }
}

/* ────────────────────────────────────────────
   Galeria de thumbs nos modais
   (usados tanto na home quanto em /produtos/)
   Classes espelhadas de produtos.css para que
   a home carregue apenas gallery-zoom.css
──────────────────────────────────────────── */
.produtos-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.produtos-gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .08);
  overflow: hidden;
}

.produtos-gallery-main img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
}

.produtos-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.produtos-thumb {
  border: 2px solid rgba(0, 0, 0, .08);
  border-radius: 0;
  background: #fff;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 8px;
  cursor: pointer;
  transition: border-color var(--transition-fast, 150ms ease),
              transform var(--transition-fast, 150ms ease),
              box-shadow var(--transition-fast, 150ms ease);
}

.produtos-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.produtos-thumb:hover { transform: translateY(-1px); }

.produtos-thumb[aria-current="true"] {
  border-color: var(--color-primary, #C40000);
  box-shadow: 0 0 0 3px rgba(196, 0, 0, .12);
}

@media (max-width: 480px) {
  .produtos-thumbs { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 420px) {
  .produtos-thumb { transition: none !important; }
}

/* Ajuste de gap quando galeria está dentro do modal da home */
.product-modal-content.produtos-modal {
  gap: var(--spacing-lg, 24px);
}
