/*
 * Manual. Rides on pricing.css for the page shell and adds what long-form
 * reading needs: a sticky contents list, a readable measure, and tables that
 * scroll inside themselves instead of pushing the page sideways.
 */

main.docs {
  max-width: 1180px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 0 40px;
  align-items: start;
}

main.docs > h1,
main.docs > .lede,
main.docs > section { grid-column: 2; max-width: 74ch; }

/* ── contents ─────────────────────────────────────────────────────────────
   Sticky rather than fixed so it stops at the footer instead of floating
   over it. */
.toc {
  grid-column: 1;
  grid-row: 1 / span 99;
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 8px;
  border-right: 1px solid var(--vm-border-soft);
}
.toc a {
  color: var(--vm-text-muted);
  text-decoration: none;
  font-size: 0.9231rem;
  padding: 5px 8px;
  border-radius: 6px;
  line-height: 1.3;
}
.toc a:hover { background: var(--vm-hover); color: var(--vm-text); }
.toc a.here { color: var(--vm-accent); background: var(--vm-accent-soft); }

/* ── body ─────────────────────────────────────────────────────────────── */

.docs section {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 1px solid var(--vm-border-soft);
}
.docs section:first-of-type { border-top: none; margin-top: 8px; }

/* Anchored headings must clear the sticky app header when jumped to. */
.docs section { scroll-margin-top: 70px; }

.docs h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--vm-text-strong);
  margin: 0 0 14px;
}
.docs h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--vm-text-strong);
  margin: 22px 0 10px;
}
.docs p { color: var(--vm-text); line-height: 1.65; margin: 0 0 14px; }
.docs a { color: var(--vm-accent); }
.docs code {
  font-family: var(--ca-mono);
  font-size: 0.9231rem;
  background: var(--vm-inset);
  border: 1px solid var(--vm-border-soft);
  border-radius: 4px;
  padding: 1px 5px;
}

.formula {
  background: var(--vm-inset);
  border: 1px solid var(--vm-border);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: center;
  font-size: 15px;
}
.formula i { color: var(--vm-accent); font-style: normal; }

.steps { margin: 0 0 14px; padding-left: 22px; }
.steps li { color: var(--vm-text); line-height: 1.65; margin-bottom: 10px; }

.defs { margin: 0 0 14px; }
.defs dt {
  font-weight: 600;
  color: var(--vm-text-strong);
  margin-top: 16px;
  font-size: 0.9231rem;
}
.defs dt:first-child { margin-top: 0; }
.defs dd {
  margin: 5px 0 0;
  color: var(--vm-text-muted);
  line-height: 1.65;
  font-size: 0.9231rem;
}

/* Wide tables scroll inside their own box; the page never scrolls sideways. */
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
.docs table { border-collapse: collapse; width: 100%; font-size: 0.9231rem; }
.docs th, .docs td {
  border: 1px solid var(--vm-border-soft);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}
.docs th { background: var(--vm-surface-2); color: var(--vm-text-strong); font-weight: 600; }
.docs td { color: var(--vm-text-muted); }
.docs td:first-child { color: var(--vm-text); white-space: nowrap; }

.note {
  border-left: 3px solid var(--vm-accent);
  background: var(--vm-accent-soft);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: var(--vm-text-muted);
  font-size: 0.9231rem;
}

@media (max-width: 900px) {
  main.docs { grid-template-columns: minmax(0, 1fr); }
  main.docs > h1, main.docs > .lede, main.docs > section { grid-column: 1; }
  /* The contents list stops being a sidebar and becomes a wrapped row on top. */
  .toc {
    grid-row: auto;
    grid-column: 1;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--vm-border-soft);
    padding: 0 0 12px;
    margin-bottom: 8px;
  }
}
