.lightbox figure.tk-viewer-with-downloads {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-block-size: 0;
  max-block-size: calc(100dvh - 3.25rem);
  max-inline-size: min(94vw, 72rem);
}
.lightbox figure.tk-viewer-with-downloads img {
  flex: 0 1 auto;
  min-block-size: 0;
  max-inline-size: 100%;
  object-fit: contain;
  box-shadow: none;
}
.lightbox figure.tk-viewer-with-downloads figcaption {
  flex: 0 0 auto;
  max-inline-size: 100%;
}
.lightbox .tk-viewer-downloads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
  margin-block-start: .65rem;
}
.lightbox .tk-viewer-downloads[hidden] { display: none; }
.lightbox .tk-viewer-downloads a {
  box-sizing: border-box;
  display: inline-flex;
  min-block-size: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #eed4ab;
  border-radius: 999px;
  padding: .35rem .7rem;
  background: #f9edda;
  color: #192738;
  font: 650 .84rem/1.15 system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
}
.lightbox .tk-viewer-downloads a:hover { background: #fff8ed; text-decoration: underline; }
.lightbox .tk-viewer-downloads a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Keep the original per-card download links accessible if enhancement fails. */
.tk-viewer-download-ready .tk-gallery-visual-card > figcaption {
  display: none !important;
}
.tk-viewer-download-ready .tk-gallery-visual-card > a.view:focus-visible {
  outline: 3px solid #9a6138;
  outline-offset: -3px;
}
.lightbox:has(figure.tk-viewer-with-downloads) {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lightbox figure.tk-viewer-with-downloads {
  max-block-size: calc(100vh - 3.25rem);
  max-block-size: calc(100dvh - 3.25rem);
}
.lightbox figure.tk-viewer-with-downloads img {
  max-block-size: calc(100vh - 8rem);
  max-block-size: calc(100dvh - 8rem);
}
