@reference "../../css/globals.css";

.cm-tooltip .documentation,
.docs-documentation {
  line-height: normal;

  @apply font-prose;

  ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
  }

  ul {
    list-style-type: disc;
    padding-left: 1.5rem;
  }

  p {
    padding: 0.4rem 0;
    white-space: pre-wrap;
  }

  .section {
    line-height: normal;
  }

  ul,
  li,
  ol,
  .docutils p,
  .docutils dd,
  .paragraph {
    white-space: initial;
  }

  table {
    @apply text-sm border rounded my-2;

    th,
    td {
      @apply border p-2;
    }

    th {
      @apply bg-[var(--slate-2)];
    }

    tr:nth-child(2n) {
      @apply bg-[var(--slate-1)];
    }
  }

  code {
    @apply border px-1 rounded font-mono bg-[var(--slate-2)] text-sm mb-4 mt-2;
  }

  code:empty {
    display: none;
  }

  h1,
  h2 {
    font-weight: 600;
    @apply text-xl border-b pb-1 mb-1 text-primary;
  }

  dt {
    @apply font-bold;

    span {
      @apply font-normal;
    }
  }

  .doctest-block,
  .literal-block {
    white-space: pre-wrap;
    @apply bg-[var(--slate-2)] p-2 rounded text-sm;
  }

  .docutils.literal {
    @apply bg-[var(--slate-2)] px-1 border rounded-md text-sm font-mono;
  }

  pre > code,
  .codehilite code {
    width: 100%;
    display: inline-block;
    white-space: pre-wrap;
    @apply bg-[var(--slate-2)] border p-2 rounded-md font-mono text-sm;
  }

  blockquote {
    white-space: pre-wrap;

    @apply pl-2 ml-2;

    p,
    dl.docutils,
    .docutils dt {
      padding: 0;
      white-space: normal;
      font-weight: initial;
      @apply text-sm font-mono;
    }
  }
}

.docutils dd {
  white-space: pre-wrap;
  padding-left: 1rem;
}

/* Custom overrides when in a tooltip */
.cm-tooltip .documentation,
.cm-tooltip .docs-documentation {
  @apply text-sm py-1 px-2;

  h1 {
    @apply text-base;
  }

  code,
  .doctest-block,
  .literal-block,
  .docutils.literal,
  .codehilite code {
    @apply text-xs;
  }

  blockquote {
    p,
    dl.docutils,
    .docutils dt {
      @apply text-xs;
    }
  }
}
