/* The documentation page (docs/). It loads atlas.css first, for the atlas's colour tokens, both
   themes, the header bar and the swatches, and lays the page out for reading: a contents column
   beside one column of text. */

body.docs {
  display: block;
  height: auto;
  font-size: 15px;
  line-height: 1.6;
}

.docs .bar {
  position: sticky;
  top: 0;
  z-index: 5;
}

.docs .bar h1 a { color: inherit; text-decoration: none; }
.docs .bar h1 a:hover { text-decoration: underline; text-decoration-color: var(--baseline); }

.docs-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 40px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ------------------------------------------------------------------ contents */
.toc {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.4;
}

.toc summary { display: none; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li { margin: 1px 0; }

.toc a {
  display: block;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--ink-2);
  text-decoration: none;
}

.toc a:hover { background: var(--surface); color: var(--ink); }

.toc .part {
  margin: 16px 0 4px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc .part:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ text */
.doc { max-width: 740px; min-width: 0; }

.doc h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.doc .lede { margin: 0 0 8px; color: var(--ink-2); font-size: 17px; }

.doc h2 {
  margin: 56px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

.doc h3 {
  margin: 32px 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.doc h2, .doc h3, .doc dt { scroll-margin-top: 72px; }
.doc .part-title {
  margin: 72px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc .part-title.first { margin-top: 40px; }
.doc .part-title + h2 { margin-top: 8px; }
.doc p, .doc ul, .doc ol, .doc dl { margin: 10px 0; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc a { color: inherit; text-decoration-color: var(--baseline); text-underline-offset: 2px; }
.doc a:hover { text-decoration-color: var(--ink-2); }
.doc .dim { color: var(--ink-2); }
.doc .note { color: var(--ink-2); font-size: 14px; }

.doc code, .doc kbd {
  padding: 0 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.doc kbd { border-bottom-width: 2px; }

/* the atlas's controls, named in the text as they appear on screen */
.doc .ctl {
  padding: 0 6px;
  border: 1px solid var(--baseline);
  border-radius: 5px;
  background: var(--surface);
  font-size: 13px;
  white-space: nowrap;
}

/* a link that opens the atlas in the state the text describes */
.doc a.try {
  display: inline-block;
  margin-left: 2px;
  padding: 0 8px;
  border: 1px solid var(--baseline);
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.doc a.try::after { content: " ↗"; color: var(--muted); }
.doc a.try:hover { border-color: var(--ink-2); }

/* ------------------------------------------------------------------ tables */
.table-wrap { margin: 12px 0; overflow-x: auto; }

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.45;
}

.doc th, .doc td {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.doc th {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.doc td.num, .doc th.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc td .dim { font-size: 13px; }
.doc td .age { white-space: nowrap; }
.doc .swatches { display: inline-flex; gap: 3px; vertical-align: middle; }

/* ------------------------------------------------------------------ quantities */
.doc dl.qs { margin: 12px 0 20px; }

.doc dl.qs dt {
  margin-top: 18px;
  font-weight: 600;
}

.doc dl.qs dt .unit { color: var(--ink-2); font-weight: 400; }
.doc dl.qs dd { margin: 4px 0 0; }
.doc dl.qs dd p { margin: 4px 0; }

.doc .shown {
  color: var(--ink-2);
  font-size: 14px;
}

.doc .shown b, .doc .read b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ figures */
.doc figure { margin: 18px 0; }
.doc figcaption { margin-top: 6px; color: var(--ink-2); font-size: 13px; }

.schematic { display: block; width: 100%; max-width: 640px; height: auto; }
.schematic .area { fill: var(--surface); stroke: var(--baseline); stroke-width: 1; }
.schematic .fill { fill: var(--page); stroke: var(--baseline); stroke-width: 1; }
.schematic .line { stroke: var(--baseline); stroke-width: 2; }
.schematic .ink { fill: var(--ink-2); }
.schematic text { fill: var(--ink-2); font: 12px var(--font); }
.schematic .badge circle { fill: var(--ink); }
.schematic .badge text { fill: var(--surface); font: 600 12px var(--font); text-anchor: middle; }

/* a size key: dots as the atlas draws them (docs.js), each with the value it stands for */
.size-key {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px 18px;
  margin: 8px 0 4px;
  min-height: 44px;
}

.size-key figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.size-key svg { display: block; overflow: visible; }
.size-key circle { fill: var(--ink-2); }
.size-key .missing circle { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 2; }
.size-key figcaption { margin: 0; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* a line as the link overlay draws it */
.link-sample { display: inline-block; width: 34px; height: 10px; vertical-align: middle; }
.link-sample line { stroke: var(--accent); stroke-width: 2; }

/* a link's head, as the networks view draws it (docs.js, with networks.js's own marks) */
.head-key { display: inline-block; width: 24px; height: 12px; vertical-align: middle; }
.head-key .link-icon { display: block; }
.doc ul.heads { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 4px 0 12px; padding: 0; list-style: none; }
.doc ul.heads li { margin: 0; font-size: 14px; white-space: nowrap; }
.doc p.dim + ul.heads { margin-top: 0; }
.doc td .head-key { margin-top: 5px; }

/* ------------------------------------------------------------------ phones and tablets */
@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 16px 16px 64px;
  }

  .toc {
    position: static;
    max-height: none;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .toc summary {
    display: list-item;
    color: var(--ink-2);
    font-size: 14px;
    cursor: pointer;
  }

  .doc h1 { font-size: 24px; }
  .doc h2 { margin-top: 44px; }
}

@media (max-width: 640px) {
  .docs .bar .sub { display: none; }
  .doc th, .doc td { padding-right: 8px; }

  /* a wide table becomes one block per row, each cell on its own line, named where its column's
     name is needed (data-label, written by cellatlas.docs) */
  .doc table.stack thead { display: none; }
  .doc table.stack, .doc table.stack tbody, .doc table.stack tr, .doc table.stack td { display: block; }
  .doc table.stack tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .doc table.stack td { padding: 2px 0; border: none; text-align: left; white-space: normal; }
  .doc table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-2); font-size: 13px; }
  .doc table.stack td:empty { display: none; }
}
