/* The image viewer is always dark, like a light table, whatever the page theme. */
.viewer {
  --viewer-bg: #0c0d14; --viewer-fg: #e7e8f0; --viewer-muted: #a2a6bd; --viewer-accent: #ff8a4c;
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--viewer-bg); color: var(--viewer-fg); font: 15px/1.5 system-ui, sans-serif;
}
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer::backdrop { background: rgb(0 0 0 / 0.85); }
.viewer-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.viewer-count { margin: 0; color: var(--viewer-muted); font-variant-numeric: tabular-nums; }
.viewer-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 0 8px; min-height: 0; }
.viewer figure { margin: 0; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
.viewer figure img { width: 100%; height: 100%; object-fit: contain; touch-action: pan-y; user-select: none; }
.viewer figcaption { text-align: center; color: var(--viewer-muted); max-width: 80ch; margin: 0 auto; }
.viewer button { background: none; border: 0; color: var(--viewer-fg); cursor: pointer; border-radius: 6px; }
.viewer button:focus-visible { outline: 2px solid var(--viewer-accent); outline-offset: 2px; }
.viewer-close { font-size: 20px; width: 44px; height: 44px; }
.viewer-step { font-size: 44px; width: 52px; height: 88px; }
.viewer-step:hover, .viewer-close:hover { background: rgb(255 255 255 / 0.08); }
.viewer-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; scroll-padding: 16px; }
.viewer-strip button { flex: none; padding: 0; width: 88px; height: 64px; opacity: 0.5; border: 2px solid transparent; overflow: hidden; }
.viewer-strip button[aria-current="true"] { opacity: 1; border-color: var(--viewer-accent); }
.viewer-strip img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
:is(.grid, .gallery) img { cursor: zoom-in; }
@media (max-width: 600px) {
  .viewer-step { width: 36px; font-size: 32px; }
  .viewer-strip button { width: 64px; height: 48px; }
}
