/* ── Full-screen modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1,4,9,0.92);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  position: relative;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.modal-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t);
  z-index: 10;
}
.modal-close:hover { background: var(--border); color: var(--text-1); }

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t);
  z-index: 10;
}
.modal-nav:hover { background: var(--border); color: var(--text-1); }
.modal-prev { left: 12px; }
.modal-next { right: 12px; }

.modal img {
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 80px);
  object-fit: contain;
  border-radius: var(--r-sm);
  display: block;
}
.modal video {
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 80px);
  border-radius: var(--r-sm);
  display: block;
}
.modal audio { width: 400px; max-width: 90vw; }
.modal embed, .modal iframe {
  width: calc(100vw - 100px);
  height: calc(100vh - 80px);
  border: none;
  border-radius: var(--r-sm);
}
.modal pre {
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: var(--bg-el);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal-caption {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22,27,34,0.9);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
  backdrop-filter: blur(8px);
  font-family: 'JetBrains Mono', monospace;
}
