/* ==========================================================================
   dia-design · docs — раскладка документации (подключать после dia.css)
   ========================================================================== */

.docs-body { background: var(--paper); }

/* Шапка */
.docs-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 20px;
  background: rgba(251, 250, 246, 0.86);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.docs-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-weight: 500; font-size: 20px; letter-spacing: -0.03em; }
.docs-badge { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; border: 0.5px solid var(--line-strong); color: var(--ink-2); }
.docs-version { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.docs-search-btn {
  margin-left: 28px; display: flex; align-items: center; gap: 10px; width: 280px; height: 36px; padding: 0 10px 0 12px;
  border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); font-size: 14px;
}
.docs-search-btn kbd { margin-left: auto; }
.docs-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.docs-menu-btn { display: none; width: 36px; height: 36px; border-radius: 10px; align-items: center; justify-content: center; }
kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--chip-solid); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12); color: var(--ink-2); }

/* Каркас */
.docs-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 220px; max-width: 1360px; margin: 0 auto; }
.docs-side {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
  padding: 22px 14px 40px 20px; border-right: 1px solid var(--line);
}
.docs-filter { width: 100%; height: 34px; border: 0; border-radius: 9px; padding: 0 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font: inherit; font-size: 13.5px; color: var(--ink); outline: none; margin-bottom: 12px; }
.docs-filter:focus { box-shadow: inset 0 0 0 1.5px var(--sun-600); }
.docs-group { margin: 18px 0 6px 10px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.docs-nav { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 14px; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.docs-nav a:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.docs-nav a[aria-current="page"] { background: var(--sun-100); color: #3d2c00; font-weight: 500; }
.docs-nav li[hidden] { display: none; }

.docs-main { padding: 40px 56px 120px; min-width: 0; }
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs span + span::before { content: "/"; margin-right: 8px; opacity: 0.6; }

/* Оглавление справа */
.docs-toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 44px 20px 40px 8px; }
.docs-toc p { margin: 0 0 10px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs-toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 1px solid transparent; font-size: 13px; color: var(--ink-3); transition: color 0.15s, border-color 0.15s; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.is-active { color: #000; border-left-color: #000; }

/* Текст статьи */
.prose { max-width: 720px; font-size: 16px; line-height: 1.7; color: var(--ink); }
.prose h1 { font-family: var(--font-serif); font-weight: 500; font-size: 46px; line-height: 1.1; letter-spacing: -0.045em; margin: 0 0 18px; text-wrap: balance; }
.prose .lead { font-size: 19px; line-height: 1.6; color: rgba(0, 0, 0, 0.72); margin: 0 0 28px; }
.prose h2 { font-family: var(--font-serif); font-weight: 500; font-size: 28px; line-height: 1.25; letter-spacing: -0.035em; margin: 52px 0 14px; scroll-margin-top: 84px; position: relative; }
.prose h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 32px 0 8px; scroll-margin-top: 84px; }
.prose h2 .anchor, .prose h3 .anchor { position: absolute; left: -22px; opacity: 0; color: var(--ink-3); font-family: var(--font-sans); font-weight: 400; transition: opacity 0.15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose h3 { position: relative; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 18px; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--ink-3); }
.prose a:not(.card-link):not(.btn) { color: #000; text-decoration: underline; text-decoration-color: var(--sun-500); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:not(.card-link):not(.btn):hover { text-decoration-color: #000; }
.prose strong { font-weight: 600; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose code { font-family: var(--font-mono); font-size: 0.86em; background: rgba(242, 191, 58, 0.16); padding: 2px 6px; border-radius: 6px; }
.prose pre {
  position: relative; margin: 0 0 20px; padding: 18px 20px; overflow-x: auto;
  background: #1d1a14; color: #f5ecd6; border-radius: 14px;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65;
}
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose pre .c { color: #a89b7c; }
.prose pre .k { color: #ffcf5c; }
.copy-btn { position: absolute; top: 10px; right: 10px; padding: 4px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.08); color: #e7dcc0; font-family: var(--font-mono); font-size: 11px; opacity: 0; transition: opacity 0.2s, background 0.2s; }
.prose pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.16); }

.prose table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th { text-align: left; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }

.callout { display: flex; gap: 14px; padding: 16px 18px; margin: 0 0 22px; border-radius: 14px; background: var(--sun-50); box-shadow: inset 0 0 0 1px rgba(225, 183, 70, 0.4); font-size: 15px; line-height: 1.6; }
.callout > b:first-child { flex: none; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #7a5a10; padding-top: 3px; }
.callout p:last-child { margin: 0; }
.callout.note { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.callout.note > b:first-child { color: var(--ink-3); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 26px; }
.card-link { display: block; padding: 18px 20px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.25s, transform 0.25s var(--ease-out); }
a.card-link:hover { box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card); transform: translateY(-2px); }
.card-link b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-link span { display: block; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

.steps-list { list-style: none; padding: 0 !important; counter-reset: s; }
.steps-list > li { position: relative; padding: 0 0 22px 46px; margin: 0; counter-increment: s; }
.steps-list > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #000; color: #fff; font-family: var(--font-mono); font-size: 12px; }
.steps-list > li::after { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: 6px; width: 1px; background: var(--line); }
.steps-list > li:last-child::after { display: none; }
.steps-list > li > b:first-child { display: block; font-size: 16px; margin-bottom: 4px; }

.figure { margin: 8px 0 28px; padding: 22px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.figure figcaption { margin-top: 14px; font-size: 13px; color: var(--ink-3); }

/* Пейджер */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 720px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 14px 18px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.2s; }
.pager a:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.pager small { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.pager b { font-family: var(--font-serif); font-weight: 500; font-size: 19px; letter-spacing: -0.03em; }
.pager .next { text-align: right; grid-column: 2; }

/* Поиск (модалка) */
.search-modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; background: rgba(40, 30, 10, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.search-modal.is-open { display: flex; }
.search-panel { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--paper); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(60, 40, 0, 0.45), 0 0 0 1px var(--line); overflow: hidden; }
.search-panel input { height: 58px; border: 0; padding: 0 22px; font: inherit; font-size: 17px; background: transparent; outline: none; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results a { display: block; padding: 10px 14px; border-radius: 10px; }
.search-results a.is-sel, .search-results a:hover { background: var(--sun-100); }
.search-results b { display: block; font-size: 15px; font-weight: 500; }
.search-results small { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .sec { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-left: 8px; font-weight: 400; }
.search-empty { padding: 26px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* Адаптив */
@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-side { position: fixed; z-index: 40; top: 60px; left: 0; width: min(300px, 86vw); background: var(--paper); transform: translateX(-100%); visibility: hidden; transition: transform 0.35s var(--ease-out), visibility 0.35s; }
  body.nav-open .docs-side { transform: none; visibility: visible; box-shadow: 20px 0 60px -30px rgba(0, 0, 0, 0.3); }
  .docs-menu-btn { display: inline-flex; }
  .docs-search-btn { margin-left: 0; width: 40px; padding: 0; justify-content: center; }
  .docs-search-btn span, .docs-search-btn kbd, .docs-version { display: none; }
  .docs-main { padding: 28px 16px 100px; }
  .prose h1 { font-size: 36px; }
  .prose h2 .anchor, .prose h3 .anchor { display: none; }
  .cards { grid-template-columns: 1fr; }
  .docs-top { padding: 0 12px; gap: 8px; }
  .docs-top-right .btn-ghost { display: none; }
}
