/* Adapted from blog-public comment presentation. */
.entry-comments {
  scroll-margin-top: 16px;
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}


.entry-comments .comments-head {
  margin-bottom: 18px;
}

.entry-comments .comments-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.14;
}

.entry-comments .comments-auth-prompt {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 16px;
}

.entry-comments .comment-form {
  display: grid;
  margin: 0 0 20px;
}

.entry-comments .comment-composer {
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.entry-comments .comment-composer[data-comment-form] {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.entry-comments .comment-composer-main,
.entry-comments .comment-content {
  min-width: 0;
}

.entry-comments .comment-composer-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.entry-comments .comment-composer-input:focus-within {
  border-color: #72c02c;
  box-shadow: 0 0 0 3px rgba(114, 192, 44, 0.2);
}

.entry-comments .comment-composer-input.is-invalid {
  border-color: #9f391b;
  box-shadow: 0 0 0 3px rgba(159, 57, 27, 0.16);
}

.entry-comments .comment-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: calc(1.45em * 5 + 18px);
  overflow-y: hidden;
  border: 0;
  border-radius: 12px 0 0 12px;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 10px 8px 10px 12px;
  resize: none;
}

.entry-comments .comment-composer textarea::placeholder {
  color: #7b847e;
}

.entry-comments .comment-composer textarea:focus {
  outline: 0;
}

.entry-comments .comment-composer-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  padding: 4px 4px 4px 0;
}

.entry-comments .comment-emoji-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  margin: 6px 0 0;
}

.entry-comments .comment-composer-status {
  min-height: 1.35em;
  margin: 4px 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.entry-comments .comment-composer-status:empty {
  min-height: 0;
  margin-top: 0;
}

.entry-comments .comment-composer-status[data-tone="error"] {
  color: #9f391b;
}

.entry-comments .comment-edit-form textarea {
  width: 100%;
  min-height: 44px;
  max-height: calc(1.45em * 5 + 20px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  padding: 10px 12px;
  resize: none;
}

.entry-comments .comment-edit-form textarea:focus {
  border-color: #72c02c;
  outline: 3px solid rgba(114, 192, 44, 0.28);
  outline-offset: 2px;
}

.entry-comments [hidden] {
  display: none;
}

.entry-comments .comments-status {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.entry-comments > .comments-status {
  margin: 0 0 18px;
}

.entry-comments .comments-login-action {
  text-decoration: none;
}

.entry-comments .comments-list {
  display: grid;
  gap: 0;
}

.entry-comments .comment {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.entry-comments .comment:last-child {
  border-bottom: 0;
}

.entry-comments .comment-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid #d5dfcf;
  border-radius: 999px;
  place-items: center;
  background: #edf2e9;
  color: #52604f;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.entry-comments .comment-composer-avatar {
  width: 40px;
  height: 40px;
}

.entry-comments .comment-avatar[data-tone="1"] { background: #eef4ff; color: #315a8a; }
.entry-comments .comment-avatar[data-tone="2"] { background: #fff1ec; color: #8a442d; }
.entry-comments .comment-avatar[data-tone="3"] { background: #f4efff; color: #60479a; }
.entry-comments .comment-avatar[data-tone="4"] { background: #fff7dd; color: #795d12; }
.entry-comments .comment-avatar[data-tone="5"] { background: #e9f6f3; color: #24695c; }

.entry-comments .comment-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.entry-comments .comment-avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.entry-comments .comment-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}

.entry-comments .comment-author {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-comments .comment-body {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  line-height: 1.55;
  white-space: pre-wrap;
}

.entry-comments .comment-actions,
.entry-comments .comment-controls,
.entry-comments .comment-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.entry-comments .comment-controls {
  justify-content: flex-end;
  align-items: center;
  margin-top: 8px;
}

.entry-comments .comment-reactions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
}

.entry-comments .comment-reaction-count {
  min-width: 1.25em;
  color: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.entry-comments .comment-actions,
.entry-comments .comment-edit-actions {
  justify-content: flex-end;
}

.entry-comments .comment-edit-form,
.entry-comments .comment-reply-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.entry-comments .comment-replies-block {
  margin-top: 2px;
}

.entry-comments .comment-replies {
  display: grid;
  margin-top: 2px;
  border-left: 2px solid #dfe5dc;
  padding-left: 14px;
}

.entry-comments .comment-replies .comment {
  padding: 14px 0;
}

.entry-comments .comment-more-replies {
  margin-top: 2px;
}

.entry-comments .comment-overflow {
  position: relative;
  flex: 0 0 auto;
}

.entry-comments .comment-overflow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 8;
  display: grid;
  gap: 2px;
  min-width: 136px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 4px;
  box-shadow: 0 12px 30px rgba(24, 32, 28, 0.16);
}

.entry-comments .comment-overflow-menu .comment-action {
  justify-content: flex-end;
  width: 100%;
}

.entry-comments .comments-more {
  margin-top: 14px;
}


.entry-comments .comments-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.entry-comments .comments-head h2 { margin: 0; }
.entry-comments .comments-head button { margin-left: auto; flex-shrink: 0; max-width: 60%; white-space: normal; }
.entry-comments .comments-auth-prompt { justify-content: flex-end; }
.entry-comments .comments-auth-prompt .comments-status { flex: 1 1 auto; }
.entry-comments .comments-more, .entry-comments .comments-retry, .entry-comments .comment-more-replies { display: flex; margin-left: auto; }
.entry-comments .comment-reply-cancel { justify-self: end; }
.entry-comments .comment-composer { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; }
.entry-comments .comment-composer[data-comment-form] { grid-template-columns: minmax(0, 1fr); gap: 0; }
.entry-comments .comment { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
.entry-comments .comment-avatar { width: 34px; height: 34px; }
.entry-comments .comment-replies { padding-left: 10px; }
.entry-comments .comment-date { color: var(--muted); font-size: .75rem; }
@media (min-width: 521px) {
  .entry-comments .comment { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
  .entry-comments .comment-avatar { width: 36px; height: 36px; }
  .entry-comments .comment-replies { padding-left: 14px; }
}
.entry-comments .comments-widget > .comments-status:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.entry-comments .comments-widget > .comments-status > span { flex: 1 1 auto; }
.entry-comments .comments-login-action { margin-left: auto; }
.entry-comments .comment-replies-toggle { display: flex; margin-left: auto; }

.entry-comments [hidden] { display: none; }
