/* === Shared picture viewer (zoomViewer.js + zoomViewerWire.js) ===
   The viewer is the same in every theme: a picture reads best on a deep neutral dark, so the backdrop never takes the
   theme colour. Only the focus ring uses the theme accent. Phone first: the picture uses the whole width at 390 px. */

/* Pictures that open big: a zoom cursor and a soft lift on hover; a clear ring when reached by keyboard. */
img[data-zoom-armed="on"] { cursor: zoom-in; transition: filter 0.18s ease, transform 0.18s ease; }
@media (hover: hover) { img[data-zoom-armed="on"]:hover { filter: brightness(1.08) saturate(1.04); } }
img[data-zoom-armed="on"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Overlays drawn on top of some pictures must let the tap reach the picture underneath. */
.pcs-frame::after, .pcs-n, .bd-pic::after, .bd-chip { pointer-events: none; }

/* The magnifier for a picture whose own tap does something else (pick a person, tick a photo). */
.zv-badge-host { position: relative; }
.zv-badge { position: absolute; top: 0.4rem; right: 0.4rem; z-index: 3; display: grid; place-items: center; width: 32px; height: 32px;
  padding: 0; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 50%; background: rgba(12, 14, 18, 0.62); color: #fff;
  cursor: zoom-in; backdrop-filter: blur(4px); transition: background 0.15s ease, transform 0.15s ease; }
.zv-badge:hover { background: rgba(12, 14, 18, 0.85); transform: scale(1.06); }
.zv-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zv-badge-host.is-bottom .zv-badge { top: auto; bottom: 0.4rem; }

/* The viewer itself. */
dialog.zv { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  overflow: hidden; background: rgba(9, 10, 12, 0.94); color: #f3f3f1; font-family: var(--font-body, system-ui, sans-serif); }
dialog.zv::backdrop { background: rgba(9, 10, 12, 0.55); backdrop-filter: blur(6px); }
dialog.zv[open] { animation: zvIn 0.18s ease-out; }
@keyframes zvIn { from { opacity: 0; } to { opacity: 1; } }

.zv-stage { position: absolute; inset: 0; display: flex; padding: 3.75rem 5rem 4.5rem; overflow: hidden; touch-action: pan-y pinch-zoom; }
.zv-img { display: block; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 3px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); user-select: none; -webkit-user-select: none; opacity: 0; transition: opacity 0.2s ease; cursor: default; }
.zv-img.is-ready { opacity: 1; }
.zv.can-zoom .zv-img { cursor: zoom-in; }
.zv.is-zoomed .zv-stage { padding: 0; overflow: auto; touch-action: auto; cursor: grab; overscroll-behavior: contain; }
.zv.is-zoomed .zv-stage:active { cursor: grabbing; }
.zv.is-zoomed .zv-img { max-width: none; max-height: none; border-radius: 0; box-shadow: none; cursor: zoom-out; }
.zv.is-zoomed .zv-cap { opacity: 0; pointer-events: none; }
.zv-wait { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; font-size: 0.9rem; color: rgba(243, 243, 241, 0.7); }
.zv-wait:empty { display: none; }

.zv-top { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.7rem 1.4rem 1.1rem; background: linear-gradient(rgba(9, 10, 12, 0.7), rgba(9, 10, 12, 0)); pointer-events: none; }
.zv-top > * { pointer-events: auto; }
.zv-count { margin: 0; font-size: 0.9rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; color: rgba(243, 243, 241, 0.82); }

.zv-x, .zv-nav { display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, 0.1); transition: background 0.15s ease, opacity 0.15s ease; }
.zv-x { width: 44px; height: 44px; }
.zv-x:hover, .zv-nav:not(:disabled):hover { background: rgba(255, 255, 255, 0.22); }
.zv-x:focus-visible, .zv-nav:focus-visible { outline: 2px solid var(--accent, #fff); outline-offset: 3px; }
.zv-nav { position: absolute; top: 50%; z-index: 2; width: 52px; height: 52px; transform: translateY(-50%); }
.zv-nav[hidden] { display: none; }
.zv-nav:disabled { opacity: 0.22; cursor: default; }
.zv-prev { left: 1.1rem; }
.zv-next { right: 1.1rem; }

.zv-cap { position: absolute; left: 50%; bottom: 1.1rem; z-index: 2; transform: translateX(-50%); width: max-content;
  max-width: min(44rem, calc(100% - 2rem)); margin: 0; padding: 0.5rem 0.95rem; border-radius: 10px; background: rgba(9, 10, 12, 0.66);
  font-size: 0.95rem; line-height: 1.45; text-align: center; color: #f3f3f1; overflow-wrap: anywhere; transition: opacity 0.15s ease; }
.zv-cap[hidden] { display: none; }

@media (max-width: 640px) {
  .zv-stage { padding: 3.6rem 0.5rem 4.6rem; }
  .zv-nav { width: 42px; height: 42px; top: auto; bottom: 0.8rem; transform: none; background: rgba(255, 255, 255, 0.14); }
  .zv-prev { left: 0.6rem; }
  .zv-next { right: 0.6rem; }
  .zv-cap { bottom: 0.9rem; max-width: calc(100% - 7.5rem); font-size: 0.86rem; padding: 0.45rem 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.zv[open], .zv-img, img[data-zoom-armed="on"], .zv-badge { animation: none; transition: none; }
}
