/*
 * Clara's docs, rendered by scripts/site.mjs, on top of site.css's tokens and header. A
 * reference layout: the docs by group on the left, the doc in the middle at reading width,
 * and its sections on the right. The one colour is the board's first agent hue, teal, which
 * marks where you are and what you can follow; everything else stays neutral. On a narrow
 * screen the two side columns fold into the top of the page, without a script.
 */

:root {
  --docs-accent: #0f766e;
  --docs-accent-tint: #effaf8;
  --docs-accent-line: #99d5cc;
  --docs-side: 264px;
  --docs-toc: 232px;
  --docs-read: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --docs-accent: #5eead4;
    --docs-accent-tint: #0f2321;
    --docs-accent-line: #1f5a53;
  }
}

.docs-page {
  font-size: 16.5px;
  line-height: 1.7;
}

/* Header */

.docs-top {
  max-width: none;
}

.docs-badge {
  margin-left: -16px;
  padding: 2px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.5;
}

.top-nav-docs a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* The three columns */

.docs-shell {
  display: grid;
  grid-template-columns: var(--docs-side) minmax(0, 1fr) var(--docs-toc);
  max-width: 1480px;
  margin: 0 auto;
}

.docs-side,
.docs-toc {
  position: sticky;
  top: var(--top);
  align-self: start;
  max-height: calc(100vh - var(--top));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.docs-side {
  padding: 28px 12px 48px var(--gutter);
  border-right: 1px solid var(--border);
}

.docs-main {
  min-width: 0;
  padding: 24px 56px 72px;
}

.docs-main > * {
  max-width: var(--docs-read);
  margin-left: auto;
  margin-right: auto;
}

.docs-toc {
  padding: 36px var(--gutter) 48px 8px;
}

/* The sidebar */

.side-group + .side-group {
  margin-top: 22px;
}

.side-title,
.side-group > summary {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 680;
  letter-spacing: -0.005em;
}

.side-group > summary {
  cursor: pointer;
  list-style-position: inside;
}

.side-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-nav li a {
  display: block;
  padding: 5px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.45;
  text-decoration: none;
}

.side-nav li a:hover {
  background: var(--sunken);
  color: var(--text);
}

.side-nav li a[aria-current="page"] {
  border-left-color: var(--docs-accent);
  background: var(--docs-accent-tint);
  color: var(--text);
  font-weight: 600;
}

/* The folded sidebar, for narrow screens */

.docs-menu {
  display: none;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.docs-menu > summary {
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.docs-menu .side-nav {
  padding: 4px 8px 14px;
  border-top: 1px solid var(--border);
}

.docs-menu .side-group:first-child {
  margin-top: 12px;
}

/* Where the doc sits */

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  color: var(--text-3);
  font-size: 14px;
  list-style: none;
}

.crumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--border-strong);
}

.crumbs a {
  color: var(--text-2);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.crumbs [aria-current="page"] {
  color: var(--text-2);
}

.doc .doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 14px;
}

.doc-meta a {
  color: var(--docs-accent);
  text-decoration: none;
}

.doc-meta a:hover {
  text-decoration: underline;
}

/* The doc */

.doc h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 720;
  letter-spacing: -0.028em;
  line-height: 1.12;
}

.doc h2 {
  margin: 52px 0 14px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  font-size: 25px;
  font-weight: 690;
  letter-spacing: -0.018em;
  line-height: 1.25;
}

.doc h3 {
  margin: 34px 0 10px;
  font-size: 19px;
  font-weight: 660;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.doc h4 {
  margin: 26px 0 8px;
  font-size: 16.5px;
  font-weight: 650;
}

.doc h2,
.doc h3,
.doc h4 {
  scroll-margin-top: calc(var(--top) + 20px);
}

.doc p,
.doc ul,
.doc ol,
.doc .table-wrap,
.doc .code-block,
.doc blockquote {
  margin: 0 0 18px;
}

.doc ul,
.doc ol {
  padding-left: 1.5em;
}

.doc li + li {
  margin-top: 6px;
}

.doc li > ul,
.doc li > ol {
  margin: 6px 0 0;
}

.doc a {
  color: var(--docs-accent);
  text-decoration-color: var(--docs-accent-line);
}

.doc a:hover {
  text-decoration-color: currentColor;
}

.doc strong {
  font-weight: 650;
}

.doc :not(pre) > code {
  padding: 0.12em 0.38em;
  border: 1px solid var(--border);
  background: var(--sunken);
  font-size: 0.86em;
}

.doc a > code {
  color: inherit;
}

.doc img {
  margin: 10px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.doc hr {
  margin: 44px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Code */

.code-block {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.code-head {
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--sunken);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 2;
}

.code-block pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.code-comment {
  color: var(--text-3);
}

/* Tables */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.55;
}

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

.doc thead th {
  background: var(--sunken);
  color: var(--text);
  font-weight: 640;
  white-space: nowrap;
}

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

.doc tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--sunken) 45%, transparent);
}

