/* Comments under a blog post (comments_section in build.sh). Paper page
   "Planning · Comments", draft C.
   All in lower case, like the rest of the site, except readers' names and
   words, which keep the case they were typed in. */
.comments {
  text-transform: lowercase;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.comments-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
}
.comments-count,
.comment-meta > :not(.comment-name),
.comment-label span {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
  line-height: 22px;
}
.comments-status {
  color: var(--muted);
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comment > p:not(.comment-meta) + p {
  margin-top: 8px; /* with the 4px gap, 12px between paragraphs */
}
.comment > p:not(.comment-meta) {
  white-space: pre-line;
  text-transform: none;
}
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
}
.comment-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  text-transform: none;
}
/* Eric's replies sit on the rule the yearbook quote on About uses. */
.comment.eric {
  margin-left: 24px;
  padding-left: 20px;
  border-left: 2px solid var(--link-rule);
}
/* The reader's own comment after a send, until Eric has read it. */
.comment.waiting :is(.comment-name, p) {
  color: var(--muted);
}
/* After a send, api/comments.mjs comes back to #comment-sent, which takes the
   form's place; "leave another" goes to #comment-form, which brings it back.
   Paper page "Audit · Comments · after sending", A and C. */
.comment-sent {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding-top: 20px;
}
.comment-sent:target {
  display: flex;
}
.comment-sent:target ~ .comment-form {
  display: none;
}
.comment-sent p + p {
  margin-top: 8px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 20px;
}
.comment-form-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comment-form-head p {
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.comment-fields {
  display: flex;
  gap: 24px;
}
.comment-fields > * {
  flex: 1;
  min-width: 0;
}
.comment-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comment-field label,
.comment-form button {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
}
.comment-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
/* Fields on slip paper, underlined like the page-number field. 16px text,
   so an iPhone doesn't zoom in on focus. */
.comment-field :is(input, textarea) {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid var(--muted);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font: 16px / 25px var(--font-body);
  appearance: none;
}
.comment-field textarea {
  display: block;
  height: 140px;
  min-height: 140px;
  padding-block: 8px;
  resize: vertical;
}
.comment-field :is(input, textarea):hover {
  border-bottom-color: var(--ink);
}
/* Focus is the line turning 2px red, instead of the usual ring; so is a
   field the browser refused once the reader has tried to send. */
.comment-field :is(input, textarea):is(:focus-visible, :user-invalid) {
  border-bottom-color: var(--accent);
  outline: none;
  box-shadow: 0 1px 0 var(--accent);
}
.comment-trap {
  display: none;
}
.comment-form button {
  align-self: flex-start;
  height: 44px;
  padding: 0 22px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.comment-form button:hover {
  text-decoration: underline 1.5px var(--accent);
  text-underline-offset: 5px;
}
@media (max-width: 599px) {
  .comment.eric {
    margin-left: 14px;
    padding-left: 16px;
  }
  .comment-fields {
    flex-direction: column;
    gap: 20px;
  }
  .comment-field input {
    height: 44px;
  }
  .comment-form button {
    align-self: stretch;
  }
}
