/* Halloween gallery + lightbox */

.gallery-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  gap: clamp(.6rem, 1.6vw, 1.1rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}
@media (max-width: 30rem) {
  .gallery-grid { grid-template-columns: 1fr 1fr; }
}

.gallery-grid > li { display: flex; }
.g-item {
  display: block; width: 100%;
  padding: 0; margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.g-item:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(30 30 20 / .08), 0 12px 28px rgb(30 30 20 / .12); }

.g-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.g-item:hover .g-thumb img { transform: scale(1.03); }

.g-play {
  position: absolute; right: .55rem; bottom: .55rem;
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 700;
  background: #f08a24; color: #1b1712;
  padding: .2rem .55rem; border-radius: 999px;
}
.g-play svg { width: .8rem; height: .8rem; }

.g-cap { display: block; padding: .6rem .8rem .7rem; font-size: .93rem; font-weight: 600; line-height: 1.3; }
@media (max-width: 30rem) {
  .g-cap { font-size: .82rem; padding: .45rem .6rem .55rem; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgb(8 9 8 / .94);
  color: #f2f2ee;
  overflow: hidden;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgb(8 9 8 / .7); }

.lb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(.5rem, 3vw, 2rem) clamp(.5rem, 6vw, 5rem);
  touch-action: pan-y pinch-zoom;
  cursor: zoom-out;
}
.lb-media { max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; cursor: default; }
.lb-media img, .lb-media video {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 7rem);
  width: auto; height: auto;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgb(0 0 0 / .5);
  user-select: none; -webkit-user-select: none;
  background: #000;
}
.lb-media video { width: min(100%, 64rem); }
.lb-media.is-loading::after {
  content: ""; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 3px solid rgb(255 255 255 / .2); border-top-color: #fff;
  animation: lb-spin .8s linear infinite;
  position: absolute;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb-btn {
  display: inline-grid; place-items: center;
  width: 3rem; height: 3rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / .2);
  background: rgb(20 20 20 / .55);
  color: #fff;
  cursor: pointer;
}
.lb-btn:hover { background: rgb(60 60 60 / .8); }
.lb-btn svg { width: 1.4rem; height: 1.4rem; }
.lb-btn:focus-visible { outline-color: #8bd3ea; }

.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: clamp(.4rem, 1.5vw, 1.25rem); }
.lb-next { right: clamp(.4rem, 1.5vw, 1.25rem); }

.lb-bar {
  flex: none;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem clamp(1rem, 4vw, 2rem) calc(.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgb(255 255 255 / .1);
}
.lb-caption { margin: 0; flex: 1 1 auto; min-width: 0; }
.lb-caption span { color: #b9bdb6; font-family: var(--font-mono); font-size: .85rem; margin-left: .4rem; }
.lb-count { margin: 0; font-family: var(--font-mono); font-size: .85rem; color: #b9bdb6; white-space: nowrap; }

@media (max-width: 40rem) {
  .lb-stage { padding: .5rem; }
  .lb-prev, .lb-next { top: auto; bottom: .75rem; transform: none; width: 2.75rem; height: 2.75rem; }
  .lb-media img, .lb-media video { max-height: calc(100dvh - 9rem); }
}

html.lb-open { overflow: hidden; }
