/* =========================================================
   ENIGMA — DOCUMENTATION
   Подключается ПОСЛЕ styles.css. Переиспользует переменные
   (--bg/--surface/--accent/...) и базовые компоненты (.topbar,
   .footer, .btn, .code, .callout). Здесь — только doc-слой.
   ========================================================= */

.doc-page main {
  display: block;
}

.doc-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.doc-sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 28px 0 40px;
  scrollbar-width: thin;
}

.doc-sidebar-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
  padding: 0 8px;
}

.doc-nav-group {
  margin-bottom: 22px;
}

.doc-nav-group > h4 {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.doc-nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.doc-nav-group a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.doc-nav-group a:hover {
  background: var(--surface);
  color: var(--text);
}

.doc-nav-group a.is-active {
  color: var(--text);
  background: rgba(79, 140, 255, 0.1);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---------- Content ---------- */
.doc-main {
  padding: 28px 0 64px;
  min-width: 0;
}

.doc-main h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.doc-lead {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 68ch;
  margin: 0 0 36px;
}

.doc-main h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 90px;
}

.doc-main h3 {
  font-size: 1.18rem;
  margin: 30px 0 10px;
  scroll-margin-top: 90px;
}

.doc-main p {
  color: var(--muted);
  max-width: 72ch;
  margin: 0 0 16px;
  line-height: 1.7;
}

.doc-main strong {
  color: var(--text);
}

.doc-main ul,
.doc-main ol {
  color: var(--muted);
  max-width: 72ch;
  margin: 0 0 18px;
  padding-left: 22px;
  line-height: 1.7;
}

.doc-main li {
  margin: 0 0 8px;
}

.doc-main li::marker {
  color: var(--accent);
}

.doc-main a {
  color: var(--accent);
  text-decoration: none;
}

.doc-main a:hover {
  text-decoration: underline;
}

.doc-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

/* ---------- Callouts (info / key / tip) ---------- */
.doc-note {
  margin: 22px 0;
  padding: 18px 20px 18px 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  color: var(--text);
}

.doc-note p {
  color: var(--muted);
  margin: 0;
  max-width: none;
}

.doc-note p + p {
  margin-top: 8px;
}

.doc-note strong {
  color: var(--text);
}

.doc-note::before {
  position: absolute;
  left: 16px;
  top: 17px;
  font-size: 1.1rem;
  line-height: 1;
}

.doc-note.is-key {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.08);
}

.doc-note.is-key::before {
  content: "🔑";
}

.doc-note.is-info::before {
  content: "ℹ️";
}

.doc-note.is-tip {
  border-color: var(--accent-2);
  background: rgba(56, 211, 159, 0.07);
}

.doc-note.is-tip::before {
  content: "✓";
  color: var(--accent-2);
  font-weight: 700;
}

/* ---------- Numbered steps ---------- */
.doc-steps {
  list-style: none;
  counter-reset: docstep;
  padding: 0;
  margin: 24px 0;
  display: grid;
  gap: 14px;
  max-width: 72ch;
}

.doc-steps li {
  counter-increment: docstep;
  position: relative;
  padding: 16px 18px 16px 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}

.doc-steps li::before {
  content: counter(docstep);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.doc-steps li strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

/* ---------- Comparison table ---------- */
.doc-table-wrap {
  overflow-x: auto;
  margin: 24px 0;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 480px;
}

.doc-table th,
.doc-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.doc-table th {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-alt);
}

.doc-table td {
  color: var(--muted);
}

.doc-table tr:last-child td {
  border-bottom: none;
}

/* ---------- Mobile nav toggle ---------- */
.doc-nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 16px 24px 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 900px) {
  .doc-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .doc-nav-toggle {
    display: inline-flex;
  }
  .doc-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    display: none;
  }
  .doc-sidebar.is-open {
    display: block;
  }
  .doc-main {
    padding-top: 8px;
  }
}
