/**
 * Korean news portal community UI.
 * WordPress still owns the data, moderation and threaded reply behavior.
 */

.kmag-community {
  --community-ink: #111318;
  --community-copy: #3f434b;
  --community-muted: #626873;
  --community-line: #dfe2e7;
  --community-soft: #f5f6f8;
  --community-accent: var(--kmag-accent, #b4183d);
  --community-blue: #24569b;
  position: relative;
  max-width: 860px;
  margin-top: clamp(68px, 8vw, 112px);
  color: var(--community-ink);
  font-family: var(--kmag-sans, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif);
}

.kmag-community::before {
  display: block;
  width: 100%;
  height: 4px;
  margin-bottom: 31px;
  background: linear-gradient(90deg, var(--community-ink) 0 72%, var(--community-accent) 72% 100%);
  content: "";
}

.kmag-community .comments-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 34px;
  align-items: end;
  margin-bottom: 25px;
}

.comments-header__main { min-width: 0; }

.comments-header__eyebrow {
  display: flex;
  margin: 0 0 10px;
  color: var(--community-muted);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  align-items: center;
  gap: 10px;
}

.comments-header__eyebrow > span {
  color: var(--community-accent);
  font-size: .9rem;
  font-weight: 850;
  letter-spacing: .17em;
}

.comments-header__eyebrow > span::after {
  display: inline-block;
  width: 1px;
  height: 11px;
  margin-left: 10px;
  background: #cfd2d8;
  content: "";
  vertical-align: -1px;
}

