/* gallery.js companion styles — thumbnail grid + fullscreen lightbox.
   No external dependencies; safe to include on any page. */

/* ── Thumbnail grid ─────────────────────────────────────────────────── */
.ce-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.ce-gallery-item {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border: 1px solid var(--border, rgba(255,255,255,.12));
  background: var(--bg2, #111);
}
.ce-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.ce-gallery-item:hover img { transform: scale(1.05); }

/* Desktop: first photo shown large, full-width, above the rest as a
   normal thumbnail row underneath — a "hero + strip" layout instead of a
   flat uniform grid. Left as a plain grid on narrow/mobile screens, where
   a tall hero photo would eat an awkward amount of vertical space. */
@media (min-width: 601px) {
  .ce-gallery-item:first-child {
    grid-column: 1 / -1;
    aspect-ratio: 21 / 9;
  }
}

/* ── Lightbox overlay ───────────────────────────────────────────────── */
.ce-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .92);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.ce-lightbox.open { display: flex; opacity: 1; }

.ce-lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  padding: 40px 20px;
  box-sizing: border-box;
}
.ce-lb-img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 4px;
}
.ce-lb-caption {
  margin-top: 14px;
  max-width: 640px;
  text-align: center;
  color: rgba(255, 255, 255, .88);
  font-size: 14px;
  line-height: 1.5;
  padding: 0 12px;
}

.ce-lb-close, .ce-lb-prev, .ce-lb-next {
  position: absolute;
  background: rgba(255, 255, 255, .08);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s;
  z-index: 2;
}
.ce-lb-close:hover, .ce-lb-prev:hover, .ce-lb-next:hover { background: rgba(255, 255, 255, .2); }
.ce-lb-close { top: 16px; right: 16px; width: 40px; height: 40px; font-size: 26px; line-height: 1; }
.ce-lb-prev, .ce-lb-next { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 18px; }
.ce-lb-prev { left: 16px; }
.ce-lb-next { right: 16px; }

.ce-lb-counter {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
  letter-spacing: .04em;
}

/* ── Responsive: smaller thumbnails/buttons, more image room on phones ── */
@media (max-width: 600px) {
  .ce-gallery { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
  .ce-lb-stage { padding: 16px 10px; }
  .ce-lb-prev, .ce-lb-next { width: 40px; height: 40px; font-size: 15px; }
  .ce-lb-prev { left: 6px; }
  .ce-lb-next { right: 6px; }
  .ce-lb-close { width: 36px; height: 36px; font-size: 22px; top: 8px; right: 8px; }
  .ce-lb-img { max-width: 96vw; max-height: 72vh; }
  .ce-lb-caption { font-size: 13px; max-width: 90vw; }
}
