/* ============================================================
   БАЗА
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --surface: #f8fafc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-text: 'Merriweather', Georgia, 'Times New Roman', serif;
  --sidebar-width: 300px;
  --content-max: 760px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

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

/* ============================================================
   МОБИЛЬНАЯ ШАПКА
   ============================================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  padding: 0 16px;
  background: var(--bg-sidebar);
  color: #fff;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.mobile-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.mobile-app-link {
  color: #93c5fd;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================================
   ОВЕРЛЕЙ
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s;
}

.overlay.visible {
  opacity: 1;
}

/* ============================================================
   МАКЕТ
   ============================================================ */
.page {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* ============================================================
   ЛЕВАЯ ПАНЕЛЬ
   ============================================================ */
.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

.sidebar-inner {
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.brand {
  margin-bottom: 28px;
}

.brand-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-muted);
}

.brand-title {
  margin: 0;
  font-family: var(--font-text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: #f1f5f9;
}

/* Навигация */
.toc {
  flex: 1;
}

.toc-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sidebar-muted);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list li {
  margin: 0;
}

.toc-link {
  display: block;
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.toc-link:hover {
  background: var(--bg-sidebar-hover);
  color: #f1f5f9;
}

.toc-link.active {
  background: var(--bg-sidebar-hover);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 500;
}

.toc-sub .toc-link {
  padding-left: 24px;
  font-size: 12.5px;
  color: var(--text-sidebar-muted);
}

.toc-sub .toc-link:hover,
.toc-sub .toc-link.active {
  color: #e2e8f0;
}

/* CTA в сайдбаре */
.sidebar-cta {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #1e293b;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.sidebar-cta .btn {
  width: 100%;
}

.sidebar-meta {
  margin: 24px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-sidebar-muted);
}

.muted {
  color: #475569;
}

/* ============================================================
   КОНТЕНТ
   ============================================================ */
.content {
  padding: 56px 56px 80px;
  max-width: calc(var(--content-max) + 112px);
  margin: 0 auto;
  min-width: 0;
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}

.section {
  margin-bottom: 64px;
}

.section h2 {
  margin: 0 0 20px;
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #0f172a;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section h3 {
  margin: 36px 0 14px;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: #0f172a;
}

.h3-plain {
  margin-top: 32px !important;
}

.section p {
  margin: 0 0 18px;
}

.section p.lead {
  font-size: 18px;
  line-height: 1.7;
  color: #334155;
}

.section strong {
  font-weight: 700;
  color: #0f172a;
}

/* ============================================================
   КАРТОЧКИ ОСЕЙ
   ============================================================ */
.axes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0 32px;
}

.axis-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.axis-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
}

.axis-card .abbr {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  vertical-align: middle;
}

.axis-card p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ============================================================
   КАРТОЧКИ ДОМЕНОВ
   ============================================================ */
.domain-card {
  margin: 24px 0;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.domain-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.domain-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.domain-num {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.domain-head h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: #0f172a;
}

.domain-head .en {
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  font-size: 14px;
}

.domain-meta {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 4px 12px;
  margin: 0 0 16px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
}

.domain-meta dt {
  font-weight: 600;
  color: var(--text-secondary);
}

.domain-meta dd {
  margin: 0;
  color: var(--text);
}

/* Полосы индексов */
.index-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.index-row {
  display: grid;
  grid-template-columns: 40px 1fr 52px;
  align-items: center;
  gap: 10px;
}

.index-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 4px;
}

.index-val {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--text-secondary);
}

.domain-note {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Чипы */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
}

.chip b {
  color: var(--accent);
  font-weight: 700;
}

.domain-card dl {
  margin: 0;
}

.domain-card dt {
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.domain-card dt:first-child {
  margin-top: 0;
}

.domain-card dd {
  margin: 4px 0 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
}

/* ============================================================
   ВЕКТОРЫ
   ============================================================ */
.vector-card {
  margin: 20px 0;
  padding: 20px 24px;
  background: #fff;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: var(--shadow-sm);
}

.vector-card h4 {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
}

.vector-card .num {
  color: var(--accent);
  font-weight: 700;
  margin-right: 6px;
}

.vector-card .arrow {
  color: var(--accent);
  font-weight: 400;
  margin: 0 2px;
}

.vector-card p {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.65;
}

.vector-card p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   НУМЕРОВАННЫЕ СПИСКИ
   ============================================================ */
.numbered {
  margin: 20px 0;
  padding-left: 0;
  list-style: none;
  counter-reset: item;
}

.numbered li {
  position: relative;
  padding-left: 36px;
  margin-bottom: 18px;
  font-size: 16px;
  line-height: 1.7;
  counter-increment: item;
}

.numbered li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}

/* ============================================================
   РАЗЛОМЫ
   ============================================================ */
.fault-card {
  margin: 24px 0;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fault-title {
  margin: 0 0 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.fault-poles {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.pole {
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  text-align: center;
}

.pole-domains {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.pole-values {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.pole-essence {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.fault-vs {
  font-size: 22px;
  color: var(--accent);
  font-weight: 300;
}

/* ============================================================
   АКЦЕНТ
   ============================================================ */
.highlight {
  padding: 24px 28px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 17px;
  line-height: 1.7;
}

/* ============================================================
   НИЖНИЙ CTA
   ============================================================ */
.final-cta {
  margin: 64px 0 32px;
  padding: 40px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.final-cta p {
  margin: 0 0 18px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.btn-large {
  padding: 15px 32px;
  font-size: 15px;
}

/* ============================================================
   ПОДВАЛ
   ============================================================ */
.site-footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.site-footer p {
  margin: 0 0 8px;
}

.footer-project {
  font-weight: 600;
  color: var(--text);
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-meta {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

/* Планшет / небольшой десктоп */
@media (max-width: 1100px) {
  :root {
    --sidebar-width: 260px;
  }

  .content {
    padding: 44px 36px 64px;
    font-size: 16.5px;
  }

  .axes-grid {
    grid-template-columns: 1fr;
  }
}

/* Мобильная версия */
@media (max-width: 1023px) {
  .mobile-header {
    display: flex;
  }

  .overlay {
    display: block;
    pointer-events: none;
  }

  .overlay.visible {
    pointer-events: auto;
  }

  .page {
    grid-template-columns: 1fr;
    padding-top: 56px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 85vw);
    height: 100vh;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-inner {
    padding: 24px 20px 40px;
  }

  .content {
    padding: 32px 20px 56px;
    font-size: 16px;
    max-width: 100%;
  }

  .section h2 {
    font-size: 23px;
  }

  .domain-card {
    padding: 18px 16px;
  }

  .domain-meta {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .domain-meta dt {
    margin-top: 6px;
  }

  .domain-meta dt:first-child {
    margin-top: 0;
  }

  .fault-poles {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .fault-vs {
    transform: rotate(90deg);
    text-align: center;
  }

  .vector-card {
    padding: 16px 18px;
  }

  .final-cta {
    padding: 32px 20px;
  }

  .btn-large {
    width: 100%;
  }

  .highlight {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 24px 16px 48px;
    font-size: 15.5px;
  }

  .section h2 {
    font-size: 21px;
  }

  .domain-head {
    flex-wrap: wrap;
  }

  .index-row {
    grid-template-columns: 36px 1fr 44px;
    gap: 8px;
  }

  .numbered li {
    padding-left: 30px;
  }
}

/* Уменьшение анимаций */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}