/*
 * st-gallery.css — estilos estruturais VERSIONADOS dos blocos de galeria novos:
 *   - GalleryLightbox: grade curada + overlay de lightbox (st-lightbox.js).
 *   - GalleryMasonry: mosaico infinito lazy (st-masonry.js) + mesmo lightbox.
 *
 * Carregado condicionalmente no público (main.php, flags __st_lightbox_enabled /
 * __st_masonry_enabled) e injetado ao vivo no canvas do editor in-page
 * (ensureCanvasRuntimeAssets). Só estrutura/animação genérica — cores e
 * espaçamento por bloco continuam vindo do coletor per-block (/css/page).
 * Sem `!important` e sem `style=` inline. Colunas/gap/proporção por
 * data-attributes (não são estilo inline).
 */

/* ===================================================================== */
/* GalleryLightbox — grade curada                                        */
/* ===================================================================== */

.st-lb-grid[data-gap="sm"] { gap: 0.5rem; }
.st-lb-grid[data-gap="md"] { gap: 1rem; }
.st-lb-grid[data-gap="lg"] { gap: 1.5rem; }

.st-lb-figure {
  position: relative;
  margin: 0;
  overflow: hidden;
}

.st-lb-frame {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: #e2e8f0;
}

.st-lb-frame[data-ratio="square"] { aspect-ratio: 1 / 1; }
.st-lb-frame[data-ratio="landscape"] { aspect-ratio: 4 / 3; }
.st-lb-frame[data-ratio="portrait"] { aspect-ratio: 3 / 4; }
.st-lb-frame[data-ratio="wide"] { aspect-ratio: 16 / 9; }
.st-lb-frame[data-ratio="auto"] { aspect-ratio: auto; }

/* DESCENDENTE, não filho direto (corrigido em 02/09/2026).
   No público a imagem fica dentro do `<a class="st-lb-trigger">` do lightbox,
   então `.st-lb-frame > img` só acertava o caso do EDITOR — e no site
   publicado a foto ficava na altura natural dela dentro de uma moldura de
   proporção fixa, deixando uma faixa cinza do fundo do frame aparecendo.
   Vale para a grade e para o trilho. */
.st-lb-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.st-lb-frame[data-ratio="auto"] img {
  height: auto;
}

.st-lb-trigger {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.st-lb-trigger > img {
  transition: transform 0.35s ease;
}

.st-lb-trigger:hover > img {
  transform: scale(1.05);
}

.st-lb-caption-below {
  margin: 0;
  /* 1rem nas laterais, não 0,25rem (02/09/2026): com 4px a legenda encostava
     na borda do card e a faixa inteira parecia mal-acabada. */
  padding: 0.75rem 1rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  opacity: 0.75;
}

.st-lb-caption-overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  margin: 0;
  padding: 2rem 1rem 0.85rem;
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.4;
  background: linear-gradient(to top, rgba(2, 6, 23, 0.82), rgba(2, 6, 23, 0));
  pointer-events: none;
}

/* ===================================================================== */
/* GalleryMasonry — mosaico infinito (colunas CSS)                       */
/* ===================================================================== */

.st-imasonry {
  columns: 1;
}

.st-imasonry[data-gap="sm"] { column-gap: 0.5rem; }
.st-imasonry[data-gap="md"] { column-gap: 1rem; }
.st-imasonry[data-gap="lg"] { column-gap: 1.5rem; }

.st-imasonry-item {
  display: block;
  width: 100%;
  break-inside: avoid;
  overflow: hidden;
  position: relative;
}

.st-imasonry[data-gap="sm"] .st-imasonry-item { margin-bottom: 0.5rem; }
.st-imasonry[data-gap="md"] .st-imasonry-item { margin-bottom: 1rem; }
.st-imasonry[data-gap="lg"] .st-imasonry-item { margin-bottom: 1.5rem; }

.st-imasonry-item > a,
.st-imasonry-item > .st-imasonry-media {
  display: block;
  cursor: zoom-in;
}

.st-imasonry-item img {
  display: block;
  width: 100%;
  height: auto;
}

.st-imasonry-item.st-imasonry-plain > .st-imasonry-media {
  cursor: default;
}

/* Colunas por dispositivo (mobile = base; tablet e desktop nos breakpoints). */
.st-imasonry[data-cols-m="1"] { columns: 1; }
.st-imasonry[data-cols-m="2"] { columns: 2; }

