// HTML Element: Blockquote

@use '00-config' as *;

$blockquote-cite-divider-color: gesso-color(ui, generic, border);

blockquote {
  @include display-text-style(blockquote);
  margin-block: 0 rem(gesso-spacing(5));
  margin-inline: 0;

  // Add top margin when blockquote is preceded by other elements
  * + & {
    margin-block-start: rem(gesso-spacing(5));
  }

  p {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;

    &::before {
      content: '\201C';
    }

    &::after {
      content: '\201D';
    }
  }

  cite {
    display: block;
    margin-block-start: rem(gesso-spacing(2));
    text-align: end;

    em {
      border-inline-start: 1px solid $blockquote-cite-divider-color;
      font-weight: gesso-font-weight(regular);
      margin-inline-start: rem(gesso-spacing(0.5));
      padding-inline-start: rem(gesso-spacing(1));
    }
  }

  :last-child {
    margin-block-end: 0;
  }

  @media print {
    page-break-inside: avoid;
  }

  @if ($wysiwyg) {
    border-inline-start: revert;
    font-style: revert;
    padding-inline: revert;

    &::before {
      display: none;
    }
  }
}
