.ProseMirror {
  --ProseMirror-numLines: 10;

  @apply min-h-[calc(var(--ProseMirror-numLines)*theme(lineHeight.4))] whitespace-pre-wrap rounded-b-lg px-4 py-[var(--lineHeight-m)] focus:[box-shadow:none];
}

:where(.ProseMirror-fullscreen-container) {
  @apply h-1 overflow-hidden;
}

/* styling enhanced text as it appears in the editor */
.ProseMirror {
  .rte2-style-bold {
    @apply font-bold;
  }

  .rte2-style-italic {
    @apply italic;
  }

  .rte2-style-underline {
    @apply underline;
  }

  .rte2-style-strikethrough {
    @apply line-through;
  }

  .cms-textAlign-left {
    @apply text-left;
  }

  :where(.cms-textAlign-center, .rte2-style-align-center) {
    @apply text-center;
  }

  :where(.cms-textAlign-right, .rte2-style-align-right) {
    @apply text-right;
  }

  .rte2-style-subscript {
    @apply relative -bottom-1 align-baseline text-[75%]/[0];
  }

  .rte2-style-superscript {
    @apply relative -top-2 align-baseline text-[75%]/[0];
  }

  .rte2-style-brightspot-core-rte-heading-HeadingThree {
    @apply btu-heading-4;
  }

  .rte2-style-brightspot-core-rte-heading-HeadingTwo {
    @apply btu-heading-3;
  }

  :is(bsp-line, bsp-break) {
    @apply blokk;

    &:has(> .ProseMirror-trailingBreak) {
      @apply leading-[var(--lineHeight-m)];
    }
  }

  :where(ul, ol):not(.Dropdown, .ProseMirror-tableSubmenuList) {
    @apply my-[theme(lineHeight.4)] ml-8;
  }

  ul {
    @apply list-disc;

    ul {
      @apply list-[circle];
    }

    ul ul {
      @apply list-[square];
    }
  }

  ol {
    @apply list-decimal;

    ol {
      @apply list-[lower-alpha];
    }
  }

  li {
    @apply relative;
  }

  &:has(+ .ProseMirror-moveEnhancementOverlay) {
    @apply border-transparent caret-transparent ring-0;

    > *:not(.Enhancement.readOnly.ProseMirror-selectednode) {
      @apply opacity-60;
    }

    .Enhancement.readOnly.ProseMirror-selectednode {
      @apply border-primary-700;

      > * {
        @apply opacity-60;
      }
    }
  }
}

.ProseMirror .rte2-style-comment {
  @apply mx-1 gap-2 rounded bg-primary-50 px-1 text-primary-800 before:btu-icon before:btu-icon-message-circle before:pe-1 data-[collapse=true]:before:pe-0;

  .collapsed {
    @apply hidden;
  }

  .is-locked & {
    @apply opacity-60;
  }
}

.ProseMirror-comments {
  @apply hidden;
}

/* --- Track Changes --- */
.rte2-style-ins-insert {
  @apply bg-success-200 text-success-900 no-underline;

  .Enhancement {
    @apply bg-success-50;
  }
}

.rte2-style-ins-delete {
  @apply bg-error-200 text-error-900;

  .Enhancement {
    @apply bg-error-50 text-error-600;
  }

  .ProsemirrorEnhancementMenu {
    @apply hidden;
  }
}

.ProseMirror-previewMode {
  .rte2-style-ins-insert,
  .rte2-style-ins-insert .Enhancement {
    @apply bg-transparent;
  }

  .rte2-style-ins-delete {
    @apply hidden;
  }
}

.ProseMirror-aiPreviewMode {
  .rte2-style-ins-ai {
    @apply bg-purple-100 text-purple-900;
  }
}

.ProseMirror-aiInlinePreviewMode {
  .rte2-style-ai-inline-highlight {
    @apply bg-primary-50;
  }

  .rte2-style-ai-inline-ins {
    @apply bg-primary-50 text-primary-900 no-underline;
  }

  .rte2-style-ai-inline-del {
    @apply bg-gray-50 line-through;
  }
}

.CIG-row:only-child.is-unlabeled[data-field='richText'] {
  @apply w-full;
}
