html.gallery-open,
html.gallery-open body { overflow: hidden; }
.tonsorium-gallery {
  position: fixed;
  z-index: 30;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: rgb(12 12 12 / .98);
  color: #fff;
}
.tonsorium-gallery::backdrop { background: rgb(0 0 0 / .9); }
.tonsorium-gallery__top,
.tonsorium-gallery__bottom {
  position: absolute;
  z-index: 3;
  left: 32px;
  right: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}
.tonsorium-gallery__top { top: max(20px, env(safe-area-inset-top)); }
.tonsorium-gallery__bottom { bottom: max(26px, env(safe-area-inset-bottom)); }
.tonsorium-gallery__counter {
  font-family: var(--mono, monospace);
  font-size: 13px;
  letter-spacing: .06em;
  color: #d8d8d8;
  white-space: nowrap;
}
.tonsorium-gallery__caption {
  margin: 0;
  font-family: var(--sans, Arial, sans-serif);
  font-size: 14px;
  line-height: 1.45;
  color: #e0e0e0;
  text-align: center;
  width: 100%;
}
.tonsorium-gallery__stage {
  position: absolute;
  inset: 84px 100px 80px;
  display: grid;
  place-items: center;
  touch-action: pan-y;
}
.tonsorium-gallery__image {
  grid-area: 1 / 1;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 164px);
  object-fit: contain;
  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}
.tonsorium-gallery__control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 1px solid rgb(255 255 255 / .24);
  border-radius: 50%;
  background: rgb(255 255 255 / .06);
  color: #fff;
  pointer-events: auto;
}
.tonsorium-gallery__control svg { width: 20px; height: 20px; }
.tonsorium-gallery__control:focus-visible { outline: 2px solid #c2ad7d; outline-offset: 5px; }
.tonsorium-gallery__control:disabled { opacity: .3; }
.tonsorium-gallery__previous,
.tonsorium-gallery__next { position: absolute; z-index: 3; top: calc(50% - 24px); }
.tonsorium-gallery__previous { left: 28px; }
.tonsorium-gallery__next { right: 28px; }
.tonsorium-gallery__error { display: none; grid-area: 1 / 1; margin: 0; color: #ddd; font-size: 16px; }
.tonsorium-gallery__stage.has-error .tonsorium-gallery__error { display: block; }
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .tonsorium-gallery__control:hover { background: rgb(255 255 255 / .16); border-color: rgb(255 255 255 / .5); }
}
@media (max-width: 599px) {
  .tonsorium-gallery__top,
  .tonsorium-gallery__bottom { left: 16px; right: 16px; }
  .tonsorium-gallery__stage { inset: 88px 16px 132px; }
  .tonsorium-gallery__image { max-height: calc(100dvh - 220px); }
  .tonsorium-gallery__previous,
  .tonsorium-gallery__next { top: auto; bottom: max(70px, calc(env(safe-area-inset-bottom) + 58px)); }
  .tonsorium-gallery__previous { left: calc(50% - 60px); }
  .tonsorium-gallery__next { right: calc(50% - 60px); }
  .tonsorium-gallery__caption { font-size: 13px; line-height: 1.4; }
}
