/*
  评论区容器 — Artalk 评论组件外层包装。

  Artalk 自带 light/dark 主题样式（.atk-* 类，跟着 partials/comments/
  artalk.html 注入的 Artalk.css 一起加载）。深浅主题在 init 时根据
  :root[data-theme] 决定，后续切换由 MutationObserver 调 setDarkMode
  同步——这里 CSS 不需要再写一遍。

  本文件只保留容器尺寸 + h2 排版，跟面包屑 .meta 同宽（71rem max +
  1.5rem 横向 margin）。
*/

.section--comments {
  --comment-accent: var(--c-frame-text-link, #006da0);
  --comment-bg: var(--c-bg-2, #f4f0f2);
  --comment-field-bg: var(--c-bg-1, #f9f6f8);
  --comment-input-bg: #fff;
  --comment-border: var(--c-shadow-3, #bab5b8);
  --comment-border-soft: var(--c-shadow-2, #d5d0d3);
  --comment-control-text: var(--c-text-normal, #18272d);

  max-width: 71rem;
  margin: 2.5rem 1.5rem;
  padding: 1.6rem 1.8rem;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  background: var(--comment-bg);
  border: 1px solid var(--comment-border);
  box-shadow: 0 0.8rem 2.2rem rgba(17, 24, 28, 0.12);
}

.section--comments > h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 2rem;
  line-height: 2.4rem;
  font-family: 'ibm plex sans condensed', 'helvetica neue', Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  word-spacing: 0.09em;
  margin: 0 0 1.5rem;
  padding-top: 0.28rem;
  padding-bottom: 0.72rem;
}

.section--comments > h2 .comments__count {
  margin-left: 0;
  font-size: 1em;
  line-height: inherit;
  font-weight: 600;
  opacity: 1;
}

#Comments {
  --at-color-main: var(--comment-accent);
  --at-color-border: var(--comment-border);
  --at-color-bg: var(--comment-bg);
  --at-color-bg-grey: var(--comment-field-bg);
  --at-color-font: var(--comment-control-text);

  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}

.section--comments .atk-main-editor {
  padding: 1rem !important;
  border: 1px solid var(--comment-border) !important;
  border-radius: 6px;
  background: var(--comment-field-bg) !important;
  box-shadow: none !important;
  overflow: hidden;
}

.section--comments .atk-main-editor:focus-within {
  border-color: var(--comment-accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--comment-accent) 18%, transparent) !important;
}

.section--comments .atk-header {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1rem !important;
}

.section--comments .comment-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.25rem;
}

.section--comments .comment-field__label {
  min-width: 2.7em;
  color: var(--c-text-low, #43565f);
  font-size: 1.6rem;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

.section--comments .comment-field__required,
.section--comments .comment-field__optional {
  justify-self: start;
  margin-right: 0.55rem;
  font-size: 1.45rem;
  line-height: 1;
  user-select: none;
}

.section--comments .comment-field__required {
  color: var(--comment-accent);
}

.section--comments .comment-field__optional {
  color: var(--c-text-extralow, #5b717b);
  font-weight: 400;
}

.section--comments .atk-header > input,
.section--comments .atk-header > .comment-field {
  min-width: 0;
}

.section--comments .comment-field__hidden-input {
  display: none !important;
}

.section--comments .atk-header input::placeholder {
  color: transparent;
}

.section--comments .atk-header input,
.section--comments .atk-textarea,
.section--comments .atk-editor textarea {
  width: 100%;
  border: 1px solid var(--comment-border-soft) !important;
  border-radius: 4px;
  background: var(--comment-input-bg) !important;
  color: var(--comment-control-text);
  box-sizing: border-box;
  box-shadow: none !important;
}

.section--comments .atk-header input:-webkit-autofill {
  -webkit-text-fill-color: var(--comment-control-text);
  box-shadow: 0 0 0 1000px var(--comment-input-bg) inset !important;
}

.section--comments .atk-header input {
  min-height: 3.8rem;
  padding: 0.65rem 0.85rem !important;
}

.section--comments .atk-textarea,
.section--comments .atk-editor textarea {
  min-height: 11rem;
  padding: 1rem 1.15rem !important;
  resize: vertical;
}

.section--comments .atk-header input:focus,
.section--comments .atk-textarea:focus,
.section--comments .atk-editor textarea:focus {
  border-color: var(--comment-accent) !important;
  box-shadow: inset 0 0 0 1px var(--comment-accent) !important;
  outline: none;
}

.section--comments .atk-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 0.8rem !important;
  border-top: 1px solid var(--comment-border-soft);
}

.section--comments .atk-plug-panel,
.section--comments .atk-plug-btn,
.section--comments .atk-state-wrap,
.section--comments .atk-item {
  color: var(--c-text-extralow, #5b717b) !important;
}

.section--comments .atk-captcha,
.section--comments .atk-checker {
  background: var(--comment-input-bg) !important;
  border-color: var(--comment-border-soft) !important;
  color: var(--comment-control-text) !important;
}

.section--comments .atk-send-btn {
  margin-left: auto;
  min-width: 10rem;
  min-height: 3.8rem;
  padding: 0.65rem 1.4rem !important;
  border: 0 !important;
  border-radius: 4px;
  background: var(--comment-accent) !important;
  color: var(--c-text-contrast, #fff) !important;
  box-shadow: none !important;
}

.section--comments .atk-send-btn:hover,
.section--comments .atk-send-btn:focus {
  filter: brightness(0.94);
  outline: none;
}

.section--comments .atk-list-header {
  display: flex !important;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 1.8rem !important;
  padding-top: 1.1rem !important;
  border-top: 1px solid var(--comment-border-soft);
  font-family: 'ibm plex sans condensed', 'helvetica neue', Arial, sans-serif;
  font-size: 2rem !important;
  line-height: 2.4rem !important;
  font-weight: 600;
}

.section--comments .atk-comment-count,
.section--comments .atk-list-header {
  color: var(--c-text-normal, #18272d) !important;
}

.section--comments .atk-comment-count {
  font-size: 1em !important;
  line-height: inherit !important;
  font-weight: 600 !important;
  font-variant-numeric: tabular-nums;
}

.section--comments .atk-list-header .atk-comment-count,
.section--comments .atk-list-header .atk-comment-count * {
  font-size: 1em !important;
  line-height: inherit !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section--comments {
    --comment-accent: var(--c-frame-text-link, #00a9f7);
    --comment-bg: #1d1d1d;
    --comment-field-bg: #212121;
    --comment-input-bg: #171717;
    --comment-border: #4c4c4c;
    --comment-border-soft: #3a3839;
    --comment-control-text: #dde2e3;
    box-shadow: 0 0.8rem 2.2rem rgba(0, 0, 0, 0.32);
  }
}

:root[data-theme="dark"] .section--comments {
  --comment-accent: var(--c-frame-text-link, #00a9f7);
  --comment-bg: #1d1d1d;
  --comment-field-bg: #212121;
  --comment-input-bg: #171717;
  --comment-border: #4c4c4c;
  --comment-border-soft: #3a3839;
  --comment-control-text: #dde2e3;
  box-shadow: 0 0.8rem 2.2rem rgba(0, 0, 0, 0.32);
}

@media (max-width: 39em) {
  .section--comments {
    margin: 2rem 1rem;
    padding: 1.2rem;
  }

  .section--comments .atk-header {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
}
