/* Стиль по мотивам remotion.dev: тёмный фон, жирный плотный гротеск, синий акцент, «клавиатурные» кнопки */
:root {
  --bg: #1b1b1d;
  --bg2: #242526;
  --card: #262729;
  --line: #3a3b3e;
  --text: #ffffff;
  --muted: #a1a1aa;
  --blue: #0b84f3;
  --blue2: #3b9cff;
  --shadow: #0e0e10;
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "GT Planar", "SF Pro Display", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg2: #ffffff;
  --card: #ffffff;
  --line: #e4e4e7;
  --text: #0b0b0c;
  --muted: #5f5f66;
  --shadow: #d4d4d8;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
img { max-width: 100%; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10; height: 60px; display: flex; align-items: center; gap: 28px;
  padding: 0 24px; background: var(--bg2); box-shadow: 0 1px 2px rgba(0,0,0,.1); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -0.02em; }
.logo b { color: var(--blue); }
.logo .mark { flex: none; display: block; color: var(--text); }
.nav-links { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-links a { text-decoration: none; font-weight: 500; font-size: 15px; padding: 6px 10px; border-radius: 6px; color: var(--muted); }
.nav-links a:hover { color: var(--text); background: rgba(127,127,127,.12); }
/* переключатель темы: система / светлая / тёмная */
.theme { flex: none; display: flex; gap: 2px; padding: 3px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); }
.theme button { display: flex; align-items: center; justify-content: center; width: 30px; height: 26px; padding: 0; border: 0; border-radius: 7px; cursor: pointer; background: transparent; color: var(--muted); }
.theme button:hover { color: var(--text); }
.theme button[aria-checked="true"] { background: var(--card); color: var(--blue2); box-shadow: 0 0 0 1.5px var(--line); }
.theme svg { display: block; }

/* hero */
.hero { position: relative; overflow: hidden; text-align: center; padding: 120px 24px 110px; }
.hero h1 { position: relative; font-family: var(--display); font-weight: 900; font-size: clamp(52px, 9vw, 104px); line-height: .95; letter-spacing: -0.045em; margin: 0 0 26px; }
.hero .sub { position: relative; font-size: 19px; line-height: 1.5; margin: 0 0 40px; }
.swoosh { position: absolute; inset: -20px 0 0 0; width: 100%; height: 100%; pointer-events: none; }
.swoosh path { fill: none; stroke: var(--blue); stroke-width: 34; stroke-linecap: round; }
.btns { position: relative; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* buttons & cards: «клавиатурная» тень */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 8px; font: 600 15px var(--font);
  color: var(--text); text-decoration: none; background: var(--card); border: 2px solid var(--line);
  border-bottom-width: 4px; cursor: pointer; transition: transform .08s, border-bottom-width .08s;
}
.btn:hover { transform: translateY(1px); border-bottom-width: 3px; }
.btn:active { transform: translateY(3px); border-bottom-width: 1px; }
.btn.primary { background: var(--blue); border-color: #0060c0; color: #fff; }
[data-theme="dark"] .btn { border-color: #111; background: #3a3b3e; }
[data-theme="dark"] .btn.primary { background: var(--blue); border-color: #04498a; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px 80px; flex: 1; }
.section { font-family: var(--display); font-weight: 800; font-size: 40px; letter-spacing: -0.03em; margin: 10px 0 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card {
  position: relative; display: block; padding: 22px; border-radius: 14px; background: var(--card); text-decoration: none;
  border: 2px solid var(--line); border-bottom-width: 5px; transition: transform .1s, border-color .1s;
}
a.card:hover { transform: translateY(-3px); border-color: var(--blue); }
.card.off { opacity: .45; }
.card h3 { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; margin: 6px 0 6px; }
.num { font-family: var(--display); font-weight: 900; font-size: 44px; letter-spacing: -0.05em; color: var(--blue); line-height: 1; }
.num.big { font-size: 96px; }
.dates { color: var(--muted); margin: 0 0 14px; font-size: 15px; line-height: 1.4; }
.dates span { font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; border: 1.5px solid var(--line); color: var(--muted); }
.chip.on { border-color: var(--blue); color: var(--blue2); }

/* module page */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 26px 0 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue2); }
.crumbs i { font-style: normal; opacity: .5; }
.mhead { display: flex; gap: 24px; align-items: center; margin: 36px 0 34px; }
.mhead h1 { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 6vw, 64px); letter-spacing: -0.04em; margin: 0; line-height: 1; }
.mhead .dates { margin: 8px 0 0; font-size: 17px; }
.rows { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: 12px; text-decoration: none;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; transition: transform .1s, border-color .1s;
}
.row:hover { transform: translateY(-2px); border-color: var(--blue); }
.row .idx { font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--blue); min-width: 38px; }
.row .rt { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.row .rt b { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.row .rt small { color: var(--muted); font-size: 14px; }
.row .arrow { font-size: 22px; color: var(--muted); }

/* lecture */
.lecture { max-width: 760px; margin: 0 auto; }
.kicker { color: var(--blue2); font-weight: 600; font-size: 14px; letter-spacing: .02em; margin: 34px 0 10px; text-transform: uppercase; }
.lecture h1 { font-family: var(--display); font-weight: 900; font-size: clamp(36px, 5.4vw, 56px); line-height: 1.02; letter-spacing: -0.04em; margin: 0 0 22px; }
.lecture h2 { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; margin: 48px 0 16px; }
.lecture h3 { font-size: 20px; margin: 30px 0 10px; letter-spacing: -0.01em; }
.lecture h4 { font-size: 17px; margin: 22px 0 8px; }
.from-notion { display: inline-block; font-size: 14px; padding: 6px 12px; border-radius: 8px; border: 1.5px dashed var(--line); color: var(--muted); }
.from-notion a { color: var(--blue2); }
.summary { font-size: 15.5px; line-height: 1.6; color: var(--muted); padding: 2px 0 2px 18px; border-left: 3px solid var(--blue); margin: 10px 0 30px; scroll-margin-top: 110px; }
.summary p { margin: 0 0 10px; }
.summary .label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue2); margin-bottom: 6px; }
/* панель быстрых переходов: прилипает под шапкой */
.jump {
  position: sticky; top: 60px; z-index: 5; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  /* во всю ширину окна: выходим за колонку статьи */
  margin: 0 calc(50% - 50vw) 18px; padding: 7px 0; background: var(--bg); border-bottom: 1px solid var(--line);
  --edge: max(16px, calc(50vw - 380px));
}
.jump .jt { margin-left: var(--edge); }
.jump > :last-child { margin-right: var(--edge); }
.jump::-webkit-scrollbar { display: none; }
.jump .jt { flex: 1 1 auto; min-width: 80px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px; }
.jump a, .jump button { flex: none; white-space: nowrap; font: 600 13px var(--font); color: var(--text); text-decoration: none; cursor: pointer; padding: 4px 10px; border-radius: 7px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 3px; }
.jump a:hover, .jump button:hover { border-color: var(--blue); color: var(--blue2); }
#audio, #conspect, #sources { scroll-margin-top: 110px; }
html { scroll-behavior: smooth; }
.audio { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; }
.audio .btn { align-self: flex-start; }
.player { display: flex; flex-direction: column; gap: 6px; }
.plabel { font-size: 14px; color: var(--muted); font-weight: 600; }
audio { width: 100%; height: 40px; }
.md { font-size: 17px; line-height: 1.68; }
.md p { margin: 0 0 14px; }
.md ul, .md ol { padding-left: 24px; margin: 0 0 16px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--blue); }
.md strong { font-weight: 700; }
.md blockquote { margin: 16px 0; padding: 4px 18px; border-left: 3px solid var(--line); color: var(--muted); }
.md figure { margin: 20px 0; }
.md figure img { border-radius: 12px; border: 2px solid var(--line); }
.md code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 4px; background: rgba(127,127,127,.15); }
.md hr { border: 0; border-top: 2px solid var(--line); margin: 28px 0; }
.table { overflow-x: auto; margin: 16px 0; }
.md table { border-collapse: collapse; font-size: 15px; width: 100%; }
.md th, .md td { border: 1.5px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.md th { background: rgba(11,132,243,.12); }
.sources { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.sources li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sources a { color: var(--muted); word-break: break-all; }
.stype { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; border: 1.5px solid var(--line); white-space: nowrap; }
.stype.notion { border-color: var(--blue); color: var(--blue2); }
.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 760px; margin: 50px auto 0; flex-wrap: wrap; }
.pager .btn { max-width: 48%; }

/* transcript modal */
.trmodal {
  width: min(860px, 94vw); max-height: 88vh; padding: 0; border-radius: 16px; color: var(--text); background: var(--bg);
  border: 2px solid var(--line); border-bottom-width: 6px; display: none; flex-direction: column;
}
.trmodal[open] { display: flex; }
.trmodal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.trhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 2px solid var(--line); font-family: var(--display); font-size: 18px; }
.close { font-size: 28px; line-height: 1; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0 6px; }
.trnote { margin: 0; padding: 10px 20px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.trtext { overflow-y: auto; padding: 14px 20px 26px; font-size: 15px; line-height: 1.6; }
.trpart { font-size: 16px; color: var(--blue2); margin: 18px 0 8px; }
.tr { margin: 0 0 10px; }
.tr b { font-weight: 700; margin-right: 6px; }
.tr.me b { color: var(--blue2); }
.ts { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 10px; background: none; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
button.ts { cursor: pointer; }
button.ts:hover { color: #fff; background: var(--blue); border-color: var(--blue); }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 30px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .nav { gap: 12px; padding: 0 14px; }
  .nav-links { display: none; }
  .hero { padding: 80px 18px 70px; }
  .num.big { font-size: 64px; }
  .mhead { gap: 14px; }
  .pager .btn { max-width: 100%; }
}
.tr.cut { color: var(--muted); font-style: italic; border-left: 3px solid var(--line); padding-left: 10px; }
html, body { overflow-x: clip; }

/* оглавление по конспекту: колонка справа от текста (начинается под панелью и прилипает под ней),
   на узком экране — выпадающее меню из кнопки в панели */
.lec-body { position: relative; }
.toc { position: absolute; top: 0; bottom: 0; left: calc(100% + 45px); width: 240px; }
.toc-in {
  position: sticky; top: 118px; max-height: calc(100vh - 140px); overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column; font-size: 13px; line-height: 1.35;
}
.toc b { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px 12px; }
.toc a { color: var(--muted); text-decoration: none; padding: 5px 10px 5px 12px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--text); }
.toc a.lv1 { padding-left: 22px; }
.toc a.lv2 { padding-left: 34px; font-size: 12.5px; }
.toc a.lv3 { padding-left: 46px; font-size: 12px; }
.toc a.active { color: var(--blue2); border-left-color: var(--blue); }
.md h2, .md h3, .md h4 { scroll-margin-top: 110px; }
.toc-btn { display: none; }
@media (max-width: 1299px) {
  /* плавающая кнопка в правом нижнем углу, меню раскрывается над ней */
  .toc-btn {
    display: flex; align-items: center; justify-content: center; position: fixed; right: 18px; bottom: 22px; z-index: 21;
    width: 54px; height: 54px; padding: 0; border-radius: 50%; color: #fff; cursor: pointer; line-height: 0;
    background: var(--blue); border: 2px solid #04498a; border-bottom-width: 5px; box-shadow: 0 8px 22px rgba(0,0,0,.35);
  }
  .toc-btn svg { display: block; }
  .toc-btn[aria-expanded="true"] { transform: translateY(2px); border-bottom-width: 3px; }
  .toc {
    display: none; position: fixed; top: auto; bottom: 90px; left: auto; right: 14px; width: min(340px, calc(100vw - 28px)); z-index: 20;
    padding: 12px 8px; background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,.35);
  }
  .toc.open { display: block; }
  .toc-in { position: static; max-height: min(60vh, calc(100vh - 220px)); font-size: 14px; }
}

/* строка источников внизу конспекта */
p.sources { display: block; margin: 44px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
p.sources b { color: var(--text); font-weight: 600; }
p.sources a { color: var(--blue2); }
