.jmg-gallery {
  width: 100%;
  max-width: 720px;
  min-width: 0;
  margin-inline: auto;
  color: #332d29;
  --jmg-surface: #f7f5f2;
}
.jmg-gallery *, .jmg-gallery *::before { box-sizing: border-box; }
.jmg-gallery [hidden], .jmg-gallery dialog:not([open]) { display: none !important; }
.jmg-gallery .jmg-stage {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  max-height: 72vh;
  width: 100%;
  background: var(--jmg-surface);
  touch-action: pan-y pinch-zoom;
}
.jmg-gallery .jmg-frame {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2%, 18px);
}
.jmg-gallery .jmg-frame img, .jmg-gallery .jmg-view img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: contain;
  margin: 0;
  box-shadow: none;
}
.jmg-gallery .jmg-frame { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.jmg-gallery button {
  font: inherit;
  font-size: 15px;
  line-height: 1.2;
  color: #332d29;
  background: #fff;
  border: 1px solid #c8c0b9;
  border-radius: 4px;
  box-shadow: none;
  text-transform: none;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  margin: 0;
}
.jmg-gallery button:focus-visible, .jmg-gallery .jmg-view:focus-visible {
  outline: 3px solid #76502e;
  outline-offset: -4px;
}
.jmg-gallery .jmg-stage button { position: absolute; z-index: 1; }
.jmg-gallery .jmg-zoom { right: 8px; bottom: 8px; }
.jmg-gallery .jmg-prev, .jmg-gallery .jmg-next {
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  border-radius: 50%;
  font: 28px/1 Georgia, serif;
}
.jmg-gallery .jmg-prev { left: 8px; }
.jmg-gallery .jmg-next { right: 8px; }
.jmg-gallery .jmg-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px;
}
.jmg-gallery .jmg-strip button { flex: 0 0 64px; height: 64px; padding: 4px; background: var(--jmg-surface); }
.jmg-gallery .jmg-strip button[aria-pressed="true"] { border: 2px solid #715336; }
.jmg-gallery .jmg-strip img { display: block; width: 100%; height: 100%; object-fit: contain; margin: 0; }
.jmg-gallery .jmg-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.jmg-gallery dialog.jmg-dialog {
  position: fixed; inset: 0; margin: auto; padding: 0;
  width: min(96vw, 1600px); height: 90vh; height: 90dvh;
  max-width: 96vw; max-height: 96vh; border: 0;
  background: var(--jmg-surface); color: #332d29;
}
.jmg-gallery .jmg-dialog[open] { display: flex; flex-direction: column; }
.jmg-gallery .jmg-dialog::backdrop { background: rgb(27 23 21 / 78%); }
.jmg-gallery .jmg-bar { display: flex; justify-content: flex-end; gap: 8px; padding: 8px; }
.jmg-gallery .jmg-view { flex: 1; min-height: 0; overflow: auto; display: flex; padding: 8px; }
.jmg-gallery .jmg-view img { flex: none; margin: auto; }
.jmg-gallery .jmg-view.jmg-real img { max-width: none; max-height: none; }

