/* Shared full-size photo viewer (app/static/js/photo-viewer.js).
   Any <img data-zoomable> opens here. The viewer is dark in both themes on
   purpose: a photo reads best on black, and its controls carry their own
   colours so the page theme can't make them disappear. */

img[data-zoomable] { cursor: zoom-in; }

html.pv-open,
html.pv-open body {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.pv-root {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    background: rgba(8, 10, 14, 0.94);
    color: #f5f7fa;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.pv-root.pv-visible { display: block; }
.pv-root:focus { outline: none; }

/* Specific and !important so no page style can put plain page buttons on
   top of the viewer: it stays above everything, the bottom nav included. */
html body > .pv-root { z-index: 2147483000 !important; }

.pv-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    cursor: default;
}
.pv-root.pv-zoomed .pv-stage { cursor: grab; }
.pv-root.pv-dragging .pv-stage { cursor: grabbing; }

.pv-img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none !important;
    max-height: none !important;
    transform-origin: 0 0;
    will-change: transform;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: auto;
    cursor: zoom-in;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}
.pv-root.pv-zoomed .pv-img { cursor: grab; }
.pv-root.pv-dragging .pv-img { cursor: grabbing; }
.pv-root.pv-anim .pv-img { transition: transform 0.22s ease-out; }
.pv-root.pv-loading .pv-img { visibility: hidden; }

.pv-btn {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(20, 24, 31, 0.72);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}
.pv-btn:hover { background: rgba(40, 46, 58, 0.9); }
.pv-btn:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.pv-btn[hidden] { display: none; }

.pv-close { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.pv-prev,
.pv-next { top: 50%; margin-top: -24px; font-size: 34px; }
.pv-prev { left: 12px; }
.pv-next { right: 12px; }

.pv-counter,
.pv-caption {
    position: absolute;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 140px);
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(20, 24, 31, 0.72);
    color: #f5f7fa;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.pv-counter { top: max(22px, calc(env(safe-area-inset-top) + 10px)); }
.pv-caption { bottom: max(16px, env(safe-area-inset-bottom)); }
.pv-counter:empty,
.pv-caption:empty { display: none; }

.pv-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #cbd5e1;
    font-size: 15px;
    pointer-events: none;
}
.pv-status:empty { display: none; }

/* Phones: the arrows would cover the photo; swiping does the job. */
@media (max-width: 600px), (pointer: coarse) {
    .pv-prev,
    .pv-next { display: none; }
}
