/* PDF flipbook on the paper page (view_issue.php + assets/js/pdf-flipbook.js) */
.pdf-book {
    --pb-teal: #075b51;
    --pb-teal-2: #0d7a6c;
    --pb-deep: #04332d;
    --pb-mint: #3fb0a3;
    --pb-gold: #e2b54a;
    --pb-line: #e3ebe9;
    --pb-muted: #6b7c79;
    --book-ratio: 1.414;
    margin: 2.5rem 0 1rem;
    border: 1px solid var(--pb-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(7, 91, 81, .08);
    overflow: hidden;
}

/* ---------- header ---------- */
.pdf-book-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pb-line);
}

.pdf-book-head h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--pb-teal);
}

.pdf-book-head p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--pb-muted);
}

.pdf-book-actions {
    display: flex;
    gap: 8px;
}

.pdf-book-actions a,
.pdf-book-actions button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--pb-line);
    border-radius: 10px;
    background: #fff;
    color: var(--pb-teal);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.pdf-book-actions a:hover,
.pdf-book-actions button:hover {
    background: var(--pb-teal);
    border-color: var(--pb-teal);
    color: #fff;
}

/* ---------- stage ---------- */
.pdf-book-stage {
    position: relative;
    min-height: 420px;
    padding: 34px 24px;
    background:
        radial-gradient(70% 60% at 50% 0%, rgba(63, 176, 163, .18), transparent 70%),
        linear-gradient(180deg, #eef4f3 0%, #e2ebe9 100%);
}

.pdf-book-flip {
    margin: 0 auto;
    /* keep the whole open book inside the screen height */
    max-width: calc((82vh - 60px) / var(--book-ratio) * 2);
    opacity: 0;
    transform: translateY(14px) scale(.98);
    transition: opacity .6s ease, transform .8s cubic-bezier(.16, 1, .3, 1);
}

.pdf-book.is-ready .pdf-book-flip {
    opacity: 1;
    transform: none;
}

.pdf-book .stf__parent {
    margin: 0 auto;
}

/* soft (PDF) pages */
.pdf-book-page {
    background: #fff;
    overflow: hidden;
}

.pdf-book-sheet {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
}

.pdf-book-sheet canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .4s ease;
}

.pdf-book-sheet.is-rendered canvas {
    opacity: 1;
}

/* shimmer until the page is rendered */
.pdf-book-pending {
    position: absolute;
    inset: 9% 10%;
    background:
        linear-gradient(#e9efee 0 0) 0 0 / 70% 5% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 12% / 100% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 17% / 96% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 22% / 100% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 27% / 88% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 36% / 100% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 41% / 93% 2.2% no-repeat,
        linear-gradient(#eef3f2 0 0) 0 46% / 100% 2.2% no-repeat;
    animation: pb-pulse 1.4s ease-in-out infinite;
}

.pdf-book-sheet.is-rendered .pdf-book-pending {
    display: none;
}

.pdf-book-folio {
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    color: #a3b2af;
    pointer-events: none;
}

/* spine shading so open spreads look bound */
.pdf-book .stf__item.--left .pdf-book-sheet::after,
.pdf-book .stf__item.--right .pdf-book-sheet::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7%;
    pointer-events: none;
}

.pdf-book .stf__item.--left .pdf-book-sheet::after {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, .12), transparent);
}

.pdf-book .stf__item.--right .pdf-book-sheet::after {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, .12), transparent);
}

/* notes (filler) page – ruled paper */
.pdf-book-notes .pdf-book-sheet {
    padding: 10% 9% 8% 14%;
    background: #fffdf8;
}

.pdf-book-notes h4 {
    margin: 0 0 4%;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 18px;
    color: #9aa9a6;
}

.pdf-book-lines {
    position: absolute;
    inset: 18% 9% 8% 14%;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, #dfe8e6 27px, #dfe8e6 28px);
}

.pdf-book-notes .pdf-book-sheet::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 10%;
    width: 1px;
    background: rgba(214, 92, 92, .35);
}

