/* Galeria de fotos por evento — carregado só nas páginas que usam (evento, home) */

/* ---------- Grid em linhas justificadas (preserva a ordem cronológica, sem cortar fotos) ---------- */
.gal { --rh: 220px; display: flex; flex-wrap: wrap; gap: 8px; }
.gal::after { content: ''; flex-grow: 999999; }
.gi {
  position: relative; margin: 0; overflow: hidden; background: var(--surface);
  border-radius: 10px;
  flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * var(--rh));
  content-visibility: auto; contain-intrinsic-size: auto 220px;
}
.gi > i { display: block; padding-bottom: calc(100% / var(--r)); }
.gi-open { position: absolute; inset: 0; display: block; cursor: zoom-in; }
.gi img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .4s;
}
.gi:hover img { transform: scale(1.035); }
.gi::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(to top, rgba(10,36,24,.55) 0%, transparent 45%);
}
.gi:hover::after, .gi:focus-within::after { opacity: 1; }
.gi-dl {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); color: var(--forest-deep, #123d27);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s, background .2s;
}
.gi-dl svg { width: 18px; height: 18px; }
.gi:hover .gi-dl, .gi:focus-within .gi-dl { opacity: 1; transform: none; }
.gi-dl:hover { background: #fff; }
@media (hover: none) { .gi-dl { display: none; } }  /* no toque o download fica no lightbox */

.gal-head { max-width: 760px; margin-bottom: 32px; }
.gal-head p { color: var(--steel); font-size: 15px; margin-top: 8px; }
.gal-back { display: inline-block; font-size: 14px; font-weight: 700; color: var(--forest); margin-bottom: 18px; text-decoration: none; }

/* ---------- Prévia no evento / mix na home ---------- */
.gal-prev { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gal-prev a, .gal-mix a { position: relative; display: block; overflow: hidden; border-radius: 12px; background: var(--surface); aspect-ratio: 4 / 3; }
.gal-prev img, .gal-mix img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.gal-prev a:hover img, .gal-mix a:hover img { transform: scale(1.05); }
.gal-more { margin-top: 24px; text-align: center; }
.gal-mix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gal-mix-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

@media (max-width: 768px) {
  .gal { gap: 5px; --rh: 150px; }
  .gal-prev { grid-template-columns: repeat(2, 1fr); }
  .gal-mix { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}

/* ---------- Lightbox ---------- */
.glb {
  position: fixed; inset: 0; z-index: 1000; display: none; flex-direction: column;
  background: rgba(7,24,16,.95); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .25s;
}
.glb.open { display: flex; }
.glb.show { opacity: 1; }
.glb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; color: #fff; }
.glb-count { font-size: 14px; font-weight: 600; letter-spacing: .5px; opacity: .85; }
.glb-actions { display: flex; gap: 8px; }
.glb-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; text-decoration: none;
  background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.glb-btn:hover, .glb-btn:focus-visible { background: rgba(255,255,255,.26); }
.glb-btn svg { width: 22px; height: 22px; }
.glb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px 20px; touch-action: pan-y; }
.glb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; opacity: 0; transition: opacity .25s; box-shadow: 0 10px 50px rgba(0,0,0,.45); user-select: none; -webkit-user-drag: none; }
.glb-stage img.ok { opacity: 1; }
.glb-spin { position: absolute; width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: glbspin .8s linear infinite; }
.glb-spin.hide { display: none; }
@keyframes glbspin { to { transform: rotate(360deg); } }
.glb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.glb-prev { left: 10px; } .glb-next { right: 10px; }
@media (max-width: 768px) {
  .glb-stage { padding: 0 8px 16px; }
  .glb-nav { display: none; }   /* no celular: deslizar */
}
@media (prefers-reduced-motion: reduce) {
  .gi img, .gal-prev img, .gal-mix img, .glb, .glb-stage img { transition: none; }
}
