/* Image viewer shared by the studio and /manage: an immersive dark stage in every theme, like Photos. */
#dialog.image-viewer-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
#dialog.image-viewer-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; inset: 0; border: 0; border-radius: 0; background: #0b0b0c; color: #f5f5f7; color-scheme: dark; box-shadow: none; }
#dialog.image-viewer-dialog::backdrop { background: rgba(0, 0, 0, .7); }
@starting-style { #dialog.image-viewer-dialog[open] { opacity: 0; transform: scale(.985); } }
.image-viewer-dialog .dialog-heading { padding: 12px 14px 8px 20px; background: transparent; border: 0; }
.image-viewer-dialog .dialog-heading h2 { color: #f5f5f7; font-size: 15px; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.image-viewer-dialog .dialog-heading .close-button, .image-viewer-dialog #close-dialog { width: 34px; min-width: 34px; min-height: 34px; border: 0; background: rgba(255, 255, 255, .12); color: #f5f5f7; box-shadow: none; }
.image-viewer-dialog #close-dialog { border-radius: 50%; }
#picture-download { min-height: 44px; padding: 0 18px; border-radius: 999px; gap: 6px; font-weight: 600; }
#picture-download svg { width: 16px; height: 16px; }
.image-viewer-dialog #close-dialog:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
.image-viewer-dialog #dialog-content { flex: 1; min-height: 0; display: flex; padding: 0; overflow: hidden; }
.viewer-shell { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: transparent; touch-action: none; cursor: zoom-in; }
.viewer-stage:focus-visible { outline: 2px solid rgba(10, 132, 255, .8); outline-offset: -2px; }
.viewer-stage .full-image-preview { position: absolute; top: 50%; left: 50%; max-width: none; transform-origin: center; user-select: none; -webkit-user-select: none; image-rendering: auto; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: viewer-in 320ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
.viewer-stage.viewer-zoomed { cursor: grab; }
.viewer-stage.viewer-zoomed:active { cursor: grabbing; }
#viewer-message { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: rgba(245, 245, 247, .6); font-size: 14px; }
.viewer-nav { position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #f5f5f7; box-shadow: none; opacity: 0; transform: translateY(-50%); transition: opacity 200ms ease, background 200ms ease; backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); }
.viewer-nav svg { width: 20px; height: 20px; }
.viewer-nav.previous { left: 16px; }
.viewer-nav.next { right: 16px; }
.viewer-shell:hover .viewer-nav:not(:disabled), .viewer-nav:focus-visible { opacity: 1; }
.viewer-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.viewer-nav:disabled { opacity: 0 !important; pointer-events: none; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 16px; flex-wrap: wrap; }
.viewer-zoom { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, .1); }
.viewer-zoom button { border: 0; box-shadow: none; color: #f5f5f7; min-height: 32px; min-width: 32px; padding: 0 10px; border-radius: 999px; background: transparent; font-size: 13px; }
.viewer-zoom button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.viewer-zoom output { min-width: 48px; text-align: center; font-size: 13px; color: rgba(245, 245, 247, .8); font-variant-numeric: tabular-nums; }
.viewer-meta { color: rgba(245, 245, 247, .5); font-size: 13px; font-variant-numeric: tabular-nums; }
.viewer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; }
.viewer-actions button { border: 0; box-shadow: none; min-height: 44px; min-width: 44px; }
#picture-favorite { width: 44px; padding: 0; }
#picture-favorite svg { width: 18px; height: 18px; }
#picture-favorite[aria-pressed="true"] { color: #ffb2bf; }
#picture-favorite[aria-pressed="true"] svg { fill: currentColor; }
.viewer-quiet { border-radius: 999px; min-height: 40px; padding: 0 16px; background: rgba(255, 255, 255, .12); color: #f5f5f7; }
.viewer-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
#picture-delete { width: 44px; padding: 0; color: #ff6961; }
@media (hover: none) { .viewer-nav { display: none; } }
@media (max-width: 760px) {
  .image-viewer-dialog .dialog-heading { padding-top: calc(10px + env(safe-area-inset-top)); }
  .viewer-bar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .viewer-meta { display: none; }
  /* Pinch and double-tap zoom on phones; actions wrap instead of squeezing below touch size. */
  .viewer-zoom { display: none; }
  .viewer-bar { justify-content: center; }
  .viewer-actions { width: 100%; }
  .viewer-actions #picture-download { flex: 1 1 100px; }
  .viewer-actions #picture-reuse { flex: 1 0 100%; order: -1; }
}
@media (prefers-reduced-motion: reduce) { .viewer-stage .full-image-preview { animation: none; } }


/* Explicit comparison uses contained images and native scrolling, never a page-wide swipe handler. */
.comparison-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 12px; }
.comparison-shell #comparison-message { margin: auto; text-align: center; }
.comparison-grid { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); min-height: 0; gap: 12px; }
.comparison-grid[hidden] { display: none; }
.comparison-grid figure { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 0; overflow: hidden; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: 12px; }
.comparison-grid figcaption { flex: none; padding: 9px 12px; font-size: 14px; line-height: 1.4; text-align: center; }
.comparison-picture { flex: 1; min-height: 0; min-width: 0; }
.comparison-picture img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.comparison-actions { flex: none; justify-content: space-between; }
.comparison-actions button { min-height: 44px; min-width: 44px; }
@media (max-width: 760px) { .comparison-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 8px; } .comparison-shell { gap: 8px; } }

@media (max-width: 760px) and (max-height: 500px) and (orientation: landscape) { .comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); } }
