@layer components {
  .comments {
    --avatar-size: 2.33em;
    --comment-padding-block: var(--block-space-half);
    --comment-padding-inline: var(--inline-space-double);
    --comment-max: 70ch;
    --reaction-size: 2rem;

    display: flex;
    flex-direction: column;
    padding-inline: var(--inline-space);
    place-items: center;
    text-align: center;

    @media (min-width: 160ch) {
      padding-inline: var(--tray-size);
    }
  }

  .comments__subscribers {
    max-inline-size: var(--comment-max);
    padding-inline: calc(var(--comment-padding-block) + var(--inline-space-double));
  }

  .comment {
    margin-inline: auto;
    max-inline-size: var(--comment-max);
    position: relative;

    house-md-toolbar {
      margin-block-start: calc(var(--comment-padding-block) * -0.5);
    }

    .house-md-content {
      padding: var(--comment-padding-block) 0 0;
    }
  }

  .comment__author {
    .comment--system & strong {
      display: none;
    }

    .btn {
      font-weight: inherit;
    }
  }

  .comment__avatar {
    margin: calc(var(--comment-padding-block) * 0.75) calc(var(--comment-padding-inline) * -0.75);
    z-index: 0;

    .comment--mine_ & {
      margin-inline: calc(var(--comment-padding-inline) * -0.75);
    }

    .comment--system & {
      display: none;
    }
  }

  .comment__body {
    .comment--system & {
      text-align: center;
    }

    * {
      &:first-child {
        margin-block-start: 0;
      }

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

  .comment__content {
    --btn-icon-size: 1.2rem;
    --btn-size: var(--reaction-size);

    background-color: var(--color-ink-lightest);
    border-radius: 0.2em;
    padding:
      var(--comment-padding-block)
      var(--comment-padding-inline)
      calc(var(--comment-padding-block) * 1.5)
      var(--comment-padding-inline);
    word-wrap: break-word;
  }

  .comment__edit {
    .comment:not(.comment--mine) & {
      display: none;
    }
  }

  .comment__reaction {
    opacity: 0.66;

    @media (any-hover: hover) {
      .comment:not(:hover) & {
        opacity: 0;
      }
    }

    .comment--mine & {
      display: none;
    }
  }

  .comment--system {
    --comment-padding-block: var(--block-space-half);

    max-inline-size: var(--comment-max);
    text-align: center;


    &::before {
      /* Make up space for lack of avatar */
      content: "";
      display: flex;
      inline-size: calc(var(--comment-padding-inline) * 0.75);
    }

    .comment__author {
      a {
        margin: 0 auto;
      }
    }

    .comment__body {
      text-align: center !important;
    }

    .comment__content {
      background-image: repeating-linear-gradient(
        45deg in srgb,
        var(--color-canvas) 0 1px,
        var(--color-ink-lightest) 1px 10px
      );
    }

    .reactions,
    .quick-reaction {
      display: none !important;
    }
  }
}
