/* ─────────────────────────────────────────────────────────────
   Справочный центр (/faq + /faq/{cat}/{slug}).
   По дизайну help-center.jsx / help-article.jsx. Токены из base.css.
   Брейкпоинты: <768 / 768–1023 / 1024+. Контейнер 1080 как в мокапе.
   Темы — через var(--*) (data-theme на html). Зелёный статуса — фикс #1F8A5B.
   ───────────────────────────────────────────────────────────── */

.faq-page { background: var(--bg); color: var(--text); }
.faq-ic { display: block; flex-shrink: 0; }

.faq-wrap {
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 56px 60px 72px;
    display: flex;
    flex-direction: column;
    gap: 56px;
}

/* ── HERO ────────────────────────────────────────────────────── */
.faq-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--navy) 0%, #16244F 60%, #1E2E63 100%);
    padding: 50px 60px 44px;
}
.faq-hero::before,
.faq-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.faq-hero::before {
    top: -120px; right: 12%; width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(255,107,53,0.27) 0%, transparent 70%);
}
.faq-hero::after {
    bottom: -140px; left: -6%; width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
}
.faq-hero-inner { position: relative; max-width: 720px; margin: 0 auto; text-align: center; }
.faq-hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 999px;
    background: rgba(255,255,255,0.1); color: #fff;
    font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 18px;
}
.faq-hero-badge .faq-ic { fill: #fff; }
.faq-hero h1 {
    margin: 0; color: #fff;
    font-size: 50px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05;
}
.faq-hero p {
    margin: 12px auto 0; max-width: 480px;
    font-size: 17px; color: rgba(255,255,255,0.65); line-height: 1.5;
}
.faq-search {
    margin-top: 24px;
    display: flex; align-items: center; gap: 12px;
    height: 64px; padding: 0 22px;
    border-radius: 16px; background: #fff;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.faq-search > .faq-ic { color: #9CA3AF; }
.faq-search-input {
    flex: 1; min-width: 0; height: 100%; border: none; background: transparent;
    font-size: 17px; font-weight: 500; color: #0B1437; font-family: inherit; outline: none;
}
.faq-search-btn {
    padding: 0 20px; height: 44px; border-radius: 11px;
    background: var(--accent); color: #fff; border: none;
    font-size: 14px; font-weight: 800; cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.faq-quick {
    margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.faq-quick-label { font-size: 12px; color: rgba(255,255,255,0.5); align-self: center; font-weight: 600; }
.faq-quick-chip {
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.85); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.faq-quick-chip:hover { background: rgba(255,255,255,0.14); }

/* ── Section heads ───────────────────────────────────────────── */
.faq-sec[hidden] { display: none; }
.faq-sechead {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px;
}
.faq-sechead h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.faq-sechead p { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }
.faq-sechead-action {
    background: none; border: none; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap;
}
.faq-sechead-action[hidden] { display: none; }

/* ── Categories ──────────────────────────────────────────────── */
.faq-cats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.faq-cat-card {
    text-align: left; cursor: pointer; font-family: inherit;
    padding: 14px 16px; border-radius: 14px;
    background: var(--bg-elevated); border: 1px solid var(--divider);
    display: flex; flex-direction: row; align-items: center; gap: 14px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.faq-cat-card:hover { transform: translateY(-3px); border-color: rgba(255,107,53,0.4); box-shadow: 0 12px 32px rgba(11,20,55,0.10); }
.faq-cat-card.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.faq-cat-card.is-active .faq-cat-name { color: var(--accent); }
.faq-cat-card[hidden] { display: none; }
.faq-cat-ic {
    flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 11px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.faq-cat-body { flex: 1; min-width: 0; }
.faq-cat-name { display: block; font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.faq-cat-desc { display: block; margin-top: 2px; font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.faq-cat-arrow { flex-shrink: 0; color: var(--accent); }

/* ── Articles list ───────────────────────────────────────────── */
.faq-arts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
/* Сообщение «в этой категории пока нет статей» (при фильтре без статей) */
.faq-arts-empty {
    padding: 28px 16px; border-radius: 12px;
    background: var(--bg-elevated); border: 1px dashed var(--divider);
    text-align: center; font-size: 14px; color: var(--text-muted);
}
.faq-arts-empty[hidden] { display: none; }
.faq-art-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 12px;
    background: var(--bg-elevated); border: 1px solid var(--divider);
    text-decoration: none; transition: border-color .16s ease;
}
.faq-art-row:hover { border-color: rgba(255,107,53,0.4); }
.faq-art-row[hidden] { display: none; }
.faq-art-ic {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.faq-art-body { flex: 1; min-width: 0; }
.faq-art-title { display: block; font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.faq-art-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.faq-art-cat { font-size: 11px; font-weight: 700; color: var(--accent); }
.faq-art-chev { color: var(--text-dim); flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────────────── */
.faq-empty {
    padding: 48px 24px; text-align: center;
    border-radius: 16px; background: var(--bg-elevated); border: 1px dashed var(--divider);
}
.faq-empty[hidden] { display: none; }
.faq-empty-title { font-size: 16px; font-weight: 800; color: var(--text); }
.faq-empty p { margin: 8px 0 0; font-size: 14px; color: var(--text-muted); }

/* ── System status ───────────────────────────────────────────── */
.faq-status { border-radius: 18px; overflow: hidden; border: 1px solid var(--divider); background: var(--bg-elevated); }
.faq-status-head {
    padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border-bottom: 1px solid var(--divider);
}
.faq-status-head-l { display: flex; align-items: center; gap: 12px; }
.faq-status-ic {
    width: 40px; height: 40px; border-radius: 11px;
    background: rgba(31,138,91,0.09); color: #1F8A5B;
    display: flex; align-items: center; justify-content: center;
}
.faq-status.is-degraded .faq-status-ic { background: rgba(220,68,68,0.10); color: #DC4444; }
.faq-status-title { font-size: 16px; font-weight: 800; color: var(--text); }
.faq-status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(31,138,91,0.09); color: #1F8A5B; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.faq-status.is-degraded .faq-status-badge { background: rgba(220,68,68,0.10); color: #DC4444; }
.faq-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.faq-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--divider); }
.faq-status-row {
    padding: 14px 24px; background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.faq-status-name { font-size: 13px; font-weight: 600; color: var(--text); }
.faq-status-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #1F8A5B; }
.faq-status-state .faq-dot { width: 7px; height: 7px; }
.faq-status-row.is-down .faq-status-state { color: #DC4444; }

/* ── Contact ─────────────────────────────────────────────────── */
.faq-contacts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.faq-contact-card {
    padding: 22px; border-radius: 16px;
    background: var(--bg-elevated); border: 1px solid var(--divider);
    display: flex; flex-direction: column; gap: 12px; text-decoration: none;
    transition: border-color .16s ease, transform .16s ease;
}
.faq-contact-card:hover { border-color: rgba(255,107,53,0.4); transform: translateY(-2px); }
.faq-contact-ic {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.faq-contact-card--primary .faq-contact-ic { background: var(--accent); color: #fff; }
.faq-contact-title { font-size: 16px; font-weight: 800; color: var(--text); }
.faq-contact-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; }
/* CTA — кнопка как в HCContact: outlined у обычных, залитая оранжевая у primary */
.faq-contact-cta {
    margin-top: 4px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 14px; font-weight: 800; color: var(--text);
    background: transparent; border: 1.5px solid var(--divider);
}
.faq-contact-card--primary .faq-contact-cta {
    background: var(--accent); color: #fff; border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.28);
}

/* ── Search note ─────────────────────────────────────────────── */
.faq-searchnote {
    padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--text);
    font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-searchnote[hidden] { display: none; }
.faq-searchnote-reset {
    padding: 4px 10px; border-radius: 7px; background: transparent;
    border: 1px solid var(--divider); color: var(--text-muted);
    font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; flex-shrink: 0;
}

/* ════════════════ СТАТЬЯ ════════════════════════════════════ */
.faq-wrap--article { padding-top: 28px; gap: 0; }
.faq-crumb {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted); margin-bottom: 24px;
}
.faq-crumb a { color: var(--text-muted); text-decoration: none; }
.faq-crumb a:hover { color: var(--accent); }
.faq-crumb .faq-ic { color: var(--text-dim); }
.faq-crumb-cur { color: var(--text); font-weight: 700; }

.faq-article-grid { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 56px; }
/* Когда TOC скрыт (в статье <2 <h2> → faq.js не показывает оглавление) — контент
   занимает обе колонки на всю ширину, а не сваливается в узкую колонку 240px.
   Соседний комбинатор работает и при display:none у [hidden] (кроссбраузерно, без :has). */
.faq-toc[hidden] + .faq-article-main { grid-column: 1 / -1; }
.faq-article-main { min-width: 0; display: flex; flex-direction: column; gap: 36px; }

/* TOC */
.faq-toc {
    position: sticky; top: 96px; align-self: start;
    padding: 20px 18px; border-radius: 14px;
    background: var(--bg-elevated); border: 1px solid var(--divider);
}
.faq-toc[hidden] { display: none; }
.faq-toc-head {
    font-size: 11px; font-weight: 800; color: var(--text-muted);
    letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: none; border: none; width: 100%; font-family: inherit; cursor: default; padding: 0;
}
.faq-toc-head .faq-ic { display: none; color: var(--text-muted); }
.faq-toc-list { display: flex; flex-direction: column; gap: 2px; }
.faq-toc-link {
    padding: 8px 10px 8px 12px; border-radius: 8px;
    text-decoration: none; color: var(--text-muted);
    font-size: 13px; font-weight: 600; line-height: 1.35;
    border-left: 2px solid transparent;
    transition: background .16s ease, color .16s ease;
}
.faq-toc-link:hover { color: var(--text); }
.faq-toc-link.is-active {
    background: var(--accent-soft); color: var(--accent);
    font-weight: 800; border-left-color: var(--accent); padding-left: 10px;
}

/* Article header */
.faq-article-cat {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px;
}
.faq-article-title { margin: 0; font-size: 38px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1.1; }
.faq-article-lead { margin: 12px 0 0; font-size: 17px; color: var(--text-muted); line-height: 1.55; }
.faq-article-meta { margin-top: 16px; font-size: 12px; color: var(--text-dim); }
.faq-article-cover { border-radius: 16px; overflow: hidden; }
.faq-article-cover img { display: block; width: 100%; height: auto; }

/* Article content typography */
.faq-article-content { font-size: 16px; line-height: 1.7; color: var(--text-muted); }
.faq-article-content > * { margin: 0 0 18px; }
.faq-article-content > *:last-child { margin-bottom: 0; }
.faq-article-content h2 {
    margin: 32px 0 14px; font-size: 24px; font-weight: 800; color: var(--text);
    letter-spacing: -0.02em; scroll-margin-top: 96px;
}
.faq-article-content h3 { margin: 24px 0 10px; font-size: 19px; font-weight: 700; color: var(--text); }
.faq-article-content p { color: var(--text-muted); }
.faq-article-content a { color: var(--accent); }
.faq-article-content ul, .faq-article-content ol { padding-left: 22px; }
.faq-article-content li { margin-bottom: 8px; }
.faq-article-content img { max-width: 100%; height: auto; border-radius: 12px; }
.faq-article-content strong { color: var(--text); }

/* steps (ol.faq-steps) */
.faq-article-content ol.faq-steps { list-style: none; padding: 0; counter-reset: faqstep; display: flex; flex-direction: column; gap: 10px; }
.faq-article-content ol.faq-steps > li {
    position: relative; padding-left: 40px; margin: 0;
    color: var(--text); font-size: 15px; line-height: 1.5;
}
.faq-article-content ol.faq-steps > li::before {
    counter-increment: faqstep; content: counter(faqstep);
    position: absolute; left: 0; top: -2px;
    width: 26px; height: 26px; border-radius: 8px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}

/* callouts (.faq-callout--tip / --warn) */
.faq-callout {
    display: flex; gap: 12px; padding: 16px 18px; border-radius: 12px;
    background: var(--accent-soft); border: 1px solid rgba(255,107,53,0.16);
}
.faq-callout-label {
    font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
    margin-bottom: 3px; color: var(--accent);
}
.faq-callout-text { font-size: 15px; color: var(--text); line-height: 1.6; }
.faq-callout--warn { background: rgba(199,127,0,0.10); border-color: rgba(199,127,0,0.28); }
.faq-callout--warn .faq-callout-label { color: #C77F00; }

/* accordion (.faq-accordion, раскрытие в faq.js) */
.faq-accordion { border: 1px solid var(--divider); border-radius: 14px; overflow: hidden; background: var(--bg-elevated); transition: border-color .2s ease; }
.faq-accordion.is-open { border-color: rgba(255,107,53,0.4); }
.faq-accordion__head {
    position: relative; padding: 16px 48px 16px 18px;
    font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.35; cursor: pointer; user-select: none;
}
.faq-accordion__head::after {
    content: ""; position: absolute; right: 18px; top: 50%;
    width: 10px; height: 10px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: translateY(-65%) rotate(45deg); transition: transform .2s ease;
}
.faq-accordion.is-open .faq-accordion__head::after { transform: translateY(-35%) rotate(-135deg); }
.faq-accordion__body { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.faq-accordion__inner { padding: 0 18px 16px; font-size: 15px; line-height: 1.6; color: var(--text-muted); }

/* Helpful */
.faq-helpful {
    padding: 24px; border-radius: 16px; background: var(--bg-elevated); border: 1px solid var(--divider);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.faq-helpful-title { font-size: 16px; font-weight: 800; color: var(--text); }
.faq-helpful-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.faq-helpful-btns { display: flex; gap: 8px; flex-shrink: 0; }
.faq-helpful-btns[hidden] { display: none; }
.faq-helpful-btn {
    height: 44px; padding: 0 18px; border-radius: 12px;
    background: transparent; border: 1.5px solid var(--divider); color: var(--text);
    font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.faq-helpful-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Related */
.faq-related-title { margin: 0 0 16px; font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.faq-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.faq-related-card {
    display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 14px;
    background: var(--bg-elevated); border: 1px solid var(--divider); text-decoration: none;
    transition: border-color .16s ease;
}
.faq-related-card:hover { border-color: rgba(255,107,53,0.4); }
.faq-related-ic {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.faq-related-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.35; }
.faq-related-cat { font-size: 11px; font-weight: 700; color: var(--accent); }

/* ── Планшет 768–1023 ───────────────────────────────────────── */
@media (max-width: 1023px) {
    .faq-wrap { padding: 40px 32px 56px; gap: 44px; }
    .faq-hero { padding: 40px 32px 36px; }
    .faq-hero h1 { font-size: 40px; }
    .faq-cats { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .faq-article-grid { grid-template-columns: 1fr; gap: 24px; }
    .faq-toc { position: static; top: auto; }
    .faq-toc-head { cursor: pointer; }
    .faq-toc-head .faq-ic { display: block; transition: transform .2s ease; }
    .faq-toc.is-open .faq-toc-head .faq-ic { transform: rotate(90deg); }
    .faq-toc:not(.is-open) .faq-toc-list { display: none; }
    .faq-article-title { font-size: 32px; }
}

/* ── Мобайл <768 ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .faq-wrap { padding: 28px 18px 40px; gap: 36px; }
    .faq-hero { padding: 30px 20px 28px; }
    .faq-hero h1 { font-size: 30px; }
    .faq-hero p { font-size: 14px; }
    .faq-search { height: 54px; padding: 0 16px; }
    .faq-search-input { font-size: 15px; }
    .faq-search-btn { display: none; }
    .faq-sechead h2 { font-size: 20px; }
    .faq-cats { grid-template-columns: minmax(0,1fr); gap: 12px; }
    .faq-arts { grid-template-columns: minmax(0,1fr); }
    .faq-status-grid { grid-template-columns: minmax(0,1fr); }
    .faq-contacts { grid-template-columns: minmax(0,1fr); }
    .faq-related-grid { grid-template-columns: minmax(0,1fr); }
    .faq-helpful { flex-direction: column; align-items: flex-start; }
    .faq-article-title { font-size: 26px; }
    .faq-article-lead { font-size: 15px; }
}

/* ── Lightbox для картинок статьи (lightbox.js) ──────────────── */
.faq-article-content img.faq-zoomable { cursor: zoom-in; }

.faq-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;            /* как у cmex-confirm: выше шапки/меню */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(8, 16, 40, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.faq-lightbox.is-open { opacity: 1; }
.faq-lightbox[hidden] { display: none; }

.faq-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  cursor: default;
  transform: scale(0.98);
  transition: transform 0.18s ease;
}
.faq-lightbox.is-open .faq-lightbox-img { transform: scale(1); }

.faq-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.faq-lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.faq-lightbox-close svg { width: 22px; height: 22px; }
