/* =========================================================
   G-Stat - event galleries (lobby + single gallery + lightbox)
   Loads after css/styles.css and css/pages.css. Reuses .card-grid / .card
   from pages.css for the lobby; only gallery-specific parts live here.
   ========================================================= */

/* ---------- Lobby cards ---------- */
.gallery-card .card-media { aspect-ratio: 4 / 3; }
.gallery-card .card-tag { display: inline-flex; gap: 6px; align-items: center; }
.gallery-card h3 { font-size: 21px; }

/* Lobby: four events read best as a 2x2 grid */
.card-grid.gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 26px; }
.gallery-grid .gallery-card .card-media { aspect-ratio: 16 / 10; }
@media (max-width: 640px) { .card-grid.gallery-grid { grid-template-columns: 1fr; } }

/* ---------- Single gallery header meta ---------- */
.gallery-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 26px; color: var(--muted); font-size: 16px; }
.gallery-meta span { display: inline-flex; align-items: center; gap: 8px; }
.gallery-meta svg { width: 18px; height: 18px; stroke: var(--cyan); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Masonry grid ---------- */
.photo-grid { column-count: 3; column-gap: 16px; }
.photo {
  display: block; width: 100%; margin: 0 0 16px; padding: 0; border: 0; cursor: zoom-in;
  break-inside: avoid; position: relative; overflow: hidden; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .3s, box-shadow .4s, transform .5s var(--ease-out);
}
.photo img { display: block; width: 100%; height: auto; transition: transform .7s var(--ease-out), opacity .4s; opacity: .92; }
.photo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(3, 7, 13, .45));
  opacity: 0; transition: opacity .35s;
}
.photo:hover, .photo:focus-visible { border-color: var(--line-strong); box-shadow: 0 20px 44px rgba(0, 0, 0, .45); }
.photo:hover img, .photo:focus-visible img { transform: scale(1.04); opacity: 1; }
.photo:hover::after, .photo:focus-visible::after { opacity: 1; }
.photo:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.gallery-back { margin-top: 44px; display: flex; justify-content: center; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center;
  background: rgba(3, 7, 13, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .3s;
}
.lightbox.is-open { display: flex; }
.lightbox.is-visible { opacity: 1; }
.lightbox-stage { position: absolute; inset: 64px 72px; display: flex; align-items: center; justify-content: center; }
.lightbox-img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  transition: opacity .25s;
}
.lightbox-img.is-loading { opacity: .25; }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  color: var(--text); background: rgba(11, 23, 38, .8); border: 1px solid var(--line); cursor: pointer;
  transition: background .25s, border-color .25s, transform .25s var(--ease-out);
}
.lb-btn:hover, .lb-btn:focus-visible { background: rgba(22, 139, 255, .25); border-color: var(--line-strong); }
.lb-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.lb-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 16px; inset-inline-start: 16px; }
.lb-prev, .lb-next { top: 50%; margin-top: -24px; }
/* RTL: "next" sits on the left, "prev" on the right */
.lb-next { left: 14px; }
.lb-prev { right: 14px; }
.lb-count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 16px; direction: ltr; letter-spacing: .06em;
}
html.lb-lock { overflow: hidden; }

@media (max-width: 1024px) {
  .photo-grid { column-count: 2; }
}
@media (max-width: 640px) {
  .photo-grid { column-gap: 10px; }
  .photo { margin-bottom: 10px; border-radius: 10px; }
  .lightbox-stage { inset: 64px 8px 56px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; margin-top: 0; width: 44px; height: 44px; }
  .lb-next { left: 16px; }
  .lb-prev { right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .photo, .photo img, .lightbox, .lightbox-img { transition: none; }
}
