/* ============================================================
   Image viewer.

   Colours come from the active theme via variables, so one file
   serves every theme. Only transform and opacity are animated.
   ============================================================ */

.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: var(--lb-bg, rgba(10, 10, 10, 0.97));
  color: var(--lb-ink, #fff);
  opacity: 0;
  transition: opacity 150ms linear;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.lb.is-open { display: block; opacity: 1; }
html.lb-lock { overflow: hidden; }

/* ---------- stage ----------------------------------------- */

.lb__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lb__img {
  max-width: var(--lb-img-max-w, 92vw);
  max-height: var(--lb-img-max-h, 88vh);
  transform-origin: center center;
  will-change: transform;
  cursor: zoom-in;
  -webkit-user-drag: none;
  box-shadow: var(--lb-img-shadow, 0 2px 40px rgba(0,0,0,.6));
}
.lb__img--anim { transition: transform 220ms cubic-bezier(.22,.7,.25,1); }
.lb.is-zoomed  .lb__img { cursor: grab; }
.lb.is-panning .lb__img { cursor: grabbing; transition: none; }

/* the image does not move when the caption opens - artboards 4 and 5 keep it
   in exactly the same place */

/* ---------- chrome ---------------------------------------- */

.lb__bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(12px, 3vw, 26px);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 2;
}
.lb__bar > * { pointer-events: auto; }
.lb__count { color: var(--lb-dim, rgba(255,255,255,.62)); font-variant-numeric: tabular-nums; }
.lb__tools { display: flex; align-items: center; gap: 2px; }

.lb__btn {
  appearance: none; border: 0; background: transparent;
  color: var(--lb-dim, rgba(255,255,255,.72));
  font: inherit; font-size: 14px; line-height: 1;
  min-width: 32px; height: 32px; padding: 0 8px;
  cursor: pointer;
  transition: color 90ms linear, background-color 90ms linear;
}
.lb__btn:hover, .lb__btn:focus-visible {
  color: var(--lb-btn-ink, #fff);
  background: var(--lb-btn-bg, #fbf1a9);
  outline: none;
}
.lb__btn--pct { min-width: 50px; font-variant-numeric: tabular-nums; }
.lb__btn--close { font-size: 20px; }

.lb__nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  appearance: none; border: 0; background: transparent;
  color: var(--lb-dim, rgba(255,255,255,.6));
  font-size: 34px; line-height: 1; width: 54px; height: 80px;
  cursor: pointer; z-index: 2;
  transition: color 90ms linear, opacity 140ms linear;
}
.lb__nav:hover, .lb__nav:focus-visible { color: var(--lb-btn-bg, #fbf1a9); outline: none; }
.lb__nav--prev { left: 4px; }
.lb__nav--next { right: 4px; }
.lb.is-zoomed .lb__nav { opacity: 0; pointer-events: none; }

/* ---------- caption chip that expands (artboards 4 and 5) --- */
/*
   Resting state is a small pale-yellow chip holding the caption.
   Clicking it grows the same box downward to reveal the
   description - the same idiom as the nav, so the site has one
   language for "yellow reveals more".
*/

.lb__panel {
  position: absolute;
  top: var(--lb-chip-top, 11vh);
  right: var(--lb-chip-right, 3vw);
  width: var(--lb-panel-w, 15vw);
  min-width: 190px;
  max-height: 78vh;
  background: var(--panel, #fbf3bd);
  color: var(--olive, #6f6220);
  border-radius: 3px;
  padding: 6px 10px;
  z-index: 3;
  cursor: pointer;
  overflow: hidden;
  /* width collapses to the chip until opened */
  transition: border-radius 220ms linear;
}
.lb__panel:focus-visible { outline: 2px solid var(--ink, #111); outline-offset: 2px; }
.lb.is-panel-open .lb__panel { border-radius: 3px 12px 12px 3px; overflow-y: auto; }

.lb__panel h3 {
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  margin: 0;
  color: var(--olive-dark, #5d5115);
}

/* the part that grows */
.lb__panel-body {
  height: 0;
  overflow: hidden;
}
.lb__panel-body p {
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 0 0;
}
.lb__panel-body p:first-child { margin-top: 12px; }

/* chip is only as wide as it needs to be until it opens */
.lb__panel:not(.is-wide) { width: auto; min-width: 0; max-width: var(--lb-panel-w, 15vw); }

/* the chip carries the caption now, so the centred one is not needed */
.lb__cap { display: none; }

/* loading tick */
.lb.is-loading::after {
  content: "";
  position: absolute; top: 0; left: 0;
  height: 2px; width: 100%;
  background: var(--lb-btn-bg, #fbf1a9);
  transform-origin: left center;
  animation: lb-load 900ms ease-in-out infinite;
}
@keyframes lb-load {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(.9); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.gal a[data-zoom] { display: block; cursor: zoom-in; }

@media (max-width: 720px) {
  .lb__img { max-width: 100vw; max-height: 70vh; }

  /* every control grows to a thumb-sized target (44px minimum) */
  .lb__nav { width: 52px; height: 104px; font-size: 30px; }
  .lb__bar { padding: 10px 12px; }
  .lb__btn { min-width: 44px; height: 44px; font-size: 16px; }
  .lb__btn--pct { min-width: 58px; font-size: 12px; }
  .lb__btn--close { font-size: 24px; }

  /* the caption becomes a sheet along the bottom edge */
  .lb__panel {
    top: auto; bottom: 0; right: 0; left: 0;
    width: auto; max-width: none; max-height: 52vh;
    min-height: 46px;
    border-radius: 10px 10px 0 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .lb.is-panel-open .lb__panel { border-radius: 10px 10px 0 0; }
  .lb__panel:not(.is-wide) { max-width: none; }
  .lb__panel h3 { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb, .lb__img, .lb__panel, .lb__panel-body { transition: none !important; }
  .lb.is-loading::after { animation: none; opacity: 1; }
}