/* ---------- hard pages: front cover + end card ---------- */
.pdf-book-hard {
    container-type: inline-size;
    color: #fff;
    background:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 14px),
        radial-gradient(120% 70% at 85% 0%, rgba(63, 176, 163, .45), transparent 60%),
        linear-gradient(160deg, #0a6a5e 0%, #075b51 45%, #04332d 100%);
    overflow: hidden;
}

.pdf-book-cover-inner,
.pdf-book-end-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8cqw 8cqw 7cqw;
}

/* thin gold frame */
.pdf-book-cover-inner::before,
.pdf-book-end-inner::before {
    content: "";
    position: absolute;
    inset: 3.2cqw;
    border: 1px solid rgba(226, 181, 74, .55);
    border-radius: 2px;
    pointer-events: none;
}

.pdf-book-brand {
    display: flex;
    align-items: center;
    gap: 3cqw;
    padding-bottom: 4cqw;
    border-bottom: 1px solid rgba(226, 181, 74, .55);
}

.pdf-book-brand img {
    width: 12cqw;
    height: 12cqw;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: .6cqw;
}

.pdf-book-brand b {
    display: block;
    font-size: 5.4cqw;
    letter-spacing: .8cqw;
    color: var(--pb-gold);
    line-height: 1.1;
}

.pdf-book-brand small {
    display: block;
    font-size: 2.5cqw;
    line-height: 1.35;
    color: rgba(255, 255, 255, .8);
}

.pdf-book-art {
    flex: 1 1 auto;
    min-height: 18cqw;
    margin: 5cqw 0 4cqw;
    border-radius: 2cqw;
    background-size: cover;
    background-position: center;
    box-shadow: 0 2cqw 5cqw rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .15);
}

.pdf-book-cover-text {
    margin-top: auto;
}

.pdf-book-type {
    display: inline-block;
    margin-bottom: 2.4cqw;
    padding: .8cqw 2.6cqw;
    border-radius: 99px;
    background: var(--pb-gold);
    color: var(--pb-deep);
    font-size: 2.5cqw;
    font-weight: 800;
    letter-spacing: .3cqw;
    text-transform: uppercase;
}

.pdf-book-cover h2 {
    margin: 0;
    font-size: 5.6cqw;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pdf-book-authors {
    margin: 2.6cqw 0 0;
    font-size: 3cqw;
    line-height: 1.45;
    color: rgba(255, 255, 255, .85);
}

.pdf-book-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2cqw;
    margin: 4.5cqw 0 0;
    padding-top: 3.5cqw;
    border-top: 1px solid rgba(226, 181, 74, .55);
}

.pdf-book-meta dt {
    font-size: 2.2cqw;
    font-weight: 600;
    letter-spacing: .3cqw;
    text-transform: uppercase;
    color: var(--pb-gold);
}

.pdf-book-meta dd {
    margin: .4cqw 0 0;
    font-size: 2.7cqw;
    line-height: 1.3;
    color: #fff;
}

.pdf-book-doi {
    margin: 2.6cqw 0 0;
    font-size: 2.4cqw;
    color: rgba(255, 255, 255, .7);
    overflow-wrap: anywhere;
}

.pdf-book-open-hint {
    position: absolute;
    right: 7cqw;
    bottom: 5cqw;
    font-size: 2.4cqw;
    color: var(--pb-gold);
    animation: pb-nudge 1.8s ease-in-out infinite;
}

/* end card */
.pdf-book-end-inner {
    align-items: center;
    text-align: center;
    justify-content: center;
}

.pdf-book-end-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14cqw;
    height: 14cqw;
    border-radius: 50%;
    background: var(--pb-gold);
    color: var(--pb-deep);
    font-size: 6cqw;
    box-shadow: 0 0 0 2.4cqw rgba(226, 181, 74, .18);
}

.pdf-book-end h3 {
    margin: 6cqw 0 0;
    font-size: 6.4cqw;
    font-weight: 800;
    color: #fff;
}

.pdf-book-end-lead {
    margin: 1.6cqw 0 0;
    font-size: 3.1cqw;
    color: rgba(255, 255, 255, .8);
}

.pdf-book-cite {
    width: 100%;
    margin-top: 6cqw;
    padding: 3.6cqw 4cqw;
    border: 1px solid rgba(226, 181, 74, .45);
    border-radius: 2.4cqw;
    background: rgba(0, 0, 0, .18);
    text-align: left;
}

