/* =========================================
   BIBLIA DE PRODUCCION - Infinity OS viewer
   ========================================= */

body.bible-page {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: #fff;
    font-family: var(--font-body);
    background-color: #09000f;
    background-image:
        radial-gradient(circle at 18% 12%, rgba(138, 43, 226, 0.25), transparent 28%),
        radial-gradient(circle at 86% 76%, rgba(255, 43, 214, 0.13), transparent 26%),
        linear-gradient(rgba(139, 77, 255, 0.11) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 43, 214, 0.07) 2px, transparent 2px),
        #09000f;
    background-size: auto, auto, 28px 28px, 28px 28px, auto;
    background-attachment: scroll;
}

body.bible-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(rgba(255,255,255,0.028) 50%, rgba(0,0,0,0.13) 50%);
    background-size: 100% 4px;
}

.bible-main {
    width: min(1180px, calc(100% - 34px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 58px 0 42px;
    transition: margin-left 0.28s ease, max-width 0.28s ease;
}

.bible-main.sidebar-open {
    margin-left: var(--sidebar-width-open);
    max-width: calc(1180px - var(--sidebar-width-open));
}

.bible-page-header {
    margin: 0 auto 26px;
    padding-left: 62px;
    text-align: center;
}

.bible-page-header p {
    width: fit-content;
    margin: 0 auto 10px;
    padding: 4px 10px;
    color: #09000f;
    background: #8b4dff;
    border: 2px solid #fff;
    box-shadow: 4px 4px 0 #ff2bd6;
    font-family: var(--font-terminal);
    font-size: clamp(16px, 2.2vw, 22px);
    line-height: 1;
    letter-spacing: 1px;
}

.bible-page-header h1 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(31px, 5.8vw, 67px);
    font-weight: 400;
    line-height: 1.04;
    text-shadow: 5px 5px 0 #000, 0 0 17px rgba(139, 77, 255, 0.72), 0 0 26px rgba(255, 43, 214, 0.3);
}

.infinity-window {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(rgba(139, 77, 255, 0.055) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 43, 214, 0.045) 2px, transparent 2px),
        rgba(7, 4, 14, 0.97);
    background-size: 20px 20px, 20px 20px, auto;
    border: 4px solid #fff;
    box-shadow: 10px 10px 0 #000, 0 0 24px rgba(139, 77, 255, 0.35);
}

.infinity-window::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(rgba(255,255,255,0.025) 50%, rgba(0,0,0,0.1) 50%);
    background-size: 100% 4px;
}

