/* ============================================================================
   Comments — "letters to the editor"
   Extends the blogfor.net editorial system (vars live in site.css). Reader
   correspondence set like journal letters: serif voices, mono signals, oxblood
   accents, hairline rules that echo the post index. Light + dark via the vars.
   ========================================================================== */

.comments {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* section header, matching .section-label / .eyebrow */
.comments-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 1.5rem;
}
.comments-title .count { color: var(--muted); }

/* ---- the thread: hairline-ruled letters ---- */
.comment-list { list-style: none; padding: 0; margin: 0 0 2.5rem; }
.comment-list li {
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--border);
}
.comment-list li:first-child { border-top: 1px solid var(--border); }
.comment-list li.empty {
  border: 0;
  padding: 0.25rem 0 1.5rem;
  color: var(--muted);
  font-style: italic;
}

.c-head {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}
.comment-list .who {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.comment-list .c-date {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.comment-list .pending-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.16rem 0.5rem;
  border-radius: 2px;
}
.comment-list .body {
  white-space: pre-wrap;
  color: var(--fg);
  line-height: 1.62;
}
.cf-quote {
  margin: 0 0 0.5rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
  font-size: 0.95em;
}

/* ---- highlight-to-comment: marks, badges, margin notes ---- */
.cx-mark {
  background: var(--accent-soft);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.05em;
}
.cx-badge {
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1;
  vertical-align: super;
  margin-left: 1px;
  min-width: 1.1em;
  padding: 0.1em 0.3em;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.cx-note {
  margin: 0.6rem 0 0.9rem;
  padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 3px 3px 0;
}
.cx-note .cx-c + .cx-c { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.cx-note .who { font-family: var(--serif-display); font-weight: 600; }
.cx-note .body { white-space: pre-wrap; margin-top: 0.15rem; color: var(--fg); }

/* selection popover */
.cx-pop {
  position: absolute;
  transform: translateX(-50%);
  z-index: 50;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 3px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* inline composer for a highlighted passage */
.cx-form {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 60;
  width: min(92vw, 34rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.cx-form .cf-row { display: flex; gap: 0.6rem; }
.cx-form input, .cx-form textarea {
  width: 100%; font-family: var(--serif-body); font-size: 0.95rem; color: var(--fg);
  background: transparent; border: 1px solid var(--border); border-radius: 3px; padding: 0.5rem 0.6rem;
}
.cx-form textarea { resize: vertical; }
.cx-form input:focus, .cx-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cx-form .cf-actions { display: flex; align-items: center; gap: 0.8rem; }
.cx-send {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--bg); background: var(--accent); border: 1px solid var(--accent); border-radius: 3px;
  padding: 0.5rem 1rem; cursor: pointer;
}
.cx-send:hover { background: transparent; color: var(--accent); }
.cx-cancel {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); background: none; border: 0; cursor: pointer;
}

/* ---- leave a note ---- */
.comment-form { display: flex; flex-direction: column; gap: 0.85rem; }
.cf-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin: 0 0 0.1rem;
}
.comment-form .cf-row { display: flex; gap: 0.85rem; }
.comment-form input,
.comment-form textarea {
  width: 100%;
  font-family: var(--serif-body);
  font-size: 0.98rem;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.62rem 0.72rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.comment-form textarea { resize: vertical; min-height: 5.5rem; line-height: 1.6; }
.comment-form input::placeholder,
.comment-form textarea::placeholder { color: var(--muted); opacity: 0.85; }
.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-form button {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.62rem 1.3rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.comment-form button:hover { background: transparent; color: var(--accent); }
.comment-form button:active { transform: translateY(1px); }

.cf-status {
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.cf-status.is-error { color: var(--accent); }

/* honeypot stays in the DOM but off-screen for humans */
.cf-hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

/* gentle reveal as the thread populates (reuses the site's `rise` keyframe) */
@media (prefers-reduced-motion: no-preference) {
  .comment-list li { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
}

@media (max-width: 34rem) {
  .comment-form .cf-row { flex-direction: column; }
}
