/* Overlay Background */
.lbx-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 15, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
  touch-action: none;
  user-select: none;
}

.lbx-overlay.active {
  opacity: 1;
}

/* Top Counter (e.g., 2 / 8) */
.lbx-counter {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  /*font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;*/
  font-weight: 500;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.375rem 0.75rem;
  border-radius: 2rem;
  z-index: 10000;
}

/* Main Stage (Holds Media + Caption) */
.lbx-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.lbx-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: center center;
  will-change: transform, opacity;
}

/* Image Styling & Zoom Cursor */
.lbx-media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lbx-media img {
  max-width: 90vw;
  max-height: 70vh;
  border-radius: 0.375rem;
  box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.65);
  display: block;
  cursor: zoom-in;
  transform-origin: center center;
  transition: transform 0.2s ease;
  will-change: transform;
}

.lbx-media img.is-zoomed {
  cursor: grab;
  transition: none;
}

.lbx-media img.is-zoomed:active {
  cursor: grabbing;
}

/* Responsive Video Wrapper (4:3) */
.lbx-video-wrapper {
  width: 82vw;
  max-width: 60rem;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 0.375rem;
  overflow: hidden;
  box-shadow: 0 0.75rem 2.5rem rgba(0, 0, 0, 0.65);
}

.lbx-video-wrapper iframe,
.lbx-video-wrapper video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Caption (Supports bold, line breaks, and clickable links) */
.lbx-caption {
  color: #f1f1f1;
  /*font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;*/
  line-height: 1.5;
  margin-top: 0.625rem;
  text-align: center;
  max-width: 40rem;
  padding: 0 1rem;
  transition: opacity 0.2s ease;
}

.lbx-caption strong,
.lbx-caption b {
  color: #ffffff;
  font-weight: 600;
}

.lbx-caption a {
  color: #7cc4ff;
  text-decoration: underline;
  text-underline-offset: 0.1875em;
}

.lbx-caption a:hover {
  color: #b3ddff;
}

/* Hide UI chrome slightly when zoomed into an image */
.lbx-overlay.has-zoom .lbx-caption,
.lbx-overlay.has-zoom .lbx-prev,
.lbx-overlay.has-zoom .lbx-next {
  opacity: 0;
  pointer-events: none;
}

/* Thumbnail Strip (Uniform Height, Preserved Aspect Ratio) */
.lbx-thumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 92vw;
  overflow-x: auto;
  padding: 0.5rem 0.25rem;
  margin-top: 0.5rem;
  scrollbar-width: thin;
  touch-action: pan-x;
  z-index: 10000;
}

.lbx-thumb-btn {
  position: relative;
  border: 2px solid transparent;
  border-radius: 0.25rem;
  padding: 0;
  background: #222;
  cursor: pointer;
  flex: 0 0 auto;
  height: 3.5rem; /* Uniform height (56px at default 16px root) */
  overflow: hidden;
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.lbx-thumb-btn:hover {
  opacity: 0.85;
}

.lbx-thumb-btn.active {
  opacity: 1;
  border-color: #ffffff;
  transform: translateY(-0.125rem);
}

.lbx-thumb-btn img {
  height: 100%;
  width: auto; /* Preserves natural aspect ratio */
  display: block;
}

.lbx-thumb-video-placeholder {
  height: 100%;
  width: 5.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.125rem;
  background: #2c2c34;
}

.lbx-thumb-btn.is-video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.875rem;
}

/* Controls (Close, Prev, Next) */
.lbx-close,
.lbx-prev,
.lbx-next {
  position: fixed;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  font-size: 1.625rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
  z-index: 10000;
}

.lbx-close:hover,
.lbx-prev:hover,
.lbx-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lbx-close { top: 1rem; right: 1rem; }
.lbx-prev  { left: 1rem; top: 46%; transform: translateY(-50%); }
.lbx-next  { right: 1rem; top: 46%; transform: translateY(-50%); }