/**
 * OBRAS GRID POR ARTISTA — Expo Layout
 * Galeria Leme
 *
 * Estilos para o template obras-grid-artista.php
 * Carregado condicionalmente em exposicoes com campo artistas_obras
 * Versao: 1.0
 */

/* =============================================
   CARROSSEL DA VISTA DA EXPOSICAO (Swiper)
   ============================================= */
.expo-slider {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  margin-bottom: 48px;
}

.expo-slider .swiper-slide a {
  display: block;
  width: 100%;
  height: 500px;
  cursor: zoom-in;
}

.expo-slider .swiper-slide img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  display: block;
}

/* Setas — circulos translucidos */
.expo-slider .swiper-button-next,
.expo-slider .swiper-button-prev {
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.expo-slider .swiper-button-next:hover,
.expo-slider .swiper-button-prev:hover {
  background: rgba(0, 0, 0, 0.5);
}

.expo-slider .swiper-button-next::after,
.expo-slider .swiper-button-prev::after {
  font-size: 18px;
}

/* Legenda da foto da vista */
.expo-slider__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.5px;
  line-height: 150%;
}

.expo-slider .swiper-slide {
  position: relative;
}

@media (max-width: 768px) {
  .expo-slider,
  .expo-slider .swiper-slide a,
  .expo-slider .swiper-slide img {
    max-height: 300px;
    height: 300px;
  }

  .expo-slider__caption {
    font-size: 11px;
    padding: 8px 14px;
  }

  .expo-slider .swiper-button-next,
  .expo-slider .swiper-button-prev {
    width: 36px;
    height: 36px;
  }

  .expo-slider .swiper-button-next::after,
  .expo-slider .swiper-button-prev::after {
    font-size: 14px;
  }
}

/* =============================================
   SECAO POR ARTISTA
   ============================================= */
.obras-grid-section {
  margin: 0 0 56px 0;
  padding: 40px 0;
  border-bottom: 1px solid #e7e7e2;
}

.obras-grid-section:last-child {
  border-bottom: none;
}

.obras-grid-section__title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #333;
  margin: 0 0 32px 0;
  padding-bottom: 12px;
  border-bottom: 3px solid #d9ed09;
  display: inline-block;
}

/* =============================================
   GRID RESPONSIVO — 4 cols + Fade-In on Scroll
   ============================================= */
.obras-grid-artista {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}

