/* ==========================================================================
   gavagAI — общий стиль сайта
   Цвета линий: философские основания (phil), технический поворот (tech),
   синтез (synth), база персоналий (base).
   ========================================================================== */
:root {
  --paper: #F7F7F4;
  --surface: #FFFFFF;
  --surface-2: #EFEFEA;
  --ink: #16181D;
  --muted: #676970;
  --hair: #DDDDD6;
  --hair-strong: #C7C7BF;
  --phil: #D6203C;
  --tech: #0070B8;
  --synth: #8E2D9C;
  --base: #6E7076;
  --ghost: #B9BAB2;
  --accent: var(--phil);
  --link: #005C99;
  --mark: rgba(255, 196, 0, .35);
  --shadow: 0 1px 2px rgba(22, 24, 29, .05), 0 8px 24px rgba(22, 24, 29, .06);
  --shadow-lg: 0 20px 60px rgba(22, 24, 29, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1200px;
  --header-h: 64px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'IBM Plex Sans', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111216; --surface: #1A1C21; --surface-2: #23252B; --ink: #ECECE6; --muted: #A2A4AA;
    --hair: #2D3036; --hair-strong: #3D4047; --phil: #F0506A; --tech: #3D9FE3; --synth: #BD6BCC;
    --base: #9A9CA3; --ghost: #54565C; --link: #6DB7F0; --mark: rgba(255, 196, 0, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111216; --surface: #1A1C21; --surface-2: #23252B; --ink: #ECECE6; --muted: #A2A4AA;
  --hair: #2D3036; --hair-strong: #3D4047; --phil: #F0506A; --tech: #3D9FE3; --synth: #BD6BCC;
  --base: #9A9CA3; --ghost: #54565C; --link: #6DB7F0; --mark: rgba(255, 196, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

[data-seg="phil"] { --seg: var(--phil); }
[data-seg="tech"] { --seg: var(--tech); }
[data-seg="synth"] { --seg: var(--synth); }
[data-seg="base"] { --seg: var(--base); }

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em; }
h3 { font-weight: 600; font-size: 1.1rem; }
p { margin: 0 0 1em; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--tech); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Шапка ---------- */
#site-header { min-height: var(--header-h); }
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: 0 0 auto; }
.brand-name { font: 700 19px/1 var(--font-display); letter-spacing: .01em; }
.brand-name b { color: var(--phil); font-weight: 700; }
.nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px; border-radius: 999px; font-size: 14.5px; font-weight: 500; white-space: nowrap;
  color: var(--muted); text-decoration: none; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 220px; height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--hair); border-radius: 999px; background: var(--surface); color: var(--muted);
  cursor: pointer; font-size: 14px; transition: border-color .15s;
}
.search-trigger:hover { border-color: var(--hair-strong); color: var(--ink); }
.search-trigger svg { flex: 0 0 auto; }
.search-trigger kbd { margin-left: auto; }
kbd {
  font: 500 11.5px/1 var(--font); padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--hair); background: var(--surface-2); color: var(--muted);
}
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--surface); cursor: pointer; color: var(--ink);
}
.icon-btn:hover { border-color: var(--hair-strong); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

@media (max-width: 960px) {
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: 56px; }
  #site-header { min-height: calc(var(--header-h) + 44px); }
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 9px; gap: 0; }
  .brand { height: 38px; }
  .nav { order: 3; width: calc(100% + 32px); margin: 6px -16px 0; padding: 0 12px 8px; }
  .nav a { padding: 6px 11px; font-size: 14px; }
}

/* ---------- Подвал ---------- */
.site-footer { margin-top: 72px; border-top: 1px solid var(--hair); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--muted); }

