/*
 * Markdown editor: GitHub's comment editor, written once for every place Forgejo renders its own
 * markdown editor: a bordered box whose toolbar carries the Write/Preview tabs, and a plain
 * attachment line instead of a dashed drop area. To style another editor, add its container to
 * the list. The release form keeps Forgejo's drop area and only takes the editor.
 */
:is(
    .page-content.repository.view.issue.github-conversation .comment.form,
    .page-content.repository.new.issue.github-issue-new,
    .review-box-panel,
    .comment-code-cloud,
    .page-content.repository.new.release
  )
  .combo-markdown-editor {
  border: 1px solid var(--color-light-border);
  border-radius: var(--border-radius);
  background: var(--color-body);
  & markdown-toolbar {
    background: var(--color-box-header);
    border-bottom: 1px solid var(--color-light-border);
  }
  & .markdown-toolbar-button {
    color: var(--color-text-light-1);
    width: 28px;
    height: 28px;
    padding: 6px;
    border: 0;
    background: transparent;
  }
  & textarea {
    background: var(--color-body);
    font-size: 14px;
    border: 1px solid var(--color-light-border);
    border-radius: var(--border-radius);
    box-shadow: none;
  }
  overflow: visible;

  & markdown-toolbar {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    min-height: 38px;
    padding: 0 8px 0 0;
    gap: 8px;

    & .markdown-toolbar-group {
      flex: 0 0 auto;
    }
    & .switch {
      border: 0;
      background: transparent;
      border-radius: 0;
      margin: 0 auto -1px 0;
      min-height: 38px;
    }
    /* Forgejo overlaps neighbouring switch items with negative margins and paints the first one. */
    & .switch .item {
      height: 38px;
      min-height: 38px;
      margin: 0 !important;
      padding: 8px 16px !important;
      border: 1px solid transparent;
      border-radius: 0;
      background: transparent !important;
      box-shadow: none;
      outline: 0;
      color: var(--color-text-light-1);
      font-size: 14px;
      line-height: 21px;
      font-weight: 400;
    }
    & .switch .item:not(.active):hover {
      color: var(--color-text);
    }
    & .switch .item.active {
      border-right-color: var(--color-light-border);
      border-left-color: var(--color-light-border);
      border-bottom-color: var(--color-body);
      background: var(--color-body) !important;
      color: var(--color-text);
    }
    /* The editor's own border already draws the first tab's left edge. */
    & .switch .item.active:first-child {
      border-left-color: transparent;
      border-top-left-radius: var(--border-radius);
    }
    & .switch .item:focus-visible {
      outline: 2px solid var(--github-fgColor-accent);
      outline-offset: -2px;
    }
    & .switch .item.active::before,
    & .switch .item.active::after {
      display: none;
    }
  }
  & > .ui.tab.markup {
    background: var(--color-body);
    padding: 16px;
    min-height: 136px;
    font-size: 14px;
    line-height: 21px;
  }
  & textarea {
    margin: 8px;
    width: calc(100% - 16px);
    height: auto;
    min-height: 123px;
    max-height: calc(35lh + 18px);
    field-sizing: content;
    line-height: 21px;
    font-family: var(--fonts-proportional);
    padding: 8px;
  }
}
:is(
    .page-content.repository.view.issue.github-conversation .comment.form,
    .page-content.repository.new.issue.github-issue-new,
    .review-box-panel,
    .comment-code-cloud
  )
  .ui.dropzone {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  & .dz-message {
    margin: 0;
    text-align: left;
  }
  & .dz-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    min-height: 32px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
    color: var(--color-text-light-1);
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  border: 0 !important;
  & .dz-button {
    color: var(--color-text-light-1) !important;
  }
}
