.image-viewer {
  position: fixed;
  padding: 0;
  width: min(96vw, 1800px);
  max-width: none;
  max-height: 96vh;
  border: 1px solid #7b6847;
  background: #24221e;
  color: #eae2d1;
  box-shadow: 0 35px 100px #0008;
}
.image-viewer::backdrop {
  background: #12110feb;
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 14px 20px;
  border-bottom: 1px solid #564930;
}
.viewer-bar h2 {
  font: 500 12px/1.6 var(--sans);
  letter-spacing: 0;
}
.viewer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.viewer-actions button {
  min-width: 36px;
  min-height: 34px;
  border: 1px solid #6f5b38;
  background: #342e24;
  color: #e7d3ab;
  border-radius: 4px;
  font-size: 12px;
}
.viewer-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}
.viewer-actions button:hover:not(:disabled) {
  background: #4c3c24;
}
.viewer-surface {
  overflow: auto;
  max-height: calc(96vh - 103px);
  padding: 18px;
  overscroll-behavior: contain;
}
.viewer-surface img {
  max-width: none;
  width: 100%;
  height: auto;
  margin-inline: auto;
}
.viewer-caption {
  padding: 10px 20px;
  font-size: 10px;
  color: #b3a58e;
  border-top: 1px solid #564930;
}
body.viewer-open {
  overflow: hidden;
}
/* Fit both dimensions on first open; scrolling is reserved for explicit zoom. */
.image-viewer {
  height: 96vh;
}
.image-viewer[open] {
  display: flex;
  flex-direction: column;
}
.viewer-bar,
.viewer-caption {
  flex: none;
}
.viewer-surface {
  flex: 1;
  min-height: 0;
  max-height: none;
  display: flex;
  align-items: flex-start;
}
.viewer-surface img {
  flex: none;
  align-self: center;
  width: auto;
  max-width: 100%;
  max-height: 100%;
}
.viewer-surface.is-zoomed {
  display: block;
}
.viewer-surface.is-zoomed img {
  max-width: none;
  max-height: none;
}
