html.figure-viewing { overflow: hidden; }
.figure-link { cursor: zoom-in; -webkit-tap-highlight-color: transparent; }
.figure-link:focus-visible { outline: 2px solid #164f8b; outline-offset: -3px; }
.figure-viewer[open] {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: min(96vw, 1500px);
  height: 92vh;
  height: 92dvh;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  margin: auto;
  padding: 0;
  color: #fff;
  background: #1b1d20;
  border: 1px solid #484b50;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 80px #0007;
}
.figure-viewer::backdrop { background: rgba(14, 16, 18, .82); }
.figure-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  background: #242629;
}
.figure-viewer-bar h2 {
  margin: 0;
  color: #fff;
  font: 500 15px/1.4 system-ui, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  overflow-wrap: anywhere;
}
.figure-viewer-actions { display: flex; flex-shrink: 0; gap: 3px; }
.figure-viewer-actions button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font: 400 25px/1 system-ui, sans-serif;
  cursor: pointer;
}
.figure-viewer-actions button:disabled { opacity: .33; cursor: default; }
.figure-viewer-actions button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
@media (hover: hover) {
  .figure-viewer-actions button:hover:enabled { background: #393d41; }
}
.figure-viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.figure-viewer-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.figure-viewer-stage.can-pan img { cursor: grab; }
.figure-viewer-stage.can-pan:active img { cursor: grabbing; }
@media (max-width: 600px) {
  .figure-viewer[open] {
    width: 100%;
    height: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .figure-viewer-bar { padding: 5px 7px 5px 12px; }
}
