/* ==============================================================
   QA-ХАБ GEO/AEO — надстройка над styles.css
   Ничего не переписывает: только дополняет существующие токены,
   .container, .section-eyebrow, .table-wrap, .toc, .site-footer.
   Палитра и типографика - из :root боевого сайта.
   ============================================================== */

/* ---------- Полоса прогресса чтения ---------- */
.qa-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px; width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  z-index: 200;
  pointer-events: none;
}

/* ---------- Хлебные крошки ---------- */
.qa-crumbs {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 26px 32px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  color: var(--text-3);
}

.qa-crumbs a { color: var(--text-3); transition: color .18s; }
.qa-crumbs a:hover { color: var(--accent); }
.qa-crumbs span[aria-hidden] { opacity: .5; }
.qa-crumbs [aria-current] { color: var(--text-2); }

@media (max-width: 900px) {
  .qa-crumbs { padding: 20px 20px 0; font-size: 14.5px; }
  .qa-crumbs .qa-crumb-hide { display: none; }
}

/* ---------- Шапка страницы вопроса ---------- */
.qa-lead-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 20px;
}

.qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
  background: rgba(255, 255, 255, .02);
  /* white-space: nowrap; */
}

.qa-chip b { color: var(--accent); font-weight: 600; letter-spacing: .04em; }

.qa-page-h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(32px, 3.55vw, 54px);
  line-height: 1.08;
  letter-spacing: -.025em;
  color: var(--text);
  margin: 0 0 24px;
  text-wrap: balance;
}

/* ---------- Ответ за 30 секунд ---------- */
.qa-short {
  position: relative;
  margin: 0 0 40px;
  padding: 30px 34px;
  border: 1px solid rgba(47, 224, 168, .22);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(47, 224, 168, .09), rgba(47, 224, 168, .02));
  isolation: isolate;
}

.qa-short::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 224, 168, .55), transparent);
  pointer-events: none;
}

.qa-short__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent);
  margin: 0 0 14px;
}

.qa-short__label::before {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--accent);
}

.qa-short p {
  margin: 0;
  font-size: clamp(19px, 1.42vw, 22px);
  line-height: 1.6;
  color: var(--text);
}

@media (max-width: 900px) {
  .qa-short { padding: 24px 22px; }
}

/* ---------- Мини-оглавление ответа ---------- */
.qa-inline-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 36px;
  padding: 0;
  list-style: none;
}

.qa-inline-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 16px;
  color: var(--text-2);
  background: rgba(255, 255, 255, .02);
  transition: color .18s, border-color .18s, background .18s;
}

.qa-inline-toc a:hover { color: var(--accent); border-color: rgba(47, 224, 168, .4); }

.qa-inline-toc a.active {
  color: var(--accent);
  border-color: rgba(47, 224, 168, .5);
  background: rgba(47, 224, 168, .07);
}

/* ---------- Основной ответ ---------- */
.qa-body > p,
.qa-body > ul,
.qa-body > ol {
  max-width: 860px;
}

.qa-body h3 {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(47, 224, 168, .2);
}

.qa-body > ul,
.qa-body > ol {
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qa-body > ul li,
.qa-body > ol li {
  color: var(--text-2);
  font-size: 20px;
  line-height: 1.6;
  position: relative;
}

.qa-body > ul { list-style: none; }
.qa-body > ul li { padding-left: 26px; }

.qa-body > ul li::before {
  content: '';
  position: absolute;
  left: 4px; top: .62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.qa-body > ol { counter-reset: qaitem; }
.qa-body > ol li { counter-increment: qaitem; padding-left: 46px; }

.qa-body > ol li::before {
  content: counter(qaitem, decimal-leading-zero);
  position: absolute;
  left: 0; top: -1px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(47, 224, 168, .3);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 14.5px;
  color: var(--accent);
}

.qa-body a,
.qa-related a {
  color: var(--accent);
  border-bottom: 1px solid rgba(47, 224, 168, .3);
  transition: border-color .18s;
}

.qa-body a:hover,
.qa-related a:hover { border-bottom-color: var(--accent); }

/* ---------- Связанные вопросы (инлайн-строка) ---------- */
.qa-related {
  margin: 40px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  font-size: 18.5px;
  line-height: 1.7;
  color: var(--text-2);
  max-width: 860px;
}

.qa-related__label {
  display: block;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.qa-related a { font-weight: 500; }

/* ---------- Автор выпуска ---------- */
.qa-author {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 40px 0 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
}

.qa-author__ava {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #03251a;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px rgba(47, 224, 168, .35), 0 8px 28px -10px var(--accent-glow);
}

.qa-author__name {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin: 0 0 3px;
}

.qa-author__role { font-size: 16.5px; color: var(--text-3); margin: 0; }
.qa-author__role a { color: var(--text-2); border-bottom: 1px solid rgba(255, 255, 255, .18); }
.qa-author__role a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Дисклеймер ---------- */
.qa-disclaimer {
  margin: 32px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
  overflow: hidden;
}

.qa-disclaimer > summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  font-size: 16.5px;
  letter-spacing: .02em;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.qa-disclaimer > summary::-webkit-details-marker { display: none; }

.qa-disclaimer > summary::after {
  content: '+';
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 200;
  color: var(--accent);
  line-height: 1;
  transition: transform .25s;
  flex-shrink: 0;
}

.qa-disclaimer[open] > summary::after { transform: rotate(45deg); }

.qa-disclaimer__body {
  padding: 0 24px 24px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text-3);
}

/* ---------- Навигация предыдущий / следующий ---------- */
.qa-pager {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 48px 0 0;
}

@media (min-width: 760px) {
  .qa-pager { grid-template-columns: 1fr 1fr; }
}

.qa-pager a,
.qa-pager span {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
  min-height: 44px;
}

.qa-pager a { transition: border-color .2s, background .2s, transform .2s; }
.qa-pager a:hover { border-color: rgba(47, 224, 168, .45); background: rgba(47, 224, 168, .05); transform: translateY(-1px); }

.qa-pager__dir {
  display: block;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.qa-pager__ttl { font-size: 19px; color: var(--text); line-height: 1.4; }
.qa-pager a:hover .qa-pager__ttl { color: var(--accent); }
.qa-pager--next { text-align: right; }
.qa-pager__all {
  grid-column: 1 / -1;
  text-align: center;
  border-style: dashed;
}
.qa-pager__all .qa-pager__ttl { font-size: 18px; color: var(--text-2); }

/* ---------- Сайдбар категории ---------- */
.qa-toc a::before {
  content: attr(data-n);
  min-width: 40px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  opacity: .55;
}

.qa-toc a.is-current {
  color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(47, 224, 168, .09), transparent);
}

.qa-toc a.is-current::before { color: var(--accent); opacity: 1; }

.qa-toc__back {
  display: block;
  margin: 0 0 18px;
  padding: 0 12px;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--text-3);
}

.qa-toc__back:hover { color: var(--accent); }

/* ---------- Мобильный выбор категории ---------- */
.qa-mobile-cat {
  display: block;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
}

@media (min-width: 1200px) { .qa-mobile-cat { display: none; } }

.qa-mobile-cat > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-size: 17px;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.qa-mobile-cat > summary::-webkit-details-marker { display: none; }
.qa-mobile-cat ol { padding: 0 20px 20px; max-height: 60vh; overflow-y: auto; }

/* ---------- ХАБ: поиск ---------- */
.qa-search {
  position: sticky;
  top: 72px;
  z-index: 30;
  margin: 0 0 40px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(5, 8, 10, .82);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.qa-search input {
  flex: 1 1 320px;
  min-height: 52px;
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 19px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s, background .2s;
}

.qa-search input::placeholder { color: var(--text-3); }
.qa-search input:focus { border-color: rgba(47, 224, 168, .5); background: rgba(47, 224, 168, .04); }

.qa-search__meta {
  font-size: 15.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.qa-search__reset {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.qa-search__reset:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- ХАБ: категории ---------- */
.qa-cats { display: flex; flex-direction: column; gap: 32px; }

.qa-cat {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(20, 28, 32, .5);
  padding: 32px 34px;
  position: relative;
  overflow: hidden;
}

.qa-cat::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 224, 168, .45), transparent);
}

.qa-cat__head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

/* Текстовый блок шапки растягивается и может сжиматься без выдавливания */
.qa-cat__head > div { flex: 1 1 0; min-width: 0; }

.qa-cat__letter {
  flex-shrink: 0;
  width: 54px; height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(47, 224, 168, .3);
  background: rgba(47, 224, 168, .07);
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
}

.qa-cat__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 1.85vw, 30px);
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 8px;
}

.qa-cat__desc { margin: 0; font-size: 18px; color: var(--text-3); max-width: 720px; }

.qa-cat__count {
  margin-left: auto;
  font-size: 14.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.qa-cat__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 900px) { .qa-cat__list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1400px) { .qa-cat__list { grid-template-columns: 1fr 1fr 1fr; } }

.qa-cat__list a {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 15px 18px;
  background: var(--bg);
  font-size: 17.5px;
  line-height: 1.45;
  color: var(--text-2);
  transition: background .2s, color .2s;
}

