/* Энциклопедия «Пределы обоснования».
   Нейтральная типографика в духе Wikimedia Vector: без неона, градиентов
   и декоративных карточек. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-header: #f4f6f8;
  --bg-input: #eef2f5;
  --text: #202122;
  --text-muted: #54595d;
  --text-faint: #72777d;
  --border: #a2a9b1;
  --border-subtle: #c8ccd1;
  --border-faint: #eaecf0;
  --link: #3366cc;
  --link-visited: #795cb2;
  --link-hover: #447ff5;
  --danger: #d73333;
  --highlight: #fef6c7;
  --highlight-border: #fc3;
  --quote-bg: #f8f9fa;
  --theorem-bg: #f8f9fa;
  --font-serif: "Linux Libertine", "Liberation Serif", "DejaVu Serif", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --content-width: 64rem;
  --sidebar-width: 15rem;
}

@font-face {
  font-family: "Amiri";
  src: url("fonts/Amiri-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html[data-theme="dark"] {
  --bg: #101418;
  --bg-subtle: #181d23;
  --bg-elevated: #181d23;
  --bg-header: #161b21;
  --bg-input: #1d242c;
  --text: #eaecf0;
  --text-muted: #a2a9b1;
  --text-faint: #8a939c;
  --border: #54595d;
  --border-subtle: #404244;
  --border-faint: #2c3136;
  --link: #8ab4f8;
  --link-visited: #c3a6ff;
  --link-hover: #aecbfa;
  --danger: #ff8a8a;
  --highlight: #4a3f00;
  --highlight-border: #d4b000;
  --quote-bg: #181d23;
  --theorem-bg: #181d23;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #101418;
    --bg-subtle: #181d23;
    --bg-elevated: #181d23;
    --bg-header: #161b21;
    --bg-input: #1d242c;
    --text: #eaecf0;
    --text-muted: #a2a9b1;
    --text-faint: #8a939c;
    --border: #54595d;
    --border-subtle: #404244;
    --border-faint: #2c3136;
    --link: #8ab4f8;
    --link-visited: #c3a6ff;
    --link-hover: #aecbfa;
    --danger: #ff8a8a;
    --highlight: #4a3f00;
    --highlight-border: #d4b000;
    --quote-bg: #181d23;
    --theorem-bg: #181d23;
  }
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: 4.6rem;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--highlight); color: var(--text); }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

code, pre, .mono { font-family: var(--font-mono); font-size: .9em; }

mark {
  background: var(--highlight);
  color: var(--text);
  padding: 0 .08em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  background: var(--bg);
  color: var(--link);
  border: 1px solid var(--border);
  padding: .4rem .7rem;
  transition: top .15s ease;
}
.skip-link:focus { top: .5rem; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .4rem 1.5rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--text);
  flex: none;
}
.site-logo:visited { color: var(--text); }
.site-logo:hover { text-decoration: none; }
.site-logo:hover .logo-text { text-decoration: underline; }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1;
  background: var(--bg-subtle);
}
.logo-text {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  letter-spacing: .01em;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.icon-button svg { display: block; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-burger { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }
.theme-toggle { margin-left: 0; }
.icon-button:hover { border-color: var(--border-subtle); background: var(--bg-subtle); }
.menu-toggle { display: none; }

.search-form {
  position: relative;
  display: flex;
  align-items: stretch;
  min-width: 0;
}
.header-search { flex: 1 1 24rem; max-width: 32rem; }
.search-form input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 2.15rem;
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 0;
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .85rem;
  appearance: none;
}
.search-form input[type="search"]::placeholder { color: var(--text-faint); }
.search-form input[type="search"]:focus,
.search-form input[type="search"]:focus-visible,
input[type="search"]:focus,
input[type="search"]:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: var(--border);
}
.search-submit {
  flex: none;
  height: 2.15rem;
  padding: 0 .75rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .8rem;
  cursor: pointer;
}
.search-submit:hover { background: var(--border-faint); }

.header-nav {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-left: auto;
  font-size: .78rem;
  white-space: nowrap;
}
.header-nav a { color: var(--text-muted); }
.header-nav a:hover { color: var(--link); }

.theme-toggle { margin-left: 0; }

/* Подсказки поиска */
.search-suggest {
  position: absolute;
  z-index: 120;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  display: none;
  max-height: 22rem;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
}
.search-suggest.open { display: block; }
.suggest-item {
  display: block;
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border-faint);
  font-size: .82rem;
  color: var(--text);
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover,
.suggest-item.active { background: var(--bg-subtle); }
.suggest-type {
  color: var(--text-muted);
  font-size: .7rem;
  margin-left: .4rem;
}
.suggest-empty {
  padding: .55rem .6rem;
  color: var(--text-muted);
  font-size: .8rem;
}

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

