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

.trix-content {
  position: absolute;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  border: 0;
  padding: 2rem;
  outline: 0;
  overflow: auto;
}

.trix-button-group.trix-button-group--file-tools {
  display: none;
}

/* Custom styles for Tajo */

.trix--fullscreen .trix-content {
  position: absolute;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  border: 0;
  padding: 2rem;
  outline: 0;
  overflow: auto;
}

.trix--white .trix-button {
  background: white;
}

.trix--for-email .trix-button--icon-strike,
.trix--for-email .trix-button--icon-quote,
.trix--for-email .trix-button--icon-code,
.trix--for-email .trix-button--icon-heading-1,
.trix--for-email .trix-button--icon-decrease-nesting-level,
.trix--for-email .trix-button--icon-increase-nesting-level {
  display: none;
}

.trix--simple .trix-button--icon-strike,
.trix--simple .trix-button--icon-link,
.trix--simple .trix-button--icon-quote,
.trix--simple .trix-button--icon-code,
.trix--simple .trix-button--icon-decrease-nesting-level,
.trix--simple .trix-button--icon-increase-nesting-level {
  display: none;
}

.trix--minimal .trix-button--icon-strike,
.trix--minimal .trix-button--icon-link,
.trix--minimal .trix-button--icon-quote,
.trix--minimal .trix-button--icon-code,
.trix--minimal .trix-button--icon-decrease-nesting-level,
.trix--minimal .trix-button--icon-increase-nesting-level,
.trix--minimal .trix-button--icon-heading-1,
.trix--minimal .trix-button-group--history-tools {
  display: none;
}

/* Announcement editor (Lexxy, see RichTextEditorComponent) */
.rich-text-editor {
  --lexxy-font-base: Rubik, sans-serif;
  --lexxy-color-ink: #292524;
  --lexxy-color-ink-medium: #57534e;
  --lexxy-color-ink-light: #a8a29e;
  --lexxy-color-ink-lighter: #e7e5e4;
  --lexxy-color-ink-lightest: #f5f5f4;
  --lexxy-color-accent-dark: var(--color-ocean-600);
  --lexxy-color-accent-medium: var(--color-ocean-500);
  --lexxy-color-accent-light: var(--color-ocean-100);
  --lexxy-color-accent-lightest: var(--color-ocean-50);
  --lexxy-color-link: var(--color-ocean-600);
  --lexxy-focus-ring-color: var(--color-ocean-500);
  --lexxy-radius: .5rem;
  --lexxy-toolbar-button-size: 2.25rem;
  --lexxy-shadow: 0 12px 30px rgb(28 25 23 / 15%), 0 2px 6px rgb(28 25 23 / 8%);

  position: relative;
  border: 1px solid #e7e5e4;
  border-radius: 1rem;
  background: white;
}

.rich-text-editor:focus-within {
  border-color: var(--color-ocean-500);
  box-shadow: 0 0 0 3px var(--color-ocean-100);
}

.rich-text-editor lexxy-editor {
  --lexxy-editor-padding: 1.25rem 1.5rem;
  --lexxy-editor-rows: 22rem;
  display: block;
  border: 0;
  border-radius: 1rem;
}

.rich-text-editor--fill,
.rich-text-editor--fill lexxy-editor {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.rich-text-editor--fill lexxy-editor { flex: 1; }
.rich-text-editor--fill .lexxy-editor__content { flex: 1; }

.rich-text-editor lexxy-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: .5rem .75rem;
  border-bottom: 1px solid #f5f5f4;
  border-radius: 1rem 1rem 0 0;
  background: white;
}

/* Floating toolbar: the surrounding card is the frame, formatting buttons float above selected text and
   blocks (lists, tables, uploads, emojis) are inserted through the slash menu. */
.rich-text-editor--floating-toolbar,
.rich-text-editor--floating-toolbar:focus-within {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.rich-text-editor.rich-text-editor--floating-toolbar lexxy-editor {
  --lexxy-editor-padding: 0;
}

.rich-text-editor.rich-text-editor--floating-toolbar lexxy-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: .25rem;
  border: 1px solid #e7e5e4;
  border-radius: .75rem;
  box-shadow: var(--lexxy-shadow);
}

.rich-text-editor--floating-toolbar lexxy-toolbar:not([data-floating-visible]) {
  visibility: hidden;
  pointer-events: none;
}

/* Dropdowns in the same frame as the floating toolbar */
.rich-text-editor lexxy-toolbar [data-dropdown-panel] {
  border: 1px solid #e7e5e4;
  border-radius: .75rem;
}

