/* Data-access modal for the catalog (databases2). */

.data-modal[hidden] {
  display: none;
}

.data-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.data-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: data-modal-fade-in 0.25s ease-out;
}

.data-modal__dialog {
  position: relative;
  max-width: 44rem;
  margin: 10vh auto;
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 1.5rem 2rem;
  animation: data-modal-slide-in 0.25s ease-out;
}

/* Re-triggers on every open: removing [hidden] takes the dialog from
   display:none back into the render tree, which restarts a CSS animation
   defined directly on the element - no JS hook needed. */
@keyframes data-modal-slide-in {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes data-modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .data-modal__backdrop,
  .data-modal__dialog {
    animation: none;
  }
}

.data-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: 0;
  background: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.data-modal__close:hover {
  color: #000;
}

.data-modal-body fieldset {
  margin: 1rem 0;
  border: 1px solid #ddd;
  padding: 0.75rem 1rem;
}

.data-modal-body legend {
  font-weight: bold;
  padding: 0 0.4rem;
}

.data-modal-body label {
  display: inline-block;
  margin: 0.15rem 0.75rem 0.15rem 0;
}

.size-hint {
  font-size: 0.9em;
  color: #2a6b2a;
  min-height: 1.2em;
}

.size-hint.warn {
  color: #b00020;
  font-weight: bold;
}

/* Same centering the legacy .dbdoc class provided - used instead of it so
   this trigger is NOT caught by the old include/js/data.js handler, which
   binds a blank window.open() popup to any .dbdoc element. */
.table td .link-info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Wider dialog while a PDF/video is embedded - the default 44rem is too
   cramped to read a document or watch a video in. */
.data-modal__dialog--wide {
  max-width: min(90vw, 60rem);
}

.media-viewer p {
  margin: 0 0 0.75rem;
}

.media-viewer iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: 1px solid #ddd;
}

.media-viewer video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #000;
}