.infinity-titlebar {
    position: relative;
    z-index: 12;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 7px 13px;
    color: #fff;
    background: linear-gradient(90deg, #6c25dc, #8b4dff 52%, #ff2bd6);
    border-bottom: 4px solid #fff;
    font-family: var(--font-pixel);
    font-size: clamp(12px, 1.7vw, 17px);
    line-height: 1.15;
    text-shadow: 2px 2px 0 #000;
}

.infinity-window-lights {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 7px;
}

.infinity-window-lights i {
    width: 13px;
    height: 13px;
    display: block;
    background: #080711;
    border: 2px solid #fff;
    box-shadow: 2px 2px 0 #000;
}

.infinity-window-lights i:nth-child(2) { background: #00ffff; }
.infinity-window-lights i:nth-child(3) { background: #ff69b4; }

.bible-file-window {
    width: min(720px, calc(100% - 18px));
    min-height: 430px;
    margin: 0 auto 58px;
    animation: bible-window-in 0.45s steps(5) both;
}

@keyframes bible-window-in {
    0% { opacity: 0; transform: translateY(18px) scale(0.97); filter: brightness(1.8); }
    100% { opacity: 1; transform: none; filter: none; }
}

.bible-file-details {
    min-height: 378px;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 34px;
    padding: 42px;
}

.bible-file-icon {
    position: relative;
    width: 154px;
    height: 190px;
    display: grid;
    place-items: end center;
    padding-bottom: 26px;
    color: #fff;
    background: #1b102b;
    border: 5px solid #fff;
    box-shadow: 9px 9px 0 #8b4dff, 15px 15px 0 #000;
}

.bible-file-icon::before {
    content: "";
    position: absolute;
    top: -5px;
    right: -5px;
    width: 52px;
    height: 52px;
    background: #09000f;
    border-left: 5px solid #fff;
    border-bottom: 5px solid #fff;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.bible-file-icon::after {
    content: "LOCKED";
    position: absolute;
    left: 12px;
    top: 22px;
    color: #ff69b4;
    font-family: var(--font-terminal);
    font-size: 18px;
    letter-spacing: 2px;
}

.bible-file-icon span {
    width: calc(100% + 20px);
    padding: 8px 5px;
    color: #09000f;
    background: #ff2bd6;
    border: 4px solid #fff;
    font-family: var(--font-pixel);
    font-size: 24px;
    text-align: center;
    box-shadow: 5px 5px 0 #000;
}

.bible-file-copy h2 {
    margin: 0 0 26px;
    overflow-wrap: anywhere;
    color: #00ffff;
    font-family: var(--font-terminal);
    font-size: clamp(27px, 3.2vw, 32px);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: 1px;
    text-shadow: 3px 3px 0 #000;
}

.bible-file-copy dl {
    display: grid;
    gap: 14px;
    margin: 0 0 28px;
    font-family: var(--font-terminal);
    font-size: 25px;
}

.bible-file-copy dl div {
    display: grid;
    grid-template-columns: 105px 1fr;
    gap: 12px;
}

.bible-file-copy dt { color: #b9a1e8; }
.bible-file-copy dd { margin: 0; color: #fff; }
.bible-file-copy .bible-confidential { color: #ff69b4; text-shadow: 0 0 9px rgba(255, 43, 214, 0.78); }

.infinity-action-button,
.bible-viewer-controls button,
.bible-viewer-controls a {
    appearance: none;
    color: #fff;
    background: #10091a;
    border: 3px solid #8b4dff;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-terminal);
    text-decoration: none;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 4px 4px 0 #000;
    transition: transform 0.12s steps(2), border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.infinity-action-button {
    min-height: 50px;
    padding: 8px 18px;
    font-size: 26px;
}

.infinity-action-button:hover,
.infinity-action-button:focus-visible,
.bible-viewer-controls button:hover,
.bible-viewer-controls button:focus-visible,
.bible-viewer-controls a:hover,
.bible-viewer-controls a:focus-visible {
    color: #fff;
    background: #4b168a;
    border-color: #ff2bd6;
    outline: none;
    transform: translate(3px, -3px);
    box-shadow: -4px 4px 0 #00ffff, 0 0 12px rgba(255, 43, 214, 0.34);
}

.infinity-action-button:active,
.bible-viewer-controls button:active,
.bible-viewer-controls a:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.infinity-action-button:disabled,
.bible-viewer-controls button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.65);
    transform: none;
    box-shadow: 4px 4px 0 #000;
}

.bible-file-loading {
    min-height: 378px;
    padding: 70px 28px 38px;
    text-align: center;
}

.bible-loading-mark {
    height: 80px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 9px;
    margin-bottom: 28px;
}

.bible-loading-mark span {
    width: 24px;
    height: 24px;
    display: block;
    background: #8b4dff;
    border: 3px solid #fff;
    box-shadow: 4px 4px 0 #000;
    animation: bible-loader-jump 0.8s steps(4) infinite;
}

.bible-loading-mark span:nth-child(2) { background: #ff2bd6; animation-delay: 0.1s; }
.bible-loading-mark span:nth-child(3) { background: #00ffff; animation-delay: 0.2s; }
.bible-loading-mark span:nth-child(4) { background: #ff69b4; animation-delay: 0.3s; }

@keyframes bible-loader-jump {
    0%, 100% { height: 24px; }
    50% { height: 70px; }
}

.bible-file-loading p {
    min-height: 36px;
    margin: 0 0 25px;
    color: #fff;
    font-family: var(--font-terminal);
    font-size: clamp(27px, 4.5vw, 38px);
    text-shadow: 3px 3px 0 #000, 0 0 11px rgba(139, 77, 255, 0.72);
}

.bible-loading-bar {
    width: min(420px, 86%);
    height: 24px;
    margin: 0 auto;
    padding: 3px;
    overflow: hidden;
    background: #020104;
    border: 3px solid #fff;
    box-shadow: 5px 5px 0 #8b4dff;
}

.bible-loading-bar span {
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: left;
    background: repeating-linear-gradient(90deg, #8b4dff 0 17px, #ff2bd6 17px 34px, #00ffff 34px 51px);
    animation: bible-loading-progress 1.6s steps(12) both;
}

@keyframes bible-loading-progress {
    from { transform: scaleX(0.03); }
    to { transform: scaleX(1); }
}

.bible-viewer-window {
    width: 100%;
    height: min(800px, calc(100vh - 116px));
    min-height: 570px;
    margin: 0 auto 54px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    animation: bible-window-in 0.38s steps(5) both;
}

.bible-pdf-stage {
    position: relative;
    min-height: 0;
    overflow: auto;
    padding: 14px;
    background:
        linear-gradient(45deg, rgba(139,77,255,0.08) 25%, transparent 25%, transparent 75%, rgba(139,77,255,0.08) 75%),
        linear-gradient(45deg, rgba(139,77,255,0.08) 25%, #050309 25%, #050309 75%, rgba(139,77,255,0.08) 75%);
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
    scrollbar-color: #8b4dff #080711;
    scrollbar-width: thin;
}

.bible-pdf-stage:focus-visible {
    outline: 3px solid #00ffff;
    outline-offset: -7px;
}

.bible-canvas-shell {
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    display: grid;
    place-items: center;
}

#pdfCanvas {
    display: block;
    max-width: none;
    background: #fff;
    box-shadow: 8px 8px 0 #000, 0 0 18px rgba(139, 77, 255, 0.45);
}

.bible-render-status {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 11;
    transform: translate(-50%, -50%);
    padding: 8px 13px;
    color: #09000f;
    background: #00ffff;
    border: 3px solid #fff;
    box-shadow: 5px 5px 0 #ff2bd6;
    font-family: var(--font-terminal);
    font-size: 22px;
}

.bible-viewer-controls {
    position: relative;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 9px;
    padding: 12px;
    background: #0c0714;
    border-top: 4px solid #fff;
}

.bible-viewer-controls button,
.bible-viewer-controls a {
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    font-size: 19px;
    line-height: 1;
}

.bible-page-counter,
.bible-zoom-level {
    padding: 4px 8px;
    color: #00ffff;
    font-family: var(--font-terminal);
    font-size: 21px;
    line-height: 1;
    text-shadow: 2px 2px 0 #000;
    white-space: nowrap;
}

.bible-page-counter strong,
.bible-zoom-level { color: #fff; font-weight: 400; }

.bible-controls-separator {
    width: 2px;
    height: 30px;
    margin: 0 3px;
    background: #8b4dff;
    box-shadow: 3px 0 0 #ff2bd6;
}

.bible-viewer-window:fullscreen {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    border: 0;
    box-shadow: none;
}

.bible-viewer-window.is-fullscreen-fallback {
    position: fixed;
    inset: 0;
    z-index: 200000;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
}

body.bible-fallback-fullscreen {
    overflow: hidden;
}

.bible-viewer-window:fullscreen .infinity-titlebar,
.bible-viewer-window:fullscreen .bible-viewer-controls,
.bible-viewer-window.is-fullscreen-fallback .infinity-titlebar,
.bible-viewer-window.is-fullscreen-fallback .bible-viewer-controls {
    flex: 0 0 auto;
}

.bible-footer {
    margin: 12px auto 0;
    color: #bba9d0;
    font-size: 13px;
    text-align: center;
}

.bible-footer img {
    width: 150px;
    max-width: 42vw;
    height: auto;
    filter: drop-shadow(3px 3px 0 #000);
}

.bible-footer p { margin: 9px 0 0; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
    .bible-main.sidebar-open {
        width: min(1180px, calc(100% - 34px));
        max-width: none;
        margin: 0 auto;
    }

    .bible-file-details {
        grid-template-columns: 150px minmax(0, 1fr);
        gap: 25px;
        padding: 34px 28px;
    }

    .bible-file-icon {
        width: 126px;
        height: 160px;
    }

    .bible-viewer-window {
        height: calc(100vh - 96px);
        min-height: 540px;
    }
}

@media (max-width: 620px) {
    .bible-main {
        width: calc(100% - 20px);
        padding-top: 72px;
    }

    .bible-page-header {
        margin-bottom: 19px;
        padding-left: 44px;
        text-align: left;
    }

    .bible-page-header p { margin-left: 0; }
    .bible-page-header h1 { font-size: clamp(27px, 10vw, 43px); }

    .bible-file-window {
        width: 100%;
        min-height: 0;
        margin-bottom: 36px;
        border-width: 3px;
        box-shadow: 7px 7px 0 #000, 0 0 18px rgba(139, 77, 255, 0.3);
    }

    .infinity-titlebar {
        min-height: 42px;
        padding: 6px 9px;
        border-bottom-width: 3px;
        font-family: var(--font-terminal);
        font-size: 18px;
    }

    .infinity-window-lights { gap: 4px; }
    .infinity-window-lights i { width: 10px; height: 10px; border-width: 1px; }

    .bible-file-details {
        min-height: 0;
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 28px;
        padding: 30px 20px 33px;
        text-align: center;
    }

    .bible-file-icon {
        width: 112px;
        height: 138px;
        padding-bottom: 18px;
        border-width: 4px;
        box-shadow: 7px 7px 0 #8b4dff, 12px 12px 0 #000;
    }

    .bible-file-icon::before {
        width: 42px;
        height: 42px;
        top: -4px;
        right: -4px;
        border-width: 0 0 4px 4px;
        border-style: solid;
        border-color: #fff;
    }

    .bible-file-icon::after { left: 8px; top: 16px; font-size: 15px; }
    .bible-file-icon span { font-size: 19px; }
    .bible-file-copy h2 { margin-bottom: 21px; }
    .bible-file-copy dl { width: fit-content; margin: 0 auto 25px; text-align: left; }
    .bible-file-copy dl div { grid-template-columns: 87px 1fr; }
    .infinity-action-button { width: 100%; font-size: 23px; }

    .bible-file-loading {
        min-height: 410px;
        padding: 78px 18px 35px;
    }

    .bible-viewer-window {
        width: 100%;
        height: calc(100dvh - 84px);
        min-height: 500px;
        margin-bottom: 36px;
        border-width: 3px;
        box-shadow: 6px 6px 0 #000;
    }

    .bible-pdf-stage { padding: 8px; }
    .bible-viewer-controls { gap: 7px; padding: 9px 7px 11px; border-top-width: 3px; }
    .bible-viewer-controls button,
    .bible-viewer-controls a { min-height: 36px; padding: 5px 7px; font-size: 17px; }
    .bible-page-counter,
    .bible-zoom-level { padding: 3px 4px; font-size: 19px; }
    .bible-controls-separator { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .bible-file-window,
    .bible-viewer-window,
    .bible-loading-mark span,
    .bible-loading-bar span {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Arcade CRT 2.0 bible viewer polish */
.infinity-window,
.bible-file-icon,
#pdfCanvas {
    box-shadow: var(--crt-shadow-hard), 0 0 18px rgba(139, 77, 255, 0.28);
}

.bible-viewer-controls button,
.bible-viewer-controls a,
.infinity-action-button {
    min-height: 44px;
    touch-action: manipulation;
}

@media (max-width: 620px) {
    body.bible-page::before {
        background-size: 100% 6px;
        opacity: 0.72;
    }

    .infinity-window::after,
    .bible-loading-mark span {
        animation: none !important;
    }

    .infinity-action-button:hover,
    .infinity-action-button:focus-visible,
    .bible-viewer-controls button:hover,
    .bible-viewer-controls button:focus-visible,
    .bible-viewer-controls a:hover,
    .bible-viewer-controls a:focus-visible {
        transform: none;
    }
}
