/* ==========================
   Lightweight Image Lightbox
   ========================== */

/* Overlay (center content) */
.jr-lightbox {
  position: fixed;
  inset: 0;
  display: none;                  /* hidden by default */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.75);
  z-index: 99999;

  /* fade-in */
  opacity: 0;
  transition: opacity .25s ease;
}
.jr-lightbox.is-open {
  display: flex;
  opacity: 1;
}

/* Stack the image window and the controls vertically */
.jr-lightbox__frame {
  margin: auto;                   /* center in viewport */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;                      /* space between window and controls */
  position: relative; /* NEW */
}

/* Image window (scroll container) */
.jr-lightbox__inner {
  position: relative;             /* anchor for close button */
  display: block;
  overflow: hidden;               /* no scrollbars when not zoomed */
  max-width: 90vw;
  max-height: 90vh;
  outline: none;

  /* content entrance */
  transform: scale(.985);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}
.jr-lightbox.is-open .jr-lightbox__inner {
  transform: scale(1);
  opacity: 1;
}

/* When zoomed, allow panning */
.jr-lightbox__inner.is-zoomed {
  overflow: auto;
  cursor: grab;
}
.jr-lightbox__inner.is-zoomed:active { cursor: grabbing; }

/* The image */
.jr-lightbox__img {
  display: block;
  height: auto;
  width: auto;
  max-width: 90vw;                /* initial fit */
  max-height: 90vh;               /* initial fit */
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  /* No transform-based zoom here (JS sets width in pixels when zoomed) */
}

/* Close button (outside top-right corner of window) */
.jr-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #fff;
  color: #111;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.3);
  z-index: 5; /* stay above */
}
.jr-lightbox__close:hover { filter: brightness(.95); }

/* Controls (always outside the image window) */
.jr-lightbox__controls {
  display: flex;
  gap: 8px;
}
.jr-lightbox__btn {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.jr-lightbox__btn:disabled {
  opacity: .5;
  cursor: default;
}

/* Prevent background scroll when open */
body.jr-lightbox-open { overflow: hidden; }

/* --------------------------
   Optional: pin controls to viewport bottom (uncomment to use)
--------------------------- */
/*
.jr-lightbox__controls {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
}
*/

/* Small-height safety: keep controls closer if screen is short */
@media (max-height: 560px) {
  .jr-lightbox__frame { gap: 10px; }
}