.pdf-book-cite-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2cqw;
    margin-bottom: 2cqw;
    font-size: 2.6cqw;
    font-weight: 700;
    letter-spacing: .2cqw;
    text-transform: uppercase;
    color: var(--pb-gold);
}

.pdf-book-cite-head button {
    padding: .8cqw 2.4cqw;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 99px;
    background: transparent;
    color: #fff;
    font-size: 2.4cqw;
    text-transform: none;
    letter-spacing: 0;
}

.pdf-book-cite-head button:hover {
    background: #fff;
    color: var(--pb-teal);
}

.pdf-book-cite p {
    margin: 0;
    font-size: 2.7cqw;
    line-height: 1.55;
    color: rgba(255, 255, 255, .9);
    display: -webkit-box;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pdf-book-end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.4cqw;
    margin-top: 5cqw;
}

.pdf-book-end-actions a {
    display: inline-flex;
    align-items: center;
    gap: 1.6cqw;
    padding: 2.2cqw 4cqw;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 99px;
    color: #fff;
    font-size: 2.9cqw;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.pdf-book-end-actions a.primary {
    border-color: var(--pb-gold);
    background: var(--pb-gold);
    color: var(--pb-deep);
}

.pdf-book-end-actions a:hover {
    background: #fff;
    border-color: #fff;
    color: var(--pb-teal);
}

.pdf-book-end-foot {
    display: flex;
    align-items: center;
    gap: 3cqw;
    width: 100%;
    margin-top: auto;
    padding-top: 4cqw;
    border-top: 1px solid rgba(226, 181, 74, .55);
    text-align: left;
}

.pdf-book-end-inner > .pdf-book-end-badge {
    margin-top: auto;
}

.pdf-book-end-foot img {
    width: 10cqw;
    height: 10cqw;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: .5cqw;
}

.pdf-book-end-foot b {
    display: block;
    font-size: 2.6cqw;
    line-height: 1.3;
}

.pdf-book-end-foot small {
    display: block;
    margin-top: .6cqw;
    font-size: 2.3cqw;
    color: rgba(255, 255, 255, .7);
}

/* ---------- loader ---------- */
.pdf-book-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}

.pdf-book-loader[hidden] {
    display: none;
}

.pdf-book-loader-book {
    position: relative;
    width: 70px;
    height: 48px;
    perspective: 300px;
}

.pdf-book-loader-book span {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    border-radius: 0 4px 4px 0;
    background: var(--pb-teal);
    transform-origin: left center;
    animation: pb-turn 1.8s ease-in-out infinite;
}

.pdf-book-loader-book span:nth-child(2) { animation-delay: .25s; background: var(--pb-teal-2); }
.pdf-book-loader-book span:nth-child(3) { animation-delay: .5s; background: var(--pb-mint); }

.pdf-book-loader-book::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    border-radius: 4px 0 0 4px;
    background: var(--pb-deep);
}

.pdf-book-loader-bar {
    width: min(260px, 70%);
    height: 6px;
    border-radius: 6px;
    background: rgba(7, 91, 81, .12);
    overflow: hidden;
}

.pdf-book-loader-bar span {
    display: block;
    width: 8%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--pb-teal), var(--pb-mint));
    transition: width .3s ease;
}

.pdf-book-loader-text {
    margin: 0;
    font-size: 14px;
    color: var(--pb-teal);
    font-weight: 600;
}

.pdf-book-fallback {
    display: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-teal);
}

.pdf-book.is-failed .pdf-book-fallback {
    display: inline-block;
}

.pdf-book.is-failed .pdf-book-loader-book,
.pdf-book.is-failed .pdf-book-loader-bar {
    display: none;
}

/* ---------- controls ---------- */
.pdf-book-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--pb-line);
}

.pdf-book-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--pb-line);
    border-radius: 10px;
    background: #fff;
    color: var(--pb-teal);
    font-size: 16px;
    transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.pdf-book-controls button:hover:not(:disabled) {
    background: var(--pb-teal);
    border-color: var(--pb-teal);
    color: #fff;
}