.page-layout {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 2.2rem;
  padding: 1.6rem 1.5rem 4rem;
}

.sidebar {
  position: sticky;
  top: 5.16rem;
  align-self: start;
  max-height: calc(100vh - 6.4rem);
  overflow-y: auto;
  padding-right: .4rem;
  font-size: .8rem;
  scrollbar-width: thin;
}

.content {
  min-width: 0;
  max-width: var(--content-width);
}

.home-page .content,
.appendix-page .content,
.about-page .content { max-width: 72rem; }

.mobile-menu-head { display: none; }
.nav-heading {
  margin: 1rem 0 .25rem;
  color: var(--text-muted);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-list {
  list-style: none;
  margin: 0 0 .8rem;
  padding: 0;
}
.nav-list li { margin: .16rem 0; }
.nav-list a {
  display: inline;
  padding: 0;
  color: var(--link);
  border: 0;
  background: none;
  font-size: .8rem;
  line-height: 1.45;
}
.nav-list a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
.nav-list a.active {
  color: var(--text);
  font-weight: 700;
}
.nav-list a.active:hover { color: var(--text); }
.nav-random { margin-top: 1rem; font-size: .78rem; }

.toc-box {
  margin-top: 1.4rem;
  padding-top: .7rem;
  border-top: 1px solid var(--border-subtle);
}
.toc-heading {
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-list li { margin: .05rem 0; }
.toc-list a {
  display: block;
  padding: .12rem .25rem;
  color: var(--text-muted);
  font-size: .76rem;
  line-height: 1.35;
}
.toc-list a:hover { color: var(--link); background: var(--bg-subtle); text-decoration: none; }
.toc-subhead {
  margin-top: .55rem;
  color: var(--text-faint);
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.toc-para a { padding-left: .45rem; }
.toc-num {
  display: inline-block;
  min-width: 1.8rem;
  color: var(--text-faint);
  font-size: .66rem;
}

/* ------------------------------------------------------------------ */
/* Подвал                                                             */
/* ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: .76rem;
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  margin: .7rem 0 0;
}
.footer-cite {
  max-width: 62rem;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.footer-cite em { font-style: italic; }
.footer-cite-label {
  display: block;
  margin-bottom: .15rem;
  color: var(--text-faint);
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Общие заголовки                                                    */
/* ------------------------------------------------------------------ */

.breadcrumb {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .8rem;
}
.breadcrumb .sep { margin: 0 .35rem; color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--link); }

.page-header {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.4rem;
  padding-bottom: .55rem;
}
.page-header h1,
.article-header h1 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.18;
  margin: .15rem 0 .3rem;
  overflow-wrap: anywhere;
}
.page-subtitle,
.article-subtitle {
  font-size: .78rem;
  color: var(--text-muted);
  margin: 0;
}
.article-note {
  font-size: .7rem;
  color: var(--text-faint);
  margin: .45rem 0 0;
}
.muted { color: var(--text-muted); }

/* ------------------------------------------------------------------ */
/* Главная                                                            */
/* ------------------------------------------------------------------ */

.home-head {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.4rem;
  margin-bottom: 1.6rem;
}
.home-kicker {
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.home-head h1 {
  font-family: var(--font-serif);
  font-size: 2.7rem;
  font-weight: 400;
  line-height: 1.1;
  margin: .2rem 0 .2rem;
}
.home-subtitle {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-muted);
  margin: .15rem 0 .8rem;
}
.home-biblio {
  font-size: .84rem;
  color: var(--text-muted);
  max-width: 52rem;
  margin: .3rem 0;
}
.home-description {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  max-width: 48rem;
  margin: .6rem 0 1rem;
}
.home-search { max-width: 44rem; margin: 1rem 0 .45rem; }
.home-hint {
  font-size: .76rem;
  color: var(--text-muted);
  margin: .15rem 0 0;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 1.15rem;
}
.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.55rem;
  line-height: 1.1;
}
.stat-label {
  font-size: .66rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(17rem, .75fr);
  gap: 2.6rem;
}
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.section-heading h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 400;
  margin: .2rem 0 .35rem;
}
.section-link { font-size: .75rem; white-space: nowrap; }
.section-note {
  font-size: .74rem;
  color: var(--text-muted);
  margin: .35rem 0 .8rem;
}
.home-group { margin: 0 0 1.15rem; }
.home-group h3 {
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-faint);
  padding-bottom: .25rem;
  margin: .7rem 0 .35rem;
}
.home-toc {
  list-style: none;
  margin: .2rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}