.rich-text-editor lexxy-toolbar [data-dropdown-panel] button:focus {
  outline: none;
}

.rich-text-editor lexxy-toolbar [data-dropdown-panel] button:focus-visible {
  background-color: #f5f5f4;
}

/* Format menu: one line per entry, icons in a column so the labels line up */
.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list {
  min-width: 13rem;
  padding: .25rem;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list button {
  justify-content: flex-start;
  gap: .75rem;
  width: 100%;
  padding: .5rem .75rem;
  border-radius: .5rem;
  text-align: start;
  white-space: nowrap;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list button > :first-child {
  flex: none;
  width: 1.5rem;
  text-align: center;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list button > :last-child {
  flex: 1;
  text-align: start;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list button svg {
  margin-inline: auto;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown-list .lexxy-editor__toolbar-separator {
  margin-block: .25rem;
}

/* Link dialog: wide enough for an address, positioned by the rich-text-editor controller */
.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link [data-dropdown-panel] {
  inset-inline-end: auto;
  width: min(26rem, calc(100vw - 16px));
  margin-top: .375rem;
  padding: .375rem;
  gap: .375rem;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link input {
  flex: 1;
  min-width: 0;
  padding-inline: .75rem;
  border-color: #d6d3d1;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link input:focus {
  outline: none;
  border-color: var(--color-ocean-500);
  box-shadow: 0 0 0 3px var(--color-ocean-100);
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link .lexxy-editor__toolbar-dropdown-actions {
  flex: none;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link button {
  width: auto;
  padding-inline: .875rem;
  border-radius: 9999px;
  font-weight: 600;
  white-space: nowrap;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link button[value="link"] {
  background-color: var(--color-forest-500);
  color: white;
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link button[value="link"]:hover {
  background-color: var(--color-forest-600);
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link button[value="unlink"] {
  background-color: transparent;
  color: var(--color-stone-500);
}

.rich-text-editor lexxy-toolbar .lexxy-editor__toolbar-dropdown--link button[value="unlink"]:hover {
  background-color: #f5f5f4;
}

.rich-text-editor--floating-toolbar lexxy-toolbar :is(button[name="unordered-list"], button[name="ordered-list"], button[name="table"], button[name="image"], button[name="file"], button[name="emoji"], .lexxy-editor__toolbar-overflow) {
  display: none;
}

/* Undo and redo stay on Cmd/Ctrl+Z, quote and divider in the slash menu. */
.rich-text-editor lexxy-toolbar :is(button[name="undo"], button[name="redo"], button[name="quote"], button[name="divider"]) {
  display: none;
}

.rich-text-editor svg.rich-text-emoji-icon {
  fill: none;
}

.rich-text-editor svg.rich-text-emoji-icon circle {
  fill: currentColor;
}

.rich-text-editor .lexxy-editor__content {
  line-height: 1.7;
}

/* Table tools in Tajo's dropdown style instead of Lexxy's dark pills */
.rich-text-editor lexxy-table-tools {
  --lexxy-color-ink: white;
  --lexxy-color-ink-inverted: #44403c;
  --lexxy-color-ink-medium: #f5f5f4;
  --lexxy-color-floating-controls-separator: #e7e5e4;
}

.rich-text-editor lexxy-table-tools .lexxy-floating-controls__group {
  border: 1px solid #e7e5e4;
  box-shadow: 0 4px 12px rgb(28 25 23 / 10%);
}

.rich-text-slash-menu,
.rich-text-emoji-picker {
  position: fixed;
  z-index: 1100;
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: .75rem;
  box-shadow: 0 12px 30px rgb(28 25 23 / 15%), 0 2px 6px rgb(28 25 23 / 8%);
}

.rich-text-slash-menu[hidden],
.rich-text-emoji-picker[hidden],
.rich-text-emoji-picker [hidden] {
  display: none;
}

.rich-text-slash-menu {
  width: min(16rem, calc(100vw - 16px));
  max-height: min(30rem, 70vh);
  overflow-y: auto;
  padding: .35rem;
}

.rich-text-slash-separator {
  margin: .35rem .5rem;
  border-top: 1px solid #e7e5e4;
}

.rich-text-slash-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .45rem .6rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: #292524;
  text-align: left;
  cursor: pointer;
}

.rich-text-slash-option:hover,
.rich-text-slash-option[aria-selected="true"] {
  background: #f5f5f4;
}

.rich-text-slash-icon {
  display: inline-flex;
  justify-content: center;
  width: 1.5rem;
  color: #78716c;
  font-size: .8rem;
  font-weight: 600;
}

.rich-text-slash-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}



.rich-text-emoji-picker {
  display: flex;
  flex-direction: column;
  width: min(20rem, calc(100vw - 16px));
  height: min(22rem, 60vh);
  padding: .5rem;
}

.rich-text-emoji-search {
  width: 100%;
  margin-bottom: .5rem;
  padding: .45rem .65rem;
  border: 1px solid #e7e5e4;
  border-radius: .5rem;
  font-size: .875rem;
}

.rich-text-emoji-search:focus {
  border-color: var(--color-ocean-500);
  outline: none;
  box-shadow: 0 0 0 2px var(--color-ocean-100);
}

.rich-text-emoji-groups {
  flex: 1;
  overflow-y: auto;
}

.rich-text-emoji-heading {
  padding: .5rem .25rem .25rem;
  color: #78716c;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.rich-text-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
}

.rich-text-emoji {
  height: 2.25rem;
  border-radius: .4rem;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.rich-text-emoji:hover,
.rich-text-emoji:focus-visible {
  background: #f5f5f4;
  outline: none;
}

.rich-text-emoji-empty {
  padding: 1rem .25rem;
  color: #78716c;
  font-size: .875rem;
  text-align: center;
}

/* Announcement content, shared by the editor and the announcement pages */
/* Body headings stay smaller than the announcement title above them. */
.rich-text-editor .lexxy-editor__content h1,
.rich-text-content .trix-format h1 { margin: 1.5rem 0 .75rem; font-size: 1.375rem; line-height: 1.3; font-weight: 600; }
.rich-text-editor .lexxy-editor__content h2,
.rich-text-content .trix-format h2 { margin: 1.25rem 0 .5rem; font-size: 1.1875rem; line-height: 1.35; font-weight: 600; }
.rich-text-editor .lexxy-editor__content h3,
.rich-text-content .trix-format h3 { margin: 1rem 0 .5rem; font-size: 1.0625rem; line-height: 1.4; font-weight: 600; }
.rich-text-editor .lexxy-editor__content hr,
.rich-text-content .trix-format hr { width: 100%; margin: 1.5rem 0; border: 0; border-top: 1px solid #e7e5e4; }
.rich-text-content .trix-format { color: #292524; line-height: 1.7; }
.rich-text-content .trix-format :is(ul, ol) { margin: 0 0 .75rem; padding-left: 1.5rem; }
.rich-text-content .trix-format ul { list-style: disc; }
.rich-text-content .trix-format ol { list-style: decimal; }
.rich-text-content .trix-format li { margin: .125rem 0; padding: 0; }
.rich-text-content .trix-format li::marker { color: inherit; }
.rich-text-content .trix-format :is(h1, h2, h3, strong, th) { color: inherit; }
.rich-text-editor .lexxy-editor__content > :first-child,
.rich-text-content .trix-format > :first-child { margin-top: 0; }
.rich-text-content .trix-format p { margin: 0 0 .75rem; }
.rich-text-content .trix-format mark { background: transparent; color: inherit; }
.rich-text-content .trix-format figure.lexxy-content__table-wrapper { margin: 1rem 0; overflow-x: auto; }
.rich-text-content .trix-format table { width: 100%; margin: 0; border-collapse: collapse; font-size: .9375rem; }
.rich-text-content .trix-format th,
.rich-text-content .trix-format td { padding: .5rem .75rem; border: 1px solid #e7e5e4; text-align: left; vertical-align: top; }
.rich-text-content .trix-format th { background: #f5f5f4; font-weight: 600; }
.rich-text-content .trix-format th > p,
.rich-text-content .trix-format td > p { margin: 0; }

@media (max-width: 640px) {
  .rich-text-editor lexxy-editor {
    --lexxy-editor-padding: 1rem;
    --lexxy-editor-rows: 16rem;
  }

  .rich-text-editor lexxy-toolbar { padding: .375rem .5rem; }
}

/* Refactor this so that Trix can be used in various contexts */
trix-editor h1,
.trix-format h1 {
  font-size: 1.25rem;
  line-height: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

trix-editor p,
.trix-format p {
  margin-bottom: 1rem;
}

trix-editor ul,
.trix-format ul {
  list-style-position: inside;
  list-style-type: disc;
}

trix-editor ol,
.trix-format ol {
  list-style-position: inside;
  list-style-type: decimal;
}

trix-editor a,
.trix-format a {
  text-decoration: underline;
  color: blue;
}

trix-editor {
  overflow: auto;
}
