/* ============================================================
   Lightbox — fullscreen photo viewer with swipe + keyboard nav.
   Used by index.html (homepage project blocks) and gallery.html.
   ============================================================ */

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.lightbox.is-open { display: flex; opacity: 1; }

.lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 18, 24, .92);
  backdrop-filter: blur(8px);
}

.lb-stage {
  position: relative;
  max-width: 92vw; max-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.lb-image {
  max-width: 100%; max-height: 80vh;
  width: auto; height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pan-y pinch-zoom;
}
.lb-image.is-loading { opacity: .3; }

.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 2;
  border: 0; cursor: pointer;
  background: rgba(255,255,255,.12);
  color: #fff;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18);
  transition: background .15s, transform .15s;
  font-family: inherit;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(255,255,255,.22);
}

.lb-close {
  top: 20px; right: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 18px; line-height: 1;
}

.lb-prev, .lb-next {
  top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lb-next:hover { transform: translateY(-50%) translateX(2px); }
.lb-prev[disabled], .lb-next[disabled] { opacity: .25; cursor: default; pointer-events: none; }

.lb-caption {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex; gap: 12px; align-items: center;
  padding: 8px 18px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  color: #fff;
  font-size: 13px; font-weight: 600;
  max-width: 90vw;
  text-align: center;
  white-space: nowrap;
}
.lb-counter { opacity: .7; font-variant-numeric: tabular-nums; }
/* Project title is contextually redundant — the viewer just tapped into the
   lightbox from the project's own block. Keep the element in the DOM (the
   JS still sets it) but visually drop it from the caption. */
.lb-title { display: none; }
.lb-fullgallery {
  color: rgba(255,255,255,.92);
  text-decoration: none;
  font-weight: 600;
  border-left: 1px solid rgba(255,255,255,.25);
  padding-left: 12px;
}
.lb-fullgallery:hover { color: #fff; }
.lb-fullgallery.is-hidden { display: none; }
/* When the gallery link is hidden, also hide the separator border on the
   counter side so we don't get a stray vertical line. */
.lb-caption:has(.lb-fullgallery.is-hidden) .lb-counter { padding-right: 0; }

@media (max-width: 640px) {
  .lb-close { top: 14px; right: 14px; width: 40px; height: 40px; }
  .lb-prev, .lb-next {
    width: 44px; height: 44px;
    font-size: 24px;
  }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
  .lb-caption {
    bottom: 14px;
    padding: 6px 14px;
    font-size: 12px;
    gap: 10px;
  }
  .lb-fullgallery { padding-left: 10px; }
  .lb-image { max-height: 72vh; }
}

/* Prevent body scroll while lightbox is open */
body.lb-locked { overflow: hidden; }
