/* Портал документации Smart1Spec. Цели: Chrome/Edge 109+, Firefox 102+, Safari 16+.
   Без color-mix, :has(), вложенности и @container — только переменные и классические селекторы. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --bg-elev: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e3e8ef;
  --line-strong: #cbd5e1;
  --accent: #315bff;
  --accent-ink: #2347d6;
  --accent-soft: #eef2ff;
  --focus: #315bff;
  --code-bg: #f4f6fa;
  --code-ink: #1e293b;
  --code-line: #e2e8f0;
  --mark: #fff3bf;
  --note: #315bff;
  --note-bg: #f0f4ff;
  --tip: #0f9d74;
  --tip-bg: #ecfbf5;
  --warning: #b45309;
  --warning-bg: #fff8eb;
  --limit: #7c3aed;
  --limit-bg: #f6f2ff;
  --important: #c2410c;
  --important-bg: #fff3ed;
  --tok-kw: #7c3aed;
  --tok-type: #0369a1;
  --tok-string: #0f7a53;
  --tok-comment: #64748b;
  --tok-num: #b45309;
  --tok-const: #c2410c;
  --tok-op: #be185d;
  --tok-pre: #9333ea;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.22);
  --topbar-h: 60px;
  --sidebar-w: 284px;
  --toc-w: 232px;
  --content-max: 800px;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", Menlo, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --bg-soft: #0f1629;
  --bg-elev: #131b31;
  --ink: #e6ebf5;
  --ink-2: #c3cbdc;
  --muted: #8d99b3;
  --line: #222c45;
  --line-strong: #33405f;
  --accent: #7c9cff;
  --accent-ink: #a5b8ff;
  --accent-soft: #1a2445;
  --focus: #8eabff;
  --code-bg: #10172b;
  --code-ink: #dbe3f4;
  --code-line: #222c45;
  --mark: #5c4a00;
  --note: #8eabff;
  --note-bg: #141d38;
  --tip: #4fd1a5;
  --tip-bg: #0f2620;
  --warning: #fbbf24;
  --warning-bg: #2a2010;
  --limit: #c4a8ff;
  --limit-bg: #1f1838;
  --important: #fb923c;
  --important-bg: #2b1a10;
  --tok-kw: #c4a8ff;
  --tok-type: #7dd3fc;
  --tok-string: #86efac;
  --tok-comment: #7b88a5;
  --tok-num: #fcd34d;
  --tok-const: #fdba74;
  --tok-op: #f9a8d4;
  --tok-pre: #d8b4fe;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  font: 16px/1.65 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus {
  top: 10px;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  font: 600 0.78em/1.5 var(--mono);
  color: var(--ink-2);
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  text-align: center;
  white-space: nowrap;
}

/* ---------- Шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: inherit;
}
.brand-home img {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
  filter: none;
}
.brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-home:hover,
.brand-sub:hover {
  text-decoration: none;
}
.brand-sub {
  font-weight: 500;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
}
.brand-sub:hover {
  color: var(--ink-2);
}

.topnav {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar {
  display: none;
}
.topnav a {
  padding: 6px 11px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 0.93rem;
  font-weight: 550;
  white-space: nowrap;
}
.topnav a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.topnav a.is-current {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.search-open {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
  height: 38px;
  padding: 0 8px 0 12px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.search-open:hover {
  border-color: var(--line-strong);
}
.search-open kbd {
  margin-left: auto;
}

.search-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.search-ico::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 7px;
  background: currentColor;
  right: -4px;
  bottom: -6px;
  transform: rotate(-45deg);
  border-radius: 1px;
}

.studio-link {
  padding: 7px 13px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  white-space: nowrap;
}
[data-theme="dark"] .studio-link {
  color: #0b1020;
}
.studio-link:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

.theme-toggle,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.theme-toggle:hover,
.nav-toggle:hover {
  background: var(--bg-soft);
}
.theme-toggle span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-toggle {
  display: none;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before {
  top: -5px;
}
.nav-toggle span::after {
  top: 5px;
}

/* ---------- Каркас ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1480px;
  margin: 0 auto;
}
.layout.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 14px 40px 20px;
  border-right: 1px solid var(--line);
  overscroll-behavior: contain;
  font-size: 0.92rem;
}

.nav-section {
  margin-bottom: 4px;
}
.nav-section-title {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 650;
  color: var(--ink);
}
.nav-section-title:hover {
  background: var(--bg-soft);
  text-decoration: none;
}
.nav-section.is-active > .nav-section-title {
  color: var(--accent-ink);
}
.nav-section-title.is-current {
  background: var(--accent-soft);
}
.nav-section.is-active {
  margin-bottom: 12px;
}

.nav-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.nav-list.depth-1,
.nav-list.depth-2 {
  margin-left: 10px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.nav-list a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--ink-2);
  line-height: 1.4;
}
.nav-list a:hover {
  background: var(--bg-soft);
  color: var(--ink);
  text-decoration: none;
}
.nav-list a.is-current {
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 600;
}
.nav-group summary {
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  list-style: none;
}
.nav-group summary::-webkit-details-marker {
  display: none;
}
.nav-group summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 8px 2px 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.nav-group details[open] > summary::before {
  transform: rotate(45deg);
}
.nav-group summary:hover {
  color: var(--ink);
}

.sidebar-backdrop {
  display: none;
}

.content {
  min-width: 0;
  padding: 28px 48px 64px;
}
.content > * {
  max-width: var(--content-max);
}

.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 30px 20px 30px 8px;
  font-size: 0.86rem;
}
.toc-title {
  margin: 0 0 8px;
  font-weight: 650;
  color: var(--ink);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.toc ul,
.toc-inline ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.toc li a,
.toc-inline li a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  line-height: 1.4;
}
.toc li.toc-l3 a,
.toc-inline li.toc-l3 a {
  padding-left: 24px;
}
.toc li a:hover {
  color: var(--ink);
  text-decoration: none;
}
.toc li a.is-active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
}
.toc-inline {
  display: none;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 0.9rem;
}
.toc-inline summary {
  cursor: pointer;
  font-weight: 600;
}
.toc-inline ul {
  margin-top: 8px;
}

/* ---------- Мета страницы ---------- */

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumbs li + li::before {
  content: "/";
  margin-right: 4px;
  color: var(--line-strong);
}
.breadcrumbs a {
  color: var(--muted);
}
.breadcrumbs a:hover {
  color: var(--accent);
}
.breadcrumbs [aria-current] span {
  color: var(--ink-2);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg-soft);
}
.badge-type {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: transparent;
}
.badge-tutorial {
  color: var(--tip);
  background: var(--tip-bg);
}
.badge-explanation {
  color: var(--limit);
  background: var(--limit-bg);
}
.badge-reference {
  color: var(--tok-type);
  background: var(--bg-soft);
}
.badge-draft {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: transparent;
}

