/* Golos Text: по файлу на подмножество символов и начертание; браузер грузит только нужные */
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/golos-cyrillic-ext-400.fc8a0573e1.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/golos-cyrillic-400.15a5cbadfc.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/golos-latin-ext-400.0b130bd566.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/golos-latin-400.c8246f55db.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/golos-cyrillic-ext-500.1370094de5.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/golos-cyrillic-500.22337b726d.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/golos-latin-ext-500.e64df81854.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/golos-latin-500.779e46588b.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/golos-cyrillic-ext-600.bd114c2c35.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/golos-cyrillic-600.1df9c46f33.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/golos-latin-ext-600.9f89503b3f.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/golos-latin-600.ecd56e7dae.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/golos-cyrillic-ext-700.8e60118e43.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/golos-cyrillic-700.42db867ddf.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/golos-latin-ext-700.57641b457c.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:"Golos Text";font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/golos-latin-700.1ac7742b82.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --bg: #f4f5f8;
  --card: #fff;
  --border: #eceef2;
  --border-strong: #dde0e5;
  --text: #1a1d21;
  --text-muted: #6b7077;
  --text-faint: #9aa0a6;
  --primary: #6940ee;
  --primary-soft: #efeafe;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 10px; height: 10px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #80808040; background-clip: padding-box; border: 2px solid transparent; border-radius: 8px }
::-webkit-scrollbar-thumb:hover { background: #80808066; background-clip: padding-box }

/* Каркас */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 72px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  box-sizing: border-box;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand { display: flex; align-items: center; flex-shrink: 0; color: inherit; text-decoration: none }
.brand img { display: block; height: 32px; width: auto }

.site-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 112px 40px 88px;
}

@media (max-width: 900px) {
  .site-header-inner { padding: 0 24px }
  .site-content { padding: 96px 24px 64px }
}

@media (max-width: 640px) {
  .site-header { height: 60px }
  .site-header-inner { padding: 0 16px }
  .brand img { height: 26px }
  .site-content { padding: 84px 16px 56px }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none }
.breadcrumb a:hover { color: var(--primary) }
.breadcrumb .sep { color: var(--text-faint) }
.breadcrumb .current { color: var(--text) }

.icon { flex-shrink: 0; color: var(--text-faint); transition: transform .15s, color .15s }

/* Главная */

.landing { display: flex; flex-direction: column; gap: 36px }
.hero-title { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em }
.landing-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px }
.hero-subtitle { margin: 8px 0 0; font-size: 16px; color: var(--text-muted); line-height: 1.5; max-width: 820px }

.trajectory-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.trajectory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.trajectory-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.trajectory-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: .02em;
}
.trajectory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.stage-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stage-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
}
.stage-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.stage-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.row-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border) }
.row-list li { border-bottom: 1px solid var(--border) }
.row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 8px;
  color: inherit;
  text-decoration: none;
  transition: color .15s, background-color .15s;
  border-radius: 6px;
}
.row:hover { color: var(--primary); background-color: rgba(255,255,255,0.7) }
.row:hover .icon { color: var(--primary); transform: translateX(3px) }
.row-title { flex: 1; font-size: 16px; font-weight: 500; line-height: 1.45 }
.row-slug { font-family: var(--mono); font-size: 13px; color: var(--text-muted) }
.row-num {
  min-width: 36px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.empty { margin: 0; padding: 16px 8px; font-size: 15px; color: var(--text-muted) }

/* Страницы курса и темы */

.course-page { display: flex; flex-direction: column; gap: 32px }

.topic-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; align-items: start }
@media (min-width: 1100px) {
  .topic-page { grid-template-columns: minmax(0, 1fr) 280px; gap: 64px }
}
.topic-main { display: flex; flex-direction: column; gap: 28px; min-width: 0 }

.page-head { padding: 8px 0 6px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap }
.page-head-text { min-width: 0 }
.page-kicker { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--primary) }
.page-title { margin: 8px 0 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25 }
.course-page .page-title { font-size: 36px; line-height: 1.2 }

/* Кнопка «Сохранить курс/тему»: показывается, только если воркер доступен */
.offline {
  flex-shrink: 0;
  margin-top: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.offline:hover { border-color: var(--primary) }
.offline[disabled] { opacity: .7; cursor: default }
.offline.done { background: transparent; border-color: var(--primary) }
@media (max-width: 640px) { .offline { font-size: 13px; padding: 7px 12px } }

.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 8px }
.tab {
  padding: 11px 18px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--text); background: rgba(0,0,0,0.03) }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600 }

/* Заголовок документа уже показан в шапке страницы */
.panel .prose > h1:first-child { display: none }

.env-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 11px 16px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.env-download:hover { border-color: var(--primary); color: var(--primary) }
.env-download-hint { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted) }

/* Оглавление: только у теории; вкладку на <html> выставляет sgTab() */
html[data-tab]:not([data-tab="theory"]) [data-toc] { display: none }

