/* Post form: the composer, the Markdown editor, and its preview. */
@layer components {
  .post-form {
    display: grid;
    gap: var(--space-5);
    width: min(100%, var(--width-reading));
  }

  .post-form__field,
  .post-form__community-target,
  .post-form__actions {
    margin: 0;
  }

  .post-form__field--title input {
    font-family: var(--font-reading);
    font-size: var(--text-lg);
    font-weight: 700;
  }

  .post-form__quote-banner,
  .post-form__queue-hint {
    margin: 0;
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-sm);
  }

  .post-form__quote-banner p {
    margin: 0;
  }

  .post-form__required-tags,
  .post-form__manage-community-tags {
    padding-left: var(--space-3);
    border-left: 2px solid var(--color-border);
  }

  .post-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-2);
    border: var(--border-thin) solid var(--color-border-strong);
    border-bottom: 0;
    background: var(--color-surface);
  }

  .post-editor__commands,
  .post-editor__toggles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .post-editor__command,
  .post-editor__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: var(--space-2) var(--space-3);
    border: var(--border-thin) solid transparent;
    border-radius: var(--radius-small);
    background: transparent;
    color: var(--color-text);
    font-family: var(--font-interface);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
  }

  .post-editor__command:hover,
  .post-editor__toggle:hover,
  .post-editor__toggle[aria-current="true"] {
    border-color: var(--color-border-strong);
    background: var(--color-canvas);
  }

  .post-editor__command[disabled] {
    color: var(--color-disabled-text);
    cursor: not-allowed;
  }

  .post-editor__panes {
    min-width: 0;
  }

  .post-editor__panes > .field_with_errors {
    display: block;
  }

  .post-editor__panes textarea.post-editor__source {
    display: block;
    min-height: 24rem;
    border-radius: 0;
    background: var(--color-canvas);
    font-family: var(--font-reading);
    font-size: var(--text-lg);
    line-height: var(--leading-copy);
  }

  .post-editor__panes textarea.post-editor__source[hidden],
  .post-editor__preview[hidden] {
    display: none;
  }

  .post-editor__preview {
    min-height: 24rem;
    padding: var(--space-5);
    border: var(--border-thin) solid var(--color-border-strong);
    background: var(--color-canvas);
    font-family: var(--font-reading);
    font-size: var(--text-lg);
    line-height: var(--leading-copy);
    overflow-wrap: anywhere;
  }

  .post-preview__body > :first-child,
  .post-preview__empty > :first-child {
    margin-top: 0;
  }

  .post-preview__body > :last-child,
  .post-preview__empty > :last-child,
  .post-editor__error {
    margin-bottom: 0;
  }

  .post-preview__body pre,
  .post-preview__body table {
    max-width: 100%;
    overflow-x: auto;
  }

  .post-preview__body img {
    max-width: 100%;
    height: auto;
  }
}
