/* Keep evidence inspection stationary and reduce repeated visual metadata in the file viewer only. */
.proof-attachment-viewer-modal .owner-inline-modal__card {
  animation: none !important;
  transform: none !important;
}

.proof-attachment-viewer-modal .proof-attachment-resolver-kicker {
  display: none !important;
}

/*
 * Once a file resolves, put its type on the left of the same row that owns
 * Open file and Download. The head becomes transparent to the card grid, so
 * no duplicate metadata row or empty visual gap remains.
 */
.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta) {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
  .proof-attachment-resolver-head {
  display: contents;
}

/* Preserve the selected file name and ready state for assistive technology. */
.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
  .proof-attachment-resolver-head
  > :not(.proof-attachment-resolver-actions) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
  .proof-attachment-resolver-meta {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: start;
  min-width: 0;
  margin: 0;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
  .proof-attachment-resolver-actions {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  justify-content: flex-end;
  width: auto;
  flex-wrap: nowrap;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
  > :not(.proof-attachment-resolver-head):not(.proof-attachment-resolver-meta) {
  grid-column: 1 / -1;
}

/*
 * While the protected file is resolving, show a calm deterministic loading
 * signal instead of an empty card. Existing head copy stays available to
 * assistive technology while the visual dots advance one, two, three, repeat.
 */
@keyframes proof-file-viewer-loading-dots {
  0%,
  24% {
    width: 0;
  }

  25%,
  49% {
    width: 0.34em;
  }

  50%,
  74% {
    width: 0.68em;
  }

  75%,
  100% {
    width: 1.02em;
  }
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 32px;
  gap: 0;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head
  > * {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head::before {
  content: "Loading";
  color: #365981;
  font-weight: 800;
  line-height: 1.4;
}

.proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head::after {
  content: "...";
  display: inline-block;
  width: 0;
  overflow: hidden;
  color: #365981;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  animation: proof-file-viewer-loading-dots 1.2s linear infinite;
}

html.locale-ja
  .proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head::before,
html[lang^="ja"]
  .proof-attachment-viewer-modal
  .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
  .proof-attachment-resolver-head::before {
  content: "読み込み中";
}

@media (max-width: 720px) {
  .proof-attachment-viewer-modal
    .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
    .proof-attachment-resolver-actions {
    width: auto;
    justify-content: flex-end;
  }

  .proof-attachment-viewer-modal
    .proof-attachment-resolver-card:has(.proof-attachment-resolver-meta)
    .proof-attachment-resolver-actions
    .button {
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proof-attachment-viewer-modal
    .proof-attachment-resolver-card:not(:has(.proof-attachment-resolver-meta)):not(:has(.proof-attachment-resolver-actions))
    .proof-attachment-resolver-head::after {
    width: 1.02em;
    animation: none;
  }
}