@media (min-width: 640px) {
  .st-imasonry[data-cols-t="2"] { columns: 2; }
  .st-imasonry[data-cols-t="3"] { columns: 3; }
}

@media (min-width: 1024px) {
  .st-imasonry[data-cols-d="2"] { columns: 2; }
  .st-imasonry[data-cols-d="3"] { columns: 3; }
  .st-imasonry[data-cols-d="4"] { columns: 4; }
  .st-imasonry[data-cols-d="5"] { columns: 5; }
}

/* Enriquecimento por JS: esconde os itens ainda não revelados e faz o
 * skeleton dos que estão carregando. Sem JS nada disto aplica (todos visíveis). */
.st-imasonry.is-enhanced .st-imasonry-item.is-pending {
  display: none;
}

.st-imasonry.is-enhanced .st-imasonry-item {
  animation: st-imasonry-in 0.4s ease both;
}

.st-imasonry-item.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%);
  background-size: 200% 100%;
  animation: st-imasonry-shimmer 1.2s linear infinite;
}

.st-imasonry-sentinel {
  width: 100%;
  height: 1px;
}

@keyframes st-imasonry-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes st-imasonry-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ===================================================================== */
/* Lightbox — overlay compartilhado pelos dois blocos                     */
/* ===================================================================== */

html.st-lb-lock {
  overflow: hidden;
}

.st-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.st-lb-overlay.is-open {
  opacity: 1;
}

.st-lb-overlay[hidden] {
  display: none;
}

.st-lb-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: min(1200px, 94vw);
}

.st-lb-image {
  max-width: min(1200px, 94vw);
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  background: #0f172a;
}

.st-lb-caption {
  max-width: min(760px, 90vw);
  margin: 0;
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.st-lb-caption[hidden] {
  display: none;
}

.st-lb-counter {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #cbd5e1;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.st-lb-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.st-lb-btn:hover,
.st-lb-btn:focus-visible {
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.st-lb-btn[hidden] {
  display: none;
}

.st-lb-prev { top: 50%; left: 16px; transform: translateY(-50%); }
.st-lb-next { top: 50%; right: 16px; transform: translateY(-50%); }
.st-lb-close { top: 16px; right: 16px; font-size: 20px; }

@media (max-width: 640px) {
  .st-lb-prev { left: 8px; }
  .st-lb-next { right: 8px; }
  .st-lb-image { max-height: 74vh; }
}

/* ===================================================================== */
/* Movimento reduzido                                                     */
/* ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .st-lb-overlay,
  .st-lb-btn,
  .st-lb-trigger > img {
    transition: none;
  }
  .st-imasonry.is-enhanced .st-imasonry-item {
    animation: none;
  }
  .st-imasonry-item.is-loading::after {
    animation: none;
  }
}

/* ==========================================================================
   Galeria curada em modo TRILHO (display=carousel) — 02/09/2026.
   Reusa a figura, o frame e as legendas da grade; o que muda é o contêiner.
   O runtime é o st-carousel.js, o MESMO do Gallery/MenuHighlights.
   ========================================================================== */

.st-lb-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
  cursor: grab;
}
.st-lb-track::-webkit-scrollbar { display: none; }
.st-lb-track[data-gap="sm"] { gap: 0.5rem; }
.st-lb-track[data-gap="md"] { gap: 1rem; }
.st-lb-track[data-gap="lg"] { gap: 1.5rem; }

/* Durante o arrasto o encaixe sai: com scroll-snap ligado, o dedo/mouse briga
   com o navegador tentando encaixar no slide a cada pixel. */
.st-lb-track.is-arrastando { cursor: grabbing; scroll-snap-type: none; }
.st-lb-track.is-arrastando * { pointer-events: none; }

.st-lb-track > .st-lb-figure {
  flex: 0 0 clamp(260px, 30vw, 380px);
  scroll-snap-align: start;
}

/* Setas: escondidas de teclado e leitor quando não há para onde ir é papel do
   runtime (ele desabilita); aqui só a forma. */
.st-lb-seta {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: #0f172a;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(15 23 42 / 0.22);
}
.st-lb-seta:hover { background: #0f172a; color: #fff; }
.st-lb-seta[disabled] { opacity: 0.35; cursor: default; }
.st-lb-seta--ant { left: -0.5rem; }
.st-lb-seta--prox { right: -0.5rem; }

.st-lb-pontos {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .st-lb-track > .st-lb-figure { flex-basis: 82vw; }
  .st-lb-seta { display: none; }
}
