/* ==========================================================
   Shared Photo Lightbox  (public pages)
   Paired with /js/lightbox.js
   ========================================================== */

.lb,
.lb *,
.lb *::before,
.lb *::after { box-sizing: border-box; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  flex-direction: column;
  background: rgba(12, 7, 2, 0.95);
  color: #ffffff;
  font-family: "Manrope", "Noto Sans Devanagari", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.lb.is-open { display: flex; animation: lb-in 0.2s ease; }
.lb.is-closing { display: flex; animation: lb-out 0.16s ease forwards; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-out { from { opacity: 1; } to { opacity: 0; } }

/* ---------- backdrop ---------- */
.lb__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 7, 2, 0.84);
}

/* ---------- top bar ---------- */
.lb__topbar {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 10px 0;
}

.lb__iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.lb__iconbtn:hover { background: rgba(143, 78, 0, 0.85); border-color: rgba(255, 153, 51, 0.7); }
.lb__iconbtn:active { transform: scale(0.92); }
.lb__iconbtn:focus-visible { outline: 2px solid #ff9933; outline-offset: 2px; }
.lb__iconbtn .material-symbols-outlined { font-size: 24px; line-height: 1; }

.lb__close { flex: 0 0 auto; }

/* ---------- stage ---------- */
.lb__stage {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 52px;
  touch-action: none;
  overflow: hidden;
}

.lb__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}

.lb__imgwrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 10px;
  cursor: zoom-in;
}
.lb__imgwrap.is-zoomed { overflow: auto; cursor: grab; touch-action: auto; }
.lb__imgwrap.is-zoomed.is-panning { cursor: grabbing; }

.lb__img {
  display: block;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transform: translateX(var(--lb-shift, 0px)) scale(0.985);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.19, 0.6, 0.28, 1);
}
.lb__img.is-ready { opacity: 1; transform: translateX(0) scale(1); }

.lb__imgwrap.is-zoomed .lb__img {
  max-width: none;
  max-height: none;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- caption ---------- */
.lb__caption {
  flex: 0 0 auto;
  max-width: 900px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lb__caption:empty { display: none; }

/* ---------- prev / next arrows ---------- */
.lb__nav {
  position: absolute;
  z-index: 5;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  background: rgba(43, 27, 10, 0.6);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.lb__nav:hover { background: #8f4e00; box-shadow: 0 6px 20px rgba(255, 153, 51, 0.45); }
.lb__nav:active { transform: translateY(-50%) scale(0.92); }
.lb__nav:focus-visible { outline: 2px solid #ff9933; outline-offset: 2px; }
.lb__nav .material-symbols-outlined { font-size: 30px; line-height: 1; }
.lb__nav--prev { left: 6px; }
.lb__nav--next { right: 6px; }
.lb.is-single .lb__nav { display: none; }

/* ---------- bottom bar ---------- */
.lb__bottombar {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}

.lb__count {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 6px 12px;
  white-space: nowrap;
}
.lb.is-single .lb__count { display: none; }

.lb__hint {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}
.lb__hint kbd {
  font-family: inherit;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* ---------- dots ---------- */
.lb__dots {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px 14px;
}
.lb__dots:empty { display: none; }
.lb__dots .lb__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}
.lb__dots .lb__dot:hover { background: rgba(255, 255, 255, 0.6); }
.lb__dots .lb__dot.is-active {
  width: 22px;
  background: #ff9933;
  box-shadow: 0 0 10px rgba(255, 153, 51, 0.7);
}
.lb.is-single .lb__dots { display: none; }

/* ---------- zoom hint badge on thumbnails ---------- */
.lb-zoomable { cursor: zoom-in; }
.lb-zoomable .lb-zoom-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: rgba(20, 12, 4, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lb-zoomable:hover .lb-zoom-badge,
.lb-zoomable:focus-visible .lb-zoom-badge,
.lb-zoomable:focus-within .lb-zoom-badge { opacity: 1; transform: scale(1); }
.lb-zoom-badge .material-symbols-outlined { font-size: 20px; line-height: 1; }

/* ---------- loading spinner ---------- */
.lb__spinner {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ff9933;
  border-radius: 9999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.lb.is-loading .lb__spinner { opacity: 1; animation: lb-spin 0.8s linear infinite; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* ---------- tablet & up ---------- */
@media (min-width: 640px) {
  .lb__stage { padding: 4px 76px; }
  .lb__nav { width: 52px; height: 52px; }
  .lb__nav .material-symbols-outlined { font-size: 34px; }
  .lb__nav--prev { left: 12px; }
  .lb__nav--next { right: 12px; }
  .lb__iconbtn { width: 46px; height: 46px; }
  .lb__caption { font-size: 16px; }
  .lb__topbar { padding: 14px 14px 0; }
}

/* ---------- small phones ---------- */
@media (max-width: 480px) {
  .lb__stage { padding: 2px 44px; }
  .lb__nav { width: 38px; height: 38px; }
  .lb__nav .material-symbols-outlined { font-size: 26px; }
  .lb__nav--prev { left: 3px; }
  .lb__nav--next { right: 3px; }
  .lb__hint { display: none; }
  .lb__caption { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb__img { transition: none; }
  .lb.is-open, .lb.is-closing { animation: none; }
  .lb.is-loading .lb__spinner { animation: none; }
}
