/* Сайт проекта «Яблоки» — ПаркЛаб, направление Agro */
:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --surface-2: #f3f0e7;
  --text: #1c261c;
  --muted: #5b6a5a;
  --border: #e4dfd1;
  --brand: #2f7d3a;
  --brand-strong: #1e5a28;
  --brand-soft: #e5f1e2;
  --accent: #d6453b;
  --accent-soft: #fbe6e2;
  --orange: #e08a0b;
  --grey: #8a939a;
  --code-bg: #1b2419;
  --code-text: #e3ecdf;
  --band-bg: #1e3a22;
  --band-text: #f1f6ee;
  --shadow: 0 1px 2px rgba(20, 30, 20, .05), 0 10px 30px rgba(20, 30, 20, .07);
  --radius: 16px;
  --maxw: 1200px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Manrope", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f140e; --surface: #161d15; --surface-2: #1c251b; --text: #e6eee3; --muted: #9fb19c;
    --border: #2a3628; --brand: #6cc47a; --brand-strong: #92d99d; --brand-soft: #1b2c1c;
    --accent: #ff6d61; --accent-soft: #3b1f1c; --orange: #f5a524; --grey: #9aa3aa;
    --code-bg: #0b100a; --code-text: #dce7d8; --band-bg: #132616; --band-text: #eef5eb;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f140e; --surface: #161d15; --surface-2: #1c251b; --text: #e6eee3; --muted: #9fb19c;
  --border: #2a3628; --brand: #6cc47a; --brand-strong: #92d99d; --brand-soft: #1b2c1c;
  --accent: #ff6d61; --accent-soft: #3b1f1c; --orange: #f5a524; --grey: #9aa3aa;
  --code-bg: #0b100a; --code-text: #dce7d8; --band-bg: #132616; --band-text: #eef5eb;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font-body); overflow-x: hidden; }
img { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.01em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* Шапка */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand small { display: block; font: 500 .72rem/1.1 var(--font-body); color: var(--muted); letter-spacing: .02em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--brand-strong); background: var(--brand-soft); }
.theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--muted); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; flex: none; }
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
@media (max-width: 860px) {
  .site-header .wrap { flex-wrap: wrap; gap: 6px 12px; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; width: 100%; margin-left: 0; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .theme-toggle { margin-left: auto; }
}

/* Кнопки */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px; font-weight: 700; text-decoration: none; border: 1px solid transparent; transition: transform .15s ease, box-shadow .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { color: #fff; background: var(--brand-strong); }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #0f140e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-primary:hover { color: #0f140e; } }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--brand); }

/* Главная: первый экран */
.hero { padding: 56px 0 40px; background: radial-gradient(1200px 500px at 80% -10%, var(--brand-soft), transparent 60%), radial-gradient(900px 400px at -10% 20%, var(--accent-soft), transparent 55%); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; font-weight: 600; color: var(--muted); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); margin: 18px 0 16px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40em; margin: 0 0 26px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.hero-points div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; font-size: .9rem; color: var(--muted); }
.hero-points strong { display: block; color: var(--text); font-family: var(--font-head); font-size: 1rem; margin-bottom: 2px; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } .hero-points { grid-template-columns: 1fr; } }

