.attachment-preview {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  align-items: stretch;
  gap: 12px;
}

.attachment-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-self: stretch;
  overflow: hidden;
}

.attachment-card .attachment-image-button {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg);
}

.attachment-card .attachment-image-button img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: var(--bg);
}

.attachment-card iframe {
  width: 100%;
  height: 220px;
  flex: 0 0 220px;
  border: 0;
  background: var(--bg);
}

.attachment-card .attachment-name {
  display: -webkit-box;
  min-height: 2.8em;
  overflow: hidden;
  padding: 8px 2px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.attachment-card > a {
  display: grid;
  min-height: 100px;
  flex: 1;
  place-items: center;
  padding: 12px;
  overflow-wrap: anywhere;
  text-align: center;
}

@media (max-width: 480px) {
  .attachment-preview {
    grid-template-columns: 1fr;
  }
}

.attachment-card .attachment-remove { align-self: flex-end; margin-top: 8px; }