.doc td code {
  overflow-wrap: normal;
  white-space: nowrap;
}

/* Notes set apart */

.doc blockquote.callout {
  padding: 12px 16px;
  border: 1px solid var(--docs-accent-line);
  border-left: 4px solid var(--docs-accent);
  border-radius: var(--radius);
  background: var(--docs-accent-tint);
  color: var(--text);
}

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

/* On this page */

.toc-title {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 680;
}

.toc-list {
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
  list-style: none;
  font-size: 13.5px;
  line-height: 1.45;
}

.toc-list a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  border-left: 1px solid transparent;
  color: var(--text-2);
  text-decoration: none;
}

.toc-list .toc-3 a {
  padding-left: 24px;
  color: var(--text-3);
}

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

.toc-list code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.95em;
}

.toc-inline {
  display: none;
  margin: -8px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc-inline > summary {
  padding: 9px 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.toc-inline .toc-list {
  margin: 0 14px 14px;
}

.doc .toc-list {
  padding-left: 0;
}

.doc .toc-list li + li {
  margin-top: 0;
}

/* Previous and next */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
}

.pager-link {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}

.pager-link:hover {
  border-color: var(--docs-accent);
}

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

.pager-dir {
  color: var(--text-3);
  font-size: 13px;
}

.pager-name {
  color: var(--docs-accent);
  font-size: 16px;
  font-weight: 620;
}

.docs-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 14px;
}

.docs-foot p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.docs-foot a {
  color: var(--text-2);
}

/* The docs' front page */

.doc-home .lead {
  margin-bottom: 26px;
  color: var(--text-2);
  font-size: 18.5px;
  line-height: 1.6;
}

.home-install {
  margin-bottom: 8px;
}

.home-install p {
  color: var(--text-2);
  font-size: 15px;
}

.doc .steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.doc .steps li {
  margin: 0;
  counter-increment: step;
}

.doc .step {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 12px;
  height: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.doc .step::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--docs-accent-tint);
  color: var(--docs-accent);
  font-size: 14px;
  font-weight: 700;
}

.doc .step:hover {
  border-color: var(--docs-accent);
}

.step-name {
  font-weight: 650;
}

.step-text {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.5;
}

.doc .features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
  padding: 0;
  list-style: none;
}

.doc .features li {
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.doc .features h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.doc .features p {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
}

.doc .doc-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
  padding: 0;
  list-style: none;
}

.doc .doc-index li {
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.doc .doc-index a {
  font-weight: 620;
  text-decoration: none;
}

.doc .doc-index a:hover {
  text-decoration: underline;
}

.doc .doc-index p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.5;
}

.doc .doc-index-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc .doc-index-compact li {
  padding: 8px 0;
}

/* Narrower screens */

@media (max-width: 1240px) {
  .docs-shell {
    grid-template-columns: var(--docs-side) minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }

  .toc-inline {
    display: block;
  }

  .docs-main {
    padding: 24px 40px 72px;
  }
}

@media (max-width: 900px) {
  .docs-shell {
    display: block;
  }

  .docs-side {
    display: none;
  }

  .docs-menu {
    display: block;
  }

  .docs-main {
    padding: 20px var(--gutter) 64px;
  }

  .doc .steps,
  .doc .features,
  .doc .doc-index {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc .doc-index-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .docs-page {
    font-size: 16px;
  }

  .docs-badge {
    display: none;
  }

  .doc h2 {
    margin-top: 40px;
    padding-top: 20px;
    font-size: 22px;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

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