.qa-cat__list a:hover { background: var(--bg-3); color: var(--accent); }

.qa-cat__num {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  font-size: 15.5px;
  padding-top: 2px;
  min-width: 34px;
}

.qa-cat__list a:hover .qa-cat__num { color: var(--accent); }

/* Служебная мелочь: длинные вопросы не должны выдавливать колонку */
.qa-cat__list a > span:last-child { min-width: 0; overflow-wrap: anywhere; }

.qa-empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 19px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- ХАБ: маршруты «с чего начать» ---------- */
.qa-routes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 48px;
}

@media (min-width: 860px) { .qa-routes { grid-template-columns: repeat(3, 1fr); } }

.qa-route {
  background: var(--bg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background .25s;
}

.qa-route:hover { background: var(--bg-2); }

.qa-route__step {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}

.qa-route__ttl {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0;
}

.qa-route p { margin: 0; font-size: 17.5px; color: var(--text-3); flex: 1; }

.qa-route__go {
  font-size: 17px;
  color: var(--accent);
  border-bottom: 1px solid rgba(47, 224, 168, .3);
  align-self: flex-start;
}

.qa-route:hover .qa-route__go { border-bottom-color: var(--accent); }

/* ---------- ХАБ: общий каркас ---------- */
.qa-hub {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 40px;
}

.qa-hub-sec { padding: 80px 0; }

.qa-hub-sec > .container {
  position: relative;
  background: linear-gradient(180deg, rgba(10, 14, 17, 0.72) 0%, rgba(6, 9, 11, 0.82) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 26px;
  padding: 52px 44px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  isolation: isolate;
}

.qa-hub-sec > .container::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 224, 168, 0.5), transparent);
  pointer-events: none;
}

/* ==============================================================
   ХАБ: МОБИЛЬНАЯ РАСКЛАДКА
   Три вложенных отступа (хаб + контейнер + карточка) на телефоне
   съедали до 40% ширины, а шапка карточки не переносилась и сжимала
   заголовок. Ниже - меньше вложенности, перенос шапки и шире текст
   вопросов. Блок стоит последним, чтобы не перебиваться каскадом.
   ============================================================== */
@media (max-width: 900px) {
  .qa-hub { padding: 0 20px; }
  .qa-hub-sec { padding: 52px 0; }
  .qa-hub-sec > .container { padding: 34px 22px; border-radius: 18px; }
}

@media (max-width: 760px) {
  /* Шапка карточки в две строки: буква и заголовок, затем счётчик */
  .qa-cat__head { flex-wrap: wrap; gap: 14px 16px; margin-bottom: 18px; }
  .qa-cat__head > div { flex: 1 1 200px; }
  .qa-cat__letter { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
  .qa-cat__title { font-size: 22px; margin-bottom: 6px; }
  .qa-cat__desc { font-size: 16.5px; max-width: none; }
  .qa-cat__count { margin-left: 0; flex-basis: 100%; font-size: 13.5px; }
  .qa-route { padding: 24px 18px; }
  .qa-route__ttl { font-size: 21px; }
}

@media (max-width: 640px) {
  /* Больше ширины под текст вопросов */
  .qa-hub { padding: 0 12px; }
  .qa-hub-sec { padding: 44px 0; }
  .qa-hub-sec > .container { padding: 26px 14px; border-radius: 16px; }
  .qa-cats { gap: 22px; }
  .qa-cat { padding: 22px 16px; border-radius: 18px; }

  .qa-cat__list a { padding: 13px 14px; font-size: 16.5px; gap: 9px; }
  .qa-cat__num { min-width: 30px; font-size: 14.5px; }

  /* Панель поиска компактнее, чтобы не закрывала индекс */
  .qa-search { top: 64px; padding: 12px; gap: 10px; border-radius: 18px; margin-bottom: 28px; }
  .qa-search input { flex: 1 1 100%; min-height: 46px; font-size: 16.5px; padding: 0 14px; border-radius: 10px; }
  .qa-search__meta { font-size: 14px; }
  .qa-search__reset { min-height: 40px; padding: 0 14px; font-size: 15px; }

  .qa-empty { padding: 40px 18px; font-size: 17.5px; }
}

/* Плавный переход по якорям с учётом липкой шапки */
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Печать ---------- */
@media print {
  .site-header, .qa-progress, .toc, .qa-pager, .qa-search,
  .site-footer, .qa-mobile-cat, .qa-inline-toc, .hx-rail, .hx-hint { display: none !important; }
  #hero.hx { height: auto !important; }
  .with-sidebar { grid-template-columns: 1fr !important; }
  .qa-short, .qa-author, .qa-disclaimer { break-inside: avoid; }
}
