/* The docs pages. tools/make-site-docs.py copies this file to site/docs/docs.css; change it
   here, not there. It is loaded after ../styles.css, which has the fonts, the tokens, the top
   bar and the footer. */

/* Top bar: where you are */

.top nav a[aria-current] {
  color: var(--fg);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* The shell: the list of pages beside the page */

.doc-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 0 clamp(32px, 4vw, 72px);
  align-items: start;
}

.doc-side {
  position: sticky;
  top: 65px;
  max-height: calc(100vh - 65px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 36px 20px 56px 0;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.doc-menu {
  display: none;
}

.doc-nav .label {
  margin: 28px 0 8px;
  font-size: 13px;
  color: var(--dim);
}

.doc-nav > .label:first-child {
  margin-top: 0;
}

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

.doc-nav a {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.3;
  text-decoration: none;
}

.doc-nav a:hover {
  color: var(--fg);
  background: var(--surface);
}

.doc-nav a:focus-visible {
  outline-offset: -2px;
}

.doc-nav a[aria-current] {
  border-left-color: var(--accent);
  color: var(--fg);
  font-weight: 500;
}

.doc-nav .home {
  margin-bottom: 4px;
}

.doc-nav ul ul {
  margin: 2px 0 10px;
  border-left: 2px solid var(--line);
}

.doc-nav ul ul a {
  margin-left: -2px;
  padding: 4px 12px 4px 22px;
  font-size: 15px;
}

.doc-nav ul ul ul {
  margin: 0;
  border-left: 0;
}

.doc-nav ul ul ul a {
  margin-left: 0;
  padding-left: 36px;
  color: var(--dim);
}

.doc-nav ul ul ul a:hover {
  color: var(--fg);
}

/* The page */

.doc-main {
  min-width: 0;
  max-width: 1180px;
  padding: clamp(28px, 4vw, 56px) 0 0;
}

.doc-crumb a {
  color: var(--muted);
  text-decoration: none;
}

.doc-crumb a:hover {
  color: var(--fg);
}

.doc {
  --measure: 59ch;
}

.doc a {
  overflow-wrap: anywhere;
}

.doc > *,
.doc li > *,
.doc blockquote > * {
  margin-top: 16px;
  margin-bottom: 0;
}

.doc > p,
.doc > ul,
.doc > ol,
.doc > h1,
.doc > h3,
.doc > h4,
.doc > blockquote {
  max-width: var(--measure);
}

.doc h1 {
  margin-top: 14px;
  font-size: clamp(36px, 4.2vw, 56px);
}

.doc h1 + p {
  margin-top: 24px;
}

.doc h2 {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.15;
}

.doc h3 {
  margin-top: 40px;
  font-size: clamp(21px, 2vw, 25px);
  line-height: 1.2;
}

.doc h4 {
  margin: 32px 0 0;
  color: var(--fg);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
}

.doc h1 code,
.doc h2 code,
.doc h3 code,
.doc h4 code {
  font-size: 0.82em;
  letter-spacing: 0;
}

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

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

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

.doc ol > li::marker {
  font-family: var(--mono);
  font-size: 0.86em;
}

.doc li > :first-child {
  margin-top: 0;
}

.doc li > ul,
.doc li > ol {
  margin-top: 8px;
}

.doc em {
  font-style: normal;
  color: var(--fg);
  text-decoration: underline dotted var(--mark);
  text-underline-offset: 0.2em;
}

.doc blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--border);
}

.doc blockquote > :first-child {
  margin-top: 0;
}

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

/* Code and tables are let out past the measure, and scroll inside their own box */

.doc pre {
  width: fit-content;
  min-width: min(100%, var(--measure));
  max-width: 100%;
}

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

.doc table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.doc th,
.doc td {
  padding: 12px 24px 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 16px;
  line-height: 1.5;
}

.doc th:last-child,
.doc td:last-child {
  padding-right: 0;
}

.doc thead th {
  padding-bottom: 10px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.doc td:first-child {
  color: var(--fg);
}

.doc td code {
  overflow-wrap: break-word;
}

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

.doc .right {
  text-align: right;
}

.doc .center {
  text-align: center;
}

/* Pictures: the panel in its strip, as on the front page */

.doc .strip,
.doc .setup-shot {
  margin-top: 24px;
  margin-bottom: 8px;
}

.doc .strip-frame {
  border-radius: 12px;
  padding: clamp(5px, 0.5vw, 8px);
}

/* Previous and next, and where the page comes from */

.doc-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.doc-pager a {
  display: block;
  padding: 18px 22px 20px;
  color: var(--fg);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}

.doc-pager a:hover {
  background: var(--surface);
}

.doc-pager a:focus-visible {
  outline-offset: -3px;
}

.doc-pager .label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--dim);
}

.doc-pager .next {
  grid-column: 2;
  border-left: 1px solid var(--line);
  text-align: right;
}

.doc-source {
  margin-top: 20px;
  font-size: 15px;
  color: var(--dim);
}

.doc-source a {
  color: var(--muted);
}

.doc-source .mono {
  font-size: 13px;
}

/* The list of pages at /docs/ */

.doc-index h1 {
  margin-top: 14px;
  font-size: clamp(36px, 4.2vw, 56px);
}

.doc-index .lede {
  max-width: 59ch;
  margin-top: 24px;
}

.doc-index h2 {
  margin: 48px 0 14px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.55;
}

.doc-index .docs {
  border-top: 0;
}

.doc-index .docs li {
  margin-top: -1px;
  border-top: 1px solid var(--line);
}

.doc-index .docs .about {
  margin-top: 8px;
}

/* Wide desktops */

@media (min-width: 1900px) {
  .doc-shell {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .doc-main {
    max-width: 1320px;
  }

  .doc-nav a {
    font-size: 18px;
  }

  .doc-nav ul ul a {
    font-size: 16px;
  }

  .doc th,
  .doc td {
    font-size: 17.5px;
  }
}

/* Narrower screens: the list of pages folds away above the page */

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

  .doc-side {
    display: none;
  }

  .doc-menu {
    display: block;
    margin: 0 calc(var(--gutter) * -1);
    border-bottom: 1px solid var(--line);
  }

  .doc-menu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 var(--gutter);
    color: var(--fg);
    font-size: 16.5px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
  }

  .doc-menu summary::-webkit-details-marker {
    display: none;
  }

  .doc-menu summary .label {
    font-size: 13px;
    color: var(--dim);
  }

  .doc-menu summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin: -4px 4px 0 auto;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
  }

  .doc-menu[open] summary::after {
    margin-top: 4px;
    transform: rotate(-135deg);
  }

  .doc-menu summary:focus-visible {
    outline-offset: -3px;
  }

  .doc-menu .doc-nav {
    padding: 8px var(--gutter) 28px;
    border-top: 1px solid var(--line);
  }

  .doc-nav a {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .doc-nav ul ul a {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  /* A table of several columns keeps a width its words can be read at, and scrolls */

  .doc table.cols-3 {
    min-width: 620px;
  }

  .doc table.cols-4 {
    min-width: 780px;
  }

  .doc table.cols-5,
  .doc table.cols-6 {
    min-width: 960px;
  }
}

@media (max-width: 520px) {
  .doc h2 {
    margin-top: 44px;
    padding-top: 22px;
  }

  .doc th,
  .doc td {
    padding-right: 16px;
    font-size: 15.5px;
  }

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

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

  .doc-pager .next {
    grid-column: 1;
    border-left: 0;
    text-align: left;
  }

  .doc-pager .prev + .next {
    border-top: 1px solid var(--line);
  }
}
