/* ============================================================
   PISOS ELITE — GALERIA RESPONSIVA
   Versão 2.0
   ============================================================ */


/* ============================================================
   1. SEÇÃO PRINCIPAL
   ============================================================ */

.secao-galeria {
  position: relative;
  overflow: visible;
  padding-bottom: 80px;
}

#portfolio-section {
  background: #ffffff;
  padding: 40px 16px;
}


/* ============================================================
   2. FILTROS
   ============================================================ */

#filtros {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

#filtros button {
  appearance: none;
  background: #ffffff;
  border: 2px solid #d4af37;
  color: #111111;
  font: inherit;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;

  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease;
}

#filtros button:hover {
  background: #d4af37;
  color: #ffffff;
  transform: translateY(-1px);
}

#filtros button.ativo {
  background: #d4af37;
  border-color: #d4af37;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

#filtros button:focus-visible {
  outline: 3px solid rgba(212, 175, 55, 0.45);
  outline-offset: 3px;
}


/* ============================================================
   3. GRID DA GALERIA
   ============================================================ */

.galeria-grid,
.galeria-feed {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.galeria-feed {
  overflow: hidden;
}

/* Libera espaço quando um vídeo entra no modo cinema */
.galeria-feed.expanded-mode {
  overflow: visible;
}


/* ============================================================
   4. CARDS
   ============================================================ */

.galeria-item {
  position: relative;
  min-width: 0;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    opacity 0.35s ease,
    filter 0.35s ease;
}

.galeria-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}


/* ============================================================
   5. IMAGENS, MINIATURAS E VÍDEOS
   ============================================================ */

.galeria-item .video-wrap,
.galeria-item > img,
.galeria-item img,
.galeria-item video {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  border-radius: 16px;
}

.galeria-item img,
.galeria-item video {
  height: auto;
}

.video-wrap {
  position: relative;
  background: #000000;
  overflow: hidden;
}

/* Fade do vídeo controlado pelo JavaScript */
.galeria-item.video video {
  transition: opacity 0.35s ease;
}


/* ============================================================
   6. TÍTULO DOS CARDS
   ============================================================ */

.galeria-item .titulo {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;

  padding: 26px 10px 9px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82),
    rgba(0, 0, 0, 0)
  );

  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);

  pointer-events: none;
}


/* ============================================================
   7. BOTÃO DE REPRODUÇÃO
   ============================================================ */

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;

  width: 60px;
  height: 60px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  transform: translate(-50%, -50%);

  background: rgba(212, 175, 55, 0.92);
  border: 0;
  border-radius: 50%;

  color: #ffffff;
  font-size: 24px;
  line-height: 1;

  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);

  transition:
    transform 0.3s ease,
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

.play-overlay:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #bfa034;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.3);
}

.play-overlay:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}


/* ============================================================
   8. CARREGAMENTO DOS VÍDEOS
   ============================================================ */

.video-wrap .loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;

  display: grid;
  place-items: center;

  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(1px);

  animation: overlayFade 0.25s ease both;
}

.loading-overlay .ring {
  width: 44px;
  height: 44px;

  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #d4af37;
  border-radius: 50%;

  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  animation: ringSpin 0.8s linear infinite;
}

.video-wrap.loading {
  box-shadow: 0 10px 26px rgba(212, 175, 55, 0.35);
}

@keyframes overlayFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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


/* ============================================================
   9. MODO CINEMA INLINE
   ============================================================ */

/* Cards que não estão ativos ficam discretos */
.galeria-feed.expanded-mode .galeria-item:not(.expanded) {
  opacity: 0.4;
  filter: blur(1px);
}

/* Vídeo ativo ocupa toda a largura do grid */
.galeria-item.expanded {
  grid-column: 1 / -1;
  z-index: 10;

  background: #000000;
  border-radius: 18px;

  transform: scale(1.04);
  box-shadow: 0 50px 60px rgba(0, 0, 0, 0.45);

  transition:
    transform 0.45s ease,
    box-shadow 0.45s ease;
}

.galeria-item.expanded .video-wrap {
  width: 100%;
  height: 78vh;
  max-height: 820px;

  aspect-ratio: 9 / 16;
  background: #000000;
  border-radius: 18px;
  overflow: hidden;
}

.galeria-item.expanded video {
  width: 100%;
  height: 100%;

  aspect-ratio: auto;
  object-fit: cover;
  display: block;
  border-radius: 18px;
}

/* O título não cobre o vídeo durante a reprodução */
.galeria-item.expanded .titulo {
  opacity: 0;
}


/* ============================================================
   10. LIGHTBOX
   Mantido para possível uso com imagens no futuro
   ============================================================ */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;

  transition: opacity 0.28s ease;
}

#lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

body.no-scroll {
  overflow: hidden;
}

.lightbox-media-wrap {
  max-width: 96vw;
  max-height: 90vh;

  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: 90vh;

  object-fit: contain;
  border-radius: 14px;

  opacity: 0;
  transform: scale(0.96);

  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);

  transition:
    transform 0.28s ease,
    opacity 0.28s ease;
}

#lightbox.active .lightbox-img {
  opacity: 1;
  transform: scale(1);
  animation: fadeInLightbox 0.35s ease forwards;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;

  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.55);
  border: 0;
  border-radius: 50%;

  color: #d4af37;
  font-size: 32px;
  line-height: 1;

  cursor: pointer;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.35);

  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.lightbox-close:hover {
  background: rgba(212, 175, 55, 0.92);
  color: #111111;
  transform: rotate(90deg);
}

.lightbox-close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

@keyframes fadeInLightbox {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}


/* ============================================================
   11. MENSAGENS DE CARREGAMENTO E ERRO
   ============================================================ */

.galeria-feed .loading,
.galeria-feed .erro,
.galeria-feed > p {
  grid-column: 1 / -1;
  padding: 24px 16px;

  color: #555555;
  text-align: center;
}

.galeria-feed .erro {
  color: #9b1c1c;
}


/* ============================================================
   12. RESPONSIVIDADE
   ============================================================ */

/* Celulares */
@media (max-width: 767px) {
  #filtros {
    gap: 8px;
    margin-bottom: 24px;
  }

  #filtros button {
    padding: 9px 15px;
    font-size: 0.9rem;
  }

  .galeria-feed,
  .galeria-grid {
    grid-template-columns: 1fr;
  }

  .galeria-item.expanded {
    transform: none;
  }

  .galeria-item.expanded .video-wrap {
    height: 70vh;
    max-height: none;
  }

  .galeria-feed.expanded-mode .galeria-item:not(.expanded) {
    opacity: 0.6;
    filter: none;
  }

  .play-overlay {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1023px) {
  .galeria-feed,
  .galeria-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Computadores */
@media (min-width: 1024px) {
  .galeria-feed,
  .galeria-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* ============================================================
   13. ACESSIBILIDADE E REDUÇÃO DE MOVIMENTO
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .galeria-item,
  .galeria-item img,
  .galeria-item video,
  .play-overlay,
  #lightbox,
  .lightbox-img,
  .lightbox-close {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .loading-overlay .ring {
    animation-duration: 1.5s;
  }
}