.comment-module {
  --comment-text: #202024;
  --comment-muted: #929197;
  --comment-line: rgba(25, 23, 33, .08);
  --comment-input: var(--oonite-composer-day-surface);
  --comment-input-focus: var(--oonite-composer-day-surface);
  --comment-field-placeholder: var(--oonite-composer-day-placeholder);
  --comment-accent: #6547ff;
  color: var(--comment-text);
}

.comment-app-prompt { display:grid; gap:10px; padding:18px 0 8px; text-align:center; }
.comment-app-open { display:block; padding:13px 16px; border-radius:999px; background:#6547ff; color:#fff; font-weight:700; text-decoration:none; }

body.night-mode .comment-module {
  --comment-text: #f5f4f8;
  --comment-muted: #918f9d;
  --comment-line: rgba(255, 255, 255, .09);
  --comment-input: #24232a;
  --comment-input-focus: #2e2c35;
  --comment-field-placeholder: #aeabb6;
  --comment-accent: #a995ff;
}

.comment-module .article-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 7px 8px 7px 15px;
  border: 0;
  border-radius: 24px;
  background: var(--comment-input);
}

.comment-module .article-comment-form:focus-within {
  background: var(--comment-input-focus);
  box-shadow: none;
}

.comment-module .article-comment-form textarea {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-height: 38px;
  max-height: 112px;
  padding: 9px 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--comment-text);
  font-size: 16px;
  line-height: 20px;
}

.comment-module .article-comment-form textarea::placeholder {
  color: var(--comment-field-placeholder);
  opacity: 1;
}

.comment-module .article-comment-form button[type="submit"],
body.day-mode .comment-module .article-comment-form button[type="submit"],
body.night-mode .comment-module .article-comment-form button[type="submit"] {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  min-width: 58px;
  height: 44px;
  min-height: 44px;
  justify-self: end;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--comment-accent);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.comment-module .article-comment-form .form-note {
  grid-column: 1 / -1;
  grid-row: auto;
  margin: 0 5px 4px;
  color: var(--comment-muted);
  font-size: 11px;
}

.comment-module .article-comment-signin {
  min-height: 40px;
  margin: 0 0 14px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--comment-accent);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 13px;
}

.comment-module .article-comment-list,
.comment-module .moment-comment-list {
  display: grid;
  gap: 0;
  margin: 0;
  border: 0;
}

.comment-module .comment-thread {
  display: block;
  margin: 0;
  padding: 0;
  border-bottom:0;
}

.comment-module .comment-thread:last-child {
  border-bottom: 0;
}

.comment-module .comment-thread.is-pending {
  opacity: .72;
}

.comment-module .comment-thread.is-pending .comment-meta > small {
  color: var(--comment-accent);
  -webkit-text-fill-color: var(--comment-accent);
  font-weight: 700;
}

.comment-module .comment-thread-replies {
  display: grid;
  gap: 0;
  margin: -2px 0 4px;
}

.comment-module .article-comment,
.comment-module .moment-comment,
.comment-module .article-comment.is-publisher,
.comment-module .moment-comment.is-publisher {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  margin: 0;
  padding: 10px 0 8px;
  border: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent;
  color: var(--comment-text);
  box-sizing: border-box;
}

.comment-module .comment-avatar,
.comment-module .comment-avatar-link,
body.moment-route .comment-module .moment-comment .comment-avatar {
  display: block;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: #ededf0;
  object-fit: cover;
}

.comment-module .comment-copy {
  min-width: 0;
}

.comment-module .article-comment header,
.comment-module .moment-comment header,
.comment-module .article-comment .comment-reply-heading {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  margin: 0;
}

