:root {
    --subpage-lightbox-backdrop: rgba(8, 8, 10, 0.94);
    --subpage-lightbox-fg: #f6f2ef;
    --subpage-lightbox-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

body.subpage-lightbox-open {
    overflow: hidden !important;
    touch-action: none;
}

/*
 * The cloned Cargo markup still contains its original eye SVGs. Keep those
 * images in the layout but invisible until local-eyeroll.js has replaced the
 * source with the published Iraxxxdios style. This prevents a one-frame flash
 * of the Cargo eyes on project entry.
 */
img[data-caption*="#eye"]:not([data-ira-eye-ready="true"]),
img[alt*="#eye"]:not([data-ira-eye-ready="true"]) {
    visibility: hidden !important;
}

[local-style="33200005"] {
    display: none !important;
}

img.subpage-zoomable-image {
    cursor: zoom-in !important;
    transition: opacity 180ms ease, filter 180ms ease;
}

a.subpage-lightbox__source-link {
    display: inline-block;
    line-height: 0;
}

img.subpage-zoomable-image:hover {
    filter: brightness(1.03);
}

img.cargo-viewport-fit-image {
    display: block !important;
    height: auto !important;
    max-height: 100vh !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

a.subpage-lightbox__source-link:has(> img.cargo-viewport-fit-image) {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
}

.irax-epub-viewer {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: clamp(1.5rem, 4vw, 3.5rem) auto !important;
    padding: 0 !important;
    box-sizing: border-box;
    clear: both;
}

.irax-epub-viewer iframe.publuuflip,
iframe.publuuflip.publuu-embed-resized {
    display: block !important;
    width: var(--irax-epub-width, min(100%, var(--publuu-embed-natural-width, 100%))) !important;
    max-width: 100% !important;
    height: var(--irax-epub-height, auto) !important;
    max-height: 100vh !important;
    aspect-ratio: var(--publuu-embed-ratio, 5 / 3) !important;
    border: 0 !important;
    box-sizing: border-box;
    background: transparent !important;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

iframe.publuuflip.publuu-free-embed {
    display: block !important;
    margin: clamp(1.5rem, 4vw, 3.5rem) auto !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

@media (max-width: 760px) {
    .irax-epub-viewer {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 1.25rem auto !important;
    }

    .irax-epub-viewer iframe.publuuflip,
    iframe.publuuflip.publuu-embed-resized {
        max-height: 100vh !important;
    }
}

.subpage-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.subpage-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.subpage-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: var(--subpage-lightbox-backdrop);
    backdrop-filter: blur(8px);
}

.subpage-lightbox__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
    touch-action: none;
}

.subpage-lightbox__media-link {
    display: inline-block;
    line-height: 0;
    cursor: -webkit-grab !important;
    cursor: grab !important;
}

.subpage-lightbox__media {
    max-width: none !important;
    max-height: none !important;
    width: auto;
    height: auto;
    box-shadow: var(--subpage-lightbox-shadow);
    user-select: none;
    -webkit-user-drag: none;
    cursor: -webkit-grab !important;
    cursor: grab !important;
    transform-origin: center center;
    will-change: transform;
}

.subpage-lightbox.is-open .subpage-lightbox__media-link,
.subpage-lightbox.is-open .subpage-lightbox__media,
.subpage-lightbox__media.is-click-close {
    cursor: -webkit-grab !important;
    cursor: grab !important;
}

.subpage-lightbox.is-dragging,
.subpage-lightbox.is-dragging * {
    cursor: -webkit-grabbing !important;
    cursor: grabbing !important;
}

.subpage-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--subpage-lightbox-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
    backdrop-filter: blur(8px);
}

.subpage-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.03);
}

.subpage-lightbox__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.subpage-lightbox__close svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.subpage-lightbox__hint {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font: 500 0.82rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
    .subpage-lightbox__stage {
        padding: 0.5rem;
    }

    .subpage-lightbox__close {
        top: 0.75rem;
        right: 0.75rem;
    }

    .subpage-lightbox__hint {
        bottom: 0.75rem;
        max-width: calc(100vw - 1.5rem);
        text-align: center;
        white-space: normal;
    }
}