.toc { padding-left: 20px; border-left: 1px solid var(--border); font-size: 13.5px }
@media (min-width: 1100px) {
  .toc { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto }
}
.toc-title { margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted) }
.toc ul { margin: 0; padding-left: 0; list-style: none }
.toc ul ul { margin-top: 4px; padding-left: 14px; font-size: 12.5px }
.toc li { margin: 5px 0; line-height: 1.4 }
.toc a {
  display: inline-block;
  margin-left: -22px;
  padding: 2px 0 2px 20px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.toc a:hover, .toc a.active { color: var(--primary) }
.toc a.active { border-left-color: var(--primary); font-weight: 600 }

/* Текст документов */

.prose { max-width: 100%; font-size: 1.05rem; line-height: 1.7; overflow-wrap: break-word }
/* длинные адреса в списках литературы переносятся, а не растягивают страницу на телефоне */
.prose a { overflow-wrap: anywhere }
/* Блоки за пределами экрана не раскладываются, пока до них не доскроллят:
   длинная тема показывается на треть быстрее, на слабом телефоне полная загрузка — вдвое */
.prose > * { content-visibility: auto; contain-intrinsic-size: auto 3em }
/* Списки не должны отсекать маркеры и многозначные номера (content-visibility включает contain: paint) */
.prose > ol, .prose > ul { content-visibility: visible; contain: none }
.prose p { margin: 1.05em 0 }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 0; font-weight: 600; line-height: 1.3 }
.prose h2 { padding-top: 1.4em; margin-bottom: 0.4em; font-size: 1.55em }
.prose h3 { padding-top: 1.1em; margin-bottom: 0.3em; font-size: 1.28em }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 120px }
.prose :is(h1, h2, h3, h4, h5, h6) a { color: inherit; text-decoration: none }

.prose code, .prose kbd, .prose pre, .prose samp { font-family: var(--mono); font-feature-settings: "liga" 0 }
.prose code { padding: .15em .4em; border-radius: 4px; background: #e5e7eb; font-size: .88em }
.prose pre {
  margin: 1.8rem 0;
  padding: 1.1rem 1.4rem;
  border-radius: 8px;
  line-height: 1.6;
  overflow-x: auto;
  color: #1a1a1a;
  background: #eef0f4;
  border: 1px solid var(--border-strong);
  font-size: .88em;
}
.prose pre code { padding: 0; background: transparent; border-radius: 0; font-size: 1em; border: none }
.prose kbd { padding: .12em .45em; background: #f0f0f0; border: 1px solid #ccc; border-radius: 4px; font-size: .85em }

.prose figure { margin: 2.8rem 0; text-align: center }
.prose figure img { display: block; width: 100%; max-width: 1000px; height: auto; margin: 0 auto; border-radius: 8px }
.prose img { max-width: 100%; height: auto }
.prose figcaption { max-width: 72ch; margin: 1rem auto 0; font-size: 0.94em; line-height: 1.5; color: var(--text-muted) }

.prose blockquote {
  margin: 1.8em 0;
  padding: .8em 1.3em;
  background: #f7f8fa;
  border-left: 4px solid var(--primary);
  border-radius: 0 6px 6px 0;
  color: #383d44;
}
.prose blockquote > :first-child { margin-top: 0 }
.prose blockquote > :last-child { margin-bottom: 0 }

/* Широкие таблицы прокручиваются внутри обёртки, а не растягивают страницу */
.prose .table-wrap { margin: 1.8em 0; overflow-x: auto }
.prose table { width: 100%; border-collapse: collapse; font-size: .95em }
.prose th, .prose td { padding: .7em 1em; border-bottom: 1px solid #e2e2e6; text-align: left; vertical-align: top }
.prose th { background: #fafafa; border-bottom: 2px solid #b0b4ba; font-weight: 600 }
.prose th[style], .prose td[style] { text-align: revert }

.prose a { color: inherit; text-decoration: underline; text-decoration-color: #999; text-decoration-thickness: 1px; text-underline-offset: 2px }
.prose a:hover { text-decoration-color: #1a1a1a; text-decoration-thickness: 2px }

.prose sup.cite { font-size: .75em }
.prose sup.cite a { color: var(--primary); text-decoration: none }
.prose sup.cite a:hover { text-decoration: underline }
.prose ol.references { padding-left: 2.2em; font-size: .95em; list-style: decimal }
.prose ol.references li { margin: .5em 0; padding-left: .2em; line-height: 1.55 }
.prose ol.references li::before { content: none }
.prose ol.references li:target { background: #6940ee14; border-radius: 4px }

.prose ul { padding-left: 0; list-style: none }
.prose ul li { position: relative; padding-left: 1.3em }
.prose ul li::before { content: "–"; position: absolute; left: 0; top: 0; color: var(--text-muted) }
.prose ol { padding-left: 2.2em }
.prose li { margin: .35em 0 }
.prose li > p { margin: .5em 0 }
.prose li > ul { margin: .35em 0; padding-left: 1.3em }
.prose li > ol { margin: .35em 0; padding-left: 1.8em }
.prose hr { margin: 2.8em 0; border: none; border-top: 1px solid #e2e2e6 }

/* LaTeX / KaTeX */
.math-inline {
  display: inline-block;
  vertical-align: baseline;
  padding: 0 0.15em;
}
.math-display {
  display: block;
  margin: 1.6rem 0;
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}
.katex-display {
  margin: 1.6rem 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0;
}
.katex-display > .katex {
  max-width: 100%;
  text-align: center;
}
.katex {
  font-size: 1.08em;
  line-height: 1.2;
}

/* Страница 404 */
.not-found { display: flex; flex-direction: column; gap: 12px }
.not-found a { color: var(--primary) }
