/* ============================================================================
   docs.download-cs.uz — стили
   Стилистика: Microsoft-clean + Docusaurus-структура
   Темы: light / dark через [data-theme]
============================================================================ */

/* --------------------------------------------------- Переменные тем --- */
:root {
    /* Палитра — light */
    --c-bg:           #ffffff;
    --c-bg-soft:      #f7f7f8;
    --c-bg-elev:      #fbfbfc;
    --c-bg-code:      #f4f5f7;
    --c-border:       #e6e7eb;
    --c-border-strong:#d4d6db;
    --c-text:         #1f1f1f;
    --c-text-soft:    #4f5159;
    --c-text-mute:    #7c7e87;
    --c-text-faint:   #a6a8b0;

    --c-accent:       #0067c0;        /* MS blue */
    --c-accent-hov:   #005ba1;
    --c-accent-soft:  #e7f1fb;
    --c-accent-text:  #ffffff;

    --c-success:      #1f8a3c;
    --c-warning:      #b56500;
    --c-danger:       #c5302a;

    /* Радиусы */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;

    /* Тени */
    --sh-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --sh-sm: 0 2px 4px rgba(15, 23, 42, .06);
    --sh-md: 0 4px 12px rgba(15, 23, 42, .08);
    --sh-lg: 0 12px 32px rgba(15, 23, 42, .12);

    /* Шрифты */
    --ff-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --ff-mono: 'JetBrains Mono', 'SF Mono', Consolas, 'Liberation Mono', monospace;

    /* Размеры layout */
    --topbar-h:       56px;
    --sidebar-w:      280px;
    --toc-w:          240px;
    --content-max:    760px;
    --shell-max:      1440px;

    /* Анимация */
    --t-fast: 120ms ease;
    --t-mid:  200ms cubic-bezier(.2,.6,.2,1);
}

[data-theme="dark"] {
    --c-bg:           #0e1014;
    --c-bg-soft:      #14171c;
    --c-bg-elev:      #1a1d23;
    --c-bg-code:      #1a1d23;
    --c-border:       #24272e;
    --c-border-strong:#2f333b;
    --c-text:         #ebebec;
    --c-text-soft:    #b7b9bf;
    --c-text-mute:    #8b8e96;
    --c-text-faint:   #5e616a;

    --c-accent:       #4cc2ff;
    --c-accent-hov:   #76d1ff;
    --c-accent-soft:  rgba(76, 194, 255, .14);
    --c-accent-text:  #0a0c0f;

    --sh-xs: 0 1px 2px rgba(0, 0, 0, .25);
    --sh-sm: 0 2px 4px rgba(0, 0, 0, .35);
    --sh-md: 0 4px 12px rgba(0, 0, 0, .45);
    --sh-lg: 0 12px 32px rgba(0, 0, 0, .55);
}

/* --------------------------------------------------- Базовый сброс --- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
    margin: 0;
    font-family: var(--ff-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--c-accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-accent-hov); }

img, svg { max-width: 100%; display: block; }

button { font: inherit; cursor: pointer; }

/* --------------------------------------------------- Topbar --- */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--c-border);
    height: var(--topbar-h);
}
[data-theme="dark"] .topbar { background: rgba(14, 16, 20, .85); }

.topbar-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    height: 100%;
    padding: 0 24px;
    display: flex; align-items: center; gap: 24px;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--c-text);
    font-weight: 700;
    letter-spacing: -.01em;
    font-size: 16px;
    white-space: nowrap;
}
.brand:hover { color: var(--c-text); }

.brand-mark {
    display: inline-flex;
    color: var(--c-accent);
}

.brand-name { display: inline-flex; align-items: baseline; gap: 2px; }
.brand-name-dim {
    color: var(--c-text-mute);
    font-weight: 500;
    font-family: var(--ff-mono);
    font-size: 13px;
}

.topbar-nav {
    display: flex; align-items: center; gap: 4px;
    margin-right: auto;
}
.topbar-link {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--c-text-soft);
    font-weight: 500;
    font-size: 14px;
    padding: 7px 12px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast), color var(--t-fast);
}
.topbar-link:hover { background: var(--c-bg-soft); color: var(--c-text); }
.topbar-link.is-active {
    background: var(--c-accent-soft);
    color: var(--c-accent);
}
.topbar-link i { font-size: 13px; }

