/* LCD Wizard documentation.
 *
 * Loaded after site.css and leaning on its variables, because the docs are
 * part of the marketing site rather than a separate property - the nav, the
 * footer and the palette are all already there. What is here is the two
 * things site.css has no need of: a sidebar layout, and long-form prose with
 * code in it.
 *
 * No framework, same as site.css. A documentation page that needs a build
 * step is a documentation page that goes stale. */

/* ------------------------------------------------------------------ shell */
.docs-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 46px;
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding: 34px 24px 90px;
  align-items: start;
}

/* ------------------------------------------------------------------ aside */
.docs-side {
  position: sticky;
  /* Clears the sticky nav bar rather than sliding under it. */
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}
.docs-side::-webkit-scrollbar { width: 8px; }
.docs-side::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.docs-filter {
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: 13.5px var(--sans);
}
.docs-filter::placeholder { color: var(--muted); }
.docs-filter:focus { outline: none; border-color: rgba(34, 197, 94, .45); }

.docs-side h4 {
  margin: 20px 0 8px;
  font: 700 11.5px var(--sans);
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-side h4:first-of-type { margin-top: 0; }

.docs-side a {
  display: block;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.4;
}
.docs-side a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.docs-side a.on {
  background: rgba(34, 197, 94, .1);
  color: var(--accent);
  font-weight: 600;
}
.docs-side .none { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

/* ------------------------------------------------------------------- body */
.docs-body { min-width: 0; }

.docs-crumb {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .2px;
  margin-bottom: 14px;
}
.docs-crumb a { color: var(--muted); }

.docs-body h1 {
  font-size: clamp(30px, 4vw, 40px);
  letter-spacing: -1.1px;
  max-width: 24ch;
  margin-bottom: 16px;
}
.docs-body > p.lede { font-size: 17.5px; margin-bottom: 34px; }

.docs-body h2 {
  font-size: 25px;
  letter-spacing: -.6px;
  margin: 44px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  scroll-margin-top: 84px;
}
.docs-body h3 {
  font-size: 17.5px;
  margin: 30px 0 10px;
  color: var(--text);
  scroll-margin-top: 84px;
}
.docs-body h4 {
  font-size: 15px;
  margin: 22px 0 8px;
  font-weight: 640;
  color: var(--text);
}

/* A quiet anchor that only shows on hover, so the headings stay clean. */
.docs-body h2 .anchor,
.docs-body h3 .anchor {
  opacity: 0;
  margin-left: 9px;
  color: var(--muted);
  font-weight: 400;
  font-size: .72em;
  transition: opacity .14s;
}
.docs-body h2:hover .anchor,
.docs-body h3:hover .anchor { opacity: 1; }

.docs-body p { color: var(--text-dim); line-height: 1.72; margin: 0 0 16px; max-width: 74ch; }
.docs-body li { color: var(--text-dim); line-height: 1.7; margin-bottom: 7px; }
.docs-body ul, .docs-body ol { max-width: 74ch; padding-left: 22px; margin: 0 0 18px; }
.docs-body ul ul, .docs-body ol ol, .docs-body ul ol, .docs-body ol ul { margin: 8px 0 4px; }
.docs-body strong { color: var(--text); font-weight: 620; }

.docs-body code {
  font: 13px var(--mono);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 1.5px 5px;
  color: #cfe9d9;
  /* A long identifier should wrap rather than push the column wide. */
  overflow-wrap: anywhere;
}

.docs-body pre {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 15px 17px;
  overflow-x: auto;
  margin: 0 0 20px;
  line-height: 1.6;
}
.docs-body pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.8px;
  color: #cfe9d9;
  overflow-wrap: normal;
  white-space: pre;
}
.docs-body pre .c { color: var(--muted); }     /* a comment */
.docs-body pre .k { color: var(--accent); }    /* something worth the eye */

/* ---------------------------------------------------------------- tables */
.docs-table { overflow-x: auto; margin: 0 0 22px; }
.docs-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 460px;
}
.docs-body th {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 620;
  white-space: nowrap;
}
.docs-body td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-dim);
  vertical-align: top;
  line-height: 1.6;
}
.docs-body tr:last-child td { border-bottom: none; }
.docs-body td code { font-size: 12.5px; }

/* -------------------------------------------------------------- callouts */
.callout {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--muted);
  border-radius: 0 9px 9px 0;
  background: var(--bg-2);
  padding: 15px 18px;
  margin: 0 0 22px;
  max-width: 74ch;
}
.callout p:last-child { margin-bottom: 0; }
.callout b:first-child { color: var(--text); }
.callout.note { border-left-color: var(--accent); }
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }

/* --------------------------------------------------------------- figures */
.figure { margin: 0 0 26px; }
.figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}
.figure figcaption {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  margin-top: 9px;
}

/* ------------------------------------------------------------- on-page toc */
.docs-toc {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-2);
  padding: 16px 20px;
  margin: 0 0 34px;
  max-width: 74ch;
}
.docs-toc b {
  display: block;
  font: 700 11.5px var(--sans);
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
.docs-toc ol { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 26px; }
.docs-toc li { margin-bottom: 5px; break-inside: avoid; }
.docs-toc a { font-size: 14px; }

/* ----------------------------------------------------------------- pager */
.docs-pager {
  display: flex;
  gap: 14px;
  margin-top: 54px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.docs-pager a {
  flex: 1;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 17px;
  background: var(--bg-2);
}
.docs-pager a:hover { border-color: var(--line); text-decoration: none; }
.docs-pager span { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.docs-pager b { color: var(--text); font-weight: 600; font-size: 15px; }
.docs-pager .next { text-align: right; }

/* ------------------------------------------------------------ index cards */
.docs-index { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 34px; }
.docs-index a {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
}
.docs-index a:hover { border-color: var(--line); text-decoration: none; }
.docs-index b { display: block; color: var(--text); font-size: 15.5px; font-weight: 620; margin-bottom: 4px; }
.docs-index span { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; }

/* A keyboard key, for the shortcut tables. */
.kbd {
  font: 12px var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  padding: 2px 6px;
  color: var(--text);
  white-space: nowrap;
}

/* ----------------------------------------------------------------- narrow */
@media (max-width: 960px) {
  .docs-shell { grid-template-columns: 1fr; gap: 0; padding-top: 22px; }
  /* Sticky is wrong once it is a block at the top of the page - it would
     pin a full contents list over the article. */
  .docs-side {
    position: static;
    max-height: none;
    overflow: visible;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: var(--bg-2);
    padding: 6px 16px 16px;
    margin-bottom: 30px;
  }
  .docs-side .docs-wrap { display: none; }
  .docs-side.open .docs-wrap { display: block; }
  .docs-side summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 0;
    font-weight: 620;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .docs-side summary::-webkit-details-marker { display: none; }
  .docs-side summary::before { content: '\2630'; color: var(--accent); }
  .docs-toc ol { columns: 1; }
  .docs-index { grid-template-columns: 1fr; }
  .docs-pager { flex-direction: column; }
  .docs-pager .next { text-align: left; }
}

/* ------------------------------------------------------------- glossary */
.docs-glossary { margin: 0 0 26px; }
.docs-glossary dt {
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 3px;
}
.docs-glossary dt:first-child { margin-top: 0; }
.docs-glossary dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

/* The one-line facts under a widget heading: group, size, parts. */
.docs-meta {
  color: var(--muted);
  font-size: 13.5px;
  margin: -6px 0 14px;
}
.docs-meta b { color: var(--text); font-weight: 600; }
