/* Full-screen flip-book PDF reader (static/js/reader.js, D-011). */
.rd {
  --rd-bg: #1d231e; --rd-bar: #161b17; --rd-line: rgba(248, 247, 243, .14);
  --rd-text: #f8f7f3; --rd-muted: rgba(248, 247, 243, .68); --rd-accent: #a8c0ab; --rd-focus: #d8e6c9;
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--rd-bg); color: var(--rd-text); font-family: "DM Sans", system-ui, sans-serif;
  display: none; flex-direction: column; overflow: hidden;
}
.rd[open] { display: flex; }
.rd::backdrop { background: rgba(10, 14, 11, .8); }
html.rd-open, html.rd-open body { overflow: hidden; }

.rd-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; background: var(--rd-bar); border-bottom: 1px solid var(--rd-line); flex-shrink: 0; }
.rd-title { margin: 0; font: 400 1.05rem/1.3 "Playfair Display", Georgia, serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rd-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.rd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  background: transparent; border: 1px solid rgba(248, 247, 243, .3); border-radius: 3px; color: var(--rd-text);
  font: 500 13px/1 "DM Sans", system-ui, sans-serif; letter-spacing: .02em; text-decoration: none; cursor: pointer; white-space: nowrap; }
.rd-btn:hover:not([aria-disabled="true"]) { background: rgba(248, 247, 243, .1); }
.rd-btn[aria-disabled="true"] { opacity: .35; cursor: default; }
.rd-btn[aria-pressed="true"] { background: rgba(168, 192, 171, .18); border-color: var(--rd-accent); }
.rd-btn:focus-visible, .rd-page-input:focus-visible { outline: 2px solid var(--rd-focus); outline-offset: 2px; }
.rd-icon { min-width: 36px; padding: 6px 8px; font-size: 16px; }
.rd-zoom { min-width: 58px; font-variant-numeric: tabular-nums; }

/* The page area: centred when it fits, scrollable when zoomed in. */
.rd-view { flex: 1; min-height: 0; overflow: auto; display: flex; position: relative; outline: none; overscroll-behavior: contain; }
.rd-stage-host { margin: auto; padding: 16px; }
.rd-stage { margin: 0 auto; }
.rd-stage-host.is-zoomed { cursor: grab; }
.rd-page { background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; }
.rd-page canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.rd-page.--left::after, .rd-page.--right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 6%; pointer-events: none; }
.rd-page.--left::after  { right: 0; background: linear-gradient(to left,  rgba(0, 0, 0, .14), rgba(0, 0, 0, 0)); }
.rd-page.--right::after { left: 0;  background: linear-gradient(to right, rgba(0, 0, 0, .14), rgba(0, 0, 0, 0)); }
.rd-page-loading { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #8f978e; }
.rd-status { position: absolute; inset: 0; margin: auto; height: max-content; text-align: center; color: var(--rd-muted); font-size: 15px; padding: 0 20px; }
.rd-frame { display: block; width: calc(100vw - 32px); height: calc(100dvh - 150px); border: 0; background: #fff; }
.rd-fallback { color: var(--rd-muted); font-size: 14px; margin: 10px 0 0; text-align: center; }
.rd-fallback a { color: var(--rd-accent); }

.rd-controls { display: flex; align-items: center; justify-content: center; gap: 10px 22px; flex-wrap: wrap; padding: 10px 16px;
  background: var(--rd-bar); border-top: 1px solid var(--rd-line); flex-shrink: 0; }
.rd-controls[hidden] { display: none; }
.rd-group { display: flex; align-items: center; gap: 6px; }
.rd-goto { display: inline-flex; align-items: center; gap: 6px; color: var(--rd-muted); font-size: 13px; font-variant-numeric: tabular-nums; padding: 0 4px; }
.rd-page-input { width: 4.2em; min-height: 36px; padding: 4px 6px; border: 1px solid rgba(248, 247, 243, .3); border-radius: 3px;
  background: rgba(0, 0, 0, .25); color: var(--rd-text); font: 500 14px "DM Sans", system-ui, sans-serif; text-align: center; -moz-appearance: textfield; }
.rd-page-input::-webkit-outer-spin-button, .rd-page-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  .rd-bar { padding: 8px 12px; }
  .rd-download { padding: 6px 10px; }
  .rd-stage-host { padding: 8px; }
  .rd-controls { gap: 8px 12px; padding: 8px; }
  [data-act="spread"], [data-act="first"], [data-act="last"] { display: none; }
}

/* "Read PDF" buttons on the pages (ReadPdf in base.html). A zero-specificity reset, so the
   page's own link classes (.cat-action, .bk-btn, .pub-links button, …) style them like their neighbours. */
:where(button.rd-trigger) { appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.rd-trigger { display: inline-flex; align-items: center; gap: 6px; }
.rd-trigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.cat-foot .rd-trigger, .cat-links .rd-trigger { font-size: 14px; font-weight: 600; color: var(--bkb-accentText, #49684e); white-space: nowrap; }
.cat-foot .rd-trigger:hover, .cat-links .rd-trigger:hover { text-decoration: underline; text-underline-offset: 3px; }
.cat-action.rd-trigger { gap: 8px; }
.rd-trigger:focus-visible { outline: 2px solid var(--bkb-accentText, #49684e); outline-offset: 3px; }
.cat-card .rd-trigger { position: relative; z-index: 2; }   /* above the stretched "whole card" link */
.im-ev-link.rd-trigger { margin-right: 18px; }
/* Home page link rows */
.lp-pub-links .rd-trigger, .lp-book-actions .rd-trigger, .lp-output .rd-trigger { font-size: 14px; font-weight: 600; color: var(--bkb-accentText, #49684e); }
.lp-book-actions .rd-trigger { font-size: 15px; }
.lp-output .rd-trigger { margin: 0 18px 6px 0; }
.lp-interview-actions .rd-trigger, .lp-talk-links .rd-trigger { font-size: 14px; font-weight: 600; color: var(--bkb-accentText, #49684e); border-bottom: 1px solid currentColor; padding-bottom: 6px; }
.lp-pub-links .rd-trigger:hover, .lp-book-actions .rd-trigger:hover, .lp-output .rd-trigger:hover,
.lp-interview-actions .rd-trigger:hover, .lp-talk-links .rd-trigger:hover { color: var(--bkb-text, #222923); }
.pub-links .rd-trigger { align-items: flex-start; }   /* text on the same line as the neighbouring links */
