/**
 * Himbodied sitewide lightbox — styles
 * ------------------------------------------------------------
 * Pairs with himbodied-lightbox.js. Quiet on purpose: dark backdrop,
 * small thin text, no boxes. Uses the site's own font.
 */

/* ---- Click cues: images that will open the lightbox ---- */
.wp-lightbox-container img,
[data-hb-lightbox],
.hb-lightbox,
.hb-lightbox img,
#gallery-scroll img {
  cursor: zoom-in;
}

/* WordPress's own little "expand" icon is replaced by this lightbox, so hide it */
.wp-lightbox-container .lightbox-trigger {
  display: none !important;
}

/* ---- Overlay ---- */
html.hb-viewer-lock {
  overflow: hidden;
}

.hb-viewer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  font-family: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.hb-viewer[hidden] {
  display: none;
}

.hb-viewer.is-open {
  opacity: 1;
}

/* ---- Picture area (room left top and bottom for the controls) ---- */
.hb-viewer__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 56px 16px 96px;
  overflow: hidden;
  touch-action: none;
}

.hb-viewer__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.hb-viewer.is-loaded .hb-viewer__img {
  opacity: 1;
}

.hb-viewer__img.is-zoomed {
  cursor: grab;
}

.hb-viewer__img.is-zoomed:active {
  cursor: grabbing;
}

.hb-viewer.is-loading .hb-viewer__stage::after {
  content: "Loading";
  position: absolute;
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.5;
}

/* ---- Caption ---- */
.hb-viewer__caption {
  position: absolute;
  left: 50%;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 46px);
  transform: translateX(-50%);
  z-index: 2;
  box-sizing: border-box;
  width: min(640px, calc(100vw - 48px));
  max-height: 4.5em;
  margin: 0;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0.8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
}

/* ---- Bottom controls: − Fit 1:1 + ---- */
.hb-viewer__bar {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hb-viewer__btn,
.hb-viewer__close {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  font: inherit;
  line-height: 1;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
  opacity: 0.65;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.hb-viewer__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.hb-viewer__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 44px;
  height: 44px;
  font-size: 30px;
}

.hb-viewer__btn:hover,
.hb-viewer__close:hover,
.hb-viewer__btn:focus-visible,
.hb-viewer__close:focus-visible {
  opacity: 1;
  background: none;
  color: #fff;
}

.hb-viewer__btn:focus-visible,
.hb-viewer__close:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.85);
  outline-offset: -6px;
}

/* If the zoom engine could not load, the picture still opens, just without zoom buttons */
.hb-viewer--basic .hb-viewer__bar {
  display: none;
}

/* Touchscreens (phones and tablets): pinch and double-tap handle zoom, so keep only Fit and 1:1.
   Based on the device, not the window width, so a narrow desktop window keeps its + and - buttons. */
@media (pointer: coarse) {
  .hb-viewer__step {
    display: none;
  }

  .hb-viewer__btn {
    padding: 0 16px;
    font-size: 14px;
  }
}

/* Landscape phones: very little height, so tighten the spacing around the picture */
@media (max-height: 500px) and (orientation: landscape) {
  .hb-viewer__stage {
    padding: 8px 56px 54px;
  }

  .hb-viewer__caption {
    bottom: calc(max(6px, env(safe-area-inset-bottom)) + 44px);
    max-height: 2.8em;
    font-size: 12px;
  }

  .hb-viewer__close {
    top: 2px;
    right: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hb-viewer,
  .hb-viewer__img,
  .hb-viewer__btn,
  .hb-viewer__close {
    transition: none;
  }
}
