.doc-layout,
.document-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, var(--prose-width));
  gap: var(--space-7);
  align-items: start;
  padding: 0 0 var(--space-7);
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.prose,
.document-prose {
  max-width: var(--prose-width);
  line-height: var(--leading-prose);
  font-size: var(--text-md);
}

.prose h1,
.document-prose h1 {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin-top: 0;
  line-height: var(--leading-tight);
}

.prose h2,
.document-prose h2 {
  margin-top: var(--space-7);
  font-size: var(--text-lg);
  font-weight: 600;
}

.prose h3,
.document-prose h3 {
  font-size: var(--text-md);
  font-weight: 500;
}

.doc-header {
  margin-bottom: var(--space-6);
}

.doc-main {
  min-width: 0;
  max-width: var(--prose-width);
}

.doc-main > .back-link {
  margin-bottom: var(--space-5);
}

.doc-meta,
.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}

.version-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.doc-toc,
.toc {
  position: sticky;
  top: var(--space-6);
  font-size: var(--text-sm);
  padding: var(--space-inset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-container-low);
  width: auto;
  margin: 0;
}

.doc-toc nav,
.toc ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-toc a,
.toc a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.doc-toc a:hover,
.toc a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.toc .level-3 {
  padding-left: var(--space-4);
}

.doc-body,
.prose pre,
.document-prose pre {
  overflow-x: auto;
}

.prose pre,
.document-prose pre {
  padding: var(--space-5);
  background: var(--color-panel-capsule);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.prose code,
.document-prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.prose a,
.document-prose a {
  color: var(--color-text);
}

.prose table,
.document-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-5) 0;
  font-size: var(--text-sm);
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.prose th,
.prose td,
.document-prose th,
.document-prose td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.prose th,
.document-prose th {
  font-weight: 600;
  background: var(--color-surface-container-low);
}

@media (max-width: 900px) {
  .doc-layout,
  .document-layout {
    grid-template-columns: 1fr;
  }

  .doc-toc,
  .toc {
    position: static;
    order: -1;
  }
}

@media print {
  .site-header,
  .site-footer,
  .doc-toc,
  .toc,
  .language-switcher,
  .theme-toggle {
    display: none !important;
  }

  .doc-layout,
  .document-layout {
    display: block;
  }

  body {
    background: white;
    color: black;
  }
}