.home-toc li {
  break-inside: avoid;
  margin: .1rem 0;
  font-family: var(--font-serif);
  font-size: .9rem;
  line-height: 1.4;
}
.home-num {
  display: inline-block;
  min-width: 1.55rem;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: .65rem;
}
.home-more { margin: 1rem 0 0; font-size: .8rem; }

.home-side .home-box {
  border-top: 1px solid var(--border-subtle);
  padding-top: .7rem;
  margin-bottom: 1.35rem;
}
.home-box h2 {
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: .2rem 0 .4rem;
}
.home-box p { font-size: .8rem; margin: .3rem 0; }
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .82rem;
}
.link-list li { margin: .28rem 0; }

/* ------------------------------------------------------------------ */
/* Содержание                                                         */
/* ------------------------------------------------------------------ */

.contents-group { margin-bottom: 1.8rem; }
.contents-group h2 {
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-faint);
  padding-bottom: .3rem;
  margin: .2rem 0 .4rem;
}
.contents-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.contents-list li {
  display: flex;
  gap: .8rem;
  padding: .52rem 0;
  border-bottom: 1px solid var(--border-faint);
}
.contents-num {
  flex: none;
  min-width: 1.8rem;
  color: var(--text-faint);
  font-size: .7rem;
  padding-top: .15rem;
}
.contents-body a {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.35;
}
.contents-meta {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

/* ------------------------------------------------------------------ */
/* Статья                                                             */
/* ------------------------------------------------------------------ */

.article-header {
  border-bottom: 0;
  padding-bottom: 0;
}
.term-page .article-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: .35rem;
}

.page-tabs {
  display: flex;
  gap: .1rem;
  align-items: flex-end;
  margin-top: .75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.tab {
  display: inline-block;
  padding: .42rem .7rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--link);
  font-family: var(--font-sans);
  font-size: .78rem;
  cursor: pointer;
}
.tab:visited { color: var(--link); }
.tab:hover { text-decoration: none; background: var(--bg-subtle); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--link);
  font-weight: 600;
}

.infobox {
  float: right;
  width: 18rem;
  margin: 1.1rem 0 1.1rem 1.4rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: .76rem;
  line-height: 1.45;
}
.infobox-title {
  padding: .42rem .55rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  text-align: center;
  font-weight: 600;
  letter-spacing: .02em;
}
.infobox-table {
  width: 100%;
  border-collapse: collapse;
}
.infobox-table th,
.infobox-table td {
  border: 0;
  border-top: 1px solid var(--border-faint);
  padding: .32rem .5rem;
  vertical-align: top;
  text-align: left;
}
.infobox-table th {
  width: 36%;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
}
.infobox-source {
  border-top: 1px solid var(--border);
  padding: .35rem .5rem;
  text-align: center;
}

.article-text { margin-top: 1rem; }

.prose {
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.72;
  margin: 0 0 .95rem;
}
.lead { font-size: 1.09rem; }

.thesis { scroll-margin-top: 5rem; }
.term-link {
  border-bottom: 1px dotted var(--border);
}
.term-link:hover {
  border-bottom-color: var(--link);
  text-decoration: none;
}
.thesis-permalink,
.para-permalink,
.block-permalink {
  opacity: 0;
  margin-left: .3em;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: .68em;
  text-decoration: none;
  transition: opacity .12s ease;
}
.thesis-permalink { display: none; }
.prose:hover .para-permalink,
.quote-block:hover .block-permalink,
.book-list li:hover .block-permalink,
.equation:hover .block-permalink { opacity: 1; }
.thesis-permalink:hover,
.para-permalink:hover,
.block-permalink:hover { color: var(--link); text-decoration: none; }