@media (max-width: 1024px) {
  .obras-grid-artista {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .obras-grid-artista {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .obras-grid-artista {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* =============================================
   CARD DE OBRA
   ============================================= */
.obras-grid-artista__card {
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
}

.obras-grid-artista__card.visible {
  opacity: 1;
  transform: translateY(0);
}

.obras-grid-artista__card.visible:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Container de midia (video ou imagem) */
.obras-grid-artista__media {
  position: relative;
  overflow: hidden;
  background: transparent;
  border-radius: 2px;
  aspect-ratio: 3 / 4;
}

.obras-grid-artista__media > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.3s ease;
}

/* =============================================
   VIDEO EMBED DIRETO (sem facade)
   ============================================= */
.video-embed-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
}

.video-embed-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* =============================================
   VIDEO FACADE — thumbnail + play elegante
   Performance: iframe carrega so no clique
   ============================================= */
.video-facade {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.video-facade img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.4s ease;
}

/* Overlay escuro sutil */
.video-facade::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease;
  pointer-events: none;
}

.video-facade:hover::after {
  background: rgba(0, 0, 0, 0.35);
}

.video-facade:hover img {
  transform: scale(1.03);
}

/* Botao play — circulo fino elegante */
.video-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: none;
  border: none;
  cursor: pointer;
  width: 68px;
  height: 68px;
  padding: 0;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.video-facade:hover .video-facade__play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-facade__play svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Estado carregado: iframe substitui facade */
.video-facade--loaded {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-facade--loaded iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-facade--loaded::after {
  display: none;
}

.video-facade--loaded .video-facade__play {
  display: none;
}

.video-facade--loaded > img {
  display: none;
}

/* =============================================
   FICHA TECNICA — padrao (videos)
   ============================================= */
.obras-grid-artista__info {
  padding: 14px 4px 8px;
}

.obras-grid-artista__info h3 {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #333;
  line-height: 140%;
}

.obras-grid-artista__info h3 span {
  font-weight: 300;
  color: #666;
}

.obras-grid-artista__info p {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: #888;
  line-height: 170%;
  margin: 0;
  letter-spacing: 0.3px;
}

/* =============================================
   OVERLAY COM INFO — so para imagens
   ============================================= */
.obras-grid-artista__card[data-lb-type="image"] {
  position: relative;
  overflow: hidden;
}

.obras-grid-artista__card[data-lb-type="image"] .obras-grid-artista__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 16px;
  background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.7) 60%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.obras-grid-artista__card[data-lb-type="image"]:hover .obras-grid-artista__info {
  opacity: 1;
}

.obras-grid-artista__card[data-lb-type="image"] .obras-grid-artista__info h3 {
  color: #333;
  font-size: 14px;
}

.obras-grid-artista__card[data-lb-type="image"] .obras-grid-artista__info h3 span {
  color: #666;
}

.obras-grid-artista__card[data-lb-type="image"] .obras-grid-artista__info p {
  color: #888;
  font-size: 11px;
}

/* Mobile: overlay sempre visivel (sem hover) */
@media (hover: none) {
  .obras-grid-artista__card[data-lb-type="image"] .obras-grid-artista__info {
    opacity: 1;
  }
}

/* =============================================
   iOS SAFARI FIXES
   ============================================= */

/* Video facade: prevenir selecao ao tocar */
.video-facade {
  -webkit-tap-highlight-color: transparent;
}

/* Hover: desabilitar em touch devices (iOS mostra hover sticky) */
@media (hover: none) {
  .obras-grid-artista__card:hover {
    transform: none;
    box-shadow: none;
  }

  .video-facade:hover img {
    transform: none;
  }

  .video-facade:hover::after {
    background: rgba(0, 0, 0, 0.2);
  }
}

/* =============================================
   LIGHTBOX — Video em tela expandida
   ============================================= */
.obras-lightbox {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.obras-lightbox.active {
  display: flex !important;
}

.obras-lightbox .obras-lightbox__nav,
.obras-lightbox .obras-lightbox__close,
.obras-lightbox .obras-lightbox__content,
.obras-lightbox .obras-lightbox__overlay {
  visibility: hidden;
}

.obras-lightbox.active .obras-lightbox__nav,
.obras-lightbox.active .obras-lightbox__close,
.obras-lightbox.active .obras-lightbox__content,
.obras-lightbox.active .obras-lightbox__overlay {
  visibility: visible;
}

/* Overlay — cor do site */
.obras-lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(218, 218, 213, 0.96);
  cursor: pointer;
}

/* Setas prev/next */
.obras-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #333;
  font-size: 32px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.3s, background 0.3s;
  line-height: 1;
  padding: 0 0 2px 0;
}

.obras-lightbox__nav:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.obras-lightbox__nav--prev {
  left: 20px;
}

.obras-lightbox__nav--next {
  right: 20px;
}

/* Conteudo centralizado */
.obras-lightbox__content {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 900px;
}

/* Botao fechar */
.obras-lightbox__close {
  position: absolute;
  top: -48px;
  right: 0;
  background: none;
  border: none;
  color: #333;
  font-size: 36px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.3s;
  z-index: 3;
}

.obras-lightbox__close:hover {
  opacity: 1;
}

/* Video container — 16:9 */
.obras-lightbox__video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
  border-radius: 2px;
  overflow: hidden;
}

.obras-lightbox__video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Imagem no lightbox */
.obras-lightbox__image {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
}

.obras-lightbox__image img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

/* Ficha tecnica no lightbox */
.obras-lightbox__info {
  padding: 20px 4px 0;
  color: #ccc;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.obras-lightbox__info h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px;
  letter-spacing: 1px;
}

.obras-lightbox__info p {
  font-size: 13px;
  color: #666;
  line-height: 170%;
  margin: 0;
}

/* Fix iOS Safari: body lock quando lightbox aberto */
body.obras-lightbox-open {
  position: fixed;
  width: 100%;
  top: var(--obras-scroll-top, 0);
  overflow: hidden;
}

/* Lightbox mobile */
@media (max-width: 768px) {
  .obras-lightbox {
    align-items: center;
    padding: 0;
  }

  .obras-lightbox__content {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  /* Video ocupa 75% da altura da tela no mobile */
  .obras-lightbox__video {
    border-radius: 0;
    padding-bottom: 0;
    height: 75vh;
  }

  .obras-lightbox__video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .obras-lightbox__close {
    position: fixed;
    top: 12px;
    right: 12px;
    font-size: 28px;
    width: 40px;
    height: 40px;
    z-index: 10;
  }

  .obras-lightbox__nav {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.4);
  }

  .obras-lightbox__nav--prev {
    left: 4px;
  }

  .obras-lightbox__nav--next {
    right: 4px;
  }
}
