/* Viewer: a dark overlay; one file, its bar, gallery arrows, status (loading, cannot show) */
.viewer { position: fixed; inset: 0; z-index: 60; background: #0b0f0e; display: flex; flex-direction: column; color: #fff; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-count { color: #b7c4bf; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer .icon-btn.light[aria-pressed="true"] { background: rgb(255 255 255 / .16); }
/* one definite cell all the way down, so max-height: 100% means "the free space" */
.viewer-body { position: relative; flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 0 16px 16px; }

/* stage: what a viewer component puts into the body */
.stage { width: 100%; height: 100%; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; }
.stage.gone { visibility: hidden; }
.stage img, .stage video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.stage.image { overflow: hidden; }
.stage.image.fit img { cursor: zoom-in; object-fit: contain; }
.stage.image.fit.small img { cursor: default; }
.stage.image.actual { overflow: auto; place-items: start; }
.stage.image.actual img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; }
.stage.audio audio { width: min(560px, 100%); }
.stage.pdf iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer-body pre.stage { display: block; margin: 0; overflow: auto; background: #111816; color: #d7e7df; border-radius: 8px; padding: 16px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

/* status: spinner while loading, the "cannot show" box with its way out */
.viewer-status { position: absolute; inset: 0 16px 16px; display: grid; place-items: center; }
.viewer-status .spinner { border-color: rgb(255 255 255 / .12); border-top-color: rgb(var(--primary)); }
.viewer-body .noprev { text-align: center; color: #b7c4bf; max-width: 420px; }
.viewer-body .noprev .ficon { margin: 0 auto 14px; width: 72px; height: 72px; border-radius: 18px; }
.viewer-body .noprev .ficon svg { width: 34px; height: 34px; }
.viewer-body .noprev .muted { color: #7f8f89; margin-top: 2px; }
.viewer-body .noprev .actions { justify-content: center; }
.viewer-note { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 48px); background: rgb(29 42 37 / .92);
  border: 1px solid rgb(255 255 255 / .08); color: #d7e7df; border-radius: 10px; padding: 8px 14px; font-size: 13px; }

/* gallery arrows */
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgb(0 0 0 / .45); color: #fff; cursor: pointer; z-index: 2; }
.viewer-nav:hover { background: rgb(0 0 0 / .65); }
.viewer-nav.prev { left: 16px; } .viewer-nav.next { right: 16px; }
.viewer-nav svg { width: 24px; height: 24px; }
@media (max-width: 860px) {
  .viewer-nav { width: 40px; height: 40px; top: auto; bottom: 22px; transform: none; }
  .viewer-bar .btn .lbl { display: none; }
  .viewer-body { padding: 0 0 8px; }
}
