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

:root {
  --bg: #0a0b11;
  --panel: #11121a;
  --panel-2: #151722;
  --border: #272938;
  --text: #ececf2;
  --muted: #a3a3b4;
  --subtle: #737386;
  --label: #8a8a9e;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --content-width: 760px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid rgba(37, 38, 54, 0.4);
}

.nav-logo {
  display: flex;
  align-items: center;
  justify-self: start;
  text-decoration: none;
}

.nav-logo img {
  height: 44px;
  width: auto;
  border-radius: 50%;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 20px;
}

.site-nav-link {
  color: var(--label);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav-link:hover,
.site-nav-link.active {
  color: var(--text);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}

.topbar-link,
.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--label);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: opacity 0.15s, background 0.15s;
}

.topbar-link:hover,
.topbar-cta:hover {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.55);
  text-decoration: none;
}

.topbar-cta {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.topbar-cta:hover {
  color: #fff;
  opacity: 0.9;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 18px;
}

.nav-section-title {
  margin: 0 8px 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.nav-link:hover {
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
  background: var(--accent-soft);
}

.content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  width: 100%;
  max-width: calc(var(--content-width) + 96px);
  padding: 56px 48px 72px;
}

.doc {
  max-width: var(--content-width);
  margin-bottom: 54px;
}

.doc h1,
.doc h2,
.doc h3,
.doc h4,
.doc h5,
.doc h6 {
  color: var(--text);
  line-height: 1.2;
  letter-spacing: 0;
}

.doc h1 {
  margin: 0 0 22px;
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 700;
}

.doc h2 {
  margin: 42px 0 12px;
  font-size: 24px;
  font-weight: 650;
}

.doc h3 {
  margin: 30px 0 10px;
  font-size: 19px;
  font-weight: 650;
}

.doc p,
.doc li {
  color: var(--muted);
}

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

.doc ul,
.doc ol {
  margin: 0 0 22px;
  padding-left: 26px;
}

.doc li { margin: 7px 0; }
.doc strong { color: var(--text); font-weight: 650; }

.doc blockquote {
  margin: 16px 0 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
}

.doc blockquote p:last-child {
  margin-bottom: 0;
}

.doc h1 + p {
  color: #c5c5d2;
  font-size: 17px;
}

.doc table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.doc th {
  color: var(--text);
  background: var(--panel-2);
  font-size: 13px;
  font-weight: 700;
}

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

.doc-screenshot {
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.doc-screenshot-frame {
  display: grid;
  min-height: 210px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.14), transparent 44%),
    var(--panel-2);
}

.doc-screenshot-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.doc-screenshot-placeholder {
  margin: 24px;
  color: var(--subtle);
  border: 1px dashed rgba(163, 163, 180, 0.42);
  border-radius: 8px;
  padding: 18px 22px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-screenshot figcaption {
  padding: 16px 18px;
}

.doc-screenshot strong {
  display: block;
  margin-bottom: 4px;
}

.doc-screenshot p {
  margin: 0;
}

.doc > p img,
.doc > img {
  display: block;
  width: 100%;
  max-width: 760px;
  margin: 28px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.related-pages {
  margin: 34px 0 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.related-pages h2 {
  margin-top: 0;
}

.related-pages a {
  display: inline-flex;
  margin: 6px 8px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.related-pages a:hover {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.55);
  text-decoration: none;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: var(--content-width);
  width: 100%;
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 78px;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.pager-link:hover {
  border-color: rgba(139, 92, 246, 0.55);
  text-decoration: none;
}

.pager-link span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pager-next { text-align: right; }

@media (max-width: 860px) {
  .topbar {
    align-items: center;
    flex-wrap: wrap;
    height: auto;
    gap: 10px;
    padding: 14px 18px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
  }

  .site-nav-link {
    white-space: nowrap;
  }

  .topbar-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topbar-link,
  .topbar-cta {
    white-space: nowrap;
  }

  .shell {
    display: block;
  }

  .sidebar {
    display: block;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .content {
    max-width: none;
    min-height: auto;
    padding: 38px 22px 56px;
  }

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

  .pager-next { text-align: left; }
}