.comment-module .comment-name-link,
.comment-module .article-comment header strong,
.comment-module .comment-reply-to {
  color: var(--comment-muted);
  -webkit-text-fill-color: var(--comment-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.comment-module .comment-reply-to .comment-profile-link:first-child {
  color: var(--comment-text);
  -webkit-text-fill-color: var(--comment-text);
  font-weight: 700;
}

.comment-module .article-comment .comment-author-name::after {
  content: "Author";
  min-height: 17px;
  padding: 1px 6px;
  border-color: rgba(101, 71, 255, .22);
  background: rgba(101, 71, 255, .08);
  color: var(--comment-accent);
  -webkit-text-fill-color: var(--comment-accent);
  font-size: 8px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.comment-module .article-comment > .comment-copy > p,
.comment-module .moment-comment > .comment-copy > p {
  margin: 2px 0 0;
  color: var(--comment-text);
  -webkit-text-fill-color: var(--comment-text);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.comment-module .comment-meta {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.comment-module .comment-meta > small {
  color: var(--comment-muted);
  -webkit-text-fill-color: var(--comment-muted);
  font-size: 11px;
  line-height: 20px;
}

.comment-module .comment-actions {
  display: flex;
  min-height: 20px;
  align-items: center;
  margin: 0;
}

.comment-module .comment-reply-button,
body.night-mode .comment-module .comment-reply-button {
  min-height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  color: var(--comment-text);
  -webkit-text-fill-color: var(--comment-text);
  font-size: 11px;
  font-weight: 700;
}

.comment-module .comment-reply-button:hover,
.comment-module .comment-reply-button:focus-visible {
  background: var(--comment-input);
}

.comment-module .article-comment.is-reply,
.comment-module .moment-comment.is-reply {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  width: calc(100% - 44px);
  margin-left: 44px;
  padding: 6px 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
}

.comment-module .article-comment.is-reply .comment-avatar,
.comment-module .article-comment.is-reply .comment-avatar-link,
body.moment-route .comment-module .moment-comment.is-reply .comment-avatar {
  width: 28px;
  height: 28px;
}

.comment-module .article-comment.is-reply > .comment-copy > p,
.comment-module .moment-comment.is-reply > .comment-copy > p {
  margin-top: 1px;
  font-size: 14px;
  line-height: 1.42;
}

.comment-module .comment-reply,
.comment-module .comment-load-error,
.comment-module .moment-comments-empty,
.comment-module > .muted,
.comment-module .article-comment-list > .muted {
  color: var(--comment-muted);
}

.comment-module .comment-load-error {
  display:grid;
  justify-items:start;
  gap:10px;
  padding:16px 0;
}

.comment-module .comment-load-error p {
  margin:0;
}

.comment-module .comment-load-error button {
  min-height:44px;
  padding:10px 16px;
}

@media (max-width: 560px) {
  .comment-module .article-comment,
  .comment-module .moment-comment,
  .comment-module .article-comment.is-publisher,
  .comment-module .moment-comment.is-publisher {
    padding: 9px 0 7px;
  }

  .comment-module .article-comment.is-reply,
  .comment-module .moment-comment.is-reply {
    width: calc(100% - 40px);
    margin-left: 40px;
  }
}

/* One composer grid for Article, Moment, Night Card and Nearby. The old
   three-column compact override put send outside the declared two columns. */
body .comment-module .article-comment-form {
  display:grid;
  grid-template-columns:minmax(0,1fr) 44px;
  align-items:end;
  gap:6px 10px;
  width:100%;
  min-width:0;
  height:auto;
  min-height:72px;
  max-height:none;
  box-sizing:border-box;
}
body .comment-module .article-comment-form textarea {
  grid-column:1;
  grid-row:1 / span 2;
  align-self:stretch;
  width:100%;
  min-width:0;
  height:auto;
  min-height:56px;
  max-height:140px;
  padding:8px 0;
  overflow-y:auto;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  field-sizing:content;
  font-size:16px;
  line-height:22px;
  border:0;
  outline:0;
  background:transparent;
  color:var(--comment-text);
  caret-color:currentColor;
  box-shadow:none;
}
body .comment-module .article-comment-form textarea:focus { outline:0;box-shadow:none; }
body .comment-module .article-comment-form textarea::placeholder { color:var(--comment-field-placeholder); }
body .comment-module .article-comment-form .char-counter {
  grid-column:1;
  grid-row:3;
  justify-self:end;
  margin:0 5px 2px;
  font-size:11px;
  color:var(--comment-muted);
}
body.day-mode .comment-module .article-comment-form button[type="submit"],
body.night-mode .comment-module .article-comment-form button[type="submit"] {
  grid-column:2;
  grid-row:2;
  align-self:end;
  box-shadow:none;
}
.nearby-reply-comment-module .article-comment-form { margin:0; }
.nearby-reply-comment-module .form-note { grid-column:1 / -1; }

/* Moment authors need the same calm comment surface as everyone else. The
   shared Night Card layer used to tint owner comments purple in night mode,
   which reads like an active selection instead of ordinary conversation. */
body.night-mode.moment-route .comment-module.moment-comments .article-comment.is-publisher {
  background:transparent;
}

/* A notification can take someone directly to a comment or reply. Give that
   destination a quiet, temporary marker so the jump is immediately legible. */
@keyframes comment-interaction-target {
  0%, 72% {
    background:color-mix(in srgb, var(--comment-accent) 14%, transparent);
    box-shadow:0 0 0 5px color-mix(in srgb, var(--comment-accent) 10%, transparent);
  }
  100% {
    background:transparent;
    box-shadow:0 0 0 0 transparent;
  }
}

.comment-module .article-comment.is-interaction-target,
.comment-module .moment-comment.is-interaction-target {
  border-radius:12px;
  animation:comment-interaction-target 3.1s ease-out both;
}

@media (prefers-reduced-motion:reduce) {
  .comment-module .article-comment.is-interaction-target,
  .comment-module .moment-comment.is-interaction-target {
    animation:none;
    background:color-mix(in srgb, var(--comment-accent) 12%, transparent);
    box-shadow:0 0 0 3px color-mix(in srgb, var(--comment-accent) 10%, transparent);
  }

  body.night-mode.moment-route .comment-module.moment-comments .article-comment.is-publisher.is-interaction-target {
    background:color-mix(in srgb, var(--comment-accent) 12%, transparent);
    box-shadow:0 0 0 3px color-mix(in srgb, var(--comment-accent) 10%, transparent);
  }
}

/* All reply-capable composers share the same in-field mention and controls. */
body.day-mode .comment-module .article-comment-form > .comment-reply-cancel:not([hidden]),
body.night-mode .comment-module .article-comment-form > .comment-reply-cancel:not([hidden]) {
  grid-column:2;
  grid-row:1;
  justify-self:end;
  display:grid;
  place-items:center;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  margin:0;
  padding:0;
  border:0;
  border-radius:50%;
  background:transparent;
  color:var(--comment-muted);
  -webkit-text-fill-color:var(--comment-muted);
  box-shadow:none;
}
.comment-module .article-comment-form > .comment-reply-cancel[hidden] { display:none; }
.comment-module .article-comment-form > .comment-reply-cancel svg { width:18px;height:18px; }
.comment-module .article-comment-form.nearby-reply-form textarea {
  min-height:56px;
  height:auto;
  max-height:140px;
  font-size:16px;
  line-height:22px;
  field-sizing:content;
}
.comment-module .article-comment-form.nearby-reply-form .form-note:empty { display:none; }

/* Post keeps a visible input surface in its floating reply footer. */
body .post-detail-page > .nearby-reply-comment-module .nearby-reply-form {
  grid-template-columns:minmax(0,1fr) 44px;
  align-items:center;
  gap:4px 6px;
  min-height:0;
  padding:5px 6px 5px 14px;
}
.post-detail-page > .nearby-reply-comment-module .nearby-reply-form:has(> .comment-reply-cancel:not([hidden])) {
  grid-template-columns:minmax(0,1fr) 44px 44px;
}
body .post-detail-page > .nearby-reply-comment-module .nearby-reply-form > textarea {
  grid-row:1;
  align-self:center;
  box-sizing:border-box;
  min-height:44px;
  height:44px;
  padding:11px 0;
  field-sizing:fixed;
}
.post-detail-page > .comment-module.nearby-reply-comment-module .nearby-reply-form > button[type="submit"] {
  grid-column:-2;
  grid-row:1;
  align-self:center;
}
.post-detail-page > .nearby-reply-comment-module .nearby-reply-form > .char-counter {
  grid-row:2;
}
.post-detail-page .nearby-reply-form:not(:focus-within):has(> textarea:placeholder-shown) > .char-counter {
  display:none;
}

/* Give the existing page scroller room to lift in-flow discussion composers. */
body.oonite-keyboard-visible [data-comment-form]:focus-within {
  scroll-margin-bottom:var(--oonite-visual-bottom-inset,0px);
}
body.oonite-keyboard-visible .comment-module:has([data-comment-form]:focus-within)::after {
  content:"";
  display:block;
  block-size:var(--oonite-visual-bottom-inset,0px);
}

.comment-module :is(.article-comment, .moment-comment) > .comment-copy > p,
.comment-module :is(.article-comment, .moment-comment).is-reply > .comment-copy > p {
  font-size:var(--oonite-reading-size);
  line-height:var(--oonite-reading-leading);
}
