/* =========================================================
   Gallery Stories (Eventos) - Portal Mie
   CSS recompilado (sem duplicações)
   ========================================================= */

/* ---------- Grid de thumbs ---------- */
.pm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 768px) {
  .pm-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
/* ---------- Grid de thumbs ---------- */
.pm-gallery-thumb {
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;

  border-radius: 16px;
  overflow: hidden;

  display: flex; /* 🔥 centraliza */
  align-items: center; /* 🔥 vertical */
  justify-content: center; /* 🔥 horizontal */

  aspect-ratio: 3 / 2; /* mantém padrão visual */
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.pm-gallery-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.pm-gallery-thumb img {
  max-width: 100%;
  max-height: 100%;

  object-fit: contain; /* 🔥 nunca corta */
  object-position: center;

  display: block;
}

/* ---------- Lock de scroll quando overlay abre ---------- */
html.pm-gallery-open,
body.pm-gallery-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- Overlay ---------- */
.pm-gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  background:
    repeating-linear-gradient(
      135deg,
      #111 0px,
      #111 2px,
      #141414 2px,
      #141414 4px
    ),
    radial-gradient(circle at center, #222 0%, #000 100%);
  display: flex;
  flex-direction: column;

  overscroll-behavior: contain;
  touch-action: none; /* a gente domina o gesto */
}

@media (min-width: 1024px) {
  .pm-gallery-overlay {
    position: fixed;

    top: 0;
    left: 0;
    right: 0;

    margin: 20px auto; /* centraliza horizontal */
    width: 100%;
    max-width: 1200px;
    max-height: 95vh;

    border-radius: 28px;
    overflow: hidden;

    box-shadow:
      0 40px 120px rgba(0, 0, 0, 0.8),
      0 10px 40px rgba(0, 0, 0, 0.6);
  }
}

.pm-gallery-overlay.hidden {
  display: none;
}

/* Banner dentro do overlay (relative) */
.pm-gallery-banner {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  z-index: 10;
}

.pm-gallery-banner > * {
  width: min(78vw, 900px);
  height: auto;
}

/* Mobile: reduz um pouco */
@media (max-width: 767px) {
  .pm-gallery-banner {
    width: 80%;
    height: auto;
    margin: 0 auto;
  }
}

/* ---------- Stage (área do swipe) ---------- */

/* ---------- Stage (área do swipe) ---------- */
.pm-gallery-stage {
  position: relative;
  flex: 1;
  overflow: hidden;

  user-select: none;
  -webkit-user-select: none;
  touch-action: none;

  padding-top: 0;

  min-height: 0;
  height: calc(100vh - 185px);
  height: calc(100dvh - 185px);

  display: flex;
  align-items: center; /* centraliza vertical */
  justify-content: center; /* centraliza horizontal */
}

/* ---------- Track (3 slides) ---------- */
.pm-gallery-track {
  display: flex;
  height: 100%;
  width: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  align-items: center;
}

/* ---------- Slide ---------- */
.pm-gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  min-height: 100%;

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

  padding: 0 14px;
  border-radius: 0;
  overflow: visible;
}

.pm-gallery-slide {
  position: relative;
  overflow: hidden;
}

.pm-gallery-slide::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image: var(--pm-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  transform: scale(1.08);
  filter: blur(3px) brightness(0.6);
  opacity: 0.8;

  z-index: 0;
  transition: background-image 0.25s ease;
}

.pm-gallery-img {
  position: relative;
  z-index: 2;
}
.pm-gallery-slide::before {
  transition: opacity 0.18s ease;
}
/* ---------- Imagem principal ---------- */
.pm-gallery-img {
  display: block;
  max-width: 100%;
  height: auto;

  object-fit: contain;
  object-position: center;

  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.35);

  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

@media (max-width: 767px) {
  .pm-gallery-img {
    max-height: calc(100vh - 185px); /* ✅ alinhado com o stage */
  }
}

@media (min-width: 768px) {
  .pm-gallery-img {
    max-height: 78vh;
    max-width: min(92vw, 1200px);
  }
}

/* thumb badge */
.pm-gallery-thumb {
  position: relative;
}

/* Zoom-in sutil no slide ativo (desktop e mobile) */
.pm-gallery-img.is-zoom {
  transform-origin: center center;
  animation: pmZoomIn 6.5s ease-out forwards;
  will-change: transform;
}

@keyframes pmZoomIn {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

/* ---------- Progress bars ---------- */
.pm-gallery-progress {
  position: absolute;
  inset: 0 0 auto 0; /* top 0, left 0, right 0 */
  height: 4px;
  padding: 0; /* 🔥 remove o gap do topo */
  display: flex;
  gap: 6px;
  z-index: 25;
}

.pm-gallery-bar {
  flex: 1;
  height: 4px;

  border-radius: 999px;
  overflow: hidden;

  background: rgba(255, 255, 255, 0.2);
  transform-origin: left center;
  transform: scaleX(0);
}

/* ---------- UI inferior (título/coração) ---------- */
/* UI inferior - colada no bottom */
.pm-gallery-ui {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%); /* 🔥 centraliza */

  width: 100%;
  max-width: 800px; /* 🔥 limite no desktop */

  z-index: 25;

  padding: 14px;
  padding-bottom: 18px;
}

@media (max-width: 767px) {
  .pm-gallery-ui {
    left: 0;
    transform: none;
    max-width: 100%;
  }
}

.pm-gallery-ui::before {
  content: "";
  position: absolute;
  inset: 0;

  background: rgba(0, 0, 0, 0.72); /* sólido com transparência */

  z-index: -1;
  border-radius: 20px;
}

/* linha principal */
.pm-gallery-ui-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

/* texto à esquerda */
.pm-gallery-ui-left {
  min-width: 0; /* necessário p/ clamp funcionar em flex */
}

.pm-gallery-title {
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  display: -webkit-box;
  -webkit-line-clamp: 2; /* máximo 2 linhas */
  -webkit-box-orient: vertical;
  overflow: hidden;

  font-size: 12px;
  line-height: 1.25;
  opacity: 0.92;
}

.pm-gallery-emoji {
  margin-right: 6px;
}

.pm-gallery-ph {
  font-weight: 900;
}

/* ações à direita */
.pm-gallery-ui-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* estilo “glass” como stories */
.pm-gallery-ui .glass {
  width: 44px;
  height: 44px;
  border-radius: 999px;

  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease;
}

.pm-gallery-ui .glass:active {
  transform: scale(0.95);
}

.pm-gallery-ui .glass:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pm-gallery-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 60px; /* acima da UI */
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 80;
}

