/* Labun Hang Magazine: conversation-style comments.
   Scoped to .lh-comments. Uses the theme's own variables and fonts only. */

.lh-comments {
  --lh-c-card: #fff;
  --lh-c-reply: var(--lh-paper, #f6f8f7);
  --lh-c-line: var(--lh-outline, #dae4df);
  --lh-c-ink: var(--lh-ink, #182723);
  --lh-c-quiet: #4a5d54;
  --lh-c-accent: var(--lh-green, #28674b);
  --lh-c-accent-dark: var(--lh-green-dark, #184a37);
  --lh-c-pale: var(--lh-pale, #edf4ef);
  --lh-c-radius: 14px;
  --lh-c-radius-sm: 7px;
  --lh-c-pad: 20px 22px;
  --lh-c-avatar: 48px;
  --lh-c-avatar-reply: 40px;
  --lh-c-indent: 24px;
  margin-top: 55px;
  padding-top: 28px;
  border-top: 1px solid var(--lh-c-line);
  min-width: 0;
  max-width: 100%;
  font-family: var(--lh-ui-font);
  color: var(--lh-c-ink);
}
.lh-comments *,
.lh-comments *::before,
.lh-comments *::after { box-sizing: border-box; }

.lh-comments .screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Heading */
.lh-comments .lh-comments-head { margin: 0 0 22px; }
.lh-comments .lh-comments-head h2 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0;
}
.lh-comments .lh-comments-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px;
  background: var(--lh-c-pale); color: var(--lh-c-accent-dark);
  font: 700 14px/1 var(--lh-ui-font); letter-spacing: 0;
}
.lh-comments .lh-comments-empty,
.lh-comments .lh-comments-closed {
  margin: 0 0 8px; padding: 16px 18px; border: 1px dashed #c6d6cd; border-radius: var(--lh-c-radius);
  color: var(--lh-c-quiet); font-size: 15px; line-height: 1.6; background: var(--lh-c-reply);
}

/* Thread list */
.lh-comments .lh-comment-list,
.lh-comments .lh-comment-list .children {
  list-style: none; margin: 0; padding: 0;
}
.lh-comments .lh-comment-list { display: grid; gap: 16px; margin-bottom: 30px; }
.lh-comments .lh-comment-list > li,
.lh-comments .lh-comment-item {
  margin: 0; padding: 0; border: 0; list-style: none; min-width: 0;
}

/* Replies: one gentle indent with a thread line, then flat from the third level. */
.lh-comments .lh-comment-list .children {
  display: grid; gap: 12px;
  margin: 12px 0 0 calc(var(--lh-c-avatar) / 2 + 21px);
  padding: 0 0 0 var(--lh-c-indent);
  border-left: 2px solid var(--lh-c-line);
}
.lh-comments .lh-comment-list .children .children {
  margin-left: 0; padding-left: 0; border-left: 0;
}

/* Card */
.lh-comments .lh-comment-card {
  position: relative; min-width: 0; max-width: 100%;
  padding: var(--lh-c-pad);
  background: var(--lh-c-card);
  border: 1px solid var(--lh-c-line);
  border-radius: var(--lh-c-radius);
  box-shadow: 0 1px 2px rgba(24, 39, 35, .04), 0 6px 18px rgba(27, 47, 39, .035);
  font-size: inherit; line-height: inherit;
}
.lh-comments .lh-comment-item--reply > .lh-comment-card {
  background: var(--lh-c-reply);
  box-shadow: none;
  padding: 16px 18px;
}
.lh-comments .lh-comment-item--author > .lh-comment-card {
  background: var(--lh-c-pale);
  border-color: #c9ddd1;
}
.lh-comments .lh-comment-item:target > .lh-comment-card {
  border-color: var(--lh-c-accent);
  box-shadow: 0 0 0 2px rgba(40, 103, 75, .22);
}

/* Head: avatar, name, meta */
.lh-comments .lh-comment-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start;
  column-gap: 13px; margin: 0 0 12px; padding: 0; border: 0;
}
.lh-comments .lh-comment-who {
  display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0;
  min-height: var(--lh-c-avatar); font-weight: 400;
}
.lh-comments .lh-comment-item--reply > .lh-comment-card .lh-comment-who { min-height: var(--lh-c-avatar-reply); }
.lh-comments .lh-comment-name-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0;
}
.lh-comments .lh-comment-name {
  min-width: 0; font: 700 16px/1.35 var(--lh-ui-font); color: var(--lh-c-ink);
  overflow-wrap: anywhere;
}
.lh-comments .lh-comment-name a { color: inherit; text-decoration: none; }
.lh-comments .lh-comment-name a:hover { color: var(--lh-c-accent); text-decoration: underline; text-underline-offset: 3px; }
.lh-comments .lh-comment-badge {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 999px;
  background: var(--lh-c-accent); color: #fff;
  font: 700 11.5px/1 var(--lh-ui-font); letter-spacing: .04em; text-transform: uppercase;
}
.lh-comments .lh-comment-meta {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 2px 0;
  font-size: 13.5px; line-height: 1.5; color: var(--lh-c-quiet); margin: 0; min-width: 0;
}
.lh-comments .lh-comment-meta a { color: inherit; text-decoration: none; }
.lh-comments .lh-comment-meta a:hover { color: var(--lh-c-accent); text-decoration: underline; text-underline-offset: 3px; }
.lh-comments .lh-comment-date { flex: none; }
.lh-comments .lh-comment-replyto { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-comments .lh-comment-replyto::before { content: "\00B7"; margin: 0 7px; color: #8a9a92; }
.lh-comments .lh-comment-replyto a { font-weight: 600; color: var(--lh-c-accent-dark); }

/* Avatar: initials circle, profile picture laid over it when one exists. */
.lh-comments .lh-avatar {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--lh-c-avatar); height: var(--lh-c-avatar); border-radius: 50%; overflow: hidden;
  background: var(--lh-avatar-tone, var(--lh-c-accent)); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.lh-comments .lh-comment-item--reply > .lh-comment-card .lh-avatar {
  width: var(--lh-c-avatar-reply); height: var(--lh-c-avatar-reply);
}
.lh-comments .lh-avatar__initials {
  font: 700 16px/1 var(--lh-ui-font); letter-spacing: .02em; user-select: none;
}
.lh-comments .lh-comment-item--reply > .lh-comment-card .lh-avatar__initials { font-size: 14px; }
.lh-comments .lh-avatar img,
.lh-comments .lh-avatar .avatar {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  margin: 0; border: 0; border-radius: 50%; object-fit: cover; background: transparent;
}

/* Content: editorial serif, safe for long text, links and code. */
.lh-comments .lh-comment-content {
  min-width: 0; max-width: 100%;
  font-family: var(--lh-body-font); font-size: 17px; line-height: 1.68; color: #1f342a;
  overflow-wrap: anywhere; word-break: normal; hyphens: manual;
}
.lh-comments .lh-comment-content > :first-child { margin-top: 0; }
.lh-comments .lh-comment-content > :last-child { margin-bottom: 0; }
.lh-comments .lh-comment-content p { margin: 0 0 1.15em; }
.lh-comments .lh-comment-content a {
  color: #15593d; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.lh-comments .lh-comment-content ul,
.lh-comments .lh-comment-content ol { margin: 0 0 .85em; padding-left: 1.3em; }
.lh-comments .lh-comment-content blockquote {
  margin: 0 0 .85em; padding: 4px 0 4px 14px; border-left: 3px solid #c9ddd1; color: var(--lh-c-quiet);
}
.lh-comments .lh-comment-content img,
.lh-comments .lh-comment-content video,
.lh-comments .lh-comment-content iframe { max-width: 100%; height: auto; }
.lh-comments .lh-comment-content pre {
  max-width: 100%; overflow-x: auto; white-space: pre; padding: 12px 14px; border-radius: var(--lh-c-radius-sm);
  background: #f0f4f2; font-size: 14px; line-height: 1.55;
}
.lh-comments .lh-comment-content code { font-size: .88em; overflow-wrap: anywhere; }
.lh-comments .lh-comment-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }

.lh-comments .lh-comment-awaiting {
  margin: 0 0 10px; padding: 8px 12px; border-radius: var(--lh-c-radius-sm);
  background: #fff7e8; border: 1px solid #ecd7ad; color: #6b4b12; font-size: 14px; line-height: 1.5;
}

/* Actions */
.lh-comments .lh-comment-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin: 12px 0 0; padding: 0; border: 0; font-size: 14px;
}
.lh-comments .lh-comment-actions .reply { margin: 0; font-size: inherit; }
.lh-comments .comment-reply-link,
.lh-comments .lh-comment-edit a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px 6px 10px;
  margin-left: -10px; border-radius: var(--lh-c-radius-sm);
  font: 700 14px/1 var(--lh-ui-font); color: var(--lh-c-accent); text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.lh-comments .lh-comment-edit a { margin-left: 0; padding-left: 10px; color: var(--lh-c-quiet); font-weight: 600; }
.lh-comments .comment-reply-link svg { width: 16px; height: 16px; flex: none; }
.lh-comments .comment-reply-link:hover,
.lh-comments .lh-comment-edit a:hover { background: rgba(40, 103, 75, .09); color: var(--lh-c-accent-dark); }
.lh-comments .comment-reply-link:focus-visible,
.lh-comments .lh-comment-edit a:focus-visible,
.lh-comments .lh-comment-meta a:focus-visible,
.lh-comments .lh-comment-name a:focus-visible { outline: 3px solid #c0652e; outline-offset: 2px; }

/* Pingbacks and trackbacks: compact single line. */
.lh-comments .lh-comment-ping {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 14px;
  border: 1px solid var(--lh-c-line); border-radius: var(--lh-c-radius-sm); font-size: 14px; overflow-wrap: anywhere;
}
.lh-comments .lh-comment-ping__label { font-weight: 700; color: var(--lh-c-quiet); }

/* Pagination (when enabled in Settings > Discussion). */
.lh-comments .comments-pagination,
.lh-comments .lh-comments-pagination { margin: 0 0 30px; }
.lh-comments .nav-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lh-comments .nav-links .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--lh-c-line); border-radius: var(--lh-c-radius-sm);
  font-size: 14px; font-weight: 700; color: var(--lh-c-accent-dark); text-decoration: none; background: #fff;
}
.lh-comments .nav-links .page-numbers.current { background: var(--lh-c-accent); border-color: var(--lh-c-accent); color: #fff; }
.lh-comments .nav-links a.page-numbers:hover { background: var(--lh-c-pale); }

/* Form */
.lh-comments .comment-respond {
  margin-top: 28px; padding: 26px 28px;
  background: #fff; border: 1px solid var(--lh-c-line); border-radius: var(--lh-c-radius);
  box-shadow: 0 1px 2px rgba(24, 39, 35, .04), 0 10px 26px rgba(27, 47, 39, .045);
}
.lh-comments .lh-comment-card + .comment-respond,
.lh-comments .lh-comment-item .comment-respond { margin: 12px 0 0; background: #fbfcfb; box-shadow: none; }
.lh-comments .comment-reply-title {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin: 0 0 6px; font-family: var(--lh-body-font); font-weight: 700; font-size: 23px; line-height: 1.25;
  letter-spacing: -.02em; color: var(--lh-c-ink); overflow-wrap: anywhere;
}
.lh-comments .comment-reply-title small { margin: 0; font: 600 14px/1.3 var(--lh-ui-font); letter-spacing: 0; }
.lh-comments .comment-reply-title small a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; border-radius: var(--lh-c-radius-sm);
  border: 1px solid var(--lh-c-line); color: var(--lh-c-quiet); text-decoration: none; background: #fff;
}
.lh-comments .comment-reply-title small a:hover { color: var(--lh-c-accent-dark); border-color: #b9cfc2; }
.lh-comments .comment-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-items: start; margin: 14px 0 0;
}
.lh-comments .comment-form > * { min-width: 0; }
.lh-comments .comment-form p { margin: 0; }
.lh-comments .comment-form .comment-notes,
.lh-comments .comment-form .lh-comment-note,
.lh-comments .comment-form .logged-in-as,
.lh-comments .comment-form .comment-form-comment,
.lh-comments .comment-form .comment-form-url,
.lh-comments .comment-form .comment-form-cookies-consent,
.lh-comments .comment-form .form-submit { grid-column: 1 / -1; }
.lh-comments .lh-comment-note,
.lh-comments .logged-in-as { font-size: 14.5px; line-height: 1.6; color: var(--lh-c-quiet); }
.lh-comments .logged-in-as a { color: var(--lh-c-accent-dark); font-weight: 600; text-underline-offset: 3px; }
.lh-comments .comment-form label {
  display: block; margin: 0 0 7px; font-size: 14.5px; font-weight: 700; color: #244030;
}
.lh-comments .lh-required { color: #a64736; font-weight: 800; }
.lh-comments .comment-form textarea,
.lh-comments .comment-form input:not([type=checkbox]):not([type=submit]):not([type=hidden]) {
  display: block; width: 100%; max-width: 100%; min-height: 48px; margin: 0;
  padding: 12px 14px; border: 1px solid #bfd2c6; border-radius: var(--lh-c-radius-sm);
  background: #fbfcfb; color: #1f3529; font-size: 16px; line-height: 1.5; box-shadow: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.lh-comments .comment-form textarea {
  min-height: 150px; resize: vertical; font-family: var(--lh-body-font); font-size: 17px; line-height: 1.6;
}
.lh-comments .comment-form textarea::placeholder,
.lh-comments .comment-form input::placeholder { color: #6a7c72; opacity: 1; }
.lh-comments .comment-form textarea:hover,
.lh-comments .comment-form input:not([type=checkbox]):hover { border-color: #9fbcab; }
.lh-comments .comment-form textarea:focus,
.lh-comments .comment-form input:not([type=checkbox]):focus {
  outline: 2px solid var(--lh-c-accent); outline-offset: 1px; border-color: var(--lh-c-accent); background: #fff;
}
.lh-comments .comment-form-cookies-consent { display: flex; align-items: flex-start; gap: 10px; }
.lh-comments .comment-form-cookies-consent input {
  flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--lh-c-accent);
}
.lh-comments .comment-form-cookies-consent label { margin: 0; font-size: 14.5px; line-height: 1.55; font-weight: 500; color: var(--lh-c-quiet); }
.lh-comments .form-submit { margin: 2px 0 0; }
.lh-comments .lh-comment-submit {
  display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 48px;
  padding: 12px 26px; border: 0; border-radius: var(--lh-c-radius-sm);
  background: var(--lh-c-accent); color: #fff; font: 700 15.5px/1.2 var(--lh-ui-font); cursor: pointer;
  transition: background-color .15s ease;
}
.lh-comments .lh-comment-submit:hover { background: var(--lh-c-accent-dark); }
.lh-comments .lh-comment-submit:focus-visible { outline: 3px solid #c0652e; outline-offset: 3px; }

/* Tablet */
@media (max-width: 800px) {
  .lh-comments { margin-top: 44px; }
}

/* Phones: tighter cards, shallower thread, full-width touch controls. */
@media (max-width: 560px) {
  .lh-comments {
    --lh-c-pad: 16px 15px;
    --lh-c-avatar: 40px;
    --lh-c-avatar-reply: 34px;
    --lh-c-indent: 12px;
    margin-top: 32px; padding-top: 22px;
  }
  .lh-comments .lh-comments-head { margin-bottom: 16px; }
  .lh-comments .lh-comment-list { gap: 12px; }
  .lh-comments .lh-comment-list .children { margin-left: 8px; gap: 10px; margin-top: 10px; }
  .lh-comments .lh-comment-item--reply > .lh-comment-card { padding: 14px 13px; }
  .lh-comments .lh-comment-head { column-gap: 11px; margin-bottom: 10px; }
  .lh-comments .lh-comment-name { font-size: 15.5px; }
  .lh-comments .lh-comment-meta { font-size: 13px; flex-direction: column; align-items: flex-start; }
  .lh-comments .lh-comment-replyto { max-width: 100%; }
  .lh-comments .lh-comment-replyto::before { content: none; }
  .lh-comments .lh-avatar__initials { font-size: 14px; }
  .lh-comments .lh-comment-item--reply > .lh-comment-card .lh-avatar__initials { font-size: 12.5px; }
  .lh-comments .lh-comment-content { font-size: 16.5px; line-height: 1.66; }
  .lh-comments .comment-reply-link,
  .lh-comments .lh-comment-edit a { min-height: 44px; }
  .lh-comments .comment-respond { padding: 20px 16px; margin-top: 22px; }
  .lh-comments .comment-reply-title { font-size: 21px; }
  .lh-comments .comment-form { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .lh-comments .comment-form > * { grid-column: 1 / -1; }
  .lh-comments .lh-comment-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .lh-comments * { transition: none !important; }
}
