/* CrawlSign docs: three-column reading layout on top of the site styles and tokens. */

/* Header and footer span the wider docs grid so their edges line up with it. */
.docs-page .site-header .shell,
.docs-page .site-footer .shell {
  max-width: calc(84rem + 2 * var(--gutter));
}

.docs-shell {
  display: grid;
  width: 100%;
  max-width: calc(84rem + 2 * var(--gutter));
  grid-template-columns: 14rem minmax(0, 1fr) 13rem;
  align-items: start;
  gap: clamp(2rem, 4vw, 3.5rem);
  margin: clamp(2rem, 5vw, 3.5rem) auto 0;
  padding: 0 var(--gutter);
}

.docs-sidebar,
.docs-toc {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  font-size: 0.9375rem;
}

.docs-sidebar {
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.docs-sidebar-heading {
  margin: 0 0 0.75rem;
  padding: 0 0.75rem;
  font: 700 0.6875rem/1.4 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-sidebar ul,
.docs-toc ul {
  display: grid;
  gap: 2px;
  list-style: none;
}

.docs-sidebar a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.docs-sidebar a:hover {
  background: var(--paper);
  color: var(--ink);
}

.docs-sidebar a[aria-current="page"] {
  background: var(--ink);
  color: var(--on-ink);
}

.docs-toc {
  padding-top: 1rem;
}

.docs-toc .docs-sidebar-heading {
  padding: 0;
}

.docs-toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease;
}

.docs-toc a:hover {
  border-left-color: var(--accent);
  color: var(--ink);
}

/* ---- Article typography ---- */

.doc {
  max-width: 50rem;
  line-height: 1.7;
  animation: rise 0.7s var(--ease-out) both;
}

.doc h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.2rem, 4.4vw, 3.2rem);
}

.doc h1 + p {
  font-size: 1.15rem;
  color: var(--ink-soft);
}

.doc h2 {
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.5rem, 2.6vw, 1.85rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.doc h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.doc h3 code {
  font-size: 0.9em;
}

.doc h2,
.doc h3 {
  scroll-margin-top: 1.5rem;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 1rem;
}

.doc ul,
.doc ol {
  padding-left: 1.4rem;
}

.doc li {
  margin: 0.3rem 0;
}

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

.doc li > p {
  margin: 0;
}

.doc a {
  font-weight: 600;
  text-decoration-color: var(--eye);
}

.doc :not(pre) > code {
  overflow-wrap: anywhere;
}

.doc a code {
  color: inherit;
}

.doc pre {
  margin: 0 0 1.5rem;
}

/* ---- Tables ---- */

.table-wrap {
  margin: 0 0 1.5rem;
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.5;
}

.doc th {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule-strong);
  font: 700 0.6875rem/1.4 var(--font-body);
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}

.doc td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink-soft);
}

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

.doc td:first-child code {
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .doc {
    animation: none;
  }
}

/* ---- Responsive ---- */

@media (max-width: 72rem) {
  .docs-shell {
    grid-template-columns: 13rem minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 54rem) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
    padding: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 999px;
  }

  .docs-sidebar-heading {
    display: none;
  }

  .docs-sidebar ul {
    display: flex;
    gap: 0.25rem;
  }

  .docs-sidebar a {
    white-space: nowrap;
  }
}
