html.oz-photo-open,
html.oz-photo-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

img[data-oz-photo-trigger] {
  cursor: zoom-in;
}

img[data-oz-photo-trigger]:focus-visible {
  outline: 3px solid var(--accent, Highlight);
  outline-offset: -3px;
}

.oz-photo-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: Canvas;
  color: CanvasText;
  font: 500 15px/1.35 var(--font-body, system-ui, sans-serif);
}

.oz-photo-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.oz-photo-dialog::backdrop {
  background: Canvas;
}

.oz-photo-dialog [hidden] {
  display: none !important;
}

.oz-photo-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  border-block-end: 1px solid var(--borderSoft, ButtonBorder);
  color: var(--text, CanvasText);
  background: var(--surface, Canvas);
}

.oz-photo-bar .oz-photo-title {
  margin: 0;
  color: inherit;
  font: 650 clamp(15px, 1.4vw, 21px)/1.2 var(--font-heading, system-ui, sans-serif);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.oz-photo-tools,
.oz-photo-versions,
.oz-photo-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.oz-photo-tools {
  gap: 12px;
}

.oz-photo-versions {
  gap: 0;
  border-radius: 8px;
  background: var(--surfaceAlt, ButtonFace);
}

.oz-photo-dialog .oz-photo-button,
.oz-photo-dialog .oz-photo-zoom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 9px;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  letter-spacing: normal;
  cursor: pointer;
  touch-action: manipulation;
}

.oz-photo-dialog .oz-photo-zoom {
  display: block;
  border-color: var(--borderSoft, ButtonBorder);
}

.oz-photo-dialog .oz-photo-button[aria-pressed='true'] {
  color: var(--onAccent, HighlightText);
  background: var(--accent, Highlight);
}

.oz-photo-dialog .oz-photo-button:disabled {
  opacity: .4;
  cursor: default;
}

.oz-photo-dialog :is(button, select, a):focus-visible {
  outline: 2px solid currentcolor;
  outline-offset: -3px;
}

@media (hover: hover) {
  .oz-photo-dialog .oz-photo-button:hover:enabled {
    border-color: currentcolor;
  }
}

.oz-photo-counter {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.oz-photo-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  color-scheme: dark;
  color: CanvasText;
  background: Canvas;
}

.oz-photo-viewport:focus-visible {
  outline: 2px solid Highlight;
  outline-offset: -2px;
}

.oz-photo-dialog .oz-photo-picture {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.oz-photo-dialog .oz-photo-natural {
  max-width: none;
}

.oz-photo-notice {
  display: grid;
  place-content: center;
  gap: 12px;
  min-height: 100%;
  padding: 24px;
  text-align: center;
}

.oz-photo-dialog .oz-photo-status,
.oz-photo-dialog .oz-photo-original {
  margin: 0;
  color: inherit;
  font: inherit;
}

.oz-photo-dialog .oz-photo-original {
  text-decoration: underline;
}

@media (width <= 760px) {
  .oz-photo-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }

  .oz-photo-close {
    grid-area: 1 / 2;
  }

  .oz-photo-tools {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3px 4px;
    font-size: 13px;
  }

  .oz-photo-tools .oz-photo-button,
  .oz-photo-tools .oz-photo-zoom {
    padding-inline: 5px;
  }

  .oz-photo-pages {
    gap: 0;
  }
}
