/* Article pictures, enlarged. Behaviour in lightbox.js.

   Two parts: the enlarge button laid over each figure's corner, and the
   full-screen viewer. The viewer is dark, as a picture viewer should be, but
   in the site's own warm greys rather than a neutral black, and its text is
   the cream of the page. Light-only like the rest of the site: there is no
   dark theme here, only a dark room for looking at one picture. */

/* ── The button on the figure ─────────────────────────────────────────────
   Absolutely placed in the figure's top corner, which is the picture's top
   corner because the picture is the figure's first box and fills its width.
   Nothing moves when the script adds it.

   Out of the way until wanted on a desk: it appears on hover, and whenever it
   has keyboard focus. On a touch screen there is no hover to reveal it, so it
   is always shown there, a little transparent, as the sign that the picture
   opens. */
.reading figure.fig--zoom{position:relative}
.fig__zoom{position:absolute;top:10px;inset-inline-end:10px;z-index:1;
  width:36px;height:36px;padding:0;border:0;border-radius:50%;
  display:grid;place-items:center;cursor:zoom-in;
  background:rgba(22,24,28,.66);color:#fff;opacity:0;transition:opacity .15s,background .15s}
.fig__zoom svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round}
.fig--zoom:hover .fig__zoom,.fig__zoom:focus-visible{opacity:1}
.fig__zoom:hover{background:rgba(22,24,28,.85)}
.fig__zoom:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (hover:none){.fig__zoom{opacity:.85}}

/* ── The viewer ──────────────────────────────────────────────────────────── */
html.lbox-open{overflow:hidden;scrollbar-gutter:stable}

dialog.lbox{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;
  margin:0;padding:0;border:0;overflow:hidden;overscroll-behavior:contain;
  background:rgba(18,17,15,.96);color:#ece6da;font-family:inherit}
dialog.lbox:focus{outline:none}
dialog.lbox::backdrop{background:transparent}

/* The picture takes whatever height the caption leaves it. */
.lbox__fig{position:absolute;inset:0;margin:0;display:grid;
  grid-template-rows:minmax(0,1fr) auto;justify-items:center;align-items:center;
  gap:14px;padding:68px 76px 26px;cursor:zoom-out}
.lbox__pic{width:100%;height:100%;min-height:0;display:flex;align-items:center;justify-content:center}
/* The page colour behind it, for the drawings exported with a clear ground,
   which would otherwise go black on black. */
.lbox__img{display:block;width:auto;height:auto;max-width:100%;max-height:100%;
  object-fit:contain;border-radius:3px;background:var(--bg,#efe8da);cursor:default}

.lbox__cap{max-width:68ch;max-height:26vh;overflow:auto;cursor:auto;
  font-size:14px;line-height:1.55;text-align:center;color:#d9d2c4}
.lbox__cap[hidden]{display:none}
.lbox__cap b{color:#fff;font-weight:600}
.lbox__cap .fig__credit{display:block;margin-top:4px;font-size:12px;color:#a8a090}

.lbox__btn{position:absolute;z-index:2;width:44px;height:44px;padding:0;border:0;border-radius:50%;
  display:grid;place-items:center;cursor:pointer;
  background:rgba(255,255,255,.1);color:#fff;transition:background .15s}
.lbox__btn:hover{background:rgba(255,255,255,.2)}
.lbox__btn:focus-visible{outline:2px solid #fff;outline-offset:2px}
.lbox__btn:disabled{opacity:.25;cursor:default;background:rgba(255,255,255,.1)}
.lbox__btn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round}
[dir="rtl"] .lbox__prev svg,[dir="rtl"] .lbox__next svg{transform:scaleX(-1)}

.lbox__x{top:12px;inset-inline-end:12px}
.lbox__prev,.lbox__next{top:50%;margin-top:-22px}
.lbox__prev{inset-inline-start:16px}
.lbox__next{inset-inline-end:16px}
.lbox__n{position:absolute;top:24px;inset-inline-start:22px;margin:0;
  font-size:13px;letter-spacing:.06em;color:#b9b1a2;font-variant-numeric:tabular-nums}

/* A phone: the arrows join the close button in the top bar, so they never
   sit over the picture, and the picture gets the whole width. Swiping is the
   main way along here anyway. */
@media (max-width:640px){
  .lbox__fig{padding:64px 0 18px;gap:12px}
  .lbox__img{border-radius:0}
  .lbox__cap{padding:0 16px;font-size:13.5px}
  .lbox__prev,.lbox__next{top:12px;margin-top:0;inset-inline-start:auto}
  .lbox__prev{inset-inline-end:116px}
  .lbox__next{inset-inline-end:64px}
  .lbox__n{inset-inline-start:16px}
}

@media (prefers-reduced-motion:no-preference){
  dialog.lbox[open] .lbox__fig{animation:lbox-in .18s ease-out}
}
/* Movement only, never opacity, as with the signup popup: an animation that
   has not run must still leave the picture visible. */
@keyframes lbox-in{from{transform:scale(.985)}to{transform:none}}
