/* In-site PDF / image viewer */
html.pv-open, html.pv-open body { overflow: hidden; }
.pv { position: fixed; inset: 0; z-index: 3000; background: #2b2f3a; display: flex; flex-direction: column; color: #fff; }
.pv[hidden] { display: none; }
.pv-bar { display: flex; align-items: center; gap: .35rem; padding: .45rem .6rem; background: var(--navy, #1E2A5E); border-bottom: 3px solid var(--gold, #F4C430); flex-shrink: 0;
  padding-top: max(.45rem, env(safe-area-inset-top)); }
.pv-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .4rem; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Sinhala', sans-serif; }
.pv-btn { min-width: 40px; height: 40px; border: 0; border-radius: 6px; background: rgba(255,255,255,.08); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: 0 .6rem; text-decoration: none; font: 500 .9rem system-ui, sans-serif; cursor: pointer; }
.pv-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.pv-btn:focus-visible { outline: 3px solid var(--gold, #F4C430); outline-offset: 1px; }
.pv-close { background: rgba(255,255,255,.14); }
.pv-pages, .pv-zoom-g { display: inline-flex; align-items: center; gap: .2rem; }
.pv-count { font: .9rem system-ui, sans-serif; padding: 0 .3rem; white-space: nowrap; }
.pv-zoom { min-width: 62px; }
.pv-is-image .pv-pdf-only { display: none; }
.pv-body { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; -webkit-overflow-scrolling: touch; outline: none;
  padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.pv-page-box { background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.35); flex-shrink: 0; max-width: none; }
.pv-page-box canvas { display: block; }
.pv-img { max-width: 100%; height: auto; margin: auto; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.pv-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(18,26,63,.92); padding: 1rem 1.4rem; border-radius: 8px; text-align: center; display: none; font: .95rem system-ui, sans-serif; max-width: 90vw; }
.pv-status.show { display: block; }
.pv-status.err { background: #5c1a1a; }
.pv-fallback { color: var(--gold, #F4C430); display: inline-block; margin-top: .5rem; }
.pv-spin { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.3); border-top-color: var(--gold, #F4C430); border-radius: 50%; margin-right: .6rem; vertical-align: -4px; animation: pvspin .8s linear infinite; }
@keyframes pvspin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .pv-body { padding: 8px; gap: 8px; }
  .pv-lbl, .pv-zoom-g, .pv-tab { display: none; }
  .pv-btn { min-width: 38px; padding: 0 .45rem; }
}
@media (prefers-reduced-motion: reduce) { .pv-spin { animation: none; } }
