/* Оформление генерируемых SEO-страниц (scripts/seo/template.mjs).
   Тот же локальный шрифт и та же палитра, что у лендинга в styles.css —
   ни одного внешнего запроса, CSP на ltvchat.ru это 'self' по всем директивам.
   Лендинг остаётся на styles.css: два файла независимы, общего импорта нет. */

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('fonts/outfit-latin-var.woff2') format('woff2');
}

:root {
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --secondary: #3B82F6;
    --accent: #10B981;
    --bg: #0B0F19;
    --text: #F9FAFB;
    --text-muted: #9CA3AF;
    --glass: rgba(15, 23, 42, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --article-width: 1120px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.seo-page {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Видимый фокус на всём: клавиатурная навигация — не опция. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* `main` получает фокус только программно, по skip-link: tabindex="-1" нужен,
   чтобы регион объявлялся скринридером, но обводить рамкой всю страницу
   не надо — это не интерактивный элемент. */
main#main:focus,
main#main:focus-visible {
    outline: none;
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    left: 0;
}

/* Шапка */
.seo-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.seo-logo {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}

.seo-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.seo-nav a {
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
}

.seo-nav a:hover {
    color: var(--text);
}

.seo-nav-cta {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 600;
}

.seo-nav-cta:hover {
    background: var(--primary-dark);
}

/* Хлебные крошки */
.breadcrumbs {
    grid-column: 1 / -1;
    font-size: 0.875rem;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
}

.breadcrumbs li + li::before {
    content: "/";
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-muted);
}

.breadcrumbs [aria-current="page"] {
    color: var(--text);
}

/* Сетка страницы: текст слева, CTA справа. */
.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 2.5rem;
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 2.5rem 2rem 5rem;
}

.article-body {
    min-width: 0;
}

.article-body h1 {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.article-body h2 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 3rem 0 1rem;
    scroll-margin-top: 1.5rem;
}

.article-body h3 {
    font-size: 1.3125rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    scroll-margin-top: 1.5rem;
}

.article-body p {
    margin-bottom: 1.125rem;
    color: #E5E7EB;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.5rem 1.5rem;
    color: #E5E7EB;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body a {
    color: var(--primary);
    text-underline-offset: 3px;
}

.article-body strong {
    color: var(--text);
}

.article-body blockquote {
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: rgba(139, 92, 246, 0.06);
    color: var(--text-muted);
}

/* Оглавление */
.article-toc {
    margin: 0 0 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass);
}

.article-toc p {
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.article-toc ol {
    margin-left: 1.25rem;
    color: var(--text-muted);
}

.article-toc a {
    color: var(--text-muted);
    text-decoration: none;
}

.article-toc a:hover {
    color: var(--text);
    text-decoration: underline;
}

/* Широкие таблицы прокручиваются в своей рамке, страница по горизонтали не едет. */
.comparison-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.comparison-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

.comparison-table-wrap th,
.comparison-table-wrap td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: top;
}

.comparison-table-wrap th {
    background: rgba(139, 92, 246, 0.1);
    font-weight: 700;
}

.comparison-table-wrap tr:last-child td {
    border-bottom: none;
}

/* FAQ и источники */
.faq-item {
    margin-bottom: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--glass);
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
}

.faq-item p {
    margin: 0.75rem 0 0;
    color: var(--text-muted);
}

.sources ul {
    margin: 1rem 0 0 1.25rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.sources a {
    color: var(--primary);
}

/* Блок целевых действий */
.cta-stack {
    position: sticky;
    top: 1.5rem;
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(59, 130, 246, 0.08));
}

.cta-stack h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.cta-lead {
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.cta-primary {
    display: block;
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.cta-primary:hover {
    background: var(--primary-dark);
}

.cta-links {
    margin: 1.25rem 0 0 1.125rem;
    font-size: 0.9375rem;
}

.cta-links a {
    color: var(--text);
}

.cta-checklist {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.cta-checklist a {
    color: var(--accent);
}

/* Карточки: «Читайте также» и хабы */
.related,
.hub-group {
    grid-column: 1 / -1;
    margin-top: 3rem;
}

.related h2,
.hub-group h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.content-card {
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.content-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.content-card h3 {
    font-size: 1.0625rem;
    line-height: 1.35;
    margin-bottom: 0.6rem;
}

.content-card h3 a {
    color: var(--text);
    text-decoration: none;
}

.content-card p {
    font-size: 0.9375rem;
    color: var(--text-muted);
}

/* Форма аудита. Работает и без audit.js — это прогрессивное улучшение. */
.audit-form {
    margin: 2rem 0;
    padding: 1.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--glass);
}

.audit-question {
    margin-bottom: 1.5rem;
    padding: 0 0 1.25rem;
    border: none;
    border-bottom: 1px solid var(--glass-border);
}

.audit-question:last-of-type {
    border-bottom: none;
}

.audit-question legend {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.audit-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

.audit-option input {
    margin-top: 0.35rem;
    flex: 0 0 auto;
    accent-color: var(--primary);
}

.audit-submit {
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.audit-submit:hover {
    background: var(--primary-dark);
}

.audit-result {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.audit-result[data-level="low"] {
    border-color: rgba(16, 185, 129, 0.4);
}

.audit-result[data-level="medium"] {
    border-color: rgba(139, 92, 246, 0.4);
}

.audit-result[data-level="high"] {
    border-color: rgba(239, 68, 68, 0.45);
}

/* Подвал */
.seo-footer {
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 2.5rem 2rem 3rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-requisites p {
    margin-bottom: 0.35rem;
}

.footer-requisites a {
    display: inline-block;
    margin-right: 1.5rem;
    color: var(--text-muted);
}

.footer-copy {
    margin-top: 1.25rem;
}

/* Одна колонка: CTA перестаёт быть врезкой и уезжает под текст. */
@media (max-width: 900px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    .cta-stack {
        position: static;
    }

    .article-body h1 {
        font-size: 2.25rem;
    }

    .article-body h2 {
        font-size: 1.625rem;
    }
}

@media (max-width: 640px) {
    .seo-header,
    .article-layout,
    .seo-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .article-body h1 {
        font-size: 1.875rem;
    }

    .cta-primary,
    .audit-submit {
        display: block;
        width: 100%;
    }

    .audit-form {
        padding: 1.25rem 1rem;
    }

    .footer-requisites a {
        display: block;
        margin-right: 0;
        margin-bottom: 0.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .content-card {
        transition: none;
    }
}
