/* =========================================================
   lygrax pages — руководство
   ========================================================= */

.docs-page .glow--top {
  opacity: 0.55;
}

/* The landing's .page clips overflow, which would break position: sticky;
   this page has nothing that needs clipping. */
.docs-page .page {
  overflow: visible;
}

.docs {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--side) 40px;
}

/* ---------- hero ---------- */
.docs__hero {
  max-width: 860px;
  padding: clamp(40px, 6vw, 96px) 0 clamp(32px, 4vw, 56px);
}

.docs__eyebrow {
  display: inline-block;
  color: var(--pink);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs__title {
  margin-top: 18px;
  font-size: clamp(34px, 4.6vw, 72px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.docs__lead {
  max-width: 660px;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.45;
}

/* ---------- search ---------- */
.docs__search {
  position: relative;
  max-width: 560px;
  margin-top: 32px;
}

.docs__search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.docs__search-field:focus-within {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.docs__search-field svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.docs__search input {
  width: 100%;
  padding: 16px 0;
  border: 0;
  background: none;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.docs__search input::placeholder {
  color: #8d8d8d;
}

.docs__search kbd {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.docs__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #161616;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.docs__results[hidden] {
  display: none;
}

.docs__result {
  display: block;
  padding: 12px 14px;
  border-radius: 9px;
  transition: background 0.15s ease;
}

.docs__result:hover,
.docs__result.is-focused {
  background: rgba(255, 255, 255, 0.06);
}

.docs__result strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.docs__result span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.docs__result--empty {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- layout ---------- */
.docs__layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: clamp(28px, 4vw, 48px);
}

.docs__side {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}

.docs__toc-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #191919;
  font-size: 15px;
  cursor: pointer;
}

.docs__toc-toggle span {
  color: var(--muted);
  font-size: 12px;
}

.docs__toc-toggle svg {
  transition: transform 0.2s ease;
}

.docs__side.is-open .docs__toc-toggle svg {
  transform: rotate(180deg);
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-nav__group {
  margin: 22px 0 6px;
  color: #7f7f7f;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav__group:first-child {
  margin-top: 0;
}

.docs-nav a {
  display: block;
  padding: 7px 12px 7px 14px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.docs-nav a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
}

.docs-nav a.is-active {
  border-left-color: var(--accent);
  background: rgba(255, 0, 64, 0.08);
  color: var(--white);
}

/* ---------- content ---------- */
.docs__main {
  min-width: 0;
  max-width: 840px;
}

.doc-section {
  padding-bottom: clamp(36px, 4vw, 56px);
  margin-bottom: clamp(36px, 4vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  scroll-margin-top: 24px;
}

.doc-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.doc-section h2 {
  font-size: clamp(26px, 2.4vw, 38px);
  font-weight: 400;
  line-height: 1.12;
}

.doc-section h3 {
  margin-top: 34px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
}

.doc-section h4 {
  margin: 24px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.doc-section p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.doc-section p strong,
.doc-section li strong {
  color: var(--white);
  font-weight: 600;
}

.doc-section a:not(.btn) {
  color: var(--white);
  border-bottom: 1px solid var(--accent);
}

.doc-section a:not(.btn):hover {
  color: var(--accent);
}

.doc-section ul,
.doc-section ol {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-left: 0;
  list-style: none;
  counter-reset: doc-list;
}

.doc-section li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.doc-section ul > li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.doc-section ol > li {
  counter-increment: doc-list;
}

.doc-section ol > li::before {
  content: counter(doc-list);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.9;
}

.doc-section ol > li {
  padding-left: 28px;
}

.doc-section code {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.88em;
}

.doc-section kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #262626;
  color: var(--white);
  font-family: inherit;
  font-size: 0.82em;
  line-height: 1.5;
  white-space: nowrap;
}

/* callout */
.doc-callout {
  margin-top: 24px;
  padding: 18px 20px 18px 22px;
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 0, 64, 0.07);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.doc-callout strong,
.doc-callout b {
  color: var(--white);
  font-weight: 600;
}

/* tables */
.doc-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}

.doc-table th,
.doc-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: top;
}

.doc-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.doc-table td:first-child {
  color: var(--white);
}

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

.doc-table code {
  white-space: nowrap;
}

/* steps */
.doc-steps {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  counter-reset: doc-step;
}

.doc-step {
  position: relative;
  padding: 18px 20px 18px 62px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.doc-step::before {
  counter-increment: doc-step;
  content: counter(doc-step, decimal-leading-zero);
  position: absolute;
  left: 20px;
  top: 18px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.doc-step strong {
  display: block;
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
}

.doc-step span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* card grid inside docs */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.doc-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.doc-card h3 {
  margin: 0;
  font-size: 16px;
}

.doc-card p {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.doc-card--accent {
  border-color: rgba(255, 0, 64, 0.45);
  background: rgba(255, 0, 64, 0.06);
}

/* faq */
.doc-faq {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.doc-faq details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.doc-faq summary {
  padding: 16px 44px 16px 18px;
  color: var(--white);
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
  position: relative;
}

.doc-faq summary::-webkit-details-marker {
  display: none;
}

.doc-faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}

.doc-faq details[open] summary::after {
  content: "–";
}

.doc-faq details p {
  margin: 0;
  padding: 0 18px 18px;
  font-size: 15px;
}

/* back to top */
.docs__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 840px;
  margin-left: auto;
  margin-top: 8px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.docs__foot a {
  color: var(--white);
  border-bottom: 1px solid var(--accent);
}

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .docs__layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
  }
}

@media (max-width: 1024px) {
  .docs__layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .docs__side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .docs__toc-toggle {
    display: flex;
  }

  .docs-nav {
    display: none;
    margin-top: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #181818;
  }

  .docs__side.is-open .docs-nav {
    display: flex;
  }

  .docs__main {
    max-width: none;
  }

  .docs__foot {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .docs__hero {
    padding-top: 48px;
  }

  .docs__title {
    font-size: clamp(30px, 9vw, 44px);
  }

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

  .doc-section p,
  .doc-section li {
    font-size: 15px;
  }

  .doc-table {
    font-size: 14px;
  }

  .doc-table th,
  .doc-table td {
    padding: 11px 13px;
  }

  .docs__foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- print ---------- */
@media print {
  .header,
  .footer,
  .docs__side,
  .docs__search,
  .glow {
    display: none !important;
  }

  .docs__layout {
    display: block;
  }

  body {
    background: #fff;
    color: #111;
  }

  .doc-section p,
  .doc-section li,
  .doc-table td {
    color: #333;
  }

  .doc-section {
    break-inside: avoid;
  }
}
