/* ==========================================================================
   Protected PDF preview (pdf-preview.js) — notebook theme, light + night,
   RTL, phones (full-screen sheet) → desktops, safe areas, reduced motion.
   ========================================================================== */

.pdfv-overlay {
  --pv-paper: var(--paper, #fff);
  --pv-ink: var(--ink, #141414);
  --pv-muted: var(--ink-muted, #666);
  --pv-line: var(--paper-line, #e6e4de);
  --pv-pink: var(--pink, #ff4fa0);
  --pv-yellow: var(--yellow, #f2c744);
  --pv-shadow: var(--shadow-hard, 4px 4px 0 #141414);
  --pv-mono: var(--nb-mono, ui-monospace, monospace);
  --pv-body: var(--nb-body, system-ui, sans-serif);

  position: fixed;
  inset: 0;
  z-index: 99996;                     /* above every modal it can open from (Resume, CV generator, FYP Read More = 99995) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--nb-scrim, rgba(0, 0, 0, 0.5));
  backdrop-filter: var(--nb-blur, blur(6px));
  -webkit-backdrop-filter: var(--nb-blur, blur(6px));
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: var(--pv-body);
  color: var(--pv-ink);
  overscroll-behavior: contain;
}
.pdfv-overlay[hidden] { display: none; }
.pdfv-overlay.is-open { opacity: 1; }

.pdfv {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);   /* let a long title ellipsize instead of widening the sheet past the screen */
  width: min(820px, 100%);
  height: min(92dvh, 1100px);
  background: var(--pv-paper);
  border: 2px solid var(--pv-ink);
  box-shadow: var(--pv-shadow);
  outline: none;
  translate: 0 8px;
  transition: translate 0.2s ease;
}
.pdfv-overlay.is-open .pdfv { translate: 0 0; }

.pdfv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  background: var(--pv-ink);
  color: var(--pv-paper);
}
.pdfv[dir="rtl"] .pdfv-head { padding: 12px 18px 12px 14px; }
.pdfv-titles { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pdfv-eyebrow { font: 700 10px/1.2 var(--pv-mono); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; }
.pdfv-title { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfv-close {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  padding: 0;
  color: var(--pv-paper);
  background: transparent;
  border: 1.5px solid var(--pv-paper);
  border-radius: 0;
  cursor: pointer;
}
.pdfv-close svg { width: 16px; height: 16px; }
.pdfv-close:hover { background: var(--pv-pink); color: var(--pv-ink); border-color: var(--pv-pink); }
.pdfv-close:focus-visible { outline: 2px solid var(--pv-yellow); outline-offset: 2px; }

.pdfv-pages {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 18px 12px;
  background: color-mix(in srgb, var(--pv-ink) 8%, var(--pv-paper));
}
.pdfv-page { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pdfv-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;                    /* the document itself is always white */
  border: 1.5px solid var(--pv-ink);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--pv-ink) 35%, transparent);
}
.pdfv-page figcaption { font: 600 11px/1.4 var(--pv-mono); color: var(--pv-muted); letter-spacing: 0.06em; }
.pdfv-status { margin: auto; max-width: 36ch; text-align: center; color: var(--pv-muted); line-height: 1.5; padding: 24px 8px; }

.pdfv-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-top: 2px solid var(--pv-ink);
  background: var(--pv-paper);
}
.pdfv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  font: inherit; font-weight: 700; font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid var(--pv-ink);
  border-radius: 0;
  cursor: pointer;
  transition: translate 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.pdfv-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.pdfv-btn-ghost { background: var(--pv-paper); color: var(--pv-ink); }
.pdfv-btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--pv-yellow) 40%, var(--pv-paper)); }
.pdfv-btn-primary { background: var(--pv-ink); color: var(--pv-paper); box-shadow: 3px 3px 0 var(--pv-pink); }
.pdfv-btn-primary:hover { translate: -1px -1px; box-shadow: 4px 4px 0 var(--pv-pink); }
.pdfv-btn-primary:active { translate: 1px 1px; box-shadow: 1px 1px 0 var(--pv-pink); }
.pdfv-btn:focus-visible { outline: 2px solid var(--pv-pink); outline-offset: 3px; }
.pdfv-btn:disabled,
.pdfv-btn.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; box-shadow: none; }

/* Phones: full-screen sheet, buttons share the bottom bar */
@media (max-width: 639px) {
  .pdfv-overlay { padding: 0; }
  .pdfv { width: 100%; height: 100%; height: 100dvh; border: 0; box-shadow: none; }
  .pdfv-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .pdfv-pages { padding: 12px 8px; gap: 12px; }
  .pdfv-actions { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .pdfv-btn { padding-inline: 10px; font-size: 0.88rem; }
}
@media (max-width: 340px) {
  .pdfv-actions { grid-template-columns: 1fr; }
}
/* Short landscape screens: slimmer header and footer */
@media (max-height: 520px) and (orientation: landscape) {
  .pdfv-overlay { padding: 8px; }
  .pdfv { height: 100%; }
  .pdfv-head { padding-block: 6px; }
  .pdfv-eyebrow { display: none; }
  .pdfv-actions { padding-block: 8px; }
  .pdfv-btn { min-height: 40px; padding-block: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .pdfv-overlay, .pdfv { transition: none; }
}

.pdfv-stack { display: contents; }
.pdfv-image img {
  display: block;
  max-width: min(100%, 900px);
  height: auto;
  background: #fff;
  border: 1.5px solid var(--pv-ink);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--pv-ink) 35%, transparent);
}