.pm-gallery-hint-inner {
  display: flex;
  align-items: center;
  gap: 8px;

  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 800;

  animation: pmPulse 1.4s ease-in-out infinite;
}

@keyframes pmPulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.65;
  }
}

/* ---------- Nav prev/next (desktop) ---------- */
.pm-gallery-nav {
  position: absolute;
  top: 45%;
  transform: translateY(-50%);

  width: 46px;
  height: 46px;
  border-radius: 999px;

  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;

  display: none; /* mobile hidden */
  place-items: center; /* centraliza SVG perfeito */

  z-index: 30;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  cursor: pointer;
}

.pm-gallery-prev {
  left: 16px;
}

.pm-gallery-next {
  right: 16px;
}

@media (min-width: 1024px) {
  .pm-gallery-nav {
    display: grid;
  }
}
/* Pill fotógrafo */
.pm-gallery-ph-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  background: #fff;
  color: #000;

  padding: 10px 18px;
  border-radius: 999px;

  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;

  max-width: 75vw; /* evita ficar gigante no mobile */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  transition: transform 0.15s ease;
}

.pm-gallery-ph-pill:active {
  transform: scale(0.96);
}

@media (max-width: 767px) {
  .pm-gallery-ph-pill {
    font-size: 12px;
    padding: 8px 14px;
  }
}

/* limita texto a 2 linhas caso nome muito longo */
.pm-gallery-ph {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Close (em cima da foto: ancorado no slide) ---------- */
.pm-gallery-close {
  position: absolute;
  top: 12px;
  right: 12px;

  width: 42px;
  height: 42px;
  border-radius: 999px;

  background: rgba(0, 0, 0, 0.6);
  color: #fff;

  border: 1px solid rgba(255, 255, 255, 0.25);

  display: grid;
  place-items: center;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  cursor: pointer;
  z-index: 10000;

  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.pm-gallery-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.pm-gallery-close:active {
  transform: scale(0.95);
}

/* ---- likes styles---- */

.pm-thumb-likebadge {
  position: absolute;
  right: 8px;
  bottom: 8px;

  background: rgba(0, 0, 0, 0.65);
  color: #fff;

  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;

  backdrop-filter: blur(6px);
}
.pm-gallery-like {
  position: relative;
}

.pm-gallery-like-count {
  position: absolute;
  right: -6px;
  top: -6px;

  min-width: 18px;
  height: 18px;
  padding: 0 6px;

  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;

  font-size: 11px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;

  backdrop-filter: blur(6px);
}

.pm-gallery-like-count:empty {
  display: none; /* não mostra quando 0 */
}
/* ---- Like: pop + glow ---- */
.pm-gallery-like.is-liked {
  animation: pmLikePop 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.pm-gallery-like.is-liked svg {
  animation: pmLikePulse 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes pmLikePop {
  0% {
    transform: translateZ(0) scale(1);
  }
  35% {
    transform: translateZ(0) scale(1.18);
  }
  65% {
    transform: translateZ(0) scale(0.96);
  }
  100% {
    transform: translateZ(0) scale(1);
  }
}

@keyframes pmLikePulse {
  0% {
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  35% {
    filter: drop-shadow(0 10px 18px rgba(255, 255, 255, 0.25));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
}
.pm-like-float {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  pointer-events: none;

  font-weight: 900;
  font-size: 30px;
  color: #fff;

  text-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  animation: pmLikeFloat 1200ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

@keyframes pmLikeFloat {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) scale(0.9);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-26px) scale(1.05);
  }
}

/*. CTA NEXT GALERY */
/* CTA "Próxima galeria" (pill) */
.pm-gallery-next-cta.glass {
  width: auto;
  padding: 0 14px;
  height: 44px;

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

  gap: 8px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* No mobile pequeno, não estoura */
@media (max-width: 420px) {
  .pm-gallery-next-cta.glass {
    padding: 0 10px;
    font-size: 12px;
  }
}
