:root {
    --oe-viewer-bg: #05051b;
    --oe-viewer-cream: #faf5ea;
    --oe-viewer-panel: rgba(5, 5, 27, 0.68);
    --oe-viewer-ui: rgba(250, 245, 234, 0.92);
    --oe-viewer-ui-soft: rgba(250, 245, 234, 0.62);
    --oe-pv-vw: 100vw;
    --oe-pv-vh: 100dvh;
}

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

/* The site header must never re-enter the stacking context when iOS rotates. */
body.oe-photography-viewer-open header,
body.oe-photography-viewer-open #masthead,
body.oe-photography-viewer-open .site-header,
body.oe-photography-viewer-open .oe-global-header {
    visibility: hidden !important;
    pointer-events: none !important;
}

body.oe-photography-viewer-enabled .entry-content figure.wp-block-image img,
body.oe-photography-viewer-enabled .entry-content figure.wp-block-gallery img,
body.oe-photography-viewer-enabled .wp-block-post-content figure.wp-block-image img,
body.oe-photography-viewer-enabled .wp-block-post-content figure.wp-block-gallery img,
body.oe-photography-viewer-enabled .oe-portfolio img {
    cursor: zoom-in;
}

.oe-pv {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 2147483646 !important;
    display: none;
    width: var(--oe-pv-vw);
    height: var(--oe-pv-vh);
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--oe-viewer-bg);
    color: var(--oe-viewer-cream);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    isolation: isolate;
}

.oe-pv.is-open { display: block; }

.oe-pv__stage,
.oe-pv__image-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fill the viewer canvas, then contain the complete photographic frame inside it.
   This deliberately allows enlargement beyond the image's CSS intrinsic size. */
.oe-pv__image {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: contain;
    object-position: center;
    transform-origin: center center;
    will-change: transform;
    -webkit-user-drag: none;
    user-drag: none;
}

.oe-pv__chrome {
    opacity: 1;
    transition: opacity 180ms ease;
    pointer-events: none;
}
.oe-pv.is-chrome-hidden .oe-pv__chrome { opacity: 0; }

.oe-pv__close,
.oe-pv__nav {
    pointer-events: auto;
    position: absolute;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(5, 5, 27, 0.28);
    color: var(--oe-viewer-ui);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.oe-pv__close {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    font: 300 34px/42px Inter, Arial, sans-serif;
}

.oe-pv__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 68px;
    font: 300 42px/64px Georgia, serif;
}
.oe-pv__prev { left: max(8px, env(safe-area-inset-left)); }
.oe-pv__next { right: max(8px, env(safe-area-inset-right)); }

.oe-pv__caption {
    pointer-events: auto;
    position: absolute;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    width: min(900px, calc(100% - 32px));
    padding: 10px 14px 11px;
    background: var(--oe-viewer-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.oe-pv__count {
    padding-top: 1px;
    color: var(--oe-viewer-ui-soft);
    font: 300 12px/1.45 Inter, Arial, sans-serif;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.oe-pv__caption-text {
    color: rgba(250, 245, 234, 0.88);
    font: 300 13px/1.45 Inter, Arial, sans-serif;
    letter-spacing: 0.01em;
}
.oe-pv__caption.is-count-only { width: auto; min-width: 0; grid-template-columns: 1fr; }
.oe-pv__caption.is-count-only .oe-pv__caption-text { display: none; }
.oe-pv__nav[hidden] { display: none !important; }

@media (max-width: 767px) {
    .oe-pv__close { width: 44px; height: 44px; font-size: 32px; line-height: 40px; }
    .oe-pv__nav { display: none; }
    .oe-pv__caption {
        width: calc(100% - 24px);
        bottom: max(10px, env(safe-area-inset-bottom));
        gap: 12px;
        padding: 9px 11px 10px;
    }
    .oe-pv__count { font-size: 11px; }
    .oe-pv__caption-text { font-size: 12px; }
}

@media (orientation: landscape) and (max-height: 600px) {
    .oe-pv__caption { width: min(760px, calc(100% - 120px)); padding-top: 7px; padding-bottom: 8px; }
    .oe-pv__close { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
}

@media (prefers-reduced-motion: reduce) { .oe-pv__chrome { transition: none; } }
