/* ── Docs — layout, tables, TOC, and code.
   Typography and colour tokens come from blog.css + theme.css.
   No hardcoded colour values — all from CSS custom properties.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Main wrapper ─────────────────────────────────────────────────────────── */
.docs-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.docs-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid hsl(var(--bg-200));
}

.docs-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--accent-secondary-000));
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.docs-title {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: hsl(var(--text-100));
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.docs-subtitle {
  font-size: 0.95rem;
  color: hsl(var(--text-300));
  line-height: 1.5;
}

/* ── Two-column layout ────────────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

/* ── TOC sidebar ──────────────────────────────────────────────────────────── */
.docs-toc {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

.docs-toc-heading {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--text-400));
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.docs-toc-link {
  display: block;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  color: hsl(var(--text-300));
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.12s, background 0.12s;
  line-height: 1.4;
  border-left: 2px solid transparent;
}

.docs-toc-link:hover {
  color: hsl(var(--text-100));
  background: hsl(var(--bg-200) / 60%);
  text-decoration: none;
}

.docs-toc-link--active {
  color: hsl(var(--text-100));
  border-left-color: hsl(var(--accent-secondary-000));
  background: hsl(var(--bg-200) / 40%);
}

/* ── Content area ─────────────────────────────────────────────────────────── */
.docs-content {
  max-width: 700px;
}

/* Intro paragraph that comes from the MD file preamble */
.docs-content > p:first-child {
  color: hsl(var(--text-300));
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Section h2s get a visual separator from the one above */
.docs-content h2 {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--bg-200));
  scroll-margin-top: 90px;
}

.docs-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.docs-content h3[id] {
  scroll-margin-top: 90px;
}

.docs-content hr {
  border: none;
  border-top: 1px solid hsl(var(--bg-200));
  margin: 2rem 0;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1.25rem 0 1.75rem;
  display: block;
  overflow-x: auto;
}

.docs-content thead th {
  text-align: left;
  padding: 0.55rem 0.9rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(var(--text-400));
  border-bottom: 1px solid hsl(var(--bg-200));
  white-space: nowrap;
}

.docs-content tbody td {
  padding: 0.6rem 0.9rem;
  color: hsl(var(--text-200));
  border-bottom: 1px solid hsl(var(--bg-200) / 50%);
  vertical-align: top;
  line-height: 1.55;
}

.docs-content tbody tr:last-child td {
  border-bottom: none;
}

/* ── Code blocks ──────────────────────────────────────────────────────────── */
.docs-content pre {
  background: hsl(var(--bg-200));
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.5rem;
}

.docs-content pre code {
  font-family: "SF Mono", "Fira Code", "Roboto Mono", monospace;
  font-size: 0.82rem;
  color: hsl(var(--text-100));
  background: none;
  padding: 0;
}

.docs-content code {
  font-family: "SF Mono", "Fira Code", "Roboto Mono", monospace;
  font-size: 0.82rem;
  background: hsl(var(--bg-200));
  color: hsl(var(--text-100));
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .docs-toc {
    position: static;
    max-height: none;
    overflow-y: visible;
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    background: hsl(var(--bg-200) / 35%);
    border-radius: 10px;
  }

  .docs-toc ul {
    gap: 0;
  }

  .docs-toc-link {
    padding: 0.25rem 0.45rem;
  }

  .docs-main {
    padding: 2rem 1.25rem 4rem;
  }
}
