/* ============================================================
   Блок «Вопрос / Ответ» (Q&A с голосованием) — вариант 1c.
   Маршрут и статья. Токены — из style.css (терракота #C2410C,
   фон #FBFAF8, карточки #fff / бордер #E9E3D9). Шрифты Lora /
   Manrope / JetBrains Mono.
   ============================================================ */

.qa-section { background: var(--bg, #FBFAF8); }
.qa-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 40px 90px;
}

/* На странице статьи текст лежит в левой колонке сетки .article-grid
   (max-width 1140px, padding 40px), а не по центру страницы. Чтобы блок Q&A
   визуально продолжал статью, а не «уезжал» вправо, тянем контейнер до той же
   ширины 1140px и прижимаем содержимое влево (ширина колонки ≈ как у текста). */
body.single-post .qa-inner { max-width: 1140px; }
body.single-post .qa-head,
body.single-post .qa-guest,
body.single-post .qa-composer,
body.single-post .qa-list,
body.single-post .qa-empty { max-width: 720px; }

/* На странице маршрута контент лежит в .wrap (max-width 1180px = --maxw, padding 40px)
   во всю ширину. Тянем контейнер Q&A до той же ширины и прижимаем содержимое влево —
   левый край блока совпадает с левым краем контента маршрута выше. */
body.single-route .qa-inner { max-width: 1180px; }
body.single-route .qa-head,
body.single-route .qa-guest,
body.single-route .qa-composer,
body.single-route .qa-list,
body.single-route .qa-empty { max-width: 820px; }

/* ---------- Шапка + сортировка ---------- */
.qa-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.qa-eyebrow {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent, #C2410C);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.qa-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.6px;
  margin: 0;
  line-height: 1.1;
}
.qa-sort { display: flex; gap: 8px; }
.qa-sort__pill {
  background: #fff;
  border: 1px solid #E0D9CD;
  color: #6E675C;
  border-radius: 999px;
  padding: 7px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.qa-sort__pill:hover { border-color: #C9C0B2; }
.qa-sort__pill.is-active {
  background: var(--ink, #1C1A17);
  border-color: var(--ink, #1C1A17);
  color: #fff;
}

/* ---------- Аватары-инициалы ---------- */
.qa-ava {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  font-size: 16px;
}
.qa-ava--me { background: var(--accent, #C2410C); color: #fff; }
.qa-ava--sm { width: 34px; height: 34px; font-size: 14px; }
.qa-ava--xs { width: 24px; height: 24px; font-size: 11px; }
.qa-ava--author { background: var(--accent, #C2410C); color: #fff; }

/* ---------- Гость: приглашение войти ---------- */
.qa-guest {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--ink, #1C1A17);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.qa-guest__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(194, 65, 12, .2);
  color: #F4A07A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.qa-guest__text { flex: 1; min-width: 0; }
.qa-guest__title { color: #fff; font-weight: 700; font-size: 15px; }
.qa-guest__sub { color: #B7B0A6; font-size: 13px; margin-top: 2px; }
.qa-guest__btn { white-space: nowrap; }

/* ---------- Кнопка (терракота) ---------- */
.qa-btn {
  background: var(--accent, #C2410C);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 11px 22px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .15s, box-shadow .25s, background .2s;
}
.qa-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(194, 65, 12, .28); color: #fff; background: #B23A0B; }
.qa-btn[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }

/* ---------- Поле ввода ---------- */
.qa-field {
  width: 100%;
  border: 1px solid #E0D9CD;
  border-radius: 12px;
  padding: 13px 15px;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink, #1C1A17);
  background: #FCFAF6;
  outline: none;
  resize: vertical;
  line-height: 1.55;
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
}
.qa-field:focus { border-color: var(--accent, #C2410C); box-shadow: 0 0 0 3px rgba(194, 65, 12, .1); background: #fff; }
.qa-field::placeholder { color: #B7AE9C; }

/* ---------- Composer (авторизован) ---------- */
.qa-composer {
  display: flex;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line, #E9E3D9);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
}
.qa-composer__field { flex: 1; min-width: 0; }
.qa-composer__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.qa-composer__note { font-size: 12.5px; color: #9A938A; }
.qa-composer__note.is-err { color: #B91C1C; }
.qa-composer__note.is-ok { color: #15803D; }

/* ---------- Список вопросов ---------- */
.qa-list { display: flex; flex-direction: column; gap: 12px; }
.qa-empty { color: var(--muted, #9A938A); font-size: 15px; padding: 10px 2px; }

.qa-card {
  display: flex;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line, #E9E3D9);
  border-radius: 16px;
  padding: 18px 20px;
}
.qa-card.is-new { animation: qa-pop .4s ease; }
@keyframes qa-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Колонка голосов */
.qa-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.qa-vote__btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #B7AE9C;
  line-height: 1;
  padding: 2px;
  border-radius: 8px;
  transition: color .18s, transform .12s;
}
.qa-vote__btn:hover { transform: translateY(-1px); color: #9A3412; }
.qa-vote__btn.is-voted { color: var(--accent, #C2410C); }
.qa-vote__btn:focus-visible { outline: 2px solid var(--accent, #C2410C); outline-offset: 2px; }
.qa-vote__count {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink, #1C1A17);
}
.qa-vote__label { font-size: 10px; color: #B7AE9C; font-weight: 600; }

/* Тело вопроса */
.qa-card__body { flex: 1; min-width: 0; }
.qa-card__text { font-size: 16px; font-weight: 700; color: var(--ink, #1C1A17); line-height: 1.4; }
.qa-card__meta { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.qa-card__author { font-size: 13px; color: #6E675C; }
.qa-card__author b { color: var(--ink, #1C1A17); }

/* Ответы автора */
.qa-replies:empty { display: none; }
.qa-reply {
  border-left: 2px solid #F1DFD3;
  padding: 2px 0 2px 14px;
  margin-top: 12px;
}
.qa-reply__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qa-reply__name { font-weight: 700; font-size: 13px; }
.qa-reply__ago { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; color: #A39B8E; }
.qa-reply__text { font-size: 13.5px; color: #3A352E; line-height: 1.55; margin-top: 4px; }
.qa-badge {
  background: var(--accent, #C2410C);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
}
/* Аватар-инициал у реплик: помогает различать участников обсуждения (команда + гости). */
.qa-reply .qa-ava--sm { display: inline-flex; }

/* Инлайн-ответ автора */
.qa-answer { margin-top: 12px; }
.qa-answer__toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #C2410C);
}
.qa-answer__toggle:hover { color: #9A3412; }
.qa-answer__form { margin-top: 10px; }
.qa-answer__actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.qa-answer__actions .qa-btn { padding: 9px 18px; font-size: 13px; }
.qa-answer__note { font-size: 12px; color: #9A938A; }
.qa-answer__note.is-err { color: #B91C1C; }

/* ---------- Гостевые поля Q&A (имя + подсказки) ---------- */
.qa-field--name { margin-bottom: 8px; }
.qa-composer__field > .qa-field--name { max-width: 280px; }
.qa-answer__form .qa-field--name { max-width: 240px; }
.qa-composer__note.is-hint { color: #9A938A; }
.qa-guest-hint { margin-top: 10px; font-size: 13px; color: #6B6558; }
.qa-guest-hint a { color: var(--accent, #C2410C); font-weight: 600; text-decoration: none; }
.qa-guest-hint a:hover { text-decoration: underline; }

/* ---------- Доступность ---------- */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Адаптив ---------- */
@media (max-width: 700px) {
  .qa-inner { padding: 40px 20px 64px; }
  .qa-title { font-size: 28px; }
  .qa-card { padding: 16px; gap: 12px; }
  .qa-composer { padding: 14px; gap: 10px; }
  .qa-guest { flex-wrap: wrap; }
  .qa-guest__btn { width: 100%; text-align: center; }
}
