/* static/css/gallery.css */

.gallery-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 10px;
}

.gallery-title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.2vw, 2.1rem);
  letter-spacing: -0.02em;
}

.gallery-description {
  margin: 0;
  line-height: 1.65;
  opacity: 0.85;
  max-width: 80ch;
}

.gallery-meta {
  margin: 10px 0 0;
  font-size: 0.95rem;
  opacity: 0.75;
}

.gallery-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 10px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}

.gallery-item {
  margin: 0;
  grid-column: span 4;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.02);
}

@media (max-width: 920px) {
  .gallery-item { grid-column: span 6; }
}

@media (max-width: 640px) {
  .gallery-item { grid-column: span 12; }
}

.gallery-img-btn {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  touch-action: manipulation; /* avoids some weird mobile tap delays */
}

.gallery-img-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 160ms ease;
}

.gallery-item:hover .gallery-img-btn img {
  transform: scale(1.03);
}

.gallery-empty {
  padding: 10px 0 0;
  opacity: 0.85;
}

.gallery-back {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 34px;
}

.gallery-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* -------------------------
   Lightbox overlay
   ------------------------- */

.lightbox[hidden] { display: none !important; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}

.lightbox-panel {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
}

.lightbox-stage {
  max-width: min(1100px, 96vw);
  max-height: 84vh;
  display: grid;
  place-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 84vh;
  height: auto;
  width: auto;
  border-radius: 14px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
  cursor: zoom-out;
}

/* Close */
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.92);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;

  display: grid;
  place-items: center;

  transition: transform 180ms ease, background 180ms ease;
}

.lightbox-close:hover {
  background: rgba(0,0,0,0.50);
}

.lightbox-close:active {
  transform: scale(0.96);
}

/* Nav buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

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

  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.92);

  display: grid;
  place-items: center;

  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.lightbox-nav:hover {
  background: rgba(0,0,0,0.50);
  transform: translateY(-50%) scale(1.04);
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.96);
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* SVG chevrons */
.lightbox-nav .chev {
  width: 22px;
  height: 22px;
  display: block;
}

/* Count pill */
.lightbox-meta {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.86);
  font-size: 12px;
  letter-spacing: 0.02em;
}

@media (max-width: 520px) {
  .lightbox-prev,
  .lightbox-next {
    width: 42px;
    height: 42px;
    opacity: 0.92;
  }

  .lightbox-nav .chev {
    width: 20px;
    height: 20px;
  }
}