/* Макет телефона */
.phone { width: min(360px, 100%); margin: 0 auto; border-radius: 40px; background: #121712; padding: 10px; box-shadow: 0 30px 60px rgba(20, 40, 20, .25); }
.phone-screen { border-radius: 31px; overflow: hidden; background: #d7e4cf; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1px); background-size: 14px 14px; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; background: #2f5f35; color: #fff; }
.chat-top .ava { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.chat-top .ava svg { width: 24px; height: 24px; }
.chat-top b { display: block; font-size: .95rem; }
.chat-top span { font-size: .75rem; opacity: .8; }
.chat { padding: 12px 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 88%; border-radius: 16px; padding: 8px 10px; font-size: .8rem; line-height: 1.4; color: #1b231b; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.msg.me { align-self: flex-end; background: #effdde; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; max-width: 94%; }
.msg .time { display: block; text-align: right; font-size: .65rem; color: #7a8a79; margin-top: 2px; }
.msg .tree { display: block; width: 100%; border-radius: 10px; margin-bottom: 6px; }
.marks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.marks li { display: flex; gap: 7px; align-items: flex-start; }
.badge { flex: none; width: 17px; height: 17px; border-radius: 50%; color: #fff; font: 700 .64rem/17px var(--font-body); text-align: center; }
.b-red { background: #e0453a; } .b-orange { background: #e8920c; } .b-green { background: #2e9e4f; } .b-grey { background: #8d949b; }
.msg .conf { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #dfe5dc; color: #5f6f5e; font-size: .7rem; }
.kbd { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; max-width: 94%; }
.kbd span { background: rgba(47, 95, 53, .78); color: #fff; text-align: center; border-radius: 9px; padding: 6px 4px; font-size: .72rem; font-weight: 600; }
.kbd span:last-child { grid-column: span 2; }

/* Секции главной */
section.block { padding: 64px 0; }
section.block.alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 760px; margin-bottom: 30px; }
.section-head .kicker { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 8px 0 10px; }
.section-head p { color: var(--muted); margin: 0; font-size: 1.05rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
section.alt .stat { background: var(--bg); }
.stat .num { font-family: var(--font-head); font-weight: 800; font-size: 2.2rem; line-height: 1; color: var(--brand); }
.stat .num.red { color: var(--accent); }
.stat p { margin: 10px 0 12px; color: var(--text); font-size: .95rem; }
.stat .src { margin-top: auto; font-size: .78rem; color: var(--muted); }

.insight { margin-top: 22px; padding: 18px 20px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); display: flex; gap: 14px; align-items: flex-start; }
.insight svg { flex: none; width: 26px; height: 26px; color: var(--accent); margin-top: 2px; }
.insight p { margin: 0; }

/* Карта рынка */
.market-map { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.market-map .q { position: absolute; width: 50%; height: 50%; }
.market-map .q1 { left: 0; top: 0; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.market-map .q4 { right: 0; bottom: 0; background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.market-map .axis-x, .market-map .axis-y { position: absolute; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.market-map .axis-x { left: 50%; bottom: 8px; transform: translateX(-50%); white-space: nowrap; }
.market-map .axis-y { left: 8px; top: 50%; transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl; white-space: nowrap; }
.market-map .qlabel { position: absolute; font-size: .72rem; color: var(--muted); font-weight: 600; }
.market-map svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-7px, -50%); display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pin i { width: 12px; height: 12px; border-radius: 50%; background: var(--grey); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); flex: none; }
.pin.research i { background: #6b8fd6; }
.pin.b2b i { background: #9a7b5a; }
.pin.us { font-size: .9rem; font-weight: 800; color: var(--accent); }
.pin.us i { width: 18px; height: 18px; background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.pin.left { flex-direction: row-reverse; transform: translate(calc(-100% + 7px), -50%); }
.pin.us { transform: translate(-10px, -50%); }
.pin.us.left { transform: translate(calc(-100% + 10px), -50%); }
.map-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.market-list { display: none; gap: 12px; }
.market-list .ml { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.market-list .ml.us { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.market-list b { font-family: var(--font-head); margin-bottom: 2px; }
.market-list span { color: var(--muted); font-size: .92rem; }
.market-list span.ours { color: var(--accent); font-weight: 700; }
@media (max-width: 760px) {
  .market-map { display: none; }
  .market-list { display: grid; }
}

/* Как это работает */
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; counter-reset: step; }
.flow .step { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); }
section.alt .flow .step { background: var(--bg); }
.flow .step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; margin-bottom: 10px; }
.flow .step h3 { font-size: 1rem; margin: 0 0 6px; }
.flow .step p { margin: 0; color: var(--muted); font-size: .88rem; }
.flow .step:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%); color: var(--brand); font-weight: 800; z-index: 2; }
.flywheel { margin-top: 16px; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px dashed var(--brand); border-radius: var(--radius); color: var(--brand-strong); background: var(--brand-soft); font-weight: 600; }
.flywheel svg { width: 26px; height: 26px; flex: none; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 22px; height: 6px; border-radius: 3px; display: inline-block; }
@media (max-width: 960px) { .flow { grid-template-columns: 1fr 1fr; } .flow .step::after { display: none; } }
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } }

/* Этапы */
.stages { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); border-top: 6px solid var(--brand); display: flex; flex-direction: column; }
.stage.b2b { border-top-color: var(--accent); }
section.alt .stage { background: var(--bg); }
.stage .tag { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.stage.b2b .tag { color: var(--accent); }
.stage h3 { font-size: 1.4rem; margin: 6px 0 4px; }
.stage .when { color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.stage ul { margin: 0 0 18px; padding-left: 20px; }
.stage li { margin: 6px 0; }
.stage .more { margin-top: auto; font-weight: 700; }
@media (max-width: 860px) { .stages { grid-template-columns: 1fr; } }

/* Дорожная карта */
.timeline { position: relative; margin: 0; padding: 0 0 0 28px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brand), var(--accent)); border-radius: 2px; }
.timeline li { position: relative; padding: 0 0 22px 18px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); }
.timeline li.key::before { border-color: var(--accent); }
.timeline .date { font-family: var(--font-head); font-weight: 800; color: var(--brand-strong); }
.timeline li.key .date, .timeline li.now .date { color: var(--accent); }
.timeline .title { font-weight: 700; }
.timeline p { margin: 2px 0 0; color: var(--muted); font-size: .94rem; }
.timeline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 40px; }
@media (max-width: 860px) { .timeline-grid { grid-template-columns: 1fr; } }

/* Полоса хакатона */
.band { background: var(--band-bg); color: var(--band-text); padding: 60px 0; position: relative; overflow: hidden; }
.band::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(214, 69, 59, .35), transparent 65%); pointer-events: none; }
.band-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; position: relative; z-index: 1; }
.band h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin: 8px 0 12px; }
.band .kicker { color: #ffb3aa; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.band p { color: color-mix(in srgb, var(--band-text) 80%, transparent); }
.band ul { padding-left: 20px; margin: 0 0 22px; }
.band li { margin: 6px 0; }
.band .btn-primary { background: #fff; color: #1e3a22; box-shadow: none; }
.band .btn-primary:hover { background: #eaf3e6; color: #1e3a22; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.countdown div { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; padding: 16px 8px; text-align: center; }
.countdown b { display: block; font: 800 2.2rem/1 var(--font-head); color: #fff; }
.countdown span { font-size: .75rem; opacity: .75; text-transform: uppercase; letter-spacing: .06em; }
.count-note { margin-top: 12px; font-size: .85rem; opacity: .8; text-align: center; }
.prizes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.prizes span { background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 600; }
@media (max-width: 860px) { .band-grid { grid-template-columns: 1fr; } }

/* Документы */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.doc-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
section.alt .doc-card { background: var(--bg); }
.doc-card:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--text); }
.doc-card .no { font: 800 .85rem/1 var(--font-head); color: var(--accent); letter-spacing: .06em; }
.doc-card h3 { margin: 10px 0 8px; font-size: 1.15rem; }
.doc-card p { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.doc-card .meta { margin-top: auto; font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; }
.doc-card .go { color: var(--brand); font-weight: 700; }

/* Решения */
.decisions { counter-reset: d; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.decisions li { counter-increment: d; display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
section.alt .decisions li { background: var(--bg); }
.decisions li::before { content: counter(d); width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 800 1rem var(--font-head); }
.decisions b { display: block; margin-bottom: 2px; }
.decisions span { color: var(--muted); font-size: .94rem; }

/* Страницы документов */
.doc-hero { padding: 40px 0 26px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--brand-soft), transparent); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.doc-hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin: 0 0 12px; max-width: 30em; }
.doc-hero .lead { font-size: 1.08rem; color: var(--muted); max-width: 50em; margin: 0 0 14px; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-meta span { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.wrap.wide { max-width: 1380px; }
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding-top: 30px; padding-bottom: 40px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: .86rem; padding-right: 6px; }
.toc .toc-title { font-weight: 800; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 5px 10px; border-left: 2px solid var(--border); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc li a:hover { color: var(--text); }
.toc li.l3 a { padding-left: 22px; font-size: .82rem; }
.toc li.l4 a { padding-left: 34px; font-size: .8rem; }
.toc li a.active { color: var(--brand-strong); border-left-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.toc details summary { display: none; }
@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: 1fr; gap: 16px; }
  .toc { position: static; max-height: none; }
  .toc details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 6px 10px; }
  .toc details summary { display: block; cursor: pointer; font-weight: 700; padding: 6px 0; }
  .toc .toc-title { display: none; }
}

/* Типографика документа */
.prose { min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.6rem; margin: 2.2em 0 .6em; padding-top: .6em; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.22rem; margin: 1.8em 0 .5em; }
.prose h4 { font-size: 1.05rem; margin: 1.6em 0 .4em; color: var(--brand-strong); }
.prose p, .prose li { max-width: 52em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 2.4em 0; }
.prose strong { font-weight: 700; }
.prose .anchor { margin-left: 8px; color: var(--border); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor { opacity: 1; color: var(--muted); }
.prose a.ext::after { content: "↗"; font-size: .75em; margin-left: 2px; opacity: .7; }
.table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.prose table { border-collapse: collapse; width: 100%; font-size: .88rem; line-height: 1.5; }
.prose table.wide { min-width: 760px; font-size: .85rem; }
.prose th { text-align: left; background: var(--surface-2); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.prose td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.prose tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.prose td:first-child { font-weight: 600; }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: var(--code-bg); color: var(--code-text); padding: 18px; border-radius: 12px; overflow-x: auto; font-size: .82rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose em { color: var(--muted); }

/* Схемы */
figure.diagram { margin: 1.4em 0 2em; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
figure.diagram button { all: unset; display: block; cursor: zoom-in; width: 100%; }
figure.diagram img { display: block; width: 100%; height: auto; max-height: 900px; object-fit: contain; }
figure.diagram figcaption { margin-top: 10px; font-size: .85rem; color: #4f5d4e; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; }
figure.diagram figcaption a { color: #2f7d3a; font-weight: 600; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.gallery figure.diagram { margin: 0; display: flex; flex-direction: column; }
.gallery figure.diagram img { height: 420px; }
.gallery .level { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: #2f7d3a; border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; align-self: flex-start; }
.gallery h3 { margin: 0 0 4px; font-size: 1.05rem; color: #1c261c; }
.gallery p { margin: 0 0 10px; font-size: .88rem; color: #4f5d4e; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 10, .88); display: none; overflow: auto; padding: 56px 20px 20px; }
.lightbox.open { display: block; }
.lightbox img { display: block; margin: 0 auto; background: #fff; border-radius: 10px; padding: 12px; width: min(1400px, 100%); height: auto; }
.lightbox .close { position: fixed; top: 12px; right: 16px; background: #fff; color: #111; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.lightbox .open-new { position: fixed; top: 12px; left: 16px; background: rgba(255,255,255,.14); color: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 600; text-decoration: none; }

/* Навигация между страницами */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 56px; }
.pager a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.pager a:hover { border-color: var(--brand); color: var(--text); }
.pager small { display: block; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pager b { font-family: var(--font-head); }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

.to-top { position: fixed; right: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* Подвал */
.site-footer { border-top: 1px solid var(--border); padding: 30px 0 40px; color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 30px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  section.block { padding: 48px 0; }
  .hero { padding-top: 36px; }
}
@media print {
  .site-header, .toc, .pager, .to-top, .site-footer, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .doc-layout { display: block; }
  .table-wrap { box-shadow: none; overflow: visible; }
  .prose table.wide { min-width: 0; }
}
