/* Keep the complete image visible by default, then allow deliberate zooming. */
#image-preview .image-stage {
  width: 100%;
  height: min(70vh, calc(90dvh - 160px), 900px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: zoom-in;
}
#image-preview .image-stage.is-zoomed { cursor: grab; }
#image-preview .image-stage.is-dragging { cursor: grabbing; }
#image-preview .image-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transform-origin: center;
  will-change: transform;
  user-select: none;
}
#image-preview .image-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid #ffffff55;
  border-radius: 8px;
  background: #10191ed9;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}
#image-preview [data-preview="previous"] { left: 32px; }
#image-preview [data-preview="next"] { right: 32px; }
#image-preview .image-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
#image-preview .image-preview-footer > p {
  flex: 1;
}
#image-preview .image-preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
#image-preview .image-zoom-controls {
  display: none;
}
#image-preview .image-zoom-controls button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid #c9d7dc;
  border-radius: 6px;
  background: #f7fafb;
  color: #16272e;
  font: inherit;
  cursor: pointer;
}
#image-preview .image-zoom-controls button:disabled {
  cursor: not-allowed;
  opacity: .4;
}
#image-preview .image-zoom-controls [data-preview="fit"] {
  padding-inline: 12px;
}
#image-preview .image-zoom-level {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#image-preview .image-count {
  flex-shrink: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
#image-preview button:focus-visible { outline: 3px solid #007f98; outline-offset: 3px; }
#image-preview button[hidden] { display: none; }
@media (max-width: 640px) {
  #image-preview .image-preview-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  #image-preview .image-preview-tools {
    justify-content: space-between;
    width: 100%;
  }
}
