/* ==========================================================================
   PHOTO VIEWER — phones and tablets (< 64em), js/lightbox.js
   --------------------------------------------------------------------------
   The work and the screenshots open full screen on a tap (Vadim, 2 Nov:
   stories, posts, before / after, profiles, Insights, offers, slides,
   reviews — not the atmosphere photos or the video tiles). A group of
   pictures (a row of stories, the three Insights…) is leafed through
   with a sideways swipe, like Instagram; a swipe down, the cross or a tap
   on the dark around the picture closes it.

   Ink ground and cream type — the dark side of the site (the menu, the
   case page). The picture is whole (contain), never cropped; it gets the
   field (20) at the sides, 80 at the top for the counter and the cross
   (both on the burger's line, centre y 40) and 56 at the bottom.
   ========================================================================== */

/* The pictures that open: on phones only (the script adds the role and
   the focus; desktop shows the work large already). */
.is-zoomable {
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.is-zoomable:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 2px;
}

html.lb-open {
  overflow: hidden;
}

.lb {
  position: fixed;
  inset: 0;
  z-index: 950;                                /* over the bar and the menu */
  color: var(--color-bg);
  touch-action: none;                          /* every gesture is the viewer's */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lb[hidden] {
  display: none;
}

.lb__bg {
  position: absolute;
  inset: 0;
  background: var(--color-ink);
  opacity: 0;
  transition: opacity 250ms ease;
}

.lb.is-on .lb__bg {
  opacity: var(--lb-bg, 1);
}

.lb__track {
  position: absolute;
  inset: 0;
  display: flex;
  transform: translate3d(calc(-100% * var(--lb-i, 0) + var(--lb-dx, 0px)), var(--lb-dy, 0px), 0);
  opacity: 0;
  transition: transform 350ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 250ms ease;
}

.lb.is-on .lb__track {
  opacity: 1;
}

/* While the finger is down the picture follows it, with no lag. */
.lb.is-dragging .lb__track,
.lb.is-dragging .lb__bg {
  transition: none;
}

.lb__slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem var(--page-margin) var(--space-between);   /* 80 · 20 · 56 */
}

.lb__slide picture {
  display: contents;
}

.lb__slide img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
}

/* Counter «2 / 4», left on the field; the cross right — both centred on
   y 40, like the burger and the menu's cross. */
.lb__count {
  position: absolute;
  z-index: 1;
  top: 2rem;                                   /* the 16-px line centres on 40 */
  left: var(--page-margin);
  color: var(--color-bg-soft);
  font-variant-numeric: tabular-nums;
}

.lb__close {
  position: absolute;
  z-index: 1;
  top: 1.125rem;                               /* 44 × 44 box centred on y 40 */
  right: 0.375rem;                             /* … and on x 362 at 390 */
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-bg);
  cursor: pointer;
}

.lb__close svg {
  width: 0.75rem;                              /* 12, the menu's cross */
  height: 0.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

@media (prefers-reduced-motion: reduce) {
  .lb__bg,
  .lb__track {
    transition: none;
  }
}
