/* =====================================================================
   Beyond Journey - photo gallery (lightbox)      js/bj-gallery.js
   ---------------------------------------------------------------------
   Prefix .bjpg- throughout. Loads on any page that opens photographs;
   nothing here selects a bare element or a class another module uses.

   The dialog sits at z-index 2000 - the header's own note reserves that
   layer for modals (the header pins at 1000).
   ===================================================================== */

.bjpg {
  --bjpg-ink: #17233e;
  --bjpg-orange: #f5761a;
  --bjpg-ease: cubic-bezier(.4, 0, .2, 1);

  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  opacity: 0; transition: opacity .22s var(--bjpg-ease);
}
.bjpg.is-open { opacity: 1; }
.bjpg[hidden] { display: none; }

/* the page must not scroll behind the photographs */
html.bjpg-lock, html.bjpg-lock body { overflow: hidden; }

.bjpg__scrim {
  position: absolute; inset: 0;
  background: rgba(8, 12, 24, .9);
}

/* ---- the dialog: title / stage / tabs / thumbs, stacked ---- */
.bjpg__dialog {
  position: relative; z-index: 1;
  width: min(1180px, 100%);
  height: min(860px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  color: #fff;
  transform: translateY(12px) scale(.985);
  transition: transform .26s var(--bjpg-ease);
}
.bjpg.is-open .bjpg__dialog { transform: none; }

/* ---- head ---- */
.bjpg__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 4px; }
.bjpg__titles { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.bjpg__title {
  margin: 0; font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 0;
  text-transform: none;                 /* style.css Title-Cases headings */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bjpg__count { font-size: 13px; color: rgba(255, 255, 255, .62); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.bjpg__close {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 16px;
  display: grid; place-items: center;
  transition: background .18s var(--bjpg-ease);
}
.bjpg__close:hover { background: rgba(255, 255, 255, .2); }
.bjpg__close:focus-visible,
.bjpg__arrow:focus-visible,
.bjpg__tab:focus-visible,
.bjpg__thumb:focus-visible { outline: 3px solid rgba(245, 118, 26, .7); outline-offset: 2px; }

/* ---- stage ---- */
.bjpg__stage { position: relative; min-height: 0; display: grid; place-items: center; }
.bjpg__fig { margin: 0; width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
.bjpg__img {
  width: 100%; height: 100%; min-height: 0;
  object-fit: contain;
  border-radius: 14px;
  background: #0d1322;
  display: block;
}
.bjpg__cap {
  text-align: center; font-size: 13.5px; color: rgba(255, 255, 255, .78);
  min-height: 1.4em;
}

.bjpg__arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .92); color: var(--bjpg-ink); font-size: 15px;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .6);
  transition: background .18s var(--bjpg-ease), transform .18s var(--bjpg-ease);
}
.bjpg__arrow:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.bjpg__arrow--prev { left: 14px; }
.bjpg__arrow--next { right: 14px; }
.bjpg--single .bjpg__arrow { display: none; }

/* ---- group tabs ---- */
.bjpg__tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px;
  scrollbar-width: none;
}
.bjpg__tabs::-webkit-scrollbar { display: none; }
.bjpg__tabs[hidden] { display: none; }
.bjpg__tab {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18);
  background: transparent; color: rgba(255, 255, 255, .82); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .18s var(--bjpg-ease), color .18s var(--bjpg-ease), border-color .18s var(--bjpg-ease);
}
.bjpg__tab span { color: rgba(255, 255, 255, .5); font-weight: 500; }
.bjpg__tab:hover { border-color: rgba(255, 255, 255, .4); color: #fff; }
.bjpg__tab.is-on { background: #fff; color: var(--bjpg-ink); border-color: #fff; }
.bjpg__tab.is-on span { color: rgba(23, 35, 62, .55); }

/* ---- thumbnail strip ---- */
.bjpg__thumbs {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 6px;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
}
.bjpg__thumb {
  flex: 0 0 auto; width: 96px; height: 64px; padding: 0; border: 0; border-radius: 10px;
  overflow: hidden; cursor: pointer; background: #0d1322; scroll-snap-align: center;
  opacity: .55; transition: opacity .18s var(--bjpg-ease), box-shadow .18s var(--bjpg-ease), transform .18s var(--bjpg-ease);
}
.bjpg__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bjpg__thumb:hover { opacity: .9; }
.bjpg__thumb.is-on { opacity: 1; box-shadow: 0 0 0 2px var(--bjpg-orange), 0 0 0 4px rgba(245, 118, 26, .3); transform: scale(1.04); }

/* ---- phones ---- */
@media (max-width: 767px) {
  .bjpg { padding: 0; }
  .bjpg__dialog { width: 100%; height: 100%; gap: 8px; padding: 10px 10px 12px; }
  .bjpg__title { font-size: 15px; }
  .bjpg__img { border-radius: 10px; }
  .bjpg__arrow { width: 38px; height: 38px; font-size: 13px; }
  .bjpg__arrow--prev { left: 6px; }
  .bjpg__arrow--next { right: 6px; }
  .bjpg__thumb { width: 72px; height: 50px; border-radius: 8px; }
  .bjpg__tab { padding: 7px 12px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .bjpg, .bjpg__dialog, .bjpg__thumb, .bjpg__arrow { transition: none; }
}