.comments-header__title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.kmag-community .comments-title {
  margin: 0;
  color: var(--community-ink);
  font-family: var(--kmag-serif, "Noto Serif KR", "Batang", Georgia, serif);
  font-size: clamp(2.6rem, 4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1.25;
  word-break: keep-all;
}

.comments-header__total {
  color: var(--community-accent);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kmag-community .comments-guidance {
  max-width: 650px;
  margin: 13px 0 0;
  color: var(--community-copy);
  font-size: 1.22rem;
  line-height: 1.85;
  word-break: keep-all;
}

.comments-header__stats {
  display: flex;
  overflow: hidden;
  min-width: 206px;
  border: 1px solid var(--community-line);
  border-radius: 8px;
  background: #fff;
}

.community-stat {
  display: flex;
  min-width: 102px;
  padding: 16px 13px 14px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.community-stat + .community-stat { border-left: 1px solid var(--community-line); }
.community-stat strong { font-size: 1.9rem; font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1; }
.community-stat span { margin-top: 6px; color: var(--community-muted); font-size: .98rem; white-space: nowrap; }
.community-stat--primary strong { color: var(--community-accent); }

.community-guidelines {
  overflow: hidden;
  margin: 0 0 43px;
  border: 1px solid #dbe1e9;
  border-radius: 8px;
  background: #f7f9fc;
}

.community-guidelines summary {
  display: flex;
  min-height: 68px;
  padding: 13px 18px;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.community-guidelines summary::-webkit-details-marker { display: none; }

.community-guidelines__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid #d9e0ea;
  border-radius: 50%;
  background: #fff;
  color: var(--community-blue);
  place-items: center;
}

.community-guidelines summary > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.community-guidelines summary strong { font-size: 1.16rem; line-height: 1.45; }
.community-guidelines summary small { margin-top: 2px; color: var(--community-muted); font-size: .98rem; }
.community-guidelines__toggle { position: relative; width: 22px; height: 22px; margin-left: auto; flex: 0 0 22px; }
.community-guidelines__toggle::before,
.community-guidelines__toggle::after { position: absolute; top: 10px; left: 5px; width: 12px; height: 1.5px; border-radius: 2px; background: var(--community-ink); content: ""; transition: transform .2s ease; }
.community-guidelines__toggle::after { transform: rotate(90deg); }
.community-guidelines[open] .community-guidelines__toggle::after { transform: rotate(0); }
.community-guidelines[open] summary { border-bottom: 1px solid #dfe4eb; }
.community-guidelines__body { padding: 20px 22px; background: #fff; }
.community-guidelines__body ul { display: grid; margin: 0; padding: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 23px; list-style: none; }
.community-guidelines__body li { position: relative; padding-left: 13px; }
.community-guidelines__body li::before { position: absolute; top: 8px; left: 0; width: 4px; height: 4px; border-radius: 50%; background: var(--community-blue); content: ""; }
.community-guidelines__body li strong,
.community-guidelines__body li span { display: block; }
.community-guidelines__body li strong { margin-bottom: 5px; font-size: 1.08rem; }
.community-guidelines__body li span { color: var(--community-copy); font-size: 1rem; line-height: 1.7; word-break: keep-all; }
.community-guidelines__body > p { margin: 18px 0 0; padding-top: 15px; border-top: 1px solid #eceef1; color: var(--community-muted); font-size: .98rem; line-height: 1.65; }
.community-guidelines__body > p a { margin-left: 5px; color: var(--community-blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.comments-toolbar {
  display: flex;
  min-height: 56px;
  margin-bottom: 13px;
  padding: 0 2px 12px;
  border-bottom: 2px solid var(--community-ink);
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.comments-thread-heading { display: flex; min-width: 0; align-items: center; gap: 12px; }
.comments-thread-heading h3 { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.025em; }
.comments-thread-heading h3 span { margin-left: 3px; color: var(--community-accent); font-size: 1.2rem; }
.comments-thread-heading__status { display: inline-flex; color: var(--community-muted); font-size: .95rem; align-items: center; gap: 6px; }
.comments-thread-heading__status i { width: 6px; height: 6px; border-radius: 50%; background: #219768; box-shadow: 0 0 0 3px rgba(33, 151, 104, .1); }

.comments-sort {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #d8dbe1;
  border-radius: 6px;
  background: #fff;
}

.comments-sort a {
  display: inline-flex;
  min-width: 70px;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--community-muted);
  font-size: .98rem;
  font-weight: 650;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.comments-sort a + a { border-left: 1px solid #d8dbe1; }
.comments-sort a:hover { color: var(--community-ink); }
.comments-sort a.is-active { background: var(--community-ink); color: #fff; }
.comments-sort a:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--community-accent); outline-offset: -2px; }

.kmag-community .comment-list,
.kmag-community .comment-list .children { margin: 0; padding: 0; list-style: none; }
.kmag-community .comment-list .children { position: relative; margin: 0 0 0 52px; }
.kmag-community .comment-list .children::before { position: absolute; top: 0; bottom: 15px; left: -27px; width: 1px; background: #d9dde3; content: ""; }
.kmag-community .comment-item { position: relative; margin: 0; list-style: none; }

.kmag-community .comment-body {
  position: relative;
  margin: 0 0 12px;
  padding: 20px 21px 18px;
  border: 1px solid var(--community-line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(26, 31, 40, .035);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.kmag-community .comment-body:hover { border-color: #cdd1d8; box-shadow: 0 6px 19px rgba(26, 31, 40, .065); }
.kmag-community .children .comment-body { background: #fafbfc; }
.kmag-community .children .comment-body::before { position: absolute; top: 27px; left: -24px; width: 17px; height: 11px; border-bottom: 1px solid #d9dde3; border-left: 1px solid #d9dde3; border-bottom-left-radius: 7px; content: ""; }
.kmag-community .comment-meta { display: flex; align-items: center; }
.kmag-community .comment-avatar { overflow: hidden; width: 46px; height: 46px; margin-right: 12px; flex: 0 0 46px; border: 1px solid #d9dde3; border-radius: 50%; background: var(--community-soft); }
.kmag-community .comment-avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.kmag-community .comment-meta__text { display: flex; min-width: 0; flex-direction: column; }
.kmag-community .comment-author { color: var(--community-ink); font-size: 1.15rem; font-weight: 760; line-height: 1.45; }
.kmag-community .comment-author a { color: inherit; text-decoration: none; }
.kmag-community .comment-author-badge { display: inline-flex; margin-left: 7px; padding: 2px 7px; border-radius: 3px; background: var(--community-accent); color: #fff; font-size: .82rem; font-weight: 750; vertical-align: 2px; }
.kmag-community .comment-time { margin-top: 2px; color: #666c76; font-size: 1.05rem; text-decoration: none; }
.kmag-community .comment-time:hover { color: var(--community-accent); text-decoration: underline; text-underline-offset: 3px; }
.kmag-community .comment-content { margin: 14px 0 0 58px; color: #30343a; font-size: 1.42rem; line-height: 1.82; word-break: break-word; }
.kmag-community .comment-content p { margin-top: 0; }
.kmag-community .comment-content p:last-child { margin-bottom: 0; }
.kmag-community .comment-actions { display: flex; margin: 14px 0 0 58px; align-items: center; gap: 4px; }
.kmag-community .comment-actions a { display: inline-flex; min-height: 36px; padding: 6px 9px; border: 0; border-radius: 4px; color: #555b65; font-size: 1.08rem; font-weight: 650; align-items: center; text-decoration: none; }
.kmag-community .comment-actions a + a,
.kmag-community .comment-actions span + a { margin-left: 2px; }
.kmag-community .comment-actions a:hover { background: #f0f2f5; color: var(--community-accent); }
.kmag-community .comment-actions a::before { margin-right: 5px; color: #989da5; font-size: .85em; content: "↳"; }
.kmag-community .comment-actions .comment-edit-link a::before { content: "✎"; }
.kmag-community .comment-actions .comment-report-link::before { content: "!"; font-weight: 850; }
.kmag-community .comment-awaiting-moderation { margin: 14px 0 0 58px; padding: 10px 12px; border: 1px solid #ead79a; border-radius: 5px; background: #fff9e8; color: #725b17; font-size: 1rem; }
.kmag-community .comment-item--pingback .comment-body { padding: 14px 17px; background: var(--community-soft); }
.kmag-community .comment-navigation .nav-links { display: flex; margin: 19px 0; justify-content: space-between; gap: 12px; }
.kmag-community .comment-navigation a { display: inline-flex; padding: 8px 13px; border: 1px solid var(--community-line); border-radius: 5px; color: var(--community-copy); font-size: 1rem; font-weight: 700; text-decoration: none; }
.kmag-community .comment-navigation a:hover { border-color: var(--community-accent); color: var(--community-accent); }

.kmag-community .no-comments-yet {
  display: flex;
  margin-bottom: 34px;
  padding: 25px 27px;
  border: 1px dashed #cbd0d8;
  border-radius: 8px;
  background: #fafbfc;
  align-items: center;
  gap: 17px;
}

.no-comments-yet__icon { color: var(--community-accent); }
.no-comments-yet strong { display: block; margin-bottom: 4px; font-family: var(--kmag-serif, "Noto Serif KR", "Batang", Georgia, serif); font-size: 1.5rem; }
.no-comments-yet p { margin: 0; color: var(--community-muted); font-size: 1.05rem; }

.kmag-community .community-compose {
  position: relative;
  overflow: hidden;
  margin-top: 49px;
  padding: 30px 31px;
  border: 1px solid #d8dbe1;
  border-top: 3px solid var(--community-ink);
  border-radius: 8px;
  background: #f7f8fa;
  box-shadow: 0 12px 32px rgba(23, 25, 31, .055);
}

.kmag-community .community-compose::after { position: absolute; top: 0; right: 0; width: 88px; height: 3px; background: var(--community-accent); content: ""; }
.community-compose__heading { position: relative; display: flex; margin-bottom: 22px; align-items: flex-start; gap: 12px; }
.community-compose__pen { display: grid; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--community-ink); color: #fff; place-items: center; }
.community-compose__heading > div { min-width: 0; }
.community-compose__heading p { margin: 0 0 3px; color: var(--community-accent); font-size: .85rem; font-weight: 850; letter-spacing: .16em; }
.kmag-community .comment-reply-title { display: inline; margin: 0; color: var(--community-ink); font-family: var(--kmag-serif, "Noto Serif KR", "Batang", Georgia, serif); font-size: clamp(2rem, 3vw, 2.55rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.3; }
.community-compose__heading > div > span { display: block; margin-top: 4px; color: var(--community-muted); font-size: 1.02rem; }
.kmag-community .cancel-reply { margin-left: 10px; }
.kmag-community .cancel-reply a { color: var(--community-accent); font-family: var(--kmag-sans, sans-serif); font-size: .93rem; font-weight: 700; }
.kmag-community .comment-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
.kmag-community .comment-form > p { margin: 0 0 15px; }
.kmag-community .comment-form .comment-notes,
.kmag-community .comment-form .comment-form-comment,
.kmag-community .comment-form .comment-form-cookies-consent,
.kmag-community .comment-form .community-compose__policy,
.kmag-community .comment-form .form-submit,
.kmag-community .comment-form .logged-in-as,
.kmag-community .comment-form .must-log-in { grid-column: 1 / -1; }

.kmag-community .comment-notes {
  display: flex;
  margin: 0 0 18px;
  padding: 12px 13px;
  border: 1px solid #e0e3e8;
  border-radius: 6px;
  background: #fff;
  color: var(--community-muted);
  font-size: .98rem;
  line-height: 1.55;
  align-items: flex-start;
  gap: 9px;
}

.kmag-community .comment-notes > span { display: grid; width: 18px; height: 18px; margin-top: 1px; flex: 0 0 18px; border: 1px solid #aeb3bb; border-radius: 50%; color: #737982; font-family: Georgia, serif; font-size: .87rem; font-weight: 700; place-items: center; }
.kmag-community .comment-notes p { margin: 0; }
.kmag-community .comment-notes strong { display: block; margin-bottom: 2px; color: var(--community-copy); font-size: 1rem; }
.kmag-community .logged-in-as,
.kmag-community .must-log-in { color: var(--community-muted); font-size: 1rem; }
.kmag-community .logged-in-as a,
.kmag-community .must-log-in a { color: var(--community-accent); font-weight: 700; }
.kmag-community .comment-form label { display: flex; margin: 0 0 7px; color: var(--community-ink); font-size: 1.05rem; font-weight: 750; align-items: center; }
.kmag-community .comment-form label .required { margin-left: 3px; color: var(--community-accent); }
.kmag-community .comment-form label small { margin-left: auto; color: var(--community-muted); font-size: .92rem; font-weight: 500; }
.kmag-community .comment-form input[type="text"],
.kmag-community .comment-form input[type="email"],
.kmag-community .comment-form input[type="url"],
.kmag-community .comment-form textarea { width: 100%; min-height: 47px; padding: 12px 13px; border: 1px solid #cfd3da; border-radius: 5px; outline: 0; background: #fff; color: var(--community-ink); font: inherit; transition: border-color .17s ease, box-shadow .17s ease; }
.kmag-community .comment-form textarea { min-height: 158px; padding: 14px; line-height: 1.75; resize: vertical; }
.kmag-community .comment-form input::placeholder,
.kmag-community .comment-form textarea::placeholder { color: #9ca1aa; opacity: 1; }
.kmag-community .comment-form input:focus,
.kmag-community .comment-form textarea:focus { border-color: var(--community-accent); box-shadow: 0 0 0 3px rgba(180, 24, 61, .11); }
.kmag-community .comment-form-comment { position: relative; }
.kmag-community .comment-character-counter { position: absolute; right: 10px; bottom: 10px; padding: 3px 6px; border-radius: 3px; background: rgba(255,255,255,.92); color: var(--community-muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.kmag-community .comment-character-counter.is-near-limit { color: #9b4c00; font-weight: 700; }
.kmag-community .comment-character-counter.is-at-limit { color: #b42318; font-weight: 800; }
.kmag-community .comment-form-cookies-consent { display: flex; padding: 2px 0; align-items: flex-start; gap: 9px; }
.kmag-community .comment-form-cookies-consent input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--community-accent); }
.kmag-community .comment-form-cookies-consent label { margin: 0; color: var(--community-copy); font-size: .98rem; font-weight: 500; line-height: 1.6; }
.kmag-community .community-compose__policy { color: var(--community-muted); font-size: .93rem; line-height: 1.6; }
.kmag-community .form-submit { display: flex; margin-top: 3px !important; align-items: center; gap: 13px; }
.kmag-community .comment-form input.comment-submit { min-height: 48px; padding: 11px 25px; border: 0; border-radius: 5px; background: var(--community-ink); color: #fff; font-weight: 760; cursor: pointer; box-shadow: 0 6px 15px rgba(17, 19, 24, .14); transition: background .17s ease, transform .17s ease; }
.kmag-community .comment-form input.comment-submit:hover { background: var(--community-accent); transform: translateY(-1px); }
.kmag-community .comment-form input.comment-submit:focus-visible { outline: 3px solid rgba(180, 24, 61, .25); outline-offset: 3px; }
.kmag-community .submit-assurance { color: var(--community-muted); font-size: .93rem; }

.kmag-community .comments-closed { display: flex; margin-top: 35px; padding: 21px 23px; border: 1px solid var(--community-line); border-radius: 7px; background: var(--community-soft); flex-direction: column; }
.kmag-community .comments-closed strong { margin-bottom: 4px; font-family: var(--kmag-serif, "Noto Serif KR", "Batang", Georgia, serif); font-size: 1.4rem; }
.kmag-community .comments-closed span { color: var(--community-muted); font-size: 1rem; }

@media (max-width: 720px) {
  .kmag-community { margin-top: 62px; }
  .kmag-community::before { margin-bottom: 25px; }
  .kmag-community .comments-header { grid-template-columns: 1fr; gap: 20px; align-items: stretch; }
  .kmag-community .comments-title { font-size: clamp(2.45rem, 8.8vw, 3.1rem); }
  .comments-header__stats { width: 100%; min-width: 0; }
  .community-stat { min-width: 0; flex: 1; }
  .community-guidelines { margin-bottom: 35px; }
  .community-guidelines summary { padding: 13px 14px; }
  .community-guidelines__body { padding: 17px; }
  .community-guidelines__body ul { grid-template-columns: 1fr; gap: 14px; }
  .comments-toolbar { min-height: 0; align-items: stretch; flex-direction: column; gap: 12px; }
  .comments-sort { align-self: flex-start; }
  .comments-sort a { min-height: 44px; padding-right: 16px; padding-left: 16px; font-size: 1.16rem; }
  .comments-thread-heading { justify-content: space-between; }
  .kmag-community .comment-list .children { margin-left: 20px; }
  .kmag-community .comment-list .children::before { left: -11px; }
  .kmag-community .children .comment-body::before { display: none; }
  .kmag-community .comment-body { padding: 17px 15px; }
  .kmag-community .comment-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .kmag-community .comment-content,
  .kmag-community .comment-actions,
  .kmag-community .comment-awaiting-moderation { margin-left: 0; }
  .kmag-community .comment-content { font-size: 1.46rem; }
  .kmag-community .comment-actions a { min-height: 44px; padding: 8px 10px; font-size: 1.15rem; }
  .kmag-community .community-compose { margin-right: -16px; margin-left: -16px; padding: 25px 16px; border-right: 0; border-left: 0; border-radius: 0; }
  .kmag-community .comment-form { display: block; }
  .community-compose__heading { gap: 10px; }
  .community-compose__pen { width: 38px; height: 38px; flex-basis: 38px; }
  .kmag-community .form-submit { align-items: flex-start; flex-direction: column; }
  .kmag-community .comment-form input.comment-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .kmag-community *,
  .kmag-community *::before,
  .kmag-community *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