/* ---------- Текст ---------- */

.prose {
  color: var(--ink);
}
.prose h1 {
  margin: 0 0 12px;
  font-size: 2.05rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 750;
}
.prose h2 {
  margin: 2.2em 0 0.6em;
  padding-top: 0.2em;
  font-size: 1.45rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 700;
}
.prose h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 650;
}
.prose h4 {
  margin: 1.5em 0 0.4em;
  font-size: 1rem;
  font-weight: 650;
}
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
}
.anchor {
  margin-left: 8px;
  color: var(--line-strong);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s;
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}
.anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 1em;
}
.prose ul,
.prose ol {
  padding-left: 1.5em;
}
.prose li {
  margin: 0.3em 0;
}
.prose li > ul,
.prose li > ol {
  margin: 0.3em 0;
}
.prose li > p {
  margin: 0.3em 0;
}
.prose strong {
  font-weight: 650;
}
.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.prose blockquote {
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-2);
}
.lead {
  margin: 0 0 22px;
  font-size: 1.12rem;
  color: var(--ink-2);
  line-height: 1.6;
}
.muted {
  color: var(--muted);
}

.prose code {
  padding: 0.12em 0.38em;
  font: 0.86em/1.5 var(--mono);
  color: var(--code-ink);
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  border-radius: 5px;
  overflow-wrap: anywhere;
}

a.ext::after {
  content: "\2197";
  display: inline-block;
  margin-left: 2px;
  font-size: 0.8em;
  vertical-align: 1px;
}
.studio-link.ext::after {
  content: none;
}