.topbar-search {
    position: relative;
    width: 320px;
    max-width: 32vw;
}
.topbar-search-input {
    width: 100%;
    height: 36px;
    padding: 0 36px 0 36px;
    background: var(--c-bg-soft);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text);
    font-size: 14px;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.topbar-search-input::placeholder { color: var(--c-text-mute); }
.topbar-search-input:focus {
    outline: none;
    border-color: var(--c-accent);
    background: var(--c-bg);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.topbar-search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-mute);
    font-size: 13px;
    pointer-events: none;
}
.topbar-search-kbd {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    font: 600 11px/1 var(--ff-mono);
    color: var(--c-text-mute);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xs);
    padding: 2px 6px;
}

.topbar-actions {
    display: flex; align-items: center; gap: 8px;
}

.lang-switch {
    display: inline-flex;
    background: var(--c-bg-soft);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 2px;
}
.lang-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-weight: 600;
    font-size: 12px;
    color: var(--c-text-mute);
    border-radius: 4px;
    transition: all var(--t-fast);
}
.lang-btn:hover { color: var(--c-text); }
.lang-btn.is-active {
    background: var(--c-bg);
    color: var(--c-text);
    box-shadow: var(--sh-xs);
}
[data-theme="dark"] .lang-btn.is-active { background: var(--c-bg-elev); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    color: var(--c-text-soft);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    transition: all var(--t-fast);
}
.icon-btn:hover {
    background: var(--c-bg-soft);
    color: var(--c-text);
    border-color: var(--c-border);
}

.mobile-only { display: none; }

/* --------------------------------------------------- Hero --- */
.hero {
    position: relative;
    padding: 80px 24px 64px;
    text-align: center;
    overflow: hidden;
    border-bottom: 1px solid var(--c-border);
}
.hero-inner { max-width: 760px; margin: 0 auto; position: relative; z-index: 1; }

.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    background: var(--c-bg-soft);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--c-text-soft);
    font-weight: 500;
    margin-bottom: 24px;
}
.eyebrow-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--c-success);
    box-shadow: 0 0 0 4px rgba(31, 138, 60, .12);
}

.hero-title {
    font-size: clamp(40px, 7vw, 64px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.025em;
    margin: 0 0 18px;
    color: var(--c-text);
    background: linear-gradient(180deg, var(--c-text) 0%, var(--c-text-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-lead {
    font-size: 18px;
    line-height: 1.55;
    color: var(--c-text-soft);
    max-width: 580px;
    margin: 0 auto 32px;
}

.hero-cta {
    display: inline-flex; gap: 12px;
    margin-bottom: 48px;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-stats {
    display: inline-flex; align-items: center; gap: 32px;
    padding: 16px 28px;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
}
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat-num {
    font-size: 26px; font-weight: 700;
    line-height: 1;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
}
.hero-stat-label {
    font-size: 12px;
    color: var(--c-text-mute);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 6px;
}
.hero-stat-divider {
    width: 1px;
    height: 32px;
    background: var(--c-border);
}

.hero-glow {
    position: absolute;
    inset: -50% 10% auto 10%;
    height: 320px;
    background: radial-gradient(ellipse at top, var(--c-accent-soft) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* --------------------------------------------------- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600; font-size: 14px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: all var(--t-fast);
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary {
    background: var(--c-accent);
    color: var(--c-accent-text);
}
.btn-primary:hover {
    background: var(--c-accent-hov);
    color: var(--c-accent-text);
    transform: translateY(-1px);
    box-shadow: var(--sh-md);
}
.btn-ghost {
    background: var(--c-bg);
    color: var(--c-text);
    border-color: var(--c-border-strong);
}
.btn-ghost:hover {
    background: var(--c-bg-soft);
    color: var(--c-text);
    border-color: var(--c-text-mute);
}

/* --------------------------------------------------- Категории на главной --- */
.cats-section { padding: 64px 24px; }
.cats-container { max-width: var(--shell-max); margin: 0 auto; }

.section-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0 0 32px;
    color: var(--c-text);
}

.cats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.cat-card {
    display: flex; gap: 16px;
    padding: 24px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text);
    transition: all var(--t-mid);
    position: relative;
    overflow: hidden;
}
.cat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-accent-soft) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--t-mid);
    pointer-events: none;
}
.cat-card:hover {
    border-color: var(--c-accent);
    transform: translateY(-2px);
    box-shadow: var(--sh-md);
    color: var(--c-text);
}
.cat-card:hover::before { opacity: 1; }

.cat-card-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: var(--c-accent-soft);
    color: var(--c-accent);
    font-size: 20px;
}
.cat-card-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.cat-card-title { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.cat-card-desc {
    font-size: 14px; line-height: 1.5;
    color: var(--c-text-soft);
    margin: 0 0 16px;
}
.cat-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px;
    color: var(--c-text-mute);
}
.cat-card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.cat-card-arrow {
    transition: transform var(--t-mid);
    color: var(--c-accent);
}
.cat-card:hover .cat-card-arrow { transform: translateX(4px); }

/* --------------------------------------------------- Help секция --- */
.help-section { padding: 0 24px 80px; }
.help-container {
    max-width: var(--shell-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}
.help-card {
    display: flex; align-items: center; gap: 20px;
    padding: 24px;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
}
.help-card h3 { font-size: 17px; margin: 0 0 4px; color: var(--c-text); }
.help-card p { font-size: 14px; color: var(--c-text-soft); margin: 0; line-height: 1.5; }
.help-card-icon {
    flex-shrink: 0;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: #5865F2;
    color: #fff;
    font-size: 22px;
}
.help-card-icon-alt { background: var(--c-text); color: var(--c-bg); }
.help-card .btn { flex-shrink: 0; }

/* --------------------------------------------------- Docs shell layout --- */
.docs-shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
    gap: 40px;
    align-items: flex-start;
}

.docs-shell:has(.docs-content-wide) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.docs-shell:not(:has(.toc)) { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* --------------------------------------------------- Sidebar --- */
.sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
    align-self: flex-start;
    max-height: calc(100vh - var(--topbar-h) - 48px);
    overflow-y: auto;
    padding-right: 8px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar-section { display: flex; flex-direction: column; }

.sidebar-section-head {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    color: var(--c-text);
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
    text-decoration: none;
}
.sidebar-section-head:hover { background: var(--c-bg-soft); color: var(--c-text); }
.sidebar-section-head.is-active {
    background: var(--c-accent-soft);
    color: var(--c-accent);
}
.sidebar-section-head i { font-size: 14px; opacity: .9; }
.sidebar-section-head > span:nth-child(2) { flex: 1; }

.sidebar-section-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-mute);
    background: var(--c-bg-soft);
    padding: 2px 7px;
    border-radius: 999px;
}
.sidebar-section-head.is-active .sidebar-section-count {
    background: var(--c-bg);
    color: var(--c-accent);
}

.sidebar-list {
    list-style: none;
    padding: 4px 0 8px 32px;
    margin: 0;
    display: flex; flex-direction: column;
    gap: 1px;
    border-left: 1px solid var(--c-border);
    margin-left: 18px;
}

.sidebar-link {
    display: block;
    padding: 6px 12px;
    font-size: 13.5px;
    color: var(--c-text-soft);
    border-radius: var(--r-xs);
    line-height: 1.4;
    transition: all var(--t-fast);
    margin-left: -1px;
    border-left: 2px solid transparent;
}
.sidebar-link:hover {
    color: var(--c-text);
    background: var(--c-bg-soft);
}
.sidebar-link.is-active {
    color: var(--c-accent);
    border-left-color: var(--c-accent);
    background: var(--c-accent-soft);
    font-weight: 500;
}

/* --------------------------------------------------- Контент --- */
.docs-content {
    min-width: 0;
    max-width: var(--content-max);
    padding: 16px 0 64px;
}
.docs-content-wide { max-width: 100%; }
.docs-content-narrow { max-width: 720px; margin: 0 auto; padding: 24px 24px 64px; }

.breadcrumbs {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--c-text-mute);
    margin-bottom: 24px;
}
.breadcrumbs a { color: var(--c-text-mute); }
.breadcrumbs a:hover { color: var(--c-accent); }
.breadcrumbs .sep { color: var(--c-text-faint); }
.breadcrumbs > span:last-child { color: var(--c-text); font-weight: 500; }

.docs-title {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.15;
    margin: 0 0 12px;
    color: var(--c-text);
}
.docs-title-tail { color: var(--c-text-mute); font-weight: 500; }
.docs-lead {
    font-size: 17px;
    color: var(--c-text-soft);
    line-height: 1.55;
    margin: 0 0 32px;
}

