/* FAQ: хаб (поиск + сегменты) и страницы тем (сайдбар) */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Хаб —— */
.faq-hub-main {
  padding: 1.25rem 1.25rem 2.5rem;
  min-height: 50vh;
}

.faq-hub-wrap {
  max-width: 1000px;
  margin: 0 auto;
}

.faq-hub-hero {
  margin-bottom: 1.25rem;
  max-width: 42rem;
}

.faq-hub-hero h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin: 0 0 0.35rem;
}

.faq-hub-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.faq-search-wrap {
  position: relative;
  margin-bottom: 1.5rem;
  max-width: 32rem;
}

.faq-search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 1rem;
  border: 1px solid var(--border, #e7e5e4);
  border-radius: var(--radius, 12px);
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
}

.faq-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.faq-search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border, #e7e5e4);
  border-radius: var(--radius, 12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  max-height: 18rem;
  overflow-y: auto;
}

.faq-search-results:not([hidden]) {
  display: block;
}

.faq-search-results li {
  margin: 0;
}

.faq-search-results a {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.faq-search-results a:hover,
.faq-search-results a:focus {
  background: rgba(13, 148, 136, 0.08);
  color: var(--accent);
}

.faq-search-results .faq-search-group {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.faq-search-empty {
  padding: 0.55rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.faq-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.faq-hub-card {
  display: block;
  padding: 1.15rem 1.2rem;
  background: var(--card-bg, #fafaf9);
  border: 1px solid var(--border, #e7e5e4);
  border-radius: var(--radius, 12px);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.faq-hub-card:hover,
.faq-hub-card:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.1);
  outline: none;
}

.faq-hub-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.faq-hub-card-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.faq-hub-segments {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.faq-hub-segment {
  padding: 1.1rem 1.15rem;
  background: var(--card-bg, #fafaf9);
  border: 1px solid var(--border, #e7e5e4);
  border-radius: var(--radius, 12px);
}

.faq-hub-segment-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.faq-hub-segment-desc {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.faq-hub-topic-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-hub-topic-list li {
  margin: 0;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border, #e7e5e4);
}

.faq-hub-topic-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.faq-hub-topic-list a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.95rem;
}

.faq-hub-topic-list a:hover {
  text-decoration: underline;
}

.faq-topic-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* —— Страница темы —— */
.faq-page {
  --faq-header-h: 3.25rem;
}

.faq-topic-layout {
  display: flex;
  min-height: calc(100vh - 120px);
  align-items: stretch;
}

.faq-sidebar-toggle {
  display: none;
}

.faq-sidebar {
  flex: 0 0 260px;
  width: 260px;
  padding: 1.25rem 0 2rem 1.25rem;
  border-right: 1px solid var(--border, #e7e5e4);
  background: var(--card-bg, #fafaf9);
  overflow-y: auto;
  max-height: calc(100vh - var(--faq-header-h));
  position: sticky;
  top: var(--faq-header-h);
  align-self: flex-start;
}

.faq-sidebar-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.faq-sidebar-back:hover {
  text-decoration: underline;
}

.faq-sidebar-sections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-sidebar-sections a {
  display: block;
  padding: 0.45rem 1rem 0.45rem 0;
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  border-radius: 6px;
}

.faq-sidebar-sections a:hover {
  color: var(--accent);
}

.faq-sidebar-sections a.is-active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(13, 148, 136, 0.08);
  padding-left: 0.5rem;
}

.faq-sidebar-group {
  margin-bottom: 1rem;
}

.faq-sidebar-group-title {
  margin: 0 0 0.35rem;
  padding: 0 1rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.faq-sidebar-topics {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-sidebar-topics a {
  display: block;
  padding: 0.35rem 1rem 0.35rem 0;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  border-radius: 6px;
}

.faq-sidebar-topics a:hover {
  color: var(--accent);
}

.faq-sidebar-topics a.is-active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(13, 148, 136, 0.08);
  padding-left: 0.5rem;
}

.faq-topic-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.25rem 2.5rem;
}

.faq-topic-inner {
  max-width: 42rem;
  margin: 0 auto;
}

.faq-topic-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.faq-topic-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.faq-topic-breadcrumb a:hover {
  text-decoration: underline;
}

.faq-topic-main h1 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin: 0 0 1rem;
  line-height: 1.25;
}

.faq-topic-content h2 {
  font-size: 1.15rem;
  margin: 1.25rem 0 0.5rem;
}

.faq-topic-content h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

.faq-topic-content p {
  margin: 0 0 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

.faq-topic-content ul,
.faq-topic-content ol {
  margin: 0 0 0.85rem;
  padding-left: 1.35rem;
  line-height: 1.55;
}

.faq-topic-content li {
  margin-bottom: 0.35rem;
}

.faq-topic-content a {
  color: var(--accent);
}

.faq-topic-content strong {
  font-weight: inherit;
}

@media (max-width: 960px) {
  .faq-sidebar-toggle {
    display: block;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 30;
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius, 12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
  }

  .faq-sidebar {
    position: fixed;
    top: var(--faq-header-h);
    left: 0;
    bottom: auto;
    height: calc(100dvh - var(--faq-header-h));
    z-index: 90;
    max-height: none;
    width: min(280px, 85vw);
    padding: 1rem 0 1.5rem 1.25rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    -webkit-overflow-scrolling: touch;
  }

  .faq-sidebar.is-open {
    transform: translateX(0);
  }

  .faq-topic-layout.faq-sidebar-open::before {
    content: '';
    position: fixed;
    top: var(--faq-header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.35);
  }

  .faq-topic-main {
    width: 100%;
    flex: 1 1 auto;
    padding-bottom: 4rem;
  }
}

body.faq-nav-locked {
  overflow: hidden;
}