.thesis.is-target,
.quote-block.is-target,
.bib-entry.is-target,
.book-list li.is-target,
.equation.is-target,
.table-wrap.is-target {
  background: var(--highlight);
  box-shadow: inset 3px 0 0 var(--highlight-border);
}
.thesis.is-target { padding: .08em .12em; }
.theses-mode .thesis.is-target { padding-left: 2.8rem; }

/* Режим тезисов */
body.theses-mode .article-text p.prose {
  margin: 0 0 1.3rem;
}
body.theses-mode .article-text p.prose::before {
  content: "¶ " attr(data-para-number);
  display: block;
  margin-bottom: .3rem;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: .68rem;
}
body.theses-mode .thesis {
  display: block;
  position: relative;
  padding: .55rem .65rem .55rem 2.7rem;
  border-left: 2px solid var(--border-faint);
}
body.theses-mode .thesis::before {
  content: attr(data-thesis-number);
  position: absolute;
  left: .65rem;
  top: .62rem;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: .68rem;
}
body.theses-mode .thesis + .thesis { margin-top: .15rem; }
body.theses-mode .thesis:hover {
  background: var(--bg-subtle);
  border-left-color: var(--border);
}
body.theses-mode .thesis-permalink {
  display: inline;
  opacity: 1;
}
body.theses-mode .para-permalink { display: none; }

body.sources-mode #text { display: none; }
body.sources-mode #sources { margin-top: 0; }
body.sources-mode .toc-para,
body.sources-mode .toc-subhead,
body.sources-mode .toc-box a[href="#text"] { display: none; }

/* Теоремы */
.theorem-box {
  display: flow-root;
  margin: 1.35rem 0;
  padding: .95rem 1.05rem .75rem;
  background: var(--theorem-bg);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--text-muted);
}
.theorem-box .prose { margin-bottom: .45rem; }
.theorem-box .equation { margin: .6rem 0; }
.theorem-statement strong {
  font-family: var(--font-sans);
  font-size: .9em;
  letter-spacing: .01em;
}
.theorem-continuation { margin-bottom: 0; }
.proof-start {
  display: flow-root;
  border-left: 2px solid var(--border-subtle);
  padding-left: 1rem;
  margin: 1rem 0;
}
.proof-start > .proof-start {
  border-left: 0;
  padding-left: 0;
  margin: 0;
}

/* Цитаты */
.quote-block {
  display: flow-root;
  margin: 1.35rem 0;
  padding: .85rem 1rem .55rem 1.15rem;
  background: var(--quote-bg);
  border-left: 3px solid var(--border);
  font-family: var(--font-serif);
}
.quote-block blockquote {
  margin: 0;
  font-size: 1rem;
  line-height: 1.66;
}

/* Списки книги */
.book-list {
  display: flow-root;
  margin: .8rem 0 1.15rem 1.5rem;
  padding: 0;
  font-family: var(--font-serif);
  font-size: 1.01rem;
  line-height: 1.65;
}
.book-list li { margin: .4rem 0; }
.list-objections,
.list-systems {
  list-style: none;
  margin-left: 0;
  counter-reset: item;
}
.list-objections > li,
.list-systems > li {
  position: relative;
  counter-increment: item;
  margin: 0;
  padding: .65rem .7rem .65rem 2.7rem;
  border-top: 1px solid var(--border-faint);
}
.list-objections > li::before,
.list-systems > li::before {
  content: counter(item);
  position: absolute;
  left: .55rem;
  top: .72rem;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: .68rem;
}
.list-objections > li:first-child,
.list-systems > li:first-child { border-top: 0; }
.list-conditions { font-family: var(--font-sans); font-size: .9rem; }

/* Таблицы */
.table-wrap {
  display: flow-root;
  overflow-x: auto;
  margin: 1.25rem 0;
}
.wikitable {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: .8rem;
  line-height: 1.45;
  background: var(--bg);
}
.wikitable th,
.wikitable td {
  border: 1px solid var(--border);
  padding: .42rem .52rem;
  text-align: left;
  vertical-align: top;
}
.wikitable th {
  background: var(--bg-subtle);
  font-weight: 600;
}
.wikitable tbody tr:nth-child(even) td { background: var(--bg-subtle); }

