:root {
    /* Объявляем схему явно: иначе браузер при системной тёмной теме
       применяет к странице автозатемнение и переключатель темы
       перестаёт работать. */
    color-scheme: light;
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --surface-3: #e2e8f0;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #475569;
    --text-subtle: #64748b;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --accent-softer: rgba(37, 99, 235, 0.04);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.1);
    --success: #059669;
    --success-soft: rgba(5, 150, 105, 0.1);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --code-bg: #f8fafc;
    --code-border: #e2e8f0;
    --code-keyword: #7c3aed;
    --code-string: #059669;
    --code-comment: #64748b;
    --code-number: #ea580c;
    --code-fn: #2563eb;
    --code-type: #0891b2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  }

  [data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1f2937;
    --surface-3: #374151;
    --border: #1f2937;
    --border-strong: #374151;
    --text: #f9fafb;
    --text-muted: #cbd5e1;
    --text-subtle: #94a3b8;
    --accent: #60a5fa;
    --accent-strong: #93c5fd;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --accent-softer: rgba(96, 165, 250, 0.06);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --code-bg: #0f172a;
    --code-border: #1f2937;
    --code-keyword: #c084fc;
    --code-string: #34d399;
    --code-comment: #64748b;
    --code-number: #fb923c;
    --code-fn: #60a5fa;
    --code-type: #22d3ee;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; scroll-padding-top: 80px; }

  .metrika-pixel {
    position: absolute;
    left: -9999px;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
  }
  ::selection { background: var(--accent-soft); color: var(--text); }
  a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
  a:hover { color: var(--accent-strong); }
  .container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

  .reading-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: transparent; z-index: 110; pointer-events: none;
  }
  .reading-progress-bar {
    height: 100%; background: var(--accent); width: 0%;
    transition: width 0.1s ease-out;
  }

  .site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .site-header .container {
    display: flex; align-items: center; justify-content: space-between; height: 60px;
  }
  .brand-back {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--text-muted); font-size: 14px; font-weight: 500;
    padding: 8px 14px; border-radius: 8px; transition: all 0.2s;
  }
  .brand-back:hover { color: var(--text); background: var(--surface); }
  .brand-back svg { width: 16px; height: 16px; }
  .header-actions { display: flex; gap: 8px; align-items: center; }
  .icon-btn {
    background: transparent; border: 1px solid var(--border-strong); border-radius: 10px;
    padding: 8px; cursor: pointer; color: var(--text-muted);
    display: inline-flex; align-items: center; transition: all 0.2s;
  }
  .icon-btn:hover { color: var(--text); border-color: var(--accent); }
  .icon-btn svg { width: 18px; height: 18px; }
  .theme-toggle .moon { display: none; }
  [data-theme="dark"] .theme-toggle .sun { display: none; }
  [data-theme="dark"] .theme-toggle .moon { display: block; }
  .toc-toggle { display: none; }

  .layout {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    display: grid; grid-template-columns: 300px 1fr; gap: 56px; align-items: start;
  }

  .toc {
    position: sticky; top: 84px; max-height: calc(100vh - 100px);
    overflow-y: auto; padding: 24px 0 24px 4px;
    border-right: 1px solid var(--border); padding-right: 20px;
  }
  .toc::-webkit-scrollbar { width: 6px; }
  .toc::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
  .toc-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-subtle); margin-bottom: 14px; padding-left: 14px;
  }
  .toc-pair {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--accent); margin: 16px 0 6px; padding-left: 14px;
    display: flex; align-items: center; gap: 8px;
  }
  .toc-pair::after { content: ''; flex: 1; height: 1px; background: var(--border); }
  .toc-pair:first-of-type { margin-top: 4px; }
  .toc-list { list-style: none; }
  .toc-list li { position: relative; }
  .toc-list a {
    display: flex; align-items: baseline; gap: 10px; padding: 7px 14px;
    border-radius: 6px; color: var(--text-muted); font-size: 13.5px; line-height: 1.4;
    transition: all 0.15s; border-left: 2px solid transparent; margin-bottom: 1px;
  }
  .toc-list a:hover { color: var(--text); background: var(--surface); }
  .toc-list .toc-num {
    font-variant-numeric: tabular-nums; font-size: 11px;
    color: var(--text-subtle); font-weight: 600; flex-shrink: 0;
  }
  .toc-list a.active {
    color: var(--accent); background: var(--accent-soft);
    border-left-color: var(--accent); font-weight: 500;
  }
  .toc-list a.active .toc-num { color: var(--accent); }

  .content { max-width: 780px; padding: 32px 0 80px; overflow-x: clip; }

  .hero { padding: 32px 0 56px; border-bottom: 1px solid var(--border); margin-bottom: 56px; }
  .hero-eyebrow {
    display: inline-block; font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); background: var(--accent-soft);
    padding: 6px 12px; border-radius: 6px; margin-bottom: 24px;
  }
  .hero h1 {
    font-size: clamp(34px, 5vw, 52px); font-weight: 700; letter-spacing: -0.025em;
    line-height: 1.1; margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent-strong) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  }
  [data-theme="dark"] .hero h1 {
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  }
  .hero-lead {
    font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55;
    color: var(--text-muted); margin-bottom: 36px; max-width: 700px;
  }
  .hero-meta {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; padding: 20px 24px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  }
  .hero-meta-item { display: flex; flex-direction: column; gap: 4px; }
  .hero-meta-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-subtle);
  }
  .hero-meta-value { font-size: 14.5px; color: var(--text); font-weight: 500; }

  .section { padding: 56px 0 16px; scroll-margin-top: 80px; }
  .section-eyebrow {
    display: flex; align-items: center; gap: 14px;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); margin-bottom: 16px;
  }
  .section-eyebrow::before { content: ''; width: 24px; height: 1.5px; background: var(--accent); }
  .section-num { font-variant-numeric: tabular-nums; }
  .section h2 {
    font-size: clamp(28px, 3.4vw, 38px); font-weight: 700;
    letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 20px; color: var(--text);
  }
  .section h3 {
    font-size: 22px; font-weight: 600; letter-spacing: -0.015em;
    line-height: 1.25; margin: 36px 0 14px; color: var(--text);
  }
  .section h4 {
    font-size: 16px; font-weight: 600; letter-spacing: -0.005em;
    margin: 24px 0 10px; color: var(--text);
  }
  .section p { font-size: 17px; line-height: 1.7; margin-bottom: 18px; color: var(--text); }
  .section p.lead {
    font-size: 19px; line-height: 1.6; color: var(--text-muted); margin-bottom: 28px;
  }
  .section ul, .section ol { margin: 16px 0 24px 0; padding-left: 24px; }
  .section ul li, .section ol li {
    font-size: 17px; line-height: 1.65; margin-bottom: 10px; color: var(--text);
  }
  .section strong { color: var(--text); font-weight: 600; }
  .section em { color: var(--text); font-style: italic; }

  .section :not(pre) > code, .ic {
    font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.88em; padding: 2px 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 5px; color: var(--text); overflow-wrap: anywhere; word-break: break-word;
  }

  .callout {
    border-left: 3px solid var(--accent); background: var(--accent-softer);
    padding: 18px 22px; margin: 24px 0; border-radius: 0 10px 10px 0;
  }
  .callout p { font-size: 16.5px; margin-bottom: 0; color: var(--text); }
  .callout p + p { margin-top: 10px; }
  .callout strong { color: var(--accent); }
  .callout.warning { border-left-color: var(--warning); background: var(--warning-soft); }
  .callout.warning strong { color: var(--warning); }
  .callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
  .callout.danger strong { color: var(--danger); }
  .callout.success { border-left-color: var(--success); background: var(--success-soft); }
  .callout.success strong { color: var(--success); }

  .table-wrap { overflow-x: auto; margin: 24px 0; }
  table.data {
    width: 100%; border-collapse: collapse; font-size: 15px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
  }
  table.data th, table.data td {
    text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border);
    vertical-align: top;
  }
  table.data th {
    font-weight: 600; color: var(--text-subtle); text-transform: uppercase;
    letter-spacing: 0.04em; font-size: 12px; background: var(--surface-2);
  }
  table.data tr:last-child td { border-bottom: none; }
  table.data td:first-child { font-weight: 500; }
  table.data .num { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
  table.data .tag {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; background: var(--accent-soft);
    color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em;
  }
  table.data .tag.bad { background: var(--danger-soft); color: var(--danger); }
  table.data .tag.good { background: var(--success-soft); color: var(--success); }
  table.data .tag.warn { background: var(--warning-soft); color: var(--warning); }

  pre.code {
    margin: 20px 0; padding: 18px 20px;
    background: var(--code-bg); border: 1px solid var(--code-border);
    border-radius: 10px; overflow-x: auto;
    font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13.5px; line-height: 1.55; color: var(--text);
  }
  pre.code code { font-family: inherit; font-size: inherit; }
  pre.code .kw { color: var(--code-keyword); font-weight: 500; }
  pre.code .str { color: var(--code-string); }
  pre.code .cm { color: var(--code-comment); font-style: italic; }
  pre.code .type { color: var(--code-type); }
  pre.code .num { color: var(--code-number); }
  pre.code .fn { color: var(--code-fn); }
  pre.code .ty { color: var(--code-type); }
  pre.code .hl { background: var(--warning-soft); border-radius: 3px; padding: 1px 3px; margin: 0 -3px; }
  pre.code .hl-bad { background: var(--danger-soft); border-radius: 3px; padding: 1px 3px; margin: 0 -3px; }
  pre.code .hl-good { background: var(--success-soft); border-radius: 3px; padding: 1px 3px; margin: 0 -3px; }
  .code-label {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-subtle); margin: 24px 0 -12px;
  }
  .code-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); }
  .code-label.bad { color: var(--danger); }
  .code-label.bad .dot { background: var(--danger); }
  .code-label.good { color: var(--success); }
  .code-label.good .dot { background: var(--success); }

  .two-col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 28px 0;
  }
  .two-col > *, .col-card { min-width: 0; }
  .col-card {
    padding: 24px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 14px;
  }
  .col-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .col-card h3 { margin: 0; font-size: 18px; }
  .col-card p { font-size: 15px; line-height: 1.6; margin-bottom: 14px; }
  .col-card ul { margin: 10px 0 0; padding-left: 20px; }
  .col-card li { font-size: 14.5px; line-height: 1.55; margin-bottom: 7px; color: var(--text-muted); }
  .col-tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .col-tag {
    font-size: 12px; font-weight: 500; padding: 4px 10px;
    background: var(--bg); border: 1px solid var(--border-strong);
    border-radius: 6px; color: var(--text-muted);
  }

  .phases {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; margin: 28px 0;
  }
  .phase {
    padding: 22px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; position: relative;
  }
  .phase-num {
    font-size: 36px; font-weight: 700; color: var(--accent);
    opacity: 0.3; line-height: 1; margin-bottom: 8px; font-variant-numeric: tabular-nums;
  }
  .phase h4 { font-size: 17px; margin: 0 0 10px; }
  .phase ul { padding-left: 18px; margin: 0; }
  .phase li { font-size: 14.5px; line-height: 1.5; margin-bottom: 6px; color: var(--text-muted); }

  .accordion { margin: 28px 0; display: flex; flex-direction: column; gap: 10px; }
  .acc-item {
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); overflow: hidden;
  }
  .acc-summary {
    list-style: none; cursor: pointer; padding: 18px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    font-size: 16px; font-weight: 600; color: var(--text);
    transition: background 0.2s; user-select: none;
  }
  .acc-summary::-webkit-details-marker { display: none; }
  .acc-summary:hover { background: var(--surface-2); }
  .acc-summary-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .acc-summary-left > span:last-child { min-width: 0; }
  .acc-tag {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 4px 8px; background: var(--accent-soft); color: var(--accent);
    border-radius: 5px; flex-shrink: 0;
  }
  .acc-tag.bad { background: var(--danger-soft); color: var(--danger); }
  .acc-icon { width: 18px; height: 18px; color: var(--text-subtle); transition: transform 0.2s; flex-shrink: 0; }
  .acc-item[open] .acc-icon { transform: rotate(180deg); }
  .acc-body {
    padding: 4px 22px 22px; border-top: 1px solid var(--border); margin-top: -1px;
  }
  .acc-body ol, .acc-body ul { margin: 14px 0 0; padding-left: 20px; }
  .acc-body li {
    font-size: 15.5px; margin-bottom: 8px; line-height: 1.55; color: var(--text);
  }
  .acc-body p {
    font-size: 15.5px; line-height: 1.6; color: var(--text-muted); margin: 14px 0 0;
  }
  .acc-body p:first-child { margin-top: 14px; }
  .acc-body strong { color: var(--text); }
  .acc-body table.data { font-size: 14px; margin: 14px 0; }
  .acc-body table.data th, .acc-body table.data td { padding: 8px 12px; }
  .acc-body pre.code { font-size: 12.5px; }

  .checklist {
    list-style: none !important; padding-left: 0 !important; margin: 16px 0 24px !important;
  }
  .checklist li {
    position: relative; padding: 10px 0 10px 32px;
    font-size: 15.5px !important; line-height: 1.55 !important;
    border-bottom: 1px solid var(--border); margin-bottom: 0 !important;
  }
  .checklist li:last-child { border-bottom: none; }
  .checklist li::before {
    content: ''; position: absolute; left: 0; top: 14px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--success-soft); border: 1.5px solid var(--success);
  }
  .checklist li::after {
    content: ''; position: absolute; left: 5px; top: 19px;
    width: 8px; height: 4px;
    border-left: 2px solid var(--success); border-bottom: 2px solid var(--success);
    transform: rotate(-45deg);
  }
  .checklist li strong { color: var(--text); }
  .checklist li code { font-size: 13px !important; }

  .key-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px; margin: 24px 0;
  }
  .key-stat {
    padding: 16px 18px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
  }
  .key-stat-value {
    font-size: 22px; font-weight: 700; color: var(--accent);
    letter-spacing: -0.02em; line-height: 1.1;
    margin-bottom: 4px; font-variant-numeric: tabular-nums;
  }
  .key-stat-label { font-size: 12.5px; color: var(--text-muted); line-height: 1.35; }

  .roadmap { margin: 28px 0; display: flex; flex-direction: column; gap: 12px; }
  .roadmap-step {
    display: grid; grid-template-columns: 56px 1fr; gap: 18px;
    padding: 18px 22px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    align-items: start;
  }
  .roadmap-num {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--accent); color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
    flex-shrink: 0;
  }
  .roadmap-content h4 { font-size: 16px; margin: 0 0 6px; }
  .roadmap-content p { font-size: 14.5px; margin: 0; color: var(--text-muted); line-height: 1.55; }
  .roadmap-content .roadmap-meta { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
  .roadmap-tag {
    font-size: 11px; font-weight: 600; padding: 3px 8px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: 4px; color: var(--text-muted); letter-spacing: 0.04em;
  }
  .roadmap-tag.warn { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
  .roadmap-tag.success { background: var(--success-soft); border-color: var(--success); color: var(--success); }

  .stack-layers { margin: 28px 0; display: flex; flex-direction: column; gap: 6px; }
  .stack-layer {
    display: grid; grid-template-columns: 40px 1fr; gap: 16px;
    padding: 14px 18px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
    align-items: center; transition: all 0.2s;
  }
  .stack-layer:hover { border-color: var(--accent); }
  .stack-layer.highlight { background: var(--accent-soft); border-color: var(--accent); }
  .stack-layer-num {
    font-size: 15px; font-weight: 700; color: var(--accent);
    font-variant-numeric: tabular-nums; text-align: center;
  }
  .stack-layer-body h4 { font-size: 15.5px; margin: 0 0 3px; }
  .stack-layer-body p { font-size: 13.5px; margin: 0; color: var(--text-muted); line-height: 1.5; }

  .timeline { position: relative; margin: 36px 0; padding: 24px 0; }
  .timeline::before {
    content: ''; position: absolute; left: 0; right: 0; top: 50%;
    height: 2px; background: linear-gradient(90deg, transparent, var(--border-strong) 10%, var(--border-strong) 90%, transparent);
    z-index: 0;
  }
  .timeline-track {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px; position: relative; z-index: 1;
  }
  .timeline-item {
    text-align: center; padding: 18px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px; position: relative;
  }
  .timeline-item::before {
    content: ''; width: 12px; height: 12px;
    background: var(--accent); border-radius: 50%;
    position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    box-shadow: 0 0 0 4px var(--bg);
  }
  .timeline-date { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; margin-bottom: 6px; }
  .timeline-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 4px; color: var(--text); }
  .timeline-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

  .integration-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px; margin: 20px 0;
  }
  .int-item {
    padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--text);
    text-align: center; transition: all 0.2s;
  }
  .int-item:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

  .pair-badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em;
    padding: 5px 11px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    color: var(--text-muted); margin-bottom: 16px;
  }
  .pair-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

  .content-footer { margin-top: 80px; padding: 56px 0 0; border-top: 1px solid var(--border); }
  .content-footer h2 {
    font-size: clamp(26px, 3vw, 34px); font-weight: 700;
    letter-spacing: -0.02em; margin-bottom: 12px;
  }
  .content-footer p.lead { color: var(--text-muted); font-size: 17px; margin-bottom: 28px; }
  .contact-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
  .material-buttons { align-items: center; margin: 20px 0 8px; }
  .button-note { font-size: 14px; color: var(--text-subtle); }
  .btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 20px; border-radius: 10px;
    font-size: 15px; font-weight: 500;
    transition: all 0.2s; border: 1px solid transparent;
  }
  .btn svg { width: 18px; height: 18px; }
  .btn-primary { background: var(--accent); color: #ffffff; box-shadow: var(--shadow-md); }
  .btn-primary:hover { background: var(--accent-strong); color: #ffffff; transform: translateY(-1px); }
  .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
  .btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
  .attribution {
    margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border);
    font-size: 13px; color: var(--text-subtle); line-height: 1.6;
  }
  .attribution-row {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 10px;
  }
  .attribution-row .copy { color: var(--text-muted); }

  .back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent); color: #ffffff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: all 0.25s; z-index: 90;
  }
  .back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
  .back-to-top:hover { background: var(--accent-strong); }
  .back-to-top svg { width: 20px; height: 20px; }

  @media (max-width: 1100px) {
    .layout { grid-template-columns: 250px 1fr; gap: 36px; }
  }
  @media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; gap: 0; }
    .toc {
      position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
      background: var(--bg); border-right: none; border-bottom: 1px solid var(--border);
      padding: 20px 24px; transform: translateY(-100%);
      transition: transform 0.25s ease-out; z-index: 99;
      max-height: 100vh; overflow-y: auto;
    }
    .toc.open { transform: translateY(0); }
    .toc-toggle { display: inline-flex; }
    .content { max-width: 100%; padding: 16px 0 60px; }
    .two-col { grid-template-columns: 1fr; }
    .roadmap-step { grid-template-columns: 48px 1fr; gap: 12px; padding: 14px 16px; }
  }
  @media (max-width: 600px) {
    .container { padding: 0 18px; }
    .layout { padding: 0 18px; }
    .hero { padding: 24px 0 36px; margin-bottom: 36px; }
    .section { padding: 36px 0 8px; }
    .key-stats { grid-template-columns: repeat(2, 1fr); }
    .integration-grid { grid-template-columns: repeat(2, 1fr); }
    pre.code { font-size: 12.5px; padding: 14px 16px; }
    .stack-layer { grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 14px; }
    .material-buttons .btn { width: 100%; justify-content: center; }
  }

  .content, .section, .hero, .hero-meta, .hero-meta-item, .acc-item,
  .table-wrap, pre, code { min-width: 0; }
  .hero h1, .hero-lead, .hero-meta-value, .section h2, .content-footer h2,
  .acc-summary-left span, .btn { overflow-wrap: anywhere; }
  img, svg { max-width: 100%; }
  @media (max-width: 600px) {
    .hero h1 { font-size: clamp(30px, 10vw, 40px); }
    .hero-meta, .key-stats, .integration-grid { grid-template-columns: 1fr; }
    .hero-eyebrow { white-space: normal; }
  }

  /* ---- Содержательные иллюстрации (inline SVG). Цвета только через
     классы: CSP style-src 'self' запрещает инлайновые style-атрибуты,
     а классы наследуют переменные светлой и тёмной темы. ---- */
  .figure { margin: 26px 0 30px; }
  .figure-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .figure-scroll:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px;
  }
  .figure-scroll svg { min-width: 640px; width: 100%; height: auto; display: block; }
  .figure figcaption {
    margin-top: 10px; font-size: 13.5px; color: var(--text-subtle);
    line-height: 1.55; max-width: 70ch; overflow-wrap: anywhere;
  }
  .diagram { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif; }
  .diagram .d-mono { font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
  .diagram .d-ink { fill: var(--text); }
  .diagram .d-muted { fill: var(--text-muted); }
  .diagram .d-subtle { fill: var(--text-subtle); }
  .diagram .d-accent { fill: var(--accent); }
  .diagram .d-danger { fill: var(--danger); }
  .diagram .d-ok { fill: var(--success); }
  .diagram .d-warn { fill: var(--warning); }
  .diagram .d-box { fill: var(--surface); stroke: var(--border-strong); }
  .diagram .d-box-plain { fill: var(--bg); stroke: var(--border-strong); }
  .diagram .d-box-accent { fill: var(--accent-soft); stroke: var(--accent); }
  .diagram .d-box-danger { fill: var(--danger-soft); stroke: var(--danger); }
  .diagram .d-box-ok { fill: var(--success-soft); stroke: var(--success); }
  .diagram .d-box-warn { fill: var(--warning-soft); stroke: var(--warning); }
  .diagram .d-frame { fill: none; stroke: var(--accent); stroke-dasharray: 7 5; }
  .diagram .d-line { stroke: var(--border-strong); fill: none; }
  .diagram .d-axis { stroke: var(--border-strong); fill: none; }
  .diagram .d-area-ok { fill: var(--success-soft); }
  .diagram .d-arrow { stroke: var(--text-muted); fill: none; }
  .diagram .d-arrow-accent { stroke: var(--accent); fill: none; }
  .diagram .d-arrow-danger { stroke: var(--danger); fill: none; }
  .diagram .d-arrow-ok { stroke: var(--success); fill: none; }
  .diagram .d-curve { stroke: var(--accent); fill: none; }
  .diagram .d-dot { fill: var(--accent); stroke: var(--bg); }
  .diagram .d-boundary { stroke: var(--danger); stroke-dasharray: 6 5; fill: none; }
  .diagram .mk-ink { fill: var(--text-muted); }
  .diagram .mk-accent { fill: var(--accent); }
  .diagram .mk-danger { fill: var(--danger); }
  .diagram .mk-ok { fill: var(--success); }

  @media print {
    .site-header, .toc, .back-to-top, .reading-progress, .toc-toggle { display: none !important; }
    .layout { grid-template-columns: 1fr; }
    .content { max-width: 100%; }
    body { font-size: 11pt; }
    .section { page-break-inside: avoid; }
    .acc-item { page-break-inside: avoid; }
    .acc-body { display: block !important; }
    details { display: block !important; }
    details > summary { list-style: none; }
    details > *:not(summary) { display: block !important; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
  }
