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

trix-editor.form-control {
    height: auto;
}

/*
 * 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 ol {
    list-style-type: decimal !important;
}

trix-editor {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin: 0;
    padding: 0.4em 0.6em;
    min-height: 5em;
    outline: none;
}

trix-editor * {
    overflow-wrap: break-word;
    word-break: break-word;
}

trix-toolbar * {
    box-sizing: border-box;
}

trix-toolbar .trix-button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: start;
    gap: 16px;
    margin-bottom: 10px;
    overflow-x: auto;
}

trix-toolbar .trix-button-group-spacer {
    flex-grow: 1 !important;
}

@media (max-width: 1280px) {
    trix-toolbar .trix-button-group-spacer {
        display: none;
    }
}

trix-toolbar .trix-button-group {
    display: flex;
    margin-bottom: 0;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    -webkit-box-shadow: 0 3px 4px -4px #71717a;
    -moz-box-shadow: 0 3px 4px -4px #71717a;
    box-shadow: 0 3px 4px -4px #71717a;
}

trix-toolbar .trix-button-group:not(:first-child) {
    margin-left: 0;
}

trix-toolbar .trix-button {
    position: relative;
    float: left;
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 0.5em;
    margin: 0;
    outline: none;
    border: none;
    border-radius: 2px;
    background: transparent;
}

trix-toolbar .trix-button:not(:first-child) {
    border-left: 1px solid #ccc;
}

trix-toolbar .trix-button.trix-active {
    background: #dbeafe;
    color: #513743;
}

trix-toolbar .trix-button:hover {
    background: #dbeafe;
    color: #513743;
}

trix-toolbar .trix-button:not(:disabled) {
    cursor: pointer;
}

trix-toolbar .trix-button:disabled {
    color: rgba(0, 0, 0, 0.125);
}

@media (max-device-width: 768px) {
    trix-toolbar .trix-button {
        letter-spacing: -0.01em;
        padding: 0 0.3em;
    }
}

trix-toolbar .trix-button--icon {
    font-size: inherit;
    width: 2.6em;
    height: 1.6em;
    max-width: calc(0.8em + 4vw);
    text-indent: -9999px;
}

@media (max-device-width: 768px) {
    r trix-toolbar .trix-button--icon {
        height: 2em;
        max-width: calc(0.8em + 3.5vw);
    }
}

trix-toolbar .trix-button--icon::before {
    display: inline-block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.6;
    content: "";
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

@media (max-device-width: 768px) {
    trix-toolbar .trix-button--icon::before {
        right: 6%;
        left: 6%;
    }
}

trix-toolbar .trix-button--icon.trix-active::before {
    opacity: 1;
}

trix-toolbar .trix-button--icon:disabled::before {
    opacity: 0.125;
}

trix-toolbar .trix-button--icon-attach::before {
    background-image: url("/assets/trix/paperclip-f1a47580.svg");
    top: 8%;
    bottom: 4%;
}

trix-toolbar .trix-button--icon-bold::before {
    background-image: url("/assets/trix/bold-6af79dca.svg");
}

trix-toolbar .trix-button--icon-italic::before {
    background-image: url("/assets/trix/italic-1140f862.svg");
}

trix-toolbar .trix-button--icon-link::before {
    background-image: url("/assets/trix/link-7fd8defe.svg");
}

trix-toolbar .trix-button--icon-strike::before {
    background-image: url("/assets/trix/strikethrough-8eaac7b1.svg");
}

trix-toolbar .trix-button--icon-quote::before {
    background-image: url("/assets/trix/quote-5e66b976.svg");
}

trix-toolbar .trix-button--icon-heading-1::before {
    background-image: url("/assets/trix/h1-86cd81f8.svg");
}

trix-toolbar .trix-button--icon-code::before {
    background-image: url("/assets/trix/code-bb901da5.svg");
}

trix-toolbar .trix-button--icon-bullet-list::before {
    background-image: url("/assets/trix/ul-d758fa42.svg");
}

trix-toolbar .trix-button--icon-number-list::before {
    background-image: url("/assets/trix/ol-9e136b89.svg");
}

trix-toolbar .trix-button--icon-undo::before {
    background-image: url("/assets/trix/counterclockwise-0eb7ab17.svg");
}

trix-toolbar .trix-button--icon-redo::before {
    background-image: url("/assets/trix/clockwise-b8d89ccd.svg");
}

trix-toolbar .trix-button--icon-decrease-nesting-level::before {
    background-image: url("/assets/trix/indent-right-458daac9.svg");
}

trix-toolbar .trix-button--icon-increase-nesting-level::before {
    background-image: url("/assets/trix/indent-left-8d9f26b9.svg");
}

trix-toolbar .trix-dialogs {
    position: relative;
}

trix-toolbar .trix-dialog {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 0.75em;
    padding: 15px 10px;
    background: #fff;
    box-shadow: 0 0.3em 1em #ccc;
    border-top: 2px solid #888;
    border-radius: 5px;
    z-index: 5;
}

trix-toolbar .trix-input--dialog {
    font-size: inherit;
    font-weight: normal;
    padding: 0.5em 0.8em;
    margin: 0 10px 0 0;
    border-radius: 3px;
    border: 1px solid #bbb;
    background-color: #fff;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

trix-toolbar .trix-input--dialog.validate:invalid {
    box-shadow: #f00 0px 0px 1.5px 1px;
}

trix-toolbar .trix-button--dialog {
    font-size: inherit;
    padding: 0.5em;
    border-bottom: none;
}

trix-toolbar .trix-dialog--link {
    max-width: 600px;
}

trix-toolbar .trix-dialog__link-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 1024px) {
    trix-toolbar .trix-dialog__link-fields {
        flex-direction: row;
    }
}

trix-toolbar .trix-dialog__link-fields .trix-input {
    flex: 1;
    width: 100%;
    margin: 0;
}

trix-toolbar .trix-dialog__link-fields .trix-button-group {
    align-self: end;
    flex: 0 0 content;
    margin: 0;
}

trix-editor [data-trix-mutable]:not(.attachment__caption-editor) {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

trix-editor [data-trix-mutable]::-moz-selection,
trix-editor [data-trix-cursor-target]::-moz-selection,
trix-editor [data-trix-mutable] ::-moz-selection {
    background: none;
}

trix-editor [data-trix-mutable]::selection,
trix-editor [data-trix-cursor-target]::selection,
trix-editor [data-trix-mutable] ::selection {
    background: none;
}

trix-editor .attachment__caption-editor:focus[data-trix-mutable]::-moz-selection {
    background: highlight;
}

trix-editor .attachment__caption-editor:focus[data-trix-mutable]::selection {
    background: highlight;
}

trix-editor [data-trix-mutable].attachment.attachment--file {
    box-shadow: 0 0 0 2px highlight;
    border-color: transparent;
}

trix-editor [data-trix-mutable].attachment img {
    box-shadow: 0 0 0 2px highlight;
}

trix-editor .attachment {
    position: relative;
}

trix-editor .attachment:hover {
    cursor: default;
}

trix-editor .attachment--preview .attachment__caption:hover {
    cursor: text;
}

trix-editor .attachment__progress {
    position: absolute;
    z-index: 1;
    height: 20px;
    top: calc(50% - 10px);
    left: 5%;
    width: 90%;
    opacity: 0.9;
    transition: opacity 200ms ease-in;
}

trix-editor .attachment__progress[value="100"] {
    opacity: 0;
}

trix-editor .attachment__caption-editor {
    display: inline-block;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
    color: inherit;
    text-align: center;
    vertical-align: top;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

trix-editor .attachment__toolbar {
    position: absolute;
    z-index: 1;
    top: -0.9em;
    left: 0;
    width: 100%;
    text-align: center;
}

trix-editor .trix-button-group {
    display: inline-flex;
}

trix-editor .trix-button {
    position: relative;
    float: left;
    color: #666;
    white-space: nowrap;
    font-size: 80%;
    padding: 0 0.8em;
    margin: 0;
    outline: none;
    border: none;
    border-radius: 0;
    background: transparent;
}

trix-editor .trix-button:not(:first-child) {
    border-left: 1px solid #ccc;
}

trix-editor .trix-button.trix-active {
    background: #cbeefa;
}

trix-editor .trix-button:not(:disabled) {
    cursor: pointer;
}

trix-editor .trix-button--remove {
    text-indent: -9999px;
    display: inline-block;
    padding: 0;
    outline: none;
    width: 1.8em;
    height: 1.8em;
    line-height: 1.8em;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid highlight;
    box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25);
}

trix-editor .trix-button--remove::before {
    display: inline-block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.7;
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg%20height%3D%2224%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22%2F%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 90%;
}

trix-editor .trix-button--remove:hover {
    border-color: #333;
}

trix-editor .trix-button--remove:hover::before {
    opacity: 1;
}

trix-editor .attachment__metadata-container {
    position: relative;
}

trix-editor .attachment__metadata {
    position: absolute;
    left: 50%;
    top: 2em;
    transform: translate(-50%, 0);
    max-width: 90%;
    padding: 0.1em 0.6em;
    font-size: 0.8em;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
}

trix-editor .attachment__metadata .attachment__name {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

trix-editor .attachment__metadata .attachment__size {
    margin-left: 0.2em;
    white-space: nowrap;
}

trix-editor ul {
    list-style-type: disc;
    margin-left: 1rem;
}

trix-editor ul ul {
    list-style-type: circle !important;
}

trix-editor ol {
    list-style-type: decimal;
    margin-left: 1rem;
}

trix-editor ol ol {
    list-style-type: lower-alpha !important;
}

trix-editor h1 {
    font-size: 1.25rem;
    line-height: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

trix-editor a {
    color: #2563eb;
}

trix-editor pre {
    font-size: 0.875em;
    background-color: #cbd5e1;
    margin: 0.5rem 0;
    padding: 0.5rem;
    overflow-x: auto;
    white-space: pre-wrap;
    white-space: -moz-pre-wrap;
    white-space: -o-pre-wrap;
    word-wrap: break-word;
}

.trix-content {
    line-height: 1.5;
    width: 100%;
}

.trix-content * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.trix-content h1 {
    font-size: 1.2em;
    line-height: 1.2;
}

.trix-content a {
    color: #2563eb;
}

.trix-content a:hover {
    text-decoration: underline;
}

:is(trix-editor, .trix-content) blockquote {
    border: 0 solid #ccc;
    border-left-width: 0.3em;
    margin-left: 0.3em;
    padding-left: 0.6em;
}

:is(trix-editor, .trix-content) [dir="rtl"] blockquote,
:is(trix-editor, .trix-content) blockquote[dir="rtl"] {
    border-width: 0;
    border-right-width: 0.3em;
    margin-right: 0.3em;
    padding-right: 0.6em;
}

.trix-content ul {
    list-style-type: disc;
}

.trix-content ul ul {
    list-style-type: circle !important;
}

.trix-content ol {
    list-style-type: decimal;
}

.trix-content ol ol {
    list-style-type: lower-alpha !important;
}

.trix-content li {
    margin-left: 1em;
}

.trix-content [dir="rtl"] li {
    margin-right: 1em;
}

.trix-content pre {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    font-family: monospace;
    font-size: 0.9em;
    padding: 0.5em;
    white-space: pre;
    background-color: #eee;
    overflow-x: auto;
}

.trix-content img {
    max-width: 100%;
    height: auto;
}

.trix-content .attachment {
    display: inline-block;
    position: relative;
    max-width: 100%;
}

.trix-content .attachment a {
    color: inherit;
    text-decoration: none;
}

.trix-content .attachment a:hover,
.trix-content .attachment a:visited:hover {
    color: inherit;
}

.trix-content .attachment__caption {
    text-align: center;
}

.trix-content .attachment__caption .attachment__name + .attachment__size::before {
    content: " \2022 ";
}

.trix-content .attachment--preview {
    width: 100%;
    text-align: center;
}

.trix-content .attachment--preview .attachment__caption {
    color: #666;
    font-size: 0.9em;
    line-height: 1.2;
}

.trix-content .attachment--file {
    color: #333;
    line-height: 1;
    margin: 0 2px 2px 2px;
    padding: 0.4em 1em;
    border: 1px solid #bbb;
    border-radius: 5px;
}

.trix-content .attachment-gallery {
    display: flex;
    flex-wrap: wrap;
    position: relative;
}

.trix-content .attachment-gallery .attachment {
    flex: 1 0 33%;
    padding: 0 0.5em;
    max-width: 33%;
}

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

/* Required asterisk next to text */
label.trix-content.required > *:nth-last-child(-n+2),
label.trix-content.required > .trix-content > :is(h1, div) {
    display: inline;
}