/* Формулы */
.equation {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  scroll-margin-top: 5rem;
}
.equation-math {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.equation .katex-display { margin: .15rem 0; }
.eqno {
  flex: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: .8rem;
}
.tex { white-space: normal; }

/* Нижние секции статьи */
.article-section { margin: 2rem 0; scroll-margin-top: 5rem; }
.quote-block,
.bib-entry,
.book-list li,
.table-wrap,
.equation,
.article-header,
.letter-heading,
.category-section { scroll-margin-top: 5rem; }
.article-section h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 400;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: .22rem;
  margin: .2rem 0 .55rem;
}
.article-section h3 {
  font-family: var(--font-sans);
  font-size: .88rem;
  margin: 1rem 0 .3rem;
}
.source-list {
  list-style: none;
  padding-left: 0;
  font-size: .92rem;
}
.source-list li { margin: .5rem 0; }
.bib-number {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: .72rem;
  white-space: nowrap;
}
.source-link {
  font-family: var(--font-sans);
  font-size: .72rem;
  white-space: nowrap;
}
.see-list,
.term-list {
  margin: .3rem 0 1rem 1.2rem;
  padding: 0;
  font-size: .92rem;
}
.see-list li,
.term-list li { margin: .3rem 0; }
.category-links {
  font-size: .82rem;
  line-height: 1.8;
}
.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 2rem;
  padding-top: .9rem;
  font-size: .8rem;
}
.prev-next .next { text-align: right; margin-left: auto; }
.prev-next .dir { color: var(--text-muted); }
.prev-next .small {
  color: var(--text-muted);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ------------------------------------------------------------------ */
/* Словарь                                                            */
/* ------------------------------------------------------------------ */

.letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: .7rem 0 1.2rem;
  font-size: .78rem;
}
.letter-nav a {
  padding: .12rem .35rem;
  border: 1px solid var(--border-faint);
  color: var(--text-muted);
}
.letter-nav a:hover {
  border-color: var(--border);
  background: var(--bg-subtle);
  text-decoration: none;
}
.letter-heading {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 400;
  border-bottom: 1px solid var(--border-subtle);
  margin: 1.5rem 0 .45rem;
  scroll-margin-top: 5rem;
}
.glossary-entry {
  padding: .55rem 0 1rem;
  border-bottom: 1px solid var(--border-faint);
}
.glossary-entry h3 {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 400;
  margin: 0 0 .25rem;
}
.definition { margin: .35rem 0; }
.definition p {
  margin: .15rem 0 .25rem;
  font-family: var(--font-serif);
  font-size: .98rem;
  line-height: 1.62;
}
.definition-source {
  color: var(--text-muted);
  font-size: .7rem;
}
.occurrence-note { font-size: .72rem; margin: .2rem 0; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .7rem;
  margin: .9rem 0 1.1rem;
  font-size: .76rem;
}
.filter-row input[type="search"] {
  min-width: 18rem;
  max-width: 100%;
  padding: .38rem .55rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .82rem;
}
.occurrence-list {
  list-style: none;
  margin: .5rem 0;
  padding: 0;
}
.occurrence-list li {
  margin: .65rem 0;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border-faint);
}
.occurrence-excerpt {
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: .92rem;
  margin-top: .15rem;
}

/* ------------------------------------------------------------------ */
/* Литература                                                         */
/* ------------------------------------------------------------------ */

.bibliography-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bib-entry {
  padding: .42rem 0;
  border-bottom: 1px solid var(--border-faint);
  font-family: var(--font-serif);
  font-size: .94rem;
  line-height: 1.5;
}
.bib-text { overflow-wrap: anywhere; }
.bib-backlinks {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: .7rem;
  margin-top: .12rem;
}

/* ------------------------------------------------------------------ */
/* Цитаты                                                             */
/* ------------------------------------------------------------------ */

