/* ---------- PDF VIEWER MODAL ---------- */
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 12, 0.88);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 200ms ease;
}

.pdf-modal[hidden] {
  display: none;
}

.pdf-modal.is-open {
  opacity: 1;
}

.pdf-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  /* A reading pane, not a whole-page thumbnail: the page is scaled to this
     width and scrolls, which keeps body text legible. */
  width: min(100%, 940px);
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  transition: transform 200ms var(--ease-out-expo);
}

.pdf-modal.is-open .pdf-modal-panel {
  transform: scale(1);
}

.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-accent);
  background: var(--bg-card);
  flex-shrink: 0;
}

.pdf-modal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pdf-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pdf-modal-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 6px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: var(--bull-green-dim);
  color: var(--bull-green-light);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  transition: all var(--transition-fast);
}

.pdf-modal-download:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--bull-green);
  color: var(--bull-green-light);
}

.pdf-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pdf-modal-close:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.pdf-modal-viewer {
  flex: 1;
  min-height: 0;
  background: #1c1c1c;
}

.pdf-modal-viewer object {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Hand-off card (browsers that can't embed a PDF) ---------- */
/* Sized to its content so it reads as a small prompt, not a broken viewer. */
.pdf-modal-panel.is-handoff {
  width: min(100%, 420px);
  height: auto;
}

.pdf-modal-panel.is-handoff .pdf-modal-viewer {
  flex: none;
  background: var(--bg-secondary);
}

.pdf-modal-handoff {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px 28px;
  text-align: center;
}

.pdf-modal-handoff-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-accent);
  color: var(--text-secondary);
}

.pdf-modal-handoff-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.pdf-modal-handoff-note {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.pdf-modal-handoff-action {
  margin-top: 6px;
  padding: 11px 24px;
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.4);
  background: var(--bull-green-dim);
  color: var(--bull-green-light);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.pdf-modal-handoff-action:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--bull-green);
  color: var(--bull-green-light);
}

/* Page behind the scrim holds still while the modal is up. */
body.pdf-modal-open {
  overflow: hidden;
  padding-right: var(--scrollbar-gap, 0px);
}

body.pdf-modal-open .navbar {
  padding-right: var(--scrollbar-gap, 0px);
}

@media (prefers-reduced-motion: reduce) {
  .pdf-modal,
  .pdf-modal-panel {
    transition: none;
  }
}
