/* Discussions use shared typography; editing keeps the text in its inline flow. */
.comments:empty {
  margin-top: 0;
}
.comments + * {
  margin-top: var(--margin-meaning);
}
.comments .commentsPanel,
.commentsList:empty + form {
  margin-top: 0;
}
.comments button {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.comments button:hover:not(:disabled) {
  color: var(--hover-color);
}
.commentsToggle,
.comments .commentLike {
  text-decoration: underline dotted;
  text-underline-offset: 4rlh;
  text-decoration-thickness: 1.5px;
}
.comments .commentLike {
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.comments .commentLike[aria-pressed="true"] {
  text-decoration: none;
}
.comments .commentLike:disabled {
  cursor: default;
}
.comments .commentAuthor {
  background-color: var(--browser-color);
  color: inherit;
  /* Preserve the color on white and darken it over a private background. */
  mix-blend-mode: multiply;
}
.comments .commentAuthor.blogAuthor {
  background-color: var(--notification-color);
}
.comments .commentReplyTarget {
  white-space: nowrap;
  opacity: .5;
}
.comments .commentQuote {
  background-color: var(--box-color);
  color: inherit;
}
.comments .commentText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comments form {
  width: 100%;
  align-items: stretch;
}
.comments form > * + * {
  margin-top: 0;
}
.comments .commentError {
  margin-top: 16rlh;
  color: var(--hover-color);
}
.comments .commentInput {
  --comment-send-space: 22rlh;
  position: relative;
}
.comments .commentInput::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8rlh;
  height: 1px;
  background: var(--text-color);
}
.comments .commentComposer {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--paragraph-line-height);
  margin-block: var(--paragraph-top-compensator) var(--paragraph-bottom-compensator);
  padding: 0 var(--comment-send-space) 0 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}
.comments .commentComposer:empty::before,
.comments .commentComposer:has(> br:only-child)::before {
  content: attr(aria-placeholder);
  opacity: .2;
  pointer-events: none;
}
.comments .commentSend {
  position: absolute;
  right: 0;
  bottom: var(--paragraph-bottom-compensator);
}
.comments .commentSend:disabled {
  opacity: 0.5;
}

.comments .commentText[contenteditable] {
  outline: none;
}
.comments .commentEditControl {
  margin: 0;
}
.comments .commentInput > .commentEditControl {
  /* The external nonbreaking space reserves send width beside the last word,
     outside editable/submitted text. Detachment on long-word wrapping is an accepted limit. */
  word-spacing: var(--comment-send-space);
}
.comments .commentArrow {
  rotate: 45deg;
}

.comments .commentEdit {
  display: inline-block;
  color: black;
  vertical-align: baseline;
  line-height: 0;
}
.comments .commentEdit:hover {
  color: var(--hover-color);
}
.comments .commentEdit svg {
  display: block;
  color: inherit;
  width: 16rlh;
  height: 16rlh;
}

/* Counts retain text metrics; their background never changes line layout. */
.notificationCount {
  position: relative;
  isolation: isolate;
  white-space: nowrap;
}
.notificationCount::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: max(1.5em, calc(100% + .75em));
  height: 1.5em;
  border-radius: 1em;
  background: var(--notification-color);
  pointer-events: auto;
}
.commentNotificationTitle {
  margin-inline-end: .5em;
}
.commentsDivider {
  display: flex;
  align-items: center;
  gap: 10rlh;
  color: var(--text-color);
  opacity: 0.2;
  white-space: nowrap;
}
.commentsDividerLabel {
  translate: 0 -1rlh;
}
.commentsDivider::before,
.commentsDivider::after {
  content: "";
  flex: 1;
  border-top: 1px solid currentColor;
}
.comments .comment {
  scroll-margin-top: 100rlh;
}
