/*
 * Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
 * the trix-editor content (whether displayed or under editing). Feel free to incorporate this
 * inclusion directly in any other asset bundle and remove this file.
 *
 *= require trix
*/

/*
 * 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;
}

/* tailwind resets list style, so add it back for actiontext */
.trix-content ul {
  list-style: disc;
  padding-left: 12px;
}

.trix-content ol {
  list-style: decimal;
  padding-left: 12px;
}

.trix-content a {
  color: #3b82f6;
  text-decoration: underline;
}

trix-editor[placeholder]:empty:before {
  color: #9ca3af;
  content: attr(placeholder);
  pointer-events: none;
}

trix-editor.borderless-editor,
trix-editor.borderless-editor:focus,
trix-editor.borderless-editor:active,
trix-editor.borderless-editor:hover {
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  font-size: 16px;
  line-height: 1.6;
  outline: none !important;
  margin: 0 !important;
}

trix-editor.borderless-editor[placeholder]:empty:before {
  color: #9ca3af;
  font-size: 16px;
  font-weight: normal;
}

trix-toolbar[id^="trix-toolbar-"] {
  border: none !important;
  padding: 12px 0 !important;
  margin-bottom: 16px !important;
  background: transparent !important;
  display: flex !important;
  justify-content: flex-start !important;
  gap: 0 !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button-group {
  display: flex !important;
  margin-right: 0 !important;
  border: none !important;
  padding: 0 !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button-group:not(:last-child) {
  border-right: none !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button-group:not(:last-child)::after {
  display: none !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button {
  border: none !important;
  background: transparent !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  border-radius: 4px !important;
  color: #6b7280 !important;
  font-size: 14px !important;
  min-width: 28px !important;
  height: 28px !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button:hover {
  background: #f3f4f6 !important;
  color: #374151 !important;
}

trix-toolbar[id^="trix-toolbar-"] .trix-button.trix-active {
  background: #f3f4f6 !important;
  color: #374151 !important;
}
