
/* === Cheeky Monkeys: Square Gallery Grid + Lightbox + Back-to-Top === */

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

@media (max-width: 1024px) {
  .cm-gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .cm-gallery { grid-template-columns: 1fr; }
}

/* Each thumbnail is a perfect square */
.cm-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%; /* square ratio */
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cm-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

/* Images fill square, centered, cropped */
.cm-thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* Lightbox overlay */
.cm-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.cm-lightbox-overlay.active { display: flex; }

.cm-lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
}
.cm-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Arrows */
.cm-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #e0e0e0;
  display: grid; place-items: center;
  cursor: pointer;
}
.cm-arrow-left { left: 16px; }
.cm-arrow-right { right: 16px; }
.cm-arrow svg { width: 22px; height: 22px; fill: #555; }

/* Back to top button */
.cm-back-to-top {
  position: fixed;
  right: 16px; bottom: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #e0e0e0;
  display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  cursor: pointer;
}
.cm-back-to-top.visible { display: flex; }
.cm-back-to-top span { font-size: 20px; color: #333; }