/* ---------- Кнопки, чипы, бейджи ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--phil)); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--hair); }
.btn-ghost:hover { border-color: var(--hair-strong); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 13px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.3;
  transition: border-color .15s, background .15s;
}
a.chip:hover, button.chip:hover { border-color: var(--hair-strong); text-decoration: none; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip small, .chip .count { color: var(--muted); font-weight: 400; }
.chip[aria-pressed="true"] small, .chip.on small, .chip[aria-pressed="true"] .count { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.chip-sm { min-height: 26px; padding: 2px 10px; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--seg, var(--base)); flex: 0 0 auto; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--seg, var(--muted));
}
.num-bullet {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 4px solid var(--seg, var(--base)); font: 700 14px/1 var(--font-display); color: var(--ink);
}
.tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--hair); color: var(--muted);
}

/* ---------- Карточки и секции ---------- */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 22px; }
.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-link:hover { border-color: var(--hair-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.section { padding: 56px 0 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(22px, 2.6vw, 28px); margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 720px; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.page-head { padding: 44px 0 8px; }
.page-head h1 { font-size: clamp(28px, 4vw, 44px); margin-bottom: 12px; }
.page-head .lead { font-size: 18px; color: var(--muted); max-width: 760px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* ---------- Панель фильтров ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin: 26px 0 22px; }
.field {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; min-width: min(100%, 320px); flex: 1 1 280px; max-width: 420px;
  border: 1px solid var(--hair); background: var(--surface); border-radius: 999px; color: var(--muted);
}
.field:focus-within { border-color: var(--ink); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); }
.select {
  height: 38px; padding: 0 34px 0 14px; border-radius: 999px; border: 1px solid var(--hair); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 14px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.result-count { font-size: 14px; color: var(--muted); margin-left: auto; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--hair-strong); border-radius: var(--radius); }

/* ---------- Главная ---------- */
.hero { padding: 56px 0 8px; display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(40px, 7vw, 84px); margin: 0 0 18px; letter-spacing: -.02em; line-height: 1; }
.hero h1 b { color: var(--phil); font-weight: 700; }
.hero .lead { font-size: 19px; color: var(--muted); max-width: 620px; margin-bottom: 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quine {
  position: relative; background: var(--surface); border: 1px solid var(--hair); border-radius: 22px; padding: 30px 30px 26px; box-shadow: var(--shadow);
}
.quine-word { font: 700 clamp(34px, 4.6vw, 52px)/1 var(--font-display); margin: 4px 0 18px; }
.quine-word span { color: var(--phil); }
.quine ul { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.quine li { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 15px; }
.quine p { font-size: 15px; color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 44px; }
.stat { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--hair-strong); }
.stat b { display: block; font: 700 30px/1.1 var(--font-display); }
.stat span { color: var(--muted); font-size: 14px; }

.line-strip { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 26px 26px 18px; overflow-x: auto; }
.line-strip ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(11, minmax(84px, 1fr)); min-width: 940px; }
.line-strip li { position: relative; padding-top: 30px; text-align: center; }
.line-strip li::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 6px; background: var(--seg); }
.line-strip li:first-child::before { left: 50%; border-radius: 3px 0 0 3px; }
.line-strip li:last-child::before { right: 50%; }
.line-strip li.future::before { background: repeating-linear-gradient(90deg, var(--seg) 0 6px, transparent 6px 12px); }
.line-strip a { color: var(--ink); text-decoration: none; display: block; padding: 0 4px; }
.line-strip a::before {
  content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--seg); box-sizing: border-box; transition: transform .15s;
}
.line-strip a:hover::before { transform: translateX(-50%) scale(1.25); }
.line-strip .ls-n { font: 700 12px/1 var(--font-display); color: var(--seg); display: block; margin: 4px 0 4px; }
.line-strip .ls-t { font-size: 13px; font-weight: 600; line-height: 1.25; display: block; }
.line-strip .ls-d { font-size: 12px; color: var(--muted); display: block; margin-top: 3px; }
.line-strip a:hover .ls-t { text-decoration: underline; }

.seg-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.seg-col { border-top: 6px solid var(--seg); }
.seg-col h3 { font: 600 18px/1.25 var(--font-display); margin: 6px 0 8px; }
.seg-col > p { color: var(--muted); font-size: 15px; }
.seg-col ol { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 2px; }
.seg-col li a { display: flex; gap: 12px; align-items: baseline; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.seg-col li a:hover { background: var(--surface-2); }
.seg-col li b { font: 700 13px/1 var(--font-display); color: var(--seg); min-width: 18px; }
.seg-col li small { margin-left: auto; color: var(--muted); white-space: nowrap; font-size: 13px; }

.explore { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.explore .card { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; min-height: 150px; }
.explore h3 { font: 600 20px/1.2 var(--font-display); margin-bottom: 6px; }
.explore p { color: var(--muted); margin: 0; font-size: 15px; }
.explore .arrow { font-size: 28px; color: var(--muted); }
.questions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: q; }
.questions li { list-style: none; padding: 22px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); font-size: 16.5px; }
.questions li::before { counter-increment: q; content: "0" counter(q); display: block; font: 700 14px/1 var(--font-display); color: var(--synth); margin-bottom: 12px; }
.questions { padding: 0; margin: 0; }

