/* FAQ page — aligned with glossary.css / site theme */

.faq-page [hidden] { display: none !important; }

.faq-page {
  padding: 48px 0 80px;
  text-align: left;
}

.faq-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.faq-page .content-column.faq-content--wide {
  max-width: min(1200px, calc(100vw - 48px));
}
@media (min-width: 1400px) {
  .faq-page .content-column.faq-content--wide {
    max-width: 1280px;
  }
}

#faq-search-input,
.faq-controls {
  scroll-margin-top: 92px;
}

.faq-topbar {
  position: sticky;
  top: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  margin: 0 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 255, 0.18);
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 140, 255, 0.16), transparent 55%),
    rgba(5, 7, 19, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.30);
}

/* methodology.css задаёт .back-link { margin-bottom: 18px } — сбрасываем внутри topbar */
.faq-topbar .back-link {
  margin-bottom: 0;
}

/* Одна линия по высоте (как .methodology-top-row) */
.faq-topbar .faq-back,
.faq-topbar .faq-topbar__jump {
  box-sizing: border-box;
  min-height: 42px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.faq-topbar__jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: rgba(16, 21, 40, 0.35);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}
.faq-topbar__jump:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.58);
}

.faq-back {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: rgba(16, 21, 40, 0.5);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.faq-back:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.72);
}

.faq-header {
  margin-top: 18px;
  margin-bottom: 22px;
}
.faq-title {
  margin: 0 0 6px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: 0.02em;
  font-weight: 900;
}
.faq-subtitle {
  margin: 0 0 12px;
  font-size: clamp(13px, 1.6vw, 15px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.faq-lead {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 62ch;
}
.faq-lead a {
  color: var(--accent);
}
.faq-section-lead {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}
.faq-section-lead a {
  color: var(--accent);
}
.faq-tagline {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.faq-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 14px;
  align-items: end;
  margin: 18px 0 18px;
  padding: 14px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(16, 21, 40, 0.45);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.28);
}

.faq-search__label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.faq-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(5, 7, 19, 0.55);
  padding: 10px 12px;
}

.faq-search__input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
}
.faq-search__input::placeholder {
  color: rgba(163, 173, 199, 0.75);
}

.faq-search__clear {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.faq-search__clear:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.faq-search__meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  padding-right: 2px;
}

.faq-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 24px;
}
.faq-toc__link {
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 10px;
  background: rgba(16, 21, 40, 0.35);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.faq-toc__link:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.58);
}

.faq-roles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-role {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(16, 21, 40, 0.38);
  scroll-margin-top: 92px;
  overflow: hidden;
}

.faq-role__summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  transition: background var(--transition-fast);
}
.faq-role__summary::-webkit-details-marker { display: none; }
.faq-role__summary::marker { content: ''; }

.faq-role__summary::before {
  content: '▸';
  flex: 0 0 auto;
  font-size: 14px;
  color: rgba(79, 140, 255, 0.85);
  transition: transform var(--transition-fast);
}
.faq-role[open] > .faq-role__summary::before {
  transform: rotate(90deg);
}

.faq-role__summary:hover {
  background: rgba(79, 140, 255, 0.06);
}

.faq-role__title {
  margin: 0;
  font-size: clamp(17px, 2vw, 20px);
  letter-spacing: 0.02em;
  font-weight: 700;
}

.faq-role__body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(5, 7, 19, 0.35);
  scroll-margin-top: 100px;
}

.faq-item.is-faq-highlight,
.faq-role.is-faq-highlight {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.25),
    0 18px 48px rgba(2, 6, 23, 0.12),
    0 0 26px rgba(34, 197, 94, 0.20);
}

.faq-question {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 14px 16px 14px 54px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.45;
  min-height: 44px;
  width: 100%;
  text-align: left;
  text-wrap: normal;
  hyphens: manual;
  overflow-wrap: break-word;
}

