/* ChippeX News community UI. Kept independent from the article renderer so a
   comments outage can never alter the approved Reader content or typography. */

.news-community {
  width: min(100%, 780px);
  margin: clamp(52px, 7vw, 82px) auto 0;
  padding-top: clamp(30px, 4vw, 42px);
  border-top: 1px solid rgba(196, 167, 111, .24);
  color: var(--news-ivory, #f0ebdf);
  font-family: var(--news-sans, Manrope, Arial, sans-serif);
}

.news-community__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.news-community__heading h2 {
  margin: 0;
  color: inherit;
  font: 400 clamp(1.65rem, 3vw, 2.15rem)/1.12 var(--news-serif, Georgia, serif);
}

.news-community__count {
  color: var(--news-gold, #c4a76f);
  font: 600 .66rem/1 var(--news-mono, monospace);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.news-community__moderation-note {
  margin: 0 0 28px;
  color: rgba(240, 235, 223, .55);
  font-size: .84rem;
  line-height: 1.6;
}

.news-community__state {
  margin: 0;
  padding: 18px 0;
  color: rgba(240, 235, 223, .55);
  font-size: .86rem;
  line-height: 1.55;
}

.news-community__state.is-error { color: #d9b9a1; }

.news-community__retry,
.news-community-submit,
.news-comment__like,
.news-tip-modal__close {
  cursor: pointer;
}

.news-community__retry {
  min-height: 40px;
  margin-top: 10px;
  padding: 8px 14px;
  color: var(--news-gold, #c4a76f);
  border: 1px solid rgba(196, 167, 111, .32);
  border-radius: 999px;
  background: transparent;
  font: 600 .7rem/1 var(--news-sans, sans-serif);
}

.news-community__list {
  display: grid;
  margin: 0 0 34px;
  padding: 0;
  gap: 16px;
  list-style: none;
}

.news-comment {
  display: grid;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(196, 167, 111, .19);
  border-radius: 15px;
  background: rgba(255, 255, 255, .018);
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
}

.news-comment__avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(216, 185, 126, .35);
  border-radius: 50%;
  color: #f4ead4;
  background: #322819;
  font: 700 .72rem/1 var(--news-sans, sans-serif);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.news-comment__avatar.is-tone-1 { background: #25332f; }
.news-comment__avatar.is-tone-2 { background: #2e293b; }
.news-comment__avatar.is-tone-3 { background: #3a2924; }
.news-comment__avatar.is-tone-4 { background: #23313b; }
.news-comment__avatar.is-tone-5 { background: #343021; }

.news-comment__content { min-width: 0; }
.news-comment__meta {
  display: flex;
  min-width: 0;
  margin-bottom: 7px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
}
.news-comment__nickname {
  overflow-wrap: anywhere;
  color: var(--news-ivory, #f0ebdf);
  font-size: .9rem;
  font-weight: 700;
}
.news-comment__time {
  color: rgba(240, 235, 223, .38);
  font: 500 .61rem/1.35 var(--news-mono, monospace);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.news-comment__editorial {
  padding: 4px 7px;
  color: #e4c98f;
  border: 1px solid rgba(216, 185, 126, .32);
  border-radius: 999px;
  font: 700 .56rem/1 var(--news-mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.news-comment__body {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: rgba(240, 235, 223, .78);
  font-size: .9rem;
  line-height: 1.65;
}
.news-comment__like {
  display: inline-flex;
  min-width: 50px;
  min-height: 40px;
  padding: 7px 9px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(240, 235, 223, .52);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font: 600 .72rem/1 var(--news-sans, sans-serif);
}
.news-comment__actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}
.news-comment__like-status {
  max-width: 120px;
  color: #d9b9a1;
  font-size: .62rem;
  line-height: 1.35;
  text-align: right;
}
.news-comment__like:hover,
.news-comment__like.is-liked {
  color: var(--news-gold, #c4a76f);
  border-color: rgba(196, 167, 111, .25);
  background: rgba(196, 167, 111, .05);
}
.news-comment__like[disabled] { cursor: wait; opacity: .62; }

.news-community-form {
  display: grid;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid rgba(196, 167, 111, .25);
  border-radius: 16px;
  background: rgba(196, 167, 111, .035);
  gap: 10px;
}
.news-community-form label,
.news-tip-form label {
  color: rgba(240, 235, 223, .66);
  font: 700 .63rem/1.3 var(--news-mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.news-community-form input,
.news-community-form textarea,
.news-tip-form input,
.news-tip-form textarea {
  width: 100%;
  min-width: 0;
  color: var(--news-ivory, #f0ebdf);
  border: 1px solid rgba(240, 235, 223, .16);
  border-radius: 10px;
  outline: 0;
  background: rgba(4, 4, 3, .48);
  font: 400 .9rem/1.55 var(--news-sans, sans-serif);
}
.news-community-form input,
.news-tip-form input { min-height: 46px; padding: 10px 13px; }
.news-community-form textarea,
.news-tip-form textarea { padding: 12px 13px; resize: vertical; }
.news-community-form input:focus,
.news-community-form textarea:focus,
.news-tip-form input:focus,
.news-tip-form textarea:focus {
  border-color: rgba(216, 185, 126, .62);
  box-shadow: 0 0 0 3px rgba(216, 185, 126, .08);
}
.news-community-form__status,
.news-tip-form__status {
  min-height: 1.5em;
  color: rgba(240, 235, 223, .58);
  font-size: .78rem;
  line-height: 1.5;
}
.news-community-form__status.is-error,
.news-tip-form__status.is-error { color: #d9b9a1; }
.news-community-form__status.is-success,
.news-tip-form__status.is-success { color: #b7cca0; }
.news-community-submit {
  justify-self: start;
  min-height: 44px;
  padding: 11px 18px;
  color: #120e08;
  border: 1px solid #d8b97e;
  border-radius: 999px;
  background: #d8b97e;
  font: 700 .72rem/1 var(--news-sans, sans-serif);
  letter-spacing: .04em;
}
.news-community-submit:hover { background: #e4c98f; }
.news-community-submit[disabled] { cursor: wait; opacity: .62; }

.news-community-honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.news-tip-modal[hidden] { display: none; }
.news-tip-modal {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: 24px;
  place-items: center;
  background: rgba(3, 3, 2, .82);
  backdrop-filter: blur(12px);
}
body.news-community-modal-open { overflow: hidden; }
.news-tip-modal__dialog {
  position: relative;
  width: min(100%, 620px);
  padding: clamp(24px, 5vw, 42px);
  color: var(--news-ivory, #f0ebdf);
  border: 1px solid rgba(196, 167, 111, .32);
  border-radius: 18px;
  outline: 0;
  background: #100f0c;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .46);
  font-family: var(--news-sans, Manrope, sans-serif);
}
.news-tip-modal__eyebrow {
  margin-bottom: 12px;
  color: var(--news-gold, #c4a76f);
  font: 700 .62rem/1 var(--news-mono, monospace);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.news-tip-modal__dialog h2 {
  margin: 0 0 10px;
  color: inherit;
  font: 400 clamp(1.8rem, 4vw, 2.45rem)/1.08 var(--news-serif, Georgia, serif);
}
.news-tip-modal__dialog > p {
  margin: 0 0 26px;
  max-width: 52ch;
  color: rgba(240, 235, 223, .58);
  font-size: .88rem;
  line-height: 1.6;
}
.news-tip-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 36px;
  padding: 7px 10px;
  color: rgba(240, 235, 223, .58);
  border: 1px solid rgba(240, 235, 223, .14);
  border-radius: 999px;
  background: transparent;
  font: 600 .62rem/1 var(--news-sans, sans-serif);
}
.news-tip-modal__close:hover { color: var(--news-gold, #c4a76f); }
.news-tip-form { display: grid; gap: 10px; }

.news-community button:focus-visible,
.news-community input:focus-visible,
.news-community textarea:focus-visible,
.news-tip-modal button:focus-visible,
.news-tip-modal input:focus-visible,
.news-tip-modal textarea:focus-visible {
  outline: 2px solid var(--news-gold, #c4a76f);
  outline-offset: 3px;
}

html[data-theme="light"] .news-community,
body.light-mode .news-community { color: #201a13; }
html[data-theme="light"] .news-community__moderation-note,
html[data-theme="light"] .news-community__state,
html[data-theme="light"] .news-comment__body,
body.light-mode .news-community__moderation-note,
body.light-mode .news-community__state,
body.light-mode .news-comment__body { color: rgba(32, 26, 19, .65); }
html[data-theme="light"] .news-comment,
html[data-theme="light"] .news-community-form,
body.light-mode .news-comment,
body.light-mode .news-community-form { background: rgba(255, 255, 255, .36); }
html[data-theme="light"] .news-comment__nickname,
body.light-mode .news-comment__nickname { color: #201a13; }
html[data-theme="light"] .news-community-form input,
html[data-theme="light"] .news-community-form textarea,
body.light-mode .news-community-form input,
body.light-mode .news-community-form textarea { color: #201a13; background: rgba(255, 255, 255, .52); }

@media (max-width: 600px) {
  .news-community { margin-top: 48px; }
  .news-community__heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .news-comment { grid-template-columns: 38px minmax(0, 1fr); padding: 15px; }
  .news-comment__avatar { width: 38px; height: 38px; }
  .news-comment__actions { grid-column: 2; justify-items: start; margin-top: 3px; }
  .news-comment__like-status { max-width: none; text-align: left; }
  .news-community-form { padding: 18px; }
  .news-community-submit { width: 100%; justify-self: stretch; }
  .news-tip-modal { padding: 12px; place-items: start center; }
  .news-tip-modal__dialog { margin-top: 18px; padding: 26px 18px 22px; }
  .news-tip-modal__close { top: 12px; right: 12px; }
  .news-tip-modal__dialog h2 { padding-right: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .news-community *,
  .news-tip-modal * { transition-duration: .01ms !important; }
}
