/* Article comments — compact, flat, collapsible */

.comments-section {
  margin-top: var(--space-8);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.comments-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 0;
  border: none;
  background: none;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}

.comments-toggle:hover {
  color: var(--accent);
}

.comments-toggle-arrow {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s, color 0.2s;
}

.comments-toggle:hover .comments-toggle-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.comments-panel {
  padding: 4px 0 0;
}

.comments-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
}

.comments-head h2 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.comments-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.comments-gate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 0 12px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.google-btn--compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.google-btn--compact svg {
  width: 14px;
  height: 14px;
}

.google-btn--compact:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.comments-compose {
  margin-bottom: 14px;
}

.comments-compose-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.comments-compose-row textarea,
.comment-reply-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 80px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 8px 12px;
  outline: none;
  line-height: 1.45;
  transition: max-height 0.2s, border-color 0.2s;
}

.comments-compose-row textarea.comments-input--expanded,
.comment-reply-form textarea.comments-input--expanded {
  max-height: 160px;
}

.comments-compose-row textarea:focus,
.comment-reply-form textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.comments-submit {
  flex: 0 0 auto;
  align-self: flex-end;
  border: none;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0708;
  font-weight: 600;
  font-size: 12px;
  transition: opacity 0.2s;
}

.comments-submit:hover { opacity: 0.9; }
.comments-submit:disabled { opacity: 0.45; cursor: default; }

.comments-empty {
  font-size: var(--text-sm);
  color: var(--muted);
  padding: 6px 0 10px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  background: none;
}

.comment:last-child {
  border-bottom: none;
}

.comment.reply {
  margin-left: clamp(12px, 3vw, 28px);
  padding-left: 12px;
  border-left: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-bottom: none;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* Comments mount inside <article class="post">, so chat.css's blanket
   "article.post img { width:100% !important }" article-image rule would otherwise
   blow avatars up to full width. Re-assert avatar sizing with matching weight. */
.comment-meta img,
article.post .comment-meta img {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0;
  display: block;
  margin: 0;
}

.comment-meta .avatar-fallback {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0708;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-author {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.comment-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
}

.comment-body {
  font-size: var(--text-sm);
  color: var(--text2);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.comment-body.removed {
  font-style: italic;
  color: var(--muted);
}

.comment-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.comment-actions button {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}

.comment-actions button:hover { color: var(--accent); }

.comment-reply-form {
  margin-top: 8px;
}

.comments-error {
  font-size: var(--text-xs);
  color: #f38ba0;
  margin-top: 6px;
}

.comments-replies {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 2px;
}

.article-save-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}
.article-save-btn {
  appearance: none;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.18));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text2, inherit);
  font: inherit;
  font-size: var(--text-sm, 0.85rem);
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.article-save-btn:hover {
  border-color: var(--accent, #00e8db);
  color: var(--accent, #00e8db);
}
.article-save-btn.is-saved {
  border-color: var(--accent, #00e8db);
  background: color-mix(in srgb, var(--accent, #00e8db) 14%, transparent);
  color: var(--accent, #00e8db);
}
.article-save-btn:disabled { opacity: 0.6; cursor: wait; }
.article-save-hint {
  font-size: 0.78rem;
  color: var(--muted, #94a3b8);
}
.comment-author {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.comment-author a,
.comment-author-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.comment-author a:hover,
.comment-author-link:hover { text-decoration: underline; }
.comment-handle {
  font-size: 0.78em;
  font-weight: 500;
  color: var(--muted, #94a3b8);
  text-decoration: none;
}
.comment-handle:hover { color: var(--accent, #38bdf8); text-decoration: underline; }
.comment-mention {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}
.comment-mention:hover { text-decoration: underline; }

.mention-dropdown {
  position: absolute;
  z-index: 80;
  max-height: 240px;
  overflow-y: auto;
  background: #12161c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 4px;
}

.mention-empty {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted, #94a3b8);
}

.mention-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text, #e8eef7);
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.mention-option:hover,
.mention-option.is-active {
  background: rgba(56, 189, 248, 0.12);
}

.mention-option-av {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
}

.mention-option-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mention-option-av .avatar-fallback {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #94a3b8);
}

.mention-option-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mention-option-handle {
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
}

.mention-option-name {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .comments-compose-row {
    flex-direction: column;
    align-items: stretch;
  }

  .comments-submit {
    align-self: flex-end;
  }

  .comment.reply { margin-left: 12px; }
}