.quote-filters { align-items: center; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
}
.segmented button {
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: .25rem .5rem;
  font-family: var(--font-sans);
  font-size: .72rem;
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--bg-subtle); font-weight: 600; }
.quote-entry {
  padding: .9rem 0 1.1rem;
  border-bottom: 1px solid var(--border-faint);
}
.quote-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .7rem;
  font-size: .72rem;
}
.badge {
  display: inline-block;
  padding: .08rem .33rem;
  border: 1px solid var(--border);
  font-size: .64rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-quran { background: #eaf3ff; border-color: #a3c4f3; }
.badge-hadith { background: #f6f1e2; border-color: #c9b98a; }
.badge-other { background: var(--bg-subtle); }
html[data-theme="dark"] .badge-quran { background: #16283d; border-color: #355b86; }
html[data-theme="dark"] .badge-hadith { background: #2d291d; border-color: #6f6239; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .badge-quran { background: #16283d; border-color: #355b86; }
  html[data-theme="auto"] .badge-hadith { background: #2d291d; border-color: #6f6239; }
}
.quote-entry blockquote {
  margin: .45rem 0 .35rem;
  font-family: var(--font-serif);
  font-size: .99rem;
  line-height: 1.64;
}
.quote-entry-foot { font-size: .72rem; }

/* ------------------------------------------------------------------ */
/* Указатели, категории, о книге                                      */
/* ------------------------------------------------------------------ */

.az-list {
  margin: .2rem 0 .9rem 1.2rem;
  padding: 0;
  font-size: .9rem;
}
.az-list li { margin: .22rem 0; }
.category-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .8rem;
  margin: 1rem 0 1.5rem;
  font-size: .82rem;
}
.category-section { margin: 1.6rem 0; scroll-margin-top: 5rem; }
.category-section h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  border-bottom: 1px solid var(--border-subtle);
}
.meta-table {
  border-collapse: collapse;
  font-size: .82rem;
  margin: .5rem 0 1rem;
}
.meta-table th,
.meta-table td {
  border: 1px solid var(--border-faint);
  padding: .35rem .5rem;
  text-align: left;
  vertical-align: top;
}
.meta-table th {
  background: var(--bg-subtle);
  width: 12rem;
  font-weight: 600;
}
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "body cover";
  gap: 2.2rem;
  align-items: start;
}
.about-cover { grid-area: cover; }
.about-body { grid-area: body; min-width: 0; }
.cover-figure {
  width: 100%;
  margin: 0;
}
.cover-figure img { border: 1px solid var(--border); }
.cover-figure figcaption {
  color: var(--text-muted);
  font-size: .68rem;
  margin-top: .25rem;
}
.imprint { color: var(--text-muted); font-size: .88rem; }
.citation-text { font-size: .9rem; line-height: 1.6; }
.basmala {
  width: min(100%, 28rem);
  margin: 1.2rem auto 1.6rem;
  color: var(--text);
}
.basmala svg { display: block; width: 100%; height: auto; }
.warn-list { font-size: .82rem; }
.error { color: var(--danger); }

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

.page-search { max-width: 44rem; margin: .9rem 0 1rem; }
.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .8rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin: .8rem 0 .5rem;
}
.search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .1rem;
}
.search-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--link);
  padding: .4rem .55rem;
  font-family: var(--font-sans);
  font-size: .76rem;
  cursor: pointer;
}
.search-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--link);
  font-weight: 600;
}
.sort-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: .72rem;
  padding-bottom: .35rem;
}
.sort-label select {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .76rem;
  padding: .2rem .3rem;
}
.search-status {
  color: var(--text-muted);
  font-size: .76rem;
  margin: .55rem 0 .2rem;
}
.search-result {
  padding: .9rem 0;
  border-bottom: 1px solid var(--border-faint);
}
.result-meta {
  color: var(--text-muted);
  font-size: .68rem;
  letter-spacing: .01em;
}
.result-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  margin: .18rem 0;
}
.result-snippet {
  font-family: var(--font-serif);
  font-size: .96rem;
  line-height: 1.55;
  margin: .15rem 0;
}
.search-result mark { background: var(--highlight); color: var(--text); }
.load-more {
  margin: 1.3rem 0;
  padding: .45rem .85rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: .8rem;
  cursor: pointer;
}
.load-more:hover { background: var(--border-faint); }