/* Код */
.code-block {
  margin: 0 0 1.25em;
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--code-line);
  font-size: 0.78rem;
  color: var(--muted);
}
.code-lang {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.code-copy {
  padding: 3px 10px;
  font: inherit;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.code-copy:hover {
  border-color: var(--line-strong);
}
.code-copy.is-done {
  color: var(--tip);
}
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font: 0.86rem/1.6 var(--mono);
  color: var(--code-ink);
  tab-size: 4;
  -moz-tab-size: 4;
}
.code-block pre code {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  overflow-wrap: normal;
  white-space: pre;
}
.code-block.is-invalid {
  border-color: var(--important);
}
.code-block.is-invalid .code-lang {
  color: var(--important);
}
.tok-kw {
  color: var(--tok-kw);
  font-weight: 600;
}
.tok-type {
  color: var(--tok-type);
}
.tok-string {
  color: var(--tok-string);
}
.tok-comment {
  color: var(--tok-comment);
  font-style: italic;
}
.tok-num {
  color: var(--tok-num);
}
.tok-const {
  color: var(--tok-const);
}
.tok-op {
  color: var(--tok-op);
}
.tok-pre {
  color: var(--tok-pre);
}

/* Таблицы */
.table-wrap {
  margin: 0 0 1.4em;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}
.table-wrap th,
.table-wrap td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.table-wrap th {
  font-weight: 650;
  background: var(--bg-soft);
  white-space: nowrap;
}
.table-wrap tr:last-child td {
  border-bottom: 0;
}
.table-wrap td code {
  white-space: nowrap;
}

/* Выноски */
.callout {
  margin: 0 0 1.3em;
  padding: 12px 16px;
  border-left: 3px solid var(--note);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--note-bg);
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--note);
}
.callout-tip {
  border-left-color: var(--tip);
  background: var(--tip-bg);
}
.callout-tip .callout-title {
  color: var(--tip);
}
.callout-warning {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}
.callout-warning .callout-title {
  color: var(--warning);
}
.callout-limit {
  border-left-color: var(--limit);
  background: var(--limit-bg);
}
.callout-limit .callout-title {
  color: var(--limit);
}
.callout-important {
  border-left-color: var(--important);
  background: var(--important-bg);
}
.callout-important .callout-title {
  color: var(--important);
}

/* Скриншоты */
figure.shot {
  margin: 0 0 1.5em;
}
figure.shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg-soft);
}
figure.shot figcaption {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

/* Блоки страницы */
.prereq {
  margin: 0 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.prereq-title {
  margin: 0 0 4px;
  font-weight: 650;
  font-size: 0.9rem;
}
.prereq ul,
.see-also ul {
  margin: 0;
  padding-left: 1.2em;
}
.kind {
  font-size: 0.78rem;
  color: var(--muted);
}
.see-also {
  margin-top: 2.4em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
}
.see-also h2 {
  margin-top: 0;
  font-size: 1.1rem;
}
.verified {
  margin-top: 1.8em;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Карточки на обзорных страницах */
.prose ul.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 36px;
}
.pager a {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}
.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.pager span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.pager b {
  font-weight: 600;
  color: var(--accent-ink);
}
.pager-next {
  text-align: right;
  grid-column: 2;
}

.page-footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--ink-2);
}
.page-footer p {
  margin: 0 0 6px;
}

/* ---------- Поиск ---------- */

.search-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 9vh 16px 16px;
  background: rgba(15, 23, 42, 0.45);
}
.search-dialog[hidden] {
  display: none;
}
.search-panel {
  width: 100%;
  max-width: 680px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.search-field input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: transparent;
  border: 0;
}
.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.search-close {
  padding: 3px 8px;
  font: 600 0.75rem var(--mono);
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.search-hint {
  margin: 0;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}
.search-results li a {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink);
}
.search-results li a:hover,
.search-results li[aria-selected="true"] a {
  background: var(--accent-soft);
  text-decoration: none;
}
.sr-title {
  display: block;
  font-weight: 600;
}
.sr-path {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.sr-snippet {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.45;
}
.search-results mark {
  background: var(--mark);
  color: inherit;
  border-radius: 2px;
}
.search-empty {
  padding: 16px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Адаптивность ---------- */

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
  .toc-inline {
    display: block;
  }
}

@media (max-width: 1080px) {
  .topnav {
    display: none;
  }
}

@media (max-width: 900px) {
  :root {
    --topbar-h: 56px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .nav-toggle {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(320px, 86vw);
    height: auto;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }
  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
  }
  body.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 45;
    background: rgba(15, 23, 42, 0.4);
  }
  .content {
    padding: 22px 20px 48px;
  }
  .search-open {
    min-width: 0;
  }
  .search-open .search-label,
  .search-open kbd {
    display: none;
  }
  .search-open {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
  .topbar {
    gap: 10px;
    padding: 0 12px;
  }
}

@media (max-width: 560px) {
  .brand-sub,
  .studio-link {
    display: none;
  }
  .prose h1 {
    font-size: 1.6rem;
  }
  .prose h2 {
    font-size: 1.25rem;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager-next {
    grid-column: 1;
  }
  .search-dialog {
    padding: 0;
  }
  .search-panel {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc,
  .toc-inline,
  .pager,
  .code-copy,
  .search-dialog {
    display: none !important;
  }
  .layout {
    display: block;
  }
}