.pdf-book-controls button:disabled {
    opacity: .35;
    cursor: default;
}

.pdf-book-progress {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
}

.pdf-book-progress span {
    font-size: 13px;
    font-weight: 700;
    color: var(--pb-teal);
    white-space: nowrap;
}

.pdf-book-progress input[type="range"] {
    width: 100%;
    max-width: 520px;
    height: 4px;
    accent-color: var(--pb-teal);
    cursor: pointer;
}

/* ---------- full screen ---------- */
.pdf-book.is-fullscreen {
    display: flex;
    flex-direction: column;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #0b1f1c;
}

.pdf-book.is-fullscreen .pdf-book-head,
.pdf-book.is-fullscreen .pdf-book-controls {
    background: #0f2b27;
    border-color: rgba(255, 255, 255, .08);
}

.pdf-book.is-fullscreen .pdf-book-head h3,
.pdf-book.is-fullscreen .pdf-book-progress span {
    color: #fff;
}

.pdf-book.is-fullscreen .pdf-book-stage {
    flex: 1;
    display: flex;
    align-items: center;
    background: radial-gradient(60% 60% at 50% 40%, #16423c, #0b1f1c);
}

.pdf-book.is-fullscreen .pdf-book-flip {
    width: 100%;
    max-width: calc((100vh - 230px) / var(--book-ratio) * 2);
}

/* ---------- small screens ---------- */
@media (max-width: 767.98px) {
    .pdf-book { border-radius: 14px; margin-top: 1.5rem; }
    .pdf-book-head { padding: 12px 14px; }
    .pdf-book-head h3 { font-size: 16px; }
    .pdf-book-head p { display: none; }
    .pdf-book-actions a span,
    .pdf-book-actions button span { display: none; }
    .pdf-book-actions a,
    .pdf-book-actions button { width: 38px; padding: 0; justify-content: center; }
    .pdf-book-stage { padding: 18px 10px; min-height: 320px; }
    /* single page on phones */
    .pdf-book-flip { max-width: calc((78vh - 40px) / var(--book-ratio)); }
    .pdf-book-controls { padding: 10px 12px; gap: 6px; }
    .pdf-book-controls button { width: 36px; height: 36px; }
    .pdf-book-controls [data-book="first"],
    .pdf-book-controls [data-book="last"] { display: none; }
}

@keyframes pb-turn {
    0%, 15% { transform: rotateY(0); }
    55%, 100% { transform: rotateY(-180deg); opacity: .9; }
}

@keyframes pb-pulse {
    50% { opacity: .55; }
}

@keyframes pb-nudge {
    50% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .pdf-book-flip,
    .pdf-book-sheet canvas { transition: none; }
    .pdf-book-loader-book span,
    .pdf-book-pending,
    .pdf-book-open-hint { animation: none; }
}

/* keep the page's article styles (h2 bar, h3 colour, justified text) off the book */
.pdf-book .pdf-book-cover h2 {
    border: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    text-align: left !important;
}

.pdf-book .pdf-book-end-inner h3 {
    font-size: 6.4cqw !important;
    line-height: 1.2 !important;
    color: #fff !important;
    border: 0 !important;
    padding: 0 !important;
    justify-content: center;
}

.pdf-book .pdf-book-hard p,
.pdf-book .pdf-book-cite p {
    text-align: left !important;
}

.pdf-book .pdf-book-end-inner > p {
    text-align: center !important;
}

/* text sizes on the covers scale with the page (the page's own p sizes must not apply) */
.pdf-book .pdf-book-authors { font-size: 3cqw !important; line-height: 1.45 !important; margin: 2.6cqw 0 0 !important; }
.pdf-book .pdf-book-doi { font-size: 2.4cqw !important; line-height: 1.4 !important; margin: 2.6cqw 0 0 !important; }
.pdf-book .pdf-book-end-lead { font-size: 3.1cqw !important; line-height: 1.4 !important; margin: 1.6cqw 0 0 !important; }
.pdf-book .pdf-book-cite p { font-size: 2.7cqw !important; line-height: 1.55 !important; margin: 0 !important; }