.arabic {
  font-family: "Amiri", "Noto Naskh Arabic", "Scheherazade New", "DejaVu Sans", serif;
  font-size: 1.12em;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* Служебные элементы                                                 */
/* ------------------------------------------------------------------ */

.anchor-alias { display: block; height: 0; overflow: hidden; }
.noscript-note { color: var(--text-muted); }

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

@media (max-width: 1150px) {
  .page-layout { grid-template-columns: 13rem minmax(0, 1fr); gap: 1.6rem; }
  .home-columns { grid-template-columns: minmax(0, 1.5fr) minmax(15rem, .8fr); gap: 1.8rem; }
}

@media (max-width: 950px) {
  .header-nav { display: none; }
  .menu-toggle { display: inline-grid; }
  .page-layout { grid-template-columns: minmax(0, 1fr); padding: 1.2rem 1rem 3rem; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: min(24rem, 100vw);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    padding: 0 1rem 2rem;
    background: var(--bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .18s ease;
  }
  .sidebar.open { transform: translateX(0); }
  body.menu-open { overflow: hidden; }
  .mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: .9rem 0 .7rem;
    margin-bottom: .35rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border-subtle);
  }
  .mobile-menu-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    line-height: 1.2;
  }
  .mobile-menu-close { color: var(--text); }
  .sidebar .nav-heading { margin-top: 1.15rem; }
  .sidebar .nav-list li { margin: 0; }
  .sidebar .nav-list a {
    display: block;
    padding: .6rem .1rem;
    font-size: .95rem;
    border-bottom: 1px solid var(--border-faint);
  }
  .sidebar .nav-list a.active { font-weight: 700; }
  .sidebar .nav-random {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: .9rem;
  }
  body.menu-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .35);
  }
  .content { max-width: none; }
  .header-search { max-width: none; }
  .infobox { float: none; width: 100%; margin: 1rem 0; }
  .home-columns { grid-template-columns: minmax(0, 1fr); }
  .home-toc { columns: 1; }
  .home-head h1 { font-size: 2.2rem; }
  .about-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "body";
    gap: 1.2rem;
  }
  .about-cover { width: min(300px, 82%); margin: 0 auto 1rem; }
  .about-body { width: 100%; }
  .prev-next { flex-direction: column; }
  .prev-next .next { text-align: left; margin-left: 0; }
}

@media (max-width: 620px) {
  .theme-toggle { margin-left: auto; }
  .sidebar { width: 100vw; border-right: 0; }
  .header-inner { gap: .45rem; padding: .4rem .7rem; flex-wrap: wrap; }
  .logo-text { font-size: .95rem; }
  .header-search { order: 5; flex-basis: 100%; }
  .header-search input[type="search"] { height: 2rem; }
  .search-submit { height: 2rem; }
  .page-header h1,
  .article-header h1 { font-size: 1.75rem; }
  .home-head h1 { font-size: 2rem; }
  .home-subtitle { font-size: 1.05rem; }
  .page-layout { padding: .9rem .75rem 2.5rem; }
  .prose { font-size: 1rem; line-height: 1.65; }
  .lead { font-size: 1.03rem; }
  .home-toc { font-size: .88rem; }
  .filter-row input[type="search"] { min-width: 0; width: 100%; }
  .search-toolbar { align-items: flex-start; }
  .search-tabs { overflow-x: auto; flex-wrap: nowrap; width: 100%; padding-bottom: .2rem; }
  .search-tabs button { white-space: nowrap; }
  .stats { gap: 1rem; }
  .stat-num { font-size: 1.35rem; }
  .contents-list li { gap: .55rem; }
  .infobox { font-size: .74rem; }
}

@media (max-width: 380px) {
  .header-inner { gap: .25rem; padding: .35rem .5rem; }
  .logo-text { font-size: .82rem; }
  .logo-mark { width: 1.8rem; height: 1.8rem; font-size: 1rem; }
  .icon-button { width: 1.9rem; height: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ */
/* Печать                                                             */
/* ------------------------------------------------------------------ */

@media print {
  :root {
    --bg: #fff;
    --bg-subtle: #fff;
    --text: #000;
    --text-muted: #333;
    --text-faint: #555;
    --border: #888;
    --border-subtle: #999;
    --border-faint: #ccc;
    --link: #000;
    --link-visited: #000;
  }
  html, body { background: #fff; color: #000; }
  .site-header,
  .sidebar,
  .site-footer,
  .page-tabs,
  .filter-row,
  .search-form,
  .prev-next,
  .para-permalink,
  .block-permalink,
  .thesis-permalink,
  .article-note,
  .load-more,
  .search-toolbar,
  .search-status { display: none !important; }
  .page-layout { display: block; padding: 0; max-width: none; }
  .content { max-width: none; }
  .article-header h1, .page-header h1 { font-size: 20pt; }
  .article-text { font-size: 11pt; }
  .prose { font-size: 11pt; line-height: 1.5; }
  .theorem-box, .quote-block, .infobox, .wikitable { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .infobox { float: none; width: 100%; margin: 0 0 1rem; }
}
