@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   1. БАЗОВЫЕ ШРИФТЫ И ОБЩИЕ СТИЛИ
   ========================================================================== */
:root {
  --md-text-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --md-code-font: 'JetBrains Mono', monospace;
}

body, .md-typeset {
  font-family: var(--md-text-font);
}

/* ==========================================================================
   2. ТЁМНАЯ ТЕМА (Slate)
   ========================================================================== */
[data-md-color-scheme="slate"] {
  /* Цвета фона и текста */
  --md-default-bg-color:          #090d16;
  --md-default-bg-color--light:   #111726;
  --md-default-fg-color:          #cbd5e1; /* Slate-300 */
  --md-default-fg-color--light:   #94a3b8;
  --md-default-fg-color--faint:   rgba(255, 255, 255, 0.07);
  
  /* Акценты */
  --md-accent-fg-color:           #818cf8;
  --md-typeset-a-color:           #38bdf8;
}

/* Заголовки в тёмной теме */
[data-md-color-scheme="slate"] .md-typeset h1 {
  color: #e2e8f0;
}
[data-md-color-scheme="slate"] .md-typeset h2,
[data-md-color-scheme="slate"] .md-typeset h3 {
  color: #cbd5e1;
}

/* Левая карточка-панель в тёмной теме */
@media screen and (min-width: 60em) {
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__scrollwrap {
    background-color: rgba(17, 23, 38, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* ==========================================================================
   3. СВЕТЛАЯ ТЕМА (Default)
   ========================================================================== */
[data-md-color-scheme="default"] .md-typeset h1 {
  color: #0f172a; /* Глубокий тёмно-синий (Slate-900) */
}
[data-md-color-scheme="default"] .md-typeset h2,
[data-md-color-scheme="default"] .md-typeset h3 {
  color: #334155; /* Контрастный Slate-700 */
}

/* ==========================================================================
   4. ОБЩАЯ СТИЛИЗАЦИЯ ЗАГОЛОВКОВ И ЭЛЕМЕНТОВ
   ========================================================================== */
.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.md-typeset h2, 
.md-typeset h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.md-typeset h2 {
  border-bottom: 1px solid var(--md-default-fg-color--faint);
  padding-bottom: 0.4rem;
}

/* ==========================================================================
   5. ЛЕВАЯ ПАНЕЛЬ (Навигация)
   ========================================================================== */
@media screen and (min-width: 60em) {
  .md-sidebar--primary .md-nav__title {
    display: none;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    border-radius: 12px;
    padding: 0.8rem 0.5rem;
    backdrop-filter: blur(8px);
  }
}

.md-sidebar--primary .md-nav__link {
  font-size: 0.8rem;
  border-radius: 6px;
  margin: 2px 0;
  padding: 0.4rem 0.6rem;
  transition: all 0.15s ease-in-out;
}

.md-sidebar--primary .md-nav__link--active {
  background: rgba(99, 102, 241, 0.15) !important;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #818cf8;
}

/* ==========================================================================
   6. ПРАВАЯ ПАНЕЛЬ («На этой странице»)
   ========================================================================== */
.md-sidebar--secondary .md-nav__title {
  font-size: 0 !important;
  padding: 0 0 0.5rem 0;
}

.md-sidebar--secondary .md-nav__title::after {
  content: "На этой странице:";
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: none;
  opacity: 0.7;
}

.md-sidebar--secondary .md-nav__link {
  font-size: 0.75rem;
  transition: color 0.15s ease;
}

/* Сброс автоподсветки активного пункта в правом меню */
.md-sidebar--secondary .md-nav__link--active {
  font-weight: 400 !important;
  text-shadow: none !important;
}

/* ==========================================================================
   7. СТИЛИЗАЦИЯ БЛОКОВ
   ========================================================================== */
.md-typeset pre,
.md-typeset .admonition {
  border-radius: 10px;
  border: 1px solid var(--md-default-fg-color--faint);
}