/* ---------- Список встреч ---------- */
.m-list { display: grid; gap: 14px; }
.m-group-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 4px; font: 600 15px/1.2 var(--font-display); }
.m-group-title::before { content: ""; width: 26px; height: 6px; border-radius: 3px; background: var(--seg); }
.m-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; padding: 20px 22px; border-left: 6px solid var(--seg); }
.m-card h3 { font-size: 19px; margin: 2px 0 6px; }
.m-card p { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.m-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--muted); }
.m-meta span { display: inline-flex; align-items: center; gap: 5px; }
.m-side { text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; }
.m-side b { display: block; color: var(--ink); font-size: 15px; }
.status-pill { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status-pill.next { background: var(--seg); color: #fff; }

/* ---------- Страница встречи ---------- */
.meeting-head { border-bottom: 1px solid var(--hair); padding-bottom: 26px; }
.meeting-head .num-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.meeting-head .num-bullet { width: 54px; height: 54px; border-width: 6px; font-size: 18px; }
.meeting-head h1 { max-width: 900px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 15px; }
.facts b { color: var(--ink); font-weight: 600; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 44px; align-items: start; }
.layout > aside { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 16px; }
.block { padding: 34px 0 0; }
.block > h2 { font-size: 21px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.block > h2 .count { font: 500 14px var(--font); color: var(--muted); }
.summary p { font-size: 17.5px; line-height: 1.7; }
.callout { border-left: 5px solid var(--seg, var(--synth)); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 18px; font-style: italic; }
.callout b { display: block; font-style: normal; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.lit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lit-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-sm); }
.lit-list li::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 8px; border-radius: 2px; background: var(--seg, var(--base)); }
.lit-list a { color: var(--ink); text-decoration-color: var(--hair-strong); }
.lit-list a:hover { color: var(--link); }
.lit-list .host { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.plan { counter-reset: p; list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plan li { counter-increment: p; display: flex; gap: 14px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--hair); }
.plan li::before { content: counter(p); font: 700 13px/1 var(--font-display); color: var(--seg); min-width: 18px; }
.people-row { display: flex; flex-wrap: wrap; gap: 10px; }
.person-chip { display: inline-flex; align-items: center; gap: 9px; padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.person-chip:hover { border-color: var(--hair-strong); }
.person-chip .avatar { width: 30px; height: 30px; font-size: 11px; border-width: 2px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.pager a { padding: 16px 20px; }
.pager small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.pager b { font-weight: 600; }
.pager .next { text-align: right; grid-column: 2; }
.aside-card { padding: 18px; }
.aside-card h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.audio-card audio { width: 100%; margin-top: 4px; }
.toc { position: relative; max-height: calc(100vh - var(--header-h) - 140px); overflow: auto; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.toc a { display: block; padding: 5px 10px; border-radius: 7px; border-left: 3px solid transparent; font-size: 14px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.active { color: var(--ink); border-left-color: var(--seg, var(--ink)); background: var(--surface-2); font-weight: 600; }
.toc .lvl-2 a { padding-left: 22px; font-size: 13.5px; }

/* ---------- Текст конспектов (Markdown) ---------- */
.prose { font-size: 17px; line-height: 1.72; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font); font-weight: 700; margin: 1.8em 0 .6em; scroll-margin-top: calc(var(--header-h) + 20px); }
.prose h1 { font-size: 1.6rem; padding-top: 1em; border-top: 1px solid var(--hair); }
.prose > h1:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose h2 { font-size: 1.3rem; }
.prose h3 { font-size: 1.12rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 4px solid var(--hair-strong); color: var(--muted); }
.prose img { height: auto !important; max-height: 420px; width: auto; border-radius: var(--radius-sm); display: block; margin: 1em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--hair); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: var(--radius-sm); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--hair); margin: 2em 0; }
.prose details { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-sm); padding: 10px 16px; margin: 1em 0; }
.prose summary { cursor: pointer; font-weight: 600; }
.prose a.md-link { text-decoration-style: dashed; }
.notes-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 34px clamp(18px, 4vw, 44px); }

/* ---------- Персоналии ---------- */
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center;
  background: color-mix(in srgb, var(--seg, var(--base)) 14%, var(--surface)); color: var(--seg, var(--base));
  border: 3px solid var(--seg, var(--base)); font: 700 20px/1 var(--font-display);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.p-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.p-card h3 { font-size: 16.5px; margin: 2px 0 2px; }
.p-card .years { font-size: 13.5px; color: var(--muted); }
.p-card .fields { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.p-card .badge { margin-top: 7px; font-size: 11px; }
.alpha { display: flex; flex-wrap: wrap; gap: 4px; margin: -8px 0 20px; }
.alpha button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--hair); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.alpha button:disabled { opacity: .35; cursor: default; }
.alpha button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.dossier-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 40px 0 28px; border-bottom: 1px solid var(--hair); }
.dossier-head .avatar { width: 132px; height: 132px; border-width: 5px; font-size: 40px; }
.dossier-head h1 { font-size: clamp(28px, 4vw, 42px); margin-bottom: 8px; }
.dossier-head .sub { color: var(--muted); font-size: 17px; }
.dossier-head .chips { margin-top: 14px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; padding-top: 2px; }
.kv dd { margin: 0; }
.role-box { background: var(--surface); border: 1px solid var(--hair); border-left: 6px solid var(--seg); border-radius: var(--radius-sm); padding: 16px 20px; font-size: 16.5px; }
.role-box b { display: block; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.rel-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rel-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rel-type { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 6px; background: var(--surface-2); }

/* ---------- Темы ---------- */
.topics-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
.topics-nav { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 2px; }
.topics-nav a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14.5px; }
.topics-nav a:hover { background: var(--surface-2); color: var(--ink); }
.topics-nav a.active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); font-weight: 600; }
.topics-nav h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 10px 6px; }
.theme-card { margin-bottom: 18px; scroll-margin-top: calc(var(--header-h) + 20px); }
.theme-card:target, .theme-card.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tech) 45%, transparent); }
.theme-card h2 { font-size: 21px; margin-bottom: 6px; }
.theme-card > p { color: var(--muted); }
.theme-card h4 { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.concepts-index { columns: 3 220px; column-gap: 28px; }
.concept-group { break-inside: avoid; margin-bottom: 16px; }
.concept-group h3 { font: 700 18px/1 var(--font-display); color: var(--muted); margin: 0 0 8px; }
.concept { display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px; margin: 0 -8px; border-radius: 6px; font-size: 15px; }
.concept.flash { background: var(--mark); }
.concept a { text-decoration: none; }
.concept .refs { display: flex; gap: 4px; }
.concept .refs a { font: 700 11px/1 var(--font-display); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 2.5px solid var(--seg); color: var(--ink); }

/* ---------- Выезжающая панель и модальные окна ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(10, 11, 14, .42); opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 80; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 94vw; z-index: 90; display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { padding: 24px 26px 20px; background: var(--seg, var(--ink)); color: #fff; position: relative; }
.drawer-head .kicker { color: rgba(255, 255, 255, .85); margin: 0 40px 8px 0; font-size: 12px; }
.drawer-head h2 { font-size: 21px; margin: 0 40px 6px 0; color: #fff; }
.drawer-head .sub { font-size: 14px; opacity: .9; }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .2); color: #fff; cursor: pointer; font-size: 17px; }
.drawer-close:hover { background: rgba(255, 255, 255, .34); }
.drawer-body { padding: 22px 26px 30px; overflow-y: auto; flex: 1; font-size: 15px; }
.drawer-body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 18px 0 6px; }
.drawer-body .btn { margin-top: 20px; }
@media (max-width: 720px) {
  .drawer { top: auto; bottom: 0; left: 0; width: 100%; max-width: none; height: auto; max-height: 82vh; border-radius: 18px 18px 0 0; transform: translateY(105%); }
}

.modal {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px;
  background: rgba(10, 11, 14, .5);
}
.modal.open { display: flex; }
.modal-box { width: 100%; max-width: 680px; max-height: 80vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--hair); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hair); }
.modal-head h2 { font-size: 18px; margin: 0; flex: 1; }
.modal-body { padding: 20px 24px 26px; overflow-y: auto; }

.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--hair); color: var(--muted); }
.palette-input input { flex: 1; height: 58px; border: 0; outline: 0; background: transparent; font: 400 18px var(--font); color: var(--ink); }
.palette-results { overflow-y: auto; padding: 8px 8px 12px; }
.palette-group { font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.palette-item .pi-text { min-width: 0; flex: 1; }
.palette-item .pi-title { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-icon { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; display: grid; place-items: center; background: var(--surface-2); color: var(--seg, var(--muted)); font: 700 12px/1 var(--font-display); }
.palette-item[aria-selected="true"] { background: var(--surface-2); }
.palette-item[aria-selected="true"] .pi-icon { background: var(--surface); }
.palette-hint { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--hair); font-size: 12.5px; color: var(--muted); }
.palette-empty { padding: 30px; text-align: center; color: var(--muted); }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--hair); border-top-color: var(--phil); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Адаптивность ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .seg-cols, .questions { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .layout > aside { position: static; order: -1; }
  .layout > aside .toc-card { display: none; }
  .topics-layout { grid-template-columns: 1fr; }
  .topics-nav { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .topics-nav h3 { width: 100%; margin: 6px 0 0; }
  .topics-nav a { border: 1px solid var(--hair); border-radius: 999px; background: var(--surface); }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .explore { grid-template-columns: 1fr; }
  .m-card { grid-template-columns: auto 1fr; }
  .m-side { grid-column: 2; text-align: left; }
  .m-side b { display: inline; margin-right: 6px; }
  .dossier-head { grid-template-columns: 1fr; gap: 16px; }
  .dossier-head .avatar { width: 96px; height: 96px; font-size: 30px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .toolbar .result-count { margin-left: 0; width: 100%; }
  .field { max-width: none; }
  .toolbar .select { flex: 1 1 calc(50% - 8px); min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