/* Safety: подсветка поиска/терм-типсы не должны «ломать» поток вопроса */
.faq-question mark,
.faq-question .term-tip,
.faq-question .idx {
  display: inline !important;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::marker { content: ''; }

.faq-question::before {
  content: '+';
  position: absolute;
  left: 16px;
  top: 14px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(79, 140, 255, 0.35);
  color: rgba(79, 140, 255, 0.9);
  font-size: 14px;
  line-height: 1;
}
.faq-item[open] > .faq-question::before {
  content: '−';
}

.faq-answer {
  padding: 0 16px 16px 48px;
  color: rgba(184, 198, 232, 0.9);
  font-size: 14.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.faq-answer .idx,
.faq-question .idx {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  white-space: normal;
  overflow-wrap: anywhere;
}
.faq-answer p { margin: 0 0 12px; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}
.faq-answer li { margin: 0 0 6px; }
.faq-answer blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid rgba(79, 140, 255, 0.45);
  background: rgba(79, 140, 255, 0.08);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}

.faq-empty {
  margin: 18px 0 8px;
  padding: 12px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: rgba(5, 7, 19, 0.35);
}

.faq-page mark {
  background: rgba(34, 197, 94, 0.58);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25), 0 0 18px rgba(34, 197, 94, 0.35);
}

.faq-page .methodology-actions {
  margin-top: 36px;
}

/* Light theme */
html[data-theme="light"] .faq-back {
  color: rgba(11, 18, 32, 0.70);
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.06);
}
html[data-theme="light"] .faq-back:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .faq-topbar {
  border-color: rgba(15, 23, 42, 0.10);
  background:
    radial-gradient(ellipse 70% 60% at 10% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.08);
}
html[data-theme="light"] .faq-topbar__jump {
  color: rgba(11, 18, 32, 0.72);
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.70);
}
html[data-theme="light"] .faq-lead,
html[data-theme="light"] .faq-tagline {
  color: rgba(11, 18, 32, 0.70);
}

html[data-theme="light"] .faq-controls {
  border-color: rgba(15, 23, 42, 0.10);
  background:
    radial-gradient(ellipse 70% 60% at 10% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.08);
}

html[data-theme="light"] .faq-search__field {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .faq-search__input { color: #0b1220; }
html[data-theme="light"] .faq-search__input::placeholder {
  color: rgba(11, 18, 32, 0.45);
}

html[data-theme="light"] .faq-toc__link {
  color: rgba(11, 18, 32, 0.72);
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.70);
}
html[data-theme="light"] .faq-toc__link:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .faq-role {
  border-color: rgba(15, 23, 42, 0.10);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.74));
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.08);
}

html[data-theme="light"] .faq-item {
  border-color: rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.65);
}

html[data-theme="light"] .faq-answer {
  color: rgba(55, 70, 95, 0.85);
}

html[data-theme="light"] .faq-empty {
  border-color: rgba(15, 23, 42, 0.14);
  color: rgba(11, 18, 32, 0.68);
  background: rgba(255, 255, 255, 0.70);
}

html[data-theme="light"] .faq-page mark {
  background: rgba(34, 197, 94, 0.42);
}

@media (max-width: 720px) {
  #faq-search-input,
  .faq-controls,
  .faq-role,
  .faq-item {
    scroll-margin-top: 110px;
  }
  .faq-topbar {
    top: 10px;
    border-radius: 18px;
    padding: 8px 8px;
  }
  .faq-controls {
    grid-template-columns: 1fr;
  }
  .faq-search__meta {
    text-align: left;
  }
  .faq-answer {
    padding-left: 16px;
  }
}

@media (max-width: 420px) {
  .faq-answer {
    font-size: 14px;
    padding-right: 14px;
  }
  .faq-answer ul {
    padding-left: 1.05em;
  }
  .faq-answer blockquote {
    padding: 10px 12px;
  }
}
