*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#07080c;color:#f3eee2;font-family:Arial,sans-serif}body{display:grid;grid-template-rows:auto minmax(0,1fr) auto}.reader-header{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:18px;align-items:center;padding:13px 18px;border-bottom:1px solid rgba(215,175,89,.28);background:#08090d}.reader-back{color:#f2d287;text-decoration:none}.reader-title{text-align:center}.reader-title strong,.reader-title span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.reader-title span{color:#aaa398;font-size:.78rem}.reader-tools{display:flex;flex-wrap:wrap;gap:7px}.reader-tools button,.reader-tools select{min-height:36px;padding:0 10px;border:1px solid rgba(215,175,89,.3);border-radius:8px;background:#11131a;color:#f3eee2}.reader-main{position:relative;min-height:0}.reader-stage{position:absolute;inset:0;display:grid;grid-template-columns:48px minmax(0,1fr) 48px;gap:8px;padding:16px;overflow:hidden}.reader-viewer{min-width:0;min-height:0;overflow:hidden;border:1px solid rgba(215,175,89,.3);border-radius:12px;background:#11131a}.reader-arrow{align-self:center;height:78px;border:1px solid rgba(215,175,89,.32);border-radius:10px;background:#11131a;color:#f2d287;font-size:2.3rem}.reader-toc{position:absolute;z-index:20;top:0;bottom:0;left:0;width:min(360px,88vw);padding:20px;overflow:auto;border-right:1px solid rgba(215,175,89,.3);background:#0c0e14}.reader-toc button{display:block;width:100%;padding:10px 0;border:0;background:none;color:#ddd4c4;text-align:left}.reader-footer{display:flex;justify-content:space-between;padding:10px 18px;border-top:1px solid rgba(215,175,89,.28);background:#08090d;color:#aaa398;font-size:.8rem}.reader-footer a{color:#f2d287}@media(max-width:800px){.reader-header{grid-template-columns:1fr auto}.reader-title{grid-column:1/-1;grid-row:1;text-align:left}.reader-stage{grid-template-columns:38px minmax(0,1fr) 38px;padding:8px}}
/* ==========================================================
   SAGE PDF READER MODE
   Applies only when the current catalog record is a PDF.
   ========================================================== */

body.pdf-reader-mode .reader-viewer {
    overflow: auto;
    display: grid;
    place-items: start center;
    padding: 28px;
    background: #383b41;
}

body.pdf-reader-mode #pdf-canvas {
    display: block;
    max-width: none;
    background: #ffffff;
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0.58);
}

body.pdf-reader-mode .reader-arrow:disabled,
body.pdf-reader-mode .reader-tools button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

body.pdf-reader-mode #font-down,
body.pdf-reader-mode #font-up {
    min-width: 76px;
}

.reader-error {
    align-self: center;
    justify-self: center;
    max-width: 620px;
    margin: 30px;
    padding: 22px;
    border: 1px solid rgba(220, 177, 86, 0.45);
    border-radius: 12px;
    background: rgba(25, 29, 39, 0.96);
    color: #f4e7ca;
    line-height: 1.55;
}

@media (max-width: 700px) {
    body.pdf-reader-mode .reader-viewer {
        padding: 12px;
    }

    body.pdf-reader-mode #font-down,
    body.pdf-reader-mode #font-up {
        min-width: 66px;
    }
}


/* SAGE READER NAV — BACK + WORLD LIBRARY */
.reader-nav{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.reader-library{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:34px;
    padding:0 12px;
    border:1px solid rgba(215,175,89,.48);
    border-radius:8px;
    background:#11131a;
    color:#f2d287;
    font-size:.76rem;
    font-weight:700;
    letter-spacing:.08em;
    text-decoration:none;
    white-space:nowrap;
}

.reader-library:hover,
.reader-library:focus-visible{
    border-color:#f2d287;
    background:#1a1d26;
    color:#fff;
}

@media(max-width:800px){
    .reader-nav{
        gap:6px;
    }

    .reader-library{
        min-height:32px;
        padding:0 9px;
        font-size:.68rem;
    }
}


/* SAGE READER PURCHASE TOOLBAR 20261008 */

.reader-tools .reader-purchase {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:36px;
    padding:0 14px;
    border:1px solid #f2d287;
    border-radius:8px;
    background:#d7af59;
    color:#08090d;
    font-weight:800;
    letter-spacing:.025em;
    text-decoration:none;
    white-space:nowrap;
    cursor:pointer;
}

.reader-tools .reader-purchase:hover,
.reader-tools .reader-purchase:focus-visible {
    background:#f2d287;
    color:#08090d;
}

.reader-tools .reader-purchase[aria-disabled="true"] {
    opacity:.72;
}

/*
 * Reader QR trigger belongs in the toolbar.
 * Keep the widget's floating/modal behavior,
 * but anchor only the trigger button here.
 */
.reader-tools {
    align-items:center;
}

.reader-header .reader-tools [data-sage-qr] {
    position:static !important;
    inset:auto !important;
    width:auto !important;
    height:auto !important;
    margin:0 !important;
    transform:none !important;
    display:inline-flex !important;
    align-items:center;
    flex:0 0 auto;
}

.reader-header .reader-tools .sageqr-float-button {
    position:static !important;
    inset:auto !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    top:auto !important;
    width:auto !important;
    min-width:44px !important;
    height:36px !important;
    min-height:36px !important;
    padding:0 10px !important;
    margin:0 !important;
    transform:none !important;
    border:1px solid rgba(215,175,89,.3) !important;
    border-radius:8px !important;
    background:#11131a !important;
    color:#f3eee2 !important;
    box-shadow:none !important;
    font-size:.82rem !important;
    line-height:1 !important;
}

/* The popup itself remains a full-screen overlay. */
.reader-header .reader-tools .sageqr-overlay {
    position:fixed !important;
}

.reader-footer {
    justify-content:flex-start;
}

@media(max-width:1100px) {
    .reader-tools .reader-purchase {
        padding:0 10px;
        font-size:.78rem;
    }
}
