@use 'sass:math';

@mixin markdown() {
  /*
  &,
  p {
    font-weight: 300;
  }
  */

  --margin-top: 0.5em; // var(--llm-markdown-margin-top);
  --margin-bottom: 1em; // var(--llm-markdown-margin-bottom);
  --margin-left: 1em; // var(--llm-markdown-margin-left);
  --bold: 500; // var(--llm-typography-cta2-font-weight);
  --accent: var(--neutral-700); // var(--llm-markdown-accent);
  --border: 2px solid var(--neutral-200); // var(--llm-markdown-border);

  h1 {
    @include text(display3);
  }

  h2 {
    @include text(display4);
  }

  h3 {
    @include text(display5);
  }

  h4,
  h5,
  h6 {
    @include text(display6);
  }

  ol,
  ul {
    display: flex;
    flex-direction: column;
  }

  ol {
    margin-left: var(--margin-left);
  }

  ul {
    margin-left: var(--margin-left);
    list-style: disc;
  }

  code,
  pre {
    font-size: inherit;
    line-height: inherit;
    font-style: normal;
    font-family: inherit;
    background-color: transparent;
    color: inherit;
  }

  pre,
  code {
    font-family: monospace;
    font-size: 0.9em;
  }

  i,
  em {
    font-style: italic;
  }

  b,
  strong {
    font-weight: var(--bold);
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin-bottom: 0.3em;
  }

  p,
  ul,
  ol,
  pre,
  blockquote {
    margin-bottom: var(--margin-bottom);

    &:last-child {
      margin-bottom: 0;
    }
  }

  blockquote {

    &,
    &:before,
    &:after {
      margin: 0;
      padding: 0;
      border: none;
      outline: none;
      font-family: inherit;
      font-size: inherit;
      background: none;
      color: inherit;
    }

    & {
      margin-bottom: var(--margin-bottom);
      padding-left: 0.5em;
      border-left: var(--border);
    }
  }

  hr {
    border: none;
    border-top: var(--border);
    margin-top: var(--margin-top);
    margin-bottom: var(--margin-bottom);
  }

  a {
    text-decoration: underline;

    &:link,
    &:active,
    &:visited,
    &:hover {
      color: var(--accent);
    }
  }

  img {
    max-width: 280px;
    padding: 0;
    border-radius: 2px;
    border: var(--border);
  }

  .llm__text-img {
    display: block;
    margin-top: var(--margin-top);
    margin-bottom: var(--margin-bottom);
    font-size: 0;
    text-decoration: none;

    &>img {
      display: inline-flex;
      justify-content: center;
      align-items: center;
      width: 320px;
      height: 320px;
      object-fit: cover;
    }
  }

  .llm__pill {
    max-width: Max(375px, u(30));
    margin-bottom: 1em;

    &:first-of-type {
      margin-top: var(--margin-top);
    }

    &:last-of-type {
      margin-bottom: var(--margin-bottom);
    }
  }
}
