/*
 * We need to override trix.css’s image gallery styles to accommodate the
 * <action-text-attachment> element we wrap around attachments. Otherwise,
 * images in galleries will be squished by the max-width: 33%; rule.
*/
.trix-content .attachment-gallery > action-text-attachment,
.trix-content .attachment-gallery > .attachment {
  flex: 1 0 33%;
  padding: 0 0.5em;
  max-width: 33%;
}

.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
  flex-basis: 50%;
  max-width: 50%;
}

.trix-content action-text-attachment .attachment {
  padding: 0 !important;
  max-width: 100% !important;
}

trix-toolbar .trix-button-row .trix-button:disabled {
  color: rgba(0, 0, 0, 0.5)
}
trix-toolbar .trix-button:not(:disabled) {
  background-color: var(--bg-primary-500);
}

.dark trix-toolbar .trix-button.trix-button--icon {
  filter: invert(1);
}

/*
 * .trix-basic removes the toolbar and any styling (bold, italics, etc)
 * so the editor basically looks like normal text + inline attachments.
*/
.trix-basic trix-toolbar,
.trix-basic .attachment__caption {
  display: none;
}
.trix-basic .attachment.attachment--file > .attachment__caption {
  display: inline-block;
  margin: 0;
}

.attachment__caption .attachment__name + .attachment__size::before {
  content: ' \2022 ';
  margin: 0 0.25em;
}

.attachment__icon {
  margin-right: 0.25em;
}

.attachment__download {
  margin-left: calc(var(--spacing) * 2);
}

.attachment.attachment--file {
  display: inline-block !important;
  margin: 0.5rem 0;
  padding: .4em 1em;
  border: 1px solid #bbb;
  border-radius: 5px;

  * {
    color: var(--text-primary-800);
  }
}

.attachment.attachment--preview {
  margin: 0 !important;
  display: inline-block;
}

.trix-basic em {
  font-style: normal;
}
.trix-basic strong {
  font-weight: normal;
}
.trix-basic a {
  text-decoration: none;
}
.trix-basic del {
  text-decoration: none;
}

.trix-content .attachment--file {
    color: var(--text-primary-100);
}
