/* Reader comments on blog posts and Learn articles.
   Uses the shared `--sx-*` design tokens so it tracks light/dark automatically
   and sits cleanly at the end of the article column. */

.pc {
  margin: 48px 0 8px;
  padding-top: 32px;
  border-top: 1px solid var(--sx-line, #e5e7eb);
}

.pc-header {
  margin-bottom: 20px;
}

.pc-heading {
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 4px;
  color: var(--sx-text, #111827);
}

.pc-sub {
  margin: 0;
  font-size: 14px;
}

.pc .muted {
  color: var(--sx-text-3, #6b7280);
}

/* ---- compose / inline forms ------------------------------------------- */

.pc-form,
.pc-inline-form {
  margin-bottom: 24px;
}

.pc-inline-form {
  margin: 12px 0 4px;
}

.pc-field {
  display: block;
}

.pc-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--sx-text-2, #374151);
}

.pc-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 84px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--sx-text, #111827);
  background: var(--sx-surface, #fff);
  border: 1px solid var(--sx-line, #d1d5db);
  border-radius: var(--sx-r-md, 10px);
}

.pc-textarea:focus {
  outline: none;
  border-color: var(--sx-accent, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sx-accent, #4f46e5) 22%, transparent);
}

.pc-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.pc-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--sx-text-3, #6b7280);
  min-height: 1em;
}

.pc-status--error {
  color: var(--sx-danger, #dc2626);
}

.pc-signin {
  margin: 0 0 24px;
  font-size: 15px;
}

.pc-signin a {
  color: var(--sx-accent, #4f46e5);
  font-weight: 600;
}

/* ---- comment list ------------------------------------------------------ */

.pc-list,
.pc-replies {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pc-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pc-empty {
  color: var(--sx-text-3, #6b7280);
  font-size: 15px;
  padding: 8px 0;
}

.pc-item {
  scroll-margin-top: 90px;
}

/* Replies indent under their parent with a guide rail. */
.pc-replies {
  margin: 16px 0 0 14px;
  padding-left: 18px;
  border-left: 2px solid var(--sx-line-2, #eef0f3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pc-replies[hidden] {
  display: none;
}

.pc-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pc-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--sx-accent, #4f46e5);
}

.pc-item--reply .pc-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.pc-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}

.pc-author {
  font-weight: 600;
  color: var(--sx-text, #111827);
}

.pc-dot {
  color: var(--sx-text-3, #9ca3af);
}

.pc-time {
  color: var(--sx-text-3, #6b7280);
}

.pc-flag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pc-flag--edited {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  padding: 0;
  color: var(--sx-text-3, #9ca3af);
}

.pc-flag--pending {
  color: var(--sx-warn, #b45309);
  background: color-mix(in srgb, var(--sx-warn, #b45309) 14%, transparent);
}

.pc-flag--hidden {
  color: var(--sx-text-3, #6b7280);
  background: var(--sx-surface-2, #f3f4f6);
}

.pc-flag--reported {
  color: var(--sx-danger, #dc2626);
  background: color-mix(in srgb, var(--sx-danger, #dc2626) 12%, transparent);
}

.pc-body {
  margin: 8px 0 0 44px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--sx-text, #111827);
  white-space: pre-wrap;   /* keep author line breaks; body is autoescaped */
  overflow-wrap: anywhere;
}

.pc-item--reply .pc-body {
  margin-left: 38px;
}

.pc-body--removed {
  margin-left: 0;
  color: var(--sx-text-3, #6b7280);
  font-style: italic;
}

.pc-item--removed > .pc-body--removed {
  padding: 4px 0;
}

.pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 0 44px;
}

.pc-item--reply .pc-actions {
  margin-left: 38px;
}

.pc-act {
  appearance: none;
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--sx-r-sm, 6px);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--sx-text-2, #4b5563);
  cursor: pointer;
}

.pc-act:hover {
  background: var(--sx-surface-2, #f3f4f6);
  color: var(--sx-text, #111827);
}

.pc-act--danger:hover {
  color: var(--sx-danger, #dc2626);
}

.pc-act--mod {
  color: var(--sx-accent, #4f46e5);
}

/* The inline reply/edit form sits inside the item, aligned to the body. */
.pc-item > .pc-inline-form {
  margin-left: 44px;
}

.pc-item--reply > .pc-inline-form {
  margin-left: 38px;
}

@media (max-width: 640px) {
  .pc-body,
  .pc-actions,
  .pc-item > .pc-inline-form {
    margin-left: 0;
  }
  .pc-replies {
    margin-left: 6px;
    padding-left: 12px;
  }
}
