/* it-1420 (BPDGo#472): a Long text field — its box, its rich editor and its value on a page (shared/_long_text.html,
   static/js/long-text.js). The box is the house outlined text field as a textarea (it grows, long-text.js); the rich
   editor is Trix under the house toolbar, drawn as an outlined box like the notes composer; a value keeps its line
   breaks (plain) or its formatting (rich) and folds after about eight lines. No drawn scrollbars. Prefix: .long-text,
   .rt-field, .field-input--long / --rich */

/* It grows with what's typed (long-text.js), so no drag grip. */
.field-input--long md-outlined-text-field { width: 100%; resize: none; }

/* The characters left near the cap (D1); over it, the error tone. */
.long-text__count {
  display: block;
  margin-top: var(--space-1, 0.25rem);
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--md-sys-color-on-surface-variant);
}
.long-text__count[hidden] { display: none; }
.long-text__count--over { color: var(--md-sys-color-error); }

/* The rich editor: no attach button (D4) — pictures and files don't go in a field value. */
.field-input--rich [data-trix-button-group="file-tools"] { display: none; }
.field-input--rich .rt-toolbar { margin-bottom: var(--space-1, 0.25rem); }
.rt-field {
  display: block;
  min-height: 4.5rem;
  max-height: 20rem; /* about twelve lines, then it scrolls inside */
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0.75rem 1rem;
  border-radius: var(--r-xs, 0.625rem);
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  overflow-wrap: anywhere;
}
.rt-field::-webkit-scrollbar { display: none; }
.rt-field:focus,
.rt-field:focus-within {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary) inset;
}

/* A value on a page. */
.long-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  cursor: auto;
}
.long-text__body {
  width: 100%;
  max-height: 12rem; /* about eight lines; Show more opens it */
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.long-text--open .long-text__body { max-height: none; }
.long-text__body--plain { white-space: pre-wrap; }
.long-text__more { margin-top: var(--space-1, 0.25rem); }
.long-text__more[hidden] { display: none; }

/* A rich value's blocks — drawn the same with or without Trix's own sheet on the page (a record page has none). */
.long-text__body--rich > :first-child { margin-top: 0; }
.long-text__body--rich > :last-child { margin-bottom: 0; }
.long-text__body--rich h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: var(--md-sys-typescale-title-medium-size, 1rem);
  font-weight: 600;
  line-height: 1.4;
}
.long-text__body--rich blockquote {
  margin: 0.25rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}
.long-text__body--rich pre {
  margin: 0.25rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-xs, 0.625rem);
  background: var(--md-sys-color-surface-container);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.875rem;
  white-space: pre-wrap;
}
.long-text__body--rich ul,
.long-text__body--rich ol { margin: 0.25rem 0; padding-left: 1.5rem; }
.long-text__body--rich a { color: var(--md-sys-color-primary); }

/* A list cell: the start of the text on up to two lines, the rest cut with an ellipsis; the whole value on hover. */
.long-text-clip {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 28rem;
}
