@font-face { font-family:Inter; src:url(inter.woff2) format("woff2"); font-weight:100 900; font-display:swap; }
@view-transition { navigation:auto; }
::view-transition-old(root),::view-transition-new(root) { animation-duration:.18s; }
[data-theme=dark] { color-scheme:dark; --bg:#0b0b0c; --panel:#121214; --soft:#18181b; --code:#0f0f11; --codehead:#17171a; --line:#232326; --line2:#2f2f33; --ink:#ececea; --head:#fff; --muted:#8e8c87; --accent:#c9a876; --accent2:#e2c79c; --logo:#e07b3f; --k:#e2c79c; --s:#8fc7ac; --n:#c8a2e0; --warn:#e07b3f; }
[data-theme=light] { color-scheme:light; --bg:#fff; --panel:#fafaf8; --soft:#f4f3ef; --code:#fafaf8; --codehead:#f2f1ec; --line:#e8e6e0; --line2:#d9d6ce; --ink:#2b2a27; --head:#111; --muted:#6c6a64; --accent:#8a6426; --accent2:#6f4f1c; --logo:#c8622f; --k:#8a5a14; --s:#1c7a5c; --n:#7a3fa3; --warn:#c2541c; }
* { box-sizing:border-box; }
html { scroll-padding-top:84px; -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--ink); font:15.5px/1.7 Inter,-apple-system,"Segoe UI",Roboto,sans-serif; -webkit-font-smoothing:antialiased; font-feature-settings:"cv11","ss01"; }
a { color:var(--accent); text-decoration:none; }
article a:not(.cta):not(.hash) { text-decoration:underline; text-decoration-color:color-mix(in srgb,var(--accent) 35%,transparent); text-underline-offset:3px; }
article a:not(.cta):not(.hash):hover { text-decoration-color:var(--accent); }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }
svg.i { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex:none; }
kbd { font:500 11px Inter,sans-serif; padding:2px 6px; border:1px solid var(--line2); border-radius:6px; color:var(--muted); background:var(--bg); }
/* Шапка */
.top { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:14px; height:60px; padding:0 20px; background:color-mix(in srgb,var(--bg) 82%,transparent); backdrop-filter:blur(14px) saturate(1.4); border-bottom:1px solid var(--line); }
.logo { font-size:22px; font-weight:700; letter-spacing:-.05em; color:var(--logo); display:flex; align-items:baseline; gap:8px; width:238px; flex:none; }
.logo span { font-size:13px; font-weight:500; letter-spacing:0; color:var(--muted); }
.icon { display:grid; place-items:center; width:36px; height:36px; flex:none; border:1px solid var(--line); border-radius:10px; background:none; color:var(--ink); cursor:pointer; transition:background .15s; }
.icon:hover { background:var(--soft); } #menu { display:none; }
.searchbtn { display:flex; align-items:center; gap:10px; flex:0 1 380px; height:36px; padding:0 8px 0 12px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--muted); font:inherit; font-size:14px; cursor:pointer; transition:border-color .15s; }
.searchbtn:hover { border-color:var(--line2); } .searchbtn span { flex:1; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ext { display:flex; gap:22px; margin-left:auto; font-size:14px; white-space:nowrap; } .ext a { color:var(--muted); transition:color .15s; } .ext a:hover { color:var(--head); } .ext a.accent { color:var(--accent); font-weight:550; }
/* Сетка */
.layout { display:grid; grid-template-columns:272px minmax(0,1fr) 232px; max-width:1480px; margin:0 auto; }
#side { position:sticky; top:60px; height:calc(100vh - 60px); overflow:auto; padding:26px 14px 40px 20px; scrollbar-width:thin; }
.group { margin-bottom:24px; } .group p { margin:0 0 6px; padding:0 10px; font-size:12px; font-weight:600; color:var(--head); letter-spacing:.01em; }
.group a { display:block; padding:5px 10px; border-radius:8px; color:var(--muted); font-size:14px; line-height:1.45; transition:color .12s,background .12s; }
.group a:hover { color:var(--head); background:var(--soft); }
.group a.on { color:var(--accent2); background:color-mix(in srgb,var(--accent) 12%,transparent); font-weight:550; }
main { min-width:0; max-width:820px; padding:38px clamp(20px,4vw,52px) 60px; }
.crumbs { font-size:13px; font-weight:550; color:var(--accent); margin-bottom:8px; }
h1 { margin:0; color:var(--head); font-size:clamp(30px,3.2vw,38px); line-height:1.15; letter-spacing:-.028em; font-weight:680; }
.sub { margin:12px 0 34px; color:var(--muted); font-size:18px; line-height:1.55; }
article h2 { position:relative; margin:46px 0 14px; color:var(--head); font-size:22px; line-height:1.3; letter-spacing:-.018em; font-weight:640; padding-top:6px; }
article h3 { margin:28px 0 8px; color:var(--head); font-size:16px; font-weight:620; }

article p { margin:12px 0; } ul,ol { padding-left:22px; margin:12px 0; } li { margin:6px 0; } li::marker { color:var(--muted); } b { font-weight:620; color:var(--head); }
code { font:.86em/1.5 ui-monospace,SFMono-Regular,"JetBrains Mono",Menlo,Consolas,monospace; background:var(--soft); border:1px solid var(--line); padding:1px 5px; border-radius:6px; overflow-wrap:anywhere; }
/* Блок кода: кнопка в своей строке и никогда не перекрывает текст */
figure.code { margin:18px 0 22px; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:var(--code); }
figure.code figcaption { display:flex; align-items:center; justify-content:space-between; height:38px; padding:0 8px 0 14px; background:var(--codehead); border-bottom:1px solid var(--line); font-size:12px; font-weight:550; color:var(--muted); }
.copy { height:26px; padding:0 10px; border:1px solid transparent; border-radius:7px; background:none; color:var(--muted); font:500 12px Inter,sans-serif; cursor:pointer; transition:.12s; }
.copy:hover { color:var(--head); background:var(--soft); border-color:var(--line2); } .copy.done { color:var(--s); }
pre { margin:0; padding:14px 16px; overflow-x:auto; line-height:1.62; scrollbar-width:thin; }
pre code { display:block; width:max-content; min-width:100%; background:none; border:0; padding:0; font-size:13px; color:var(--ink); overflow-wrap:normal; white-space:pre; }
.k { color:var(--k); } .s { color:var(--s); } .n { color:var(--n); } .c { color:var(--mut, #8a877f); font-style:italic; }
/* Таблицы */
.tw { overflow-x:auto; margin:16px 0 24px; border:1px solid var(--line); border-radius:12px; scrollbar-width:thin; }
table { border-collapse:collapse; width:100%; font-size:14px; line-height:1.55; }
th { text-align:left; padding:10px 14px; font-weight:600; font-size:12.5px; color:var(--muted); background:var(--panel); border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:10px 14px; border-bottom:1px solid var(--line); vertical-align:top; } tr:last-child td { border-bottom:0; }
td code { overflow-wrap:normal; word-break:normal; white-space:nowrap; } td:first-child { min-width:190px; }
td:first-child code { display:inline-block; margin:1px 0; }
/* Заметки */
.note { position:relative; margin:18px 0; padding:12px 16px 12px 18px; background:color-mix(in srgb,var(--accent) 7%,transparent); border:1px solid color-mix(in srgb,var(--accent) 22%,transparent); border-radius:12px; font-size:14.5px; }
.note.warn { background:color-mix(in srgb,var(--warn) 8%,transparent); border-color:color-mix(in srgb,var(--warn) 26%,transparent); }
/* Карточки и шаги */
.cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:12px; margin:22px 0; }
.cards a { display:block; padding:16px 18px; background:var(--panel); border:1px solid var(--line); border-radius:14px; color:var(--ink); transition:border-color .15s,transform .15s; text-decoration:none !important; }
.cards a:hover { border-color:var(--accent); transform:translateY(-1px); }
.cards b { display:block; margin-bottom:4px; font-size:15px; } .cards span { font-size:13.5px; color:var(--muted); line-height:1.5; display:block; }
.cta { display:inline-block; margin-top:4px; padding:9px 18px; border-radius:10px; background:var(--accent); color:#17120a !important; font-weight:600; font-size:14.5px; transition:filter .15s; } .cta:hover { filter:brightness(1.08); }
[data-theme=light] .cta { color:#fff !important; }
ol.steps { list-style:none; padding:0; counter-reset:s; } ol.steps li { position:relative; counter-increment:s; padding:0 0 18px 42px; margin:0; }
ol.steps li::before { content:counter(s); position:absolute; left:0; top:1px; width:26px; height:26px; display:grid; place-items:center; border-radius:50%; background:var(--soft); border:1px solid var(--line2); font-size:12.5px; font-weight:600; color:var(--accent2); }
ol.steps li:not(:last-child)::after { content:""; position:absolute; left:12.5px; top:32px; bottom:2px; width:1px; background:var(--line); }
/* Низ страницы */
.pager { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:54px; }
.pager a { display:flex; align-items:center; gap:12px; padding:14px 16px; border:1px solid var(--line); border-radius:12px; color:var(--head); font-weight:580; font-size:14.5px; transition:border-color .15s; } .pager a:hover { border-color:var(--accent); }
.pager small { display:block; color:var(--muted); font-weight:400; font-size:12.5px; } .pager .next { justify-content:flex-end; text-align:right; } .pager svg { color:var(--muted); }
.foot { display:flex; justify-content:space-between; gap:12px; margin-top:34px; padding-top:18px; border-top:1px solid var(--line); font-size:13px; color:var(--muted); } .foot a { color:var(--muted); }
/* Содержание */
.toc { position:sticky; top:60px; height:calc(100vh - 60px); overflow:auto; padding:40px 18px 30px 8px; font-size:13px; }
.toc p { margin:0 0 10px; font-weight:600; color:var(--head); font-size:12px; }
.toc a { display:block; padding:4px 0 4px 12px; border-left:1px solid var(--line); color:var(--muted); line-height:1.4; transition:color .12s,border-color .12s; } .toc a:hover { color:var(--head); } .toc a.on { color:var(--accent2); border-left-color:var(--accent); }
/* Поиск */
#search { position:fixed; inset:0; z-index:50; padding:12vh 16px 16px; background:rgba(0,0,0,.55); backdrop-filter:blur(5px); animation:fade .14s; }
#search[hidden],#shade[hidden] { display:none; }
.sbox { max-width:620px; margin:0 auto; background:var(--panel); border:1px solid var(--line2); border-radius:16px; overflow:hidden; box-shadow:0 30px 80px rgba(0,0,0,.5); animation:rise .16s cubic-bezier(.2,.8,.2,1); }
.sinput { display:flex; align-items:center; gap:12px; padding:0 14px; height:54px; border-bottom:1px solid var(--line); color:var(--muted); }
.sinput input { flex:1; min-width:0; background:none; border:0; outline:0; color:var(--head); font:inherit; font-size:16px; }
#results { max-height:56vh; overflow:auto; padding:8px; } #results:empty { display:none; }
#results a { display:block; padding:10px 12px; border-radius:10px; color:var(--ink); } #results a.sel,#results a:hover { background:var(--soft); }
#results b { display:block; font-size:14.5px; } #results span { display:block; font-size:13px; color:var(--muted); line-height:1.45; } #results mark { background:none; color:var(--accent2); font-weight:600; }
#results p { margin:0; padding:18px 12px; color:var(--muted); font-size:14px; }
#shade { position:fixed; inset:60px 0 0; z-index:9; background:rgba(0,0,0,.5); }
@keyframes fade { from { opacity:0; } } @keyframes rise { from { opacity:0; transform:translateY(8px) scale(.985); } }
@media (max-width:1180px) { .layout { grid-template-columns:262px minmax(0,1fr); } .toc { display:none; } .ext a:not(.accent) { display:none; } }
@media (max-width:860px) {
  .layout { grid-template-columns:minmax(0,1fr); } #menu { display:grid; } .logo { width:auto; } .logo span { display:none; } .ext { display:none; } .searchbtn { flex:1; margin-left:auto; } .searchbtn kbd { display:none; }
  #side { position:fixed; top:60px; left:0; width:286px; height:calc(100dvh - 60px); z-index:10; background:var(--bg); border-right:1px solid var(--line); transform:translateX(-102%); transition:transform .2s cubic-bezier(.2,.8,.2,1); }
  #side.open { transform:none; } .top { gap:10px; padding:0 12px; } main { padding-top:26px; }
  .pager { grid-template-columns:1fr; } .sub { font-size:16.5px; }
}
@media (prefers-reduced-motion:reduce) { *,::view-transition-old(root),::view-transition-new(root) { animation:none !important; transition:none !important; } }
.langsw { font-size:13px; font-weight:600; color:var(--muted); padding:7px 10px; border:1px solid var(--line); border-radius:10px; } .langsw:hover { color:var(--head); text-decoration:none; }
@media (max-width:860px) { .searchbtn { min-width:0; } .langsw { padding:7px 8px; } }
@media (max-width:440px) { .searchbtn { flex:0 0 36px; justify-content:center; padding:0; margin-left:auto; } .searchbtn span { display:none; } }

html { touch-action:manipulation; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
@media (max-width:820px) { input, textarea, select { font-size:16px !important; } }
