.image-zoom-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:4px 0 8px}
.image-zoom-controls button,.image-zoom-controls a{min-height:44px;padding:9px 13px;border:1px solid #d8c795;border-radius:8px;background:#faf4e6;color:#71551d;font:600 14px/1.4 system-ui;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.image-zoom-controls button:disabled{opacity:.4}.image-zoom-controls output{min-width:48px;text-align:center;font:14px system-ui}
.image-zoom-hint,.gallery-enlarge-hint{font:14px/1.5 system-ui;color:#6a644f;margin:8px 0 12px}
#image-dialog .gallery-stage{overflow:hidden}
.image-zoom-viewport{width:100%;height:min(65dvh,760px);display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none;cursor:grab}
#image-dialog #enlarged-image{width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain;flex-shrink:0;transform-origin:center;user-select:none;-webkit-user-select:none}
#image-dialog .image-side-arrow{z-index:2}
@media(max-width:900px){
 #image-dialog{box-sizing:border-box;width:100vw;max-width:100vw;max-height:100dvh;padding:12px;margin:auto;border-radius:0}
 #image-dialog .image-viewer-head h2{font-size:20px;margin:0}
 #image-dialog .image-viewer-head{margin-bottom:10px}
 #image-dialog .gallery-stage{padding:0 38px}
 #image-dialog .image-side-arrow{width:34px}
 .image-zoom-viewport{height:58dvh}
}
@media(max-height:500px) and (orientation:landscape){
 #image-dialog{width:100vw;max-width:100vw;max-height:100dvh;padding:8px 12px}
 #image-dialog .image-viewer-head{margin:0}.image-viewer-head h2{font-size:18px}
 #image-dialog .image-zoom-hint{display:none}
 #image-dialog figure{margin-top:4px}
 .image-zoom-viewport{height:calc(100dvh - 112px)}
 #image-dialog .image-zoom-controls{margin:2px 0;gap:6px}
}

/* Edge-to-edge fitted artwork, and an independent screen-sized zoom layer. */
#image-dialog .gallery-stage{padding:0;background:#f7f5ef}
#image-dialog .image-zoom-viewport{height:calc(100dvh - 180px);min-height:180px}
#image-dialog.image-zoomed{position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;background:#f7f5ef}
#image-dialog.image-zoomed .image-zoom-viewport{position:fixed;inset:0;width:100vw;height:100dvh;min-height:0;background:#f7f5ef;z-index:1}
#image-dialog.image-zoomed .image-viewer-head{position:fixed;top:8px;right:8px;z-index:5;margin:0;background:#fffef5ed;border-radius:8px}
#image-dialog.image-zoomed .image-viewer-head h2{display:none}
#image-dialog.image-zoomed .image-zoom-controls{position:fixed;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 20px);justify-content:center;z-index:5;padding:6px;border-radius:10px;background:#fffef5ed}
#image-dialog.image-zoomed .image-zoom-hint,#image-dialog.image-zoomed #enlarged-caption,#image-dialog.image-zoomed #image-load-status{display:none}
#image-dialog.image-zoomed .image-side-arrow{position:fixed;top:50%;z-index:5}
@media(max-height:500px) and (orientation:landscape){#image-dialog .image-zoom-viewport{height:calc(100dvh - 112px)}#image-dialog.image-zoomed .image-zoom-viewport{height:100dvh}}
