.gallery {
  column-count: 4;        /* number of columns */
  column-gap: 20px;       /* spacing between columns */
  padding: 20px;
}

.photo {
  break-inside: avoid;    /* prevents tiles from splitting */
  margin-bottom: 20px;    /* spacing between tiles */
}

.photo img {
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.caption {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #333;
    font-style: italic;
  text-align: left;
}
.viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* X CLOSE BUTTON — floats independently */
.viewer-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  z-index: 10000;
}

/* IMAGE + SIDE BUTTONS */
.viewer-content {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

/* FIXED IMAGE VIEWPORT */
.viewer-image-wrapper {
  width: 80vw;
  height: 80vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* prevents overlap */
  cursor: grab;
}

.viewer-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s ease;
}

/* ZOOM BUTTONS */
.viewer-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.viewer-controls button {
  background: #fff;
  border: none;
  padding: 10px 16px;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
}

/* CAPTION UNDERNEATH */
.viewer-caption {
  margin-top: 20px;
  color: #fff;
  background:#a0a0a0;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 1.5rem;
  text-align: center;
  max-width: 80vw;
}
.viewer-image-wrapper:active {
  cursor: grabbing;
}
#viewer-img {
  user-select: none;
  pointer-events: none; /* lets wrapper receive drag events */
}