/* Заголовок категории с иконкой */
.cat-head {
    display: flex; align-items: flex-start; gap: 20px;
    margin-bottom: 32px;
}
.cat-head-icon {
    flex-shrink: 0;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-md);
    background: var(--c-accent-soft);
    color: var(--c-accent);
    font-size: 24px;
}
.cat-head .docs-title { margin-bottom: 8px; }
.cat-head .docs-lead { margin-bottom: 0; }

/* --------------------------------------------------- Группы /docs --- */
.docs-group { margin: 48px 0; }
.docs-group:first-of-type { margin-top: 8px; }
.docs-group-head { margin-bottom: 20px; }
.docs-group-title {
    font-size: 22px; font-weight: 600;
    margin: 0 0 8px;
    display: flex; align-items: center; gap: 10px;
}
.docs-group-title a {
    color: var(--c-text);
    text-decoration: none;
}
.docs-group-title a:hover { color: var(--c-accent); }
.docs-group-title i {
    font-size: 18px;
    color: var(--c-accent);
}
.docs-group-desc {
    color: var(--c-text-soft);
    margin: 0;
    font-size: 14px;
}

.docs-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.article-card {
    display: flex; gap: 14px;
    padding: 16px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text);
    transition: all var(--t-fast);
}
.article-card:hover {
    border-color: var(--c-accent);
    background: var(--c-bg-elev);
    color: var(--c-text);
    transform: translateY(-1px);
    box-shadow: var(--sh-sm);
}
.article-card-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: var(--c-bg-soft);
    color: var(--c-text-soft);
    font-size: 14px;
    transition: all var(--t-fast);
}
.article-card:hover .article-card-icon {
    background: var(--c-accent-soft);
    color: var(--c-accent);
}
.article-card-body { flex: 1; min-width: 0; }
.article-card-body h3 {
    font-size: 14.5px; font-weight: 600;
    margin: 0 0 4px;
    color: var(--c-text);
    line-height: 1.4;
}
.article-card-body p {
    font-size: 13px; color: var(--c-text-mute);
    margin: 0; line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --------------------------------------------------- Статья --- */
.article-head { margin-bottom: 32px; }
.article-head h1 {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.15;
    margin: 0 0 12px;
    color: var(--c-text);
}
.article-lead {
    font-size: 18px;
    line-height: 1.55;
    color: var(--c-text-soft);
    margin: 0 0 18px;
}
.article-meta {
    display: flex; flex-wrap: wrap; gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    font-size: 13px;
    color: var(--c-text-mute);
}
.article-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.article-meta-item i { font-size: 13px; }

/* Markdown body */
.md-body { font-size: 15.5px; line-height: 1.7; color: var(--c-text); }
.md-body > * { margin: 0 0 18px; }
.md-body > *:last-child { margin-bottom: 0; }

.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
    color: var(--c-text);
    margin-top: 40px;
    margin-bottom: 12px;
    position: relative;
}
.md-body h1 { font-size: 28px; }
.md-body h2 {
    font-size: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c-border);
}
.md-body h3 { font-size: 19px; }
.md-body h4 { font-size: 16px; }

.md-anchor {
    color: var(--c-text-faint);
    margin-left: 8px;
    text-decoration: none;
    font-weight: 400;
    opacity: 0;
    transition: opacity var(--t-fast);
}
.md-body h1:hover .md-anchor,
.md-body h2:hover .md-anchor,
.md-body h3:hover .md-anchor,
.md-body h4:hover .md-anchor { opacity: 1; }
.md-anchor:hover { color: var(--c-accent); }

.md-body p { margin: 0 0 16px; }

.md-body a.md-link {
    color: var(--c-accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    border-bottom-color: rgba(0, 103, 192, .3);
    transition: border-color var(--t-fast);
}
[data-theme="dark"] .md-body a.md-link { border-bottom-color: rgba(76, 194, 255, .4); }
.md-body a.md-link:hover { border-bottom-color: currentColor; }

.md-body ul.md-list, .md-body ol.md-list { padding-left: 26px; margin: 0 0 16px; }
.md-body ul.md-list li, .md-body ol.md-list li { margin: 4px 0; }

/* Инлайн-код */
.md-code-inline {
    font-family: var(--ff-mono);
    font-size: .88em;
    padding: 2px 6px;
    background: var(--c-bg-code);
    color: var(--c-accent);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xs);
    font-weight: 500;
    word-break: break-word;
}

/* Блок кода */
.md-body pre.md-code {
    margin: 16px 0 20px;
    padding: 16px 18px;
    background: var(--c-bg-code);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    overflow-x: auto;
    font-family: var(--ff-mono);
    font-size: 13.5px;
    line-height: 1.6;
}
.md-body pre.md-code code {
    font-family: inherit;
    color: var(--c-text);
    background: transparent;
    border: none;
    padding: 0;
    white-space: pre;
    display: block;
}

/* Цитата */
.md-body blockquote.md-quote {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--c-bg-soft);
    border-left: 3px solid var(--c-accent);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--c-text-soft);
    font-style: italic;
}
.md-body blockquote.md-quote p:last-child { margin-bottom: 0; }

/* Таблица */
.md-table-wrap { overflow-x: auto; margin: 16px 0 20px; }
.md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.md-table th, .md-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}
.md-table th {
    background: var(--c-bg-soft);
    font-weight: 600;
    color: var(--c-text);
}

/* HR */
.md-body hr.md-hr {
    border: none;
    border-top: 1px solid var(--c-border);
    margin: 32px 0;
}

/* mark */
.md-body mark {
    background: rgba(245, 200, 70, .35);
    padding: 2px 4px;
    border-radius: 3px;
    color: inherit;
}

/* --------------------------------------------------- Pager (prev/next) --- */
.article-pager {
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.pager-link {
    display: flex; flex-direction: column;
    gap: 6px;
    padding: 14px 18px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text);
    transition: all var(--t-fast);
}
.pager-link:hover {
    border-color: var(--c-accent);
    background: var(--c-bg-elev);
    color: var(--c-text);
    transform: translateY(-1px);
    box-shadow: var(--sh-sm);
}
.pager-next { text-align: right; }
.pager-dir {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px;
    color: var(--c-text-mute);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}
.pager-next .pager-dir { justify-content: flex-end; }
.pager-title { font-size: 15px; font-weight: 600; color: var(--c-text); }

/* --------------------------------------------------- TOC --- */
.toc { position: relative; min-width: 0; }
.toc-sticky {
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
    max-height: calc(100vh - var(--topbar-h) - 48px);
    overflow-y: auto;
    padding-left: 16px;
    border-left: 1px solid var(--c-border);
}
.toc-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--c-text-mute);
    margin: 0 0 12px;
}
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.toc-item a {
    display: block;
    padding: 4px 8px;
    color: var(--c-text-soft);
    border-radius: var(--r-xs);
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -10px;
    padding-left: 10px;
    transition: all var(--t-fast);
}
.toc-item a:hover { color: var(--c-text); }
.toc-item a.is-active {
    color: var(--c-accent);
    border-left-color: var(--c-accent);
    font-weight: 500;
}
.toc-level-3 a { padding-left: 24px; font-size: 12.5px; }

/* --------------------------------------------------- Search --- */
.search-form {
    position: relative;
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.search-form-input {
    flex: 1;
    height: 44px;
    padding: 0 16px 0 44px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text);
    font-size: 15px;
}
.search-form-input:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.search-form-icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-mute);
}
.search-form .btn { padding-left: 24px; padding-right: 24px; }

.search-summary {
    color: var(--c-text-mute);
    font-size: 14px;
    margin: 0 0 20px;
}

.search-results { display: flex; flex-direction: column; gap: 10px; }
.search-result {
    display: block;
    padding: 18px 20px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    color: var(--c-text);
    transition: all var(--t-fast);
}
.search-result:hover {
    border-color: var(--c-accent);
    background: var(--c-bg-elev);
    color: var(--c-text);
    transform: translateY(-1px);
}
.search-result-cat {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px;
    color: var(--c-text-mute);
    margin-bottom: 6px;
}
.search-result-title {
    font-size: 16px; font-weight: 600;
    margin: 0 0 6px;
    color: var(--c-text);
}
.search-result-excerpt {
    font-size: 14px;
    color: var(--c-text-soft);
    margin: 0;
    line-height: 1.5;
}

/* --------------------------------------------------- Empty state --- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--c-text-mute);
}
.empty-state i { font-size: 40px; margin-bottom: 16px; opacity: .5; }
.empty-state p { font-size: 15px; margin: 0; }

/* --------------------------------------------------- Footer --- */
.footer {
    margin-top: 80px;
    padding: 48px 24px 32px;
    background: var(--c-bg-soft);
    border-top: 1px solid var(--c-border);
}
.footer-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 3fr;
    gap: 40px;
}
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--c-text);
    font-size: 16px;
}
.footer-tagline {
    color: var(--c-text-mute);
    font-size: 13.5px;
    line-height: 1.5;
    margin: 0;
    max-width: 300px;
}
.footer-h {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--c-text-mute);
    margin: 0 0 6px;
}
.footer-col a {
    color: var(--c-text-soft);
    font-size: 14px;
    padding: 3px 0;
    display: inline-flex; align-items: center; gap: 8px;
}
.footer-col a:hover { color: var(--c-accent); }
.footer-col-wide {
    text-align: right;
    align-items: flex-end;
}
.footer-text {
    color: var(--c-text-mute);
    font-size: 13px;
    line-height: 1.6;
}
.footer-text a { display: inline; color: var(--c-text-soft); }

/* --------------------------------------------------- Error pages --- */
.error-page {
    text-align: center;
    padding: 120px 24px;
    max-width: 560px;
    margin: 0 auto;
}
.error-code {
    font-size: 96px;
    font-weight: 800;
    line-height: 1;
    color: var(--c-accent);
    margin-bottom: 16px;
    letter-spacing: -.04em;
    font-family: var(--ff-mono);
}
.error-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--c-text);
}
.error-text {
    color: var(--c-text-soft);
    margin: 0 0 32px;
    font-size: 16px;
}
.error-actions {
    display: inline-flex; gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* --------------------------------------------------- Адаптив --- */
@media (max-width: 1200px) {
    :root { --toc-w: 200px; --sidebar-w: 256px; }
    .docs-shell { gap: 24px; }
}

@media (max-width: 1024px) {
    .docs-shell {
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr) !important;
        gap: 32px;
    }
    .toc { display: none; }
    .topbar-search { display: none; }
    .topbar-nav .topbar-link span { display: none; }
    .topbar-nav .topbar-link { padding: 8px 10px; }
}

@media (max-width: 768px) {
    :root { --topbar-h: 52px; --sidebar-w: 260px; }

    .topbar-inner { padding: 0 14px; gap: 12px; }
    .topbar-nav { display: none; }
    .mobile-only { display: inline-flex; }

    .hero { padding: 56px 20px 48px; }
    .hero-title { font-size: clamp(32px, 8vw, 44px); }
    .hero-lead { font-size: 16px; }
    .hero-stats { padding: 12px 16px; gap: 16px; }
    .hero-stat-num { font-size: 22px; }

    .cats-section, .help-section { padding-left: 14px; padding-right: 14px; }
    .section-title { font-size: 22px; }

    .docs-shell {
        grid-template-columns: 1fr !important;
        padding: 16px 14px;
        gap: 0;
    }

    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        bottom: 0;
        width: 84%;
        max-width: 320px;
        max-height: none;
        background: var(--c-bg);
        border-right: 1px solid var(--c-border);
        padding: 20px 16px;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform var(--t-mid);
        box-shadow: var(--sh-lg);
    }
    .sidebar.is-open { transform: translateX(0); }

    .docs-content { padding: 8px 0 48px; }
    .docs-title, .article-head h1 { font-size: 28px; }
    .article-lead { font-size: 16px; }
    .md-body { font-size: 15px; }

    .article-pager { grid-template-columns: 1fr; }

    .footer-inner { grid-template-columns: 1fr; gap: 24px; }
    .footer-col-wide { text-align: left; align-items: flex-start; }

    .help-container { grid-template-columns: 1fr; }
    .help-card { flex-direction: column; align-items: flex-start; text-align: left; gap: 14px; }
    .help-card .btn { width: 100%; justify-content: center; }
}

/* Overlay для мобильного меню */
.mobile-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 85;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-mid);
}
.mobile-overlay.is-open { opacity: 1; pointer-events: auto; }

/* Скролл-стрелка для горизонтальных таблиц */
.md-table-wrap { -webkit-overflow-scrolling: touch; }

/* --------------------------------------------------- Анимации появления --- */
@media (prefers-reduced-motion: no-preference) {
    .hero-inner > * {
        animation: fadeUp 600ms cubic-bezier(.2,.6,.2,1) backwards;
    }
    .hero-eyebrow { animation-delay: 0ms; }
    .hero-title  { animation-delay: 80ms; }
    .hero-lead   { animation-delay: 160ms; }
    .hero-cta    { animation-delay: 240ms; }
    .hero-stats  { animation-delay: 320ms; }

    @keyframes fadeUp {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
    border-radius: 4px;
}
