/* The Lathe guide (getlathe.app/docs). The site's colours and type (style.css comes first), set
   for reading: one calm column, a menu of pages on the left, the page's sections on the right.
   The pages are made by tools/build-docs.py from the lathe repo's docs/ folder. */

/* The site's pages are colour bands all the way down (body is amber); the guide reads on the cream wall. */
body.docs-page { background: var(--wall); }
.docs-page { --d-measure: 44rem; --d-code-bg: #ebe9e4; --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }

.d-skip { position: absolute; left: -9999px; }
.d-skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--ink); color: var(--wall); padding: 8px 12px; border-radius: 3px; }

/* The coloured band with the page's title: the site's colour, without the size. */
.d-band { padding: 34px 0 40px; }
.d-band h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); line-height: 1.05; }
.d-band .lede { margin: 16px 0 0; font-size: 1.16rem; line-height: 1.55; max-width: 40rem; color: rgba(27, 27, 26, 0.86); }
.d-band.c-red .lede, .d-band.c-dark .lede { color: inherit; opacity: 0.9; }
.d-band.c-dark h1 { color: #f2efe8; }
.d-crumb { margin: 0 0 10px; font: 500 0.92rem var(--sans); }
.d-crumb a { text-decoration: none; color: inherit; opacity: 0.75; }
.d-crumb a:hover { opacity: 1; text-decoration: underline; }
.top.c-dark nav a, .d-band.c-dark .d-crumb a { color: #d8d4cb; }
.top.c-red nav a { color: #fff6f0; }

/* Three columns: pages, the page, its sections. */
.d-layout { display: grid; grid-template-columns: 14rem minmax(0, var(--d-measure)) 13rem; gap: 56px; padding-top: 44px; padding-bottom: 80px; align-items: start; justify-content: space-between; }
.d-side, .d-toc { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; font-size: 0.94rem; }
.d-nav-h { font: 600 0.78rem var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.d-nav .d-nav-h:first-child, .d-toc .d-nav-h { margin-top: 0; }
.d-nav ul, .d-toc ul { list-style: none; margin: 0; padding: 0; }
.d-nav li a, .d-toc li a { display: block; padding: 5px 10px; margin-left: -10px; border-radius: 4px; text-decoration: none; color: var(--ink-2); line-height: 1.35; }
.d-nav li a:hover, .d-toc li a:hover { background: #e9e7e1; color: var(--ink); }
.d-nav li a[aria-current="page"] { background: var(--ink); color: var(--wall); font-weight: 600; }
.d-toc li a { font-size: 0.9rem; border-left: 2px solid var(--hair); border-radius: 0; margin-left: 0; padding-left: 12px; }
.d-menu { display: none; }

/* The text. */
.d-body { font-size: 1.06rem; line-height: 1.72; }
.d-body > *:first-child { margin-top: 0; }
.d-body h2 { font-size: 1.7rem; margin: 2.4em 0 0.6em; padding-top: 0.2em; scroll-margin-top: 20px; }
.d-body h3 { font-size: 1.22rem; font-weight: 600; margin: 1.9em 0 0.5em; scroll-margin-top: 20px; }
.d-body h4 { font-size: 1.04rem; font-weight: 600; margin: 1.6em 0 0.4em; }
.d-body h2, .d-body h3, .d-body h4 { position: relative; }
.d-anchor { position: absolute; left: -1.1em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.d-body h2:hover .d-anchor, .d-body h3:hover .d-anchor, .d-anchor:focus { opacity: 1; }
.d-body p { margin: 0 0 1.05em; }
.d-body ul, .d-body ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.d-body li { margin: 0.35em 0; }
.d-body li > p { margin: 0.3em 0; }
.d-body li ul, .d-body li ol { margin: 0.3em 0 0.4em; }
.d-body strong { font-weight: 650; }
.d-body a { text-decoration-color: rgba(27, 27, 26, 0.35); }
.d-body a:hover { text-decoration-color: var(--ink); }
.d-body code { font: 0.88em var(--mono); background: var(--d-code-bg); padding: 0.12em 0.38em; border-radius: 3px; overflow-wrap: anywhere; }
.d-body pre { background: var(--ui-window); color: var(--ui-text); padding: 16px 18px; border-radius: 6px; overflow-x: auto; font-size: 0.9rem; line-height: 1.55; margin: 0 0 1.3em; }
.d-body pre code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }

/* Tables: keys, devices, formats. */
.d-table { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--hair); border-radius: 6px; background: #fbfbfa; }
.d-table table { width: 100%; border-collapse: collapse; font-size: 0.96rem; line-height: 1.55; }
.d-table th, .d-table td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--hair); }
.d-table tr:last-child td { border-bottom: 0; }
.d-table th { font: 600 0.84rem var(--sans); color: var(--muted); background: #f1efea; }
.d-table td:first-child { white-space: nowrap; font-weight: 600; }
.d-table td:first-child code { white-space: nowrap; }

/* Screenshots: Lathe's own window, framed like on the rest of the site. */
.d-shot { margin: 1.6em 0 1.9em; }
.d-shot img { width: 100%; border-radius: 8px; border: 1px solid #1a1a1a; background: var(--ui-window);
  box-shadow: 0 14px 34px rgba(30, 28, 24, 0.16), 0 3px 8px rgba(30, 28, 24, 0.1); }
.d-shot figcaption { margin-top: 10px; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.d-body p img { display: inline-block; vertical-align: middle; }
.d-zoom { display: block; cursor: zoom-in; border-radius: 8px; }
.d-zoom:focus-visible { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
.d-shot .d-zoom img { transition: box-shadow 0.15s; }
.d-shot .d-zoom:hover img { box-shadow: 0 18px 44px rgba(30, 28, 24, 0.24), 0 4px 10px rgba(30, 28, 24, 0.14); }

/* The pop-up with a picture at full size (docs/docs.js). */
.d-lightbox { border: 0; padding: 0; margin: auto; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; cursor: zoom-out; }
.d-lightbox::backdrop { background: rgba(20, 19, 18, 0.86); }
.d-lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.d-lightbox img { display: block; max-width: 96vw; max-height: calc(96vh - 56px); width: auto; height: auto;
  border-radius: 8px; border: 1px solid #1a1a1a; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); background: var(--ui-window); }
.d-lightbox figcaption { color: #e9e6df; font-size: 0.95rem; line-height: 1.45; max-width: 60rem; text-align: center; }
.d-lightbox-close { position: fixed; top: 14px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); color: #fff; font: 400 28px/1 var(--sans); cursor: pointer; }
.d-lightbox-close:hover, .d-lightbox-close:focus-visible { background: rgba(255, 255, 255, 0.24); outline: none; }
html.d-lightbox-on { overflow: hidden; }

/* Callouts: a tip or a thing to watch, from a "> **Tip:** ..." line. */
.d-callout { margin: 1.4em 0; padding: 14px 18px; border-radius: 6px; border-left: 4px solid var(--ui-accent); background: #f8ecd6; }
.d-callout p { margin: 0; }
.d-callout.d-note { border-left-color: #7fb4d8; background: #e5eff6; }
.d-callout.d-careful { border-left-color: var(--ui-record); background: #f8e1dc; }

/* Previous and next. */
.d-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--hair); }
.d-pn a { display: block; padding: 14px 18px; border: 1px solid var(--hair); border-radius: 6px; text-decoration: none; font-weight: 600; background: #fbfbfa; }
.d-pn a:hover { border-color: var(--ink); }
.d-pn span { display: block; font: 500 0.82rem var(--sans); color: var(--muted); margin-bottom: 2px; }
.d-next { grid-column: 2; text-align: right; }
.d-edit { margin-top: 28px; font-size: 0.88rem; color: var(--muted); }
.d-edit a { color: var(--muted); }

@media (max-width: 1180px) {
  .d-layout { grid-template-columns: 13rem minmax(0, 1fr); gap: 44px; }
  .d-toc { display: none; }
}
@media (max-width: 860px) {
  .d-layout { grid-template-columns: minmax(0, 1fr); padding-top: 20px; gap: 0; }
  .d-side { display: none; }
  .d-menu { display: block; margin: 0 0 26px; border: 1px solid var(--hair); border-radius: 6px; background: #fbfbfa; }
  .d-menu summary { padding: 12px 16px; font-weight: 600; cursor: pointer; }
  .d-menu .d-nav { padding: 0 16px 14px 26px; }
  .d-body { font-size: 1.02rem; }
  .d-anchor { display: none; }
  .d-pn { grid-template-columns: 1fr; }
  .d-next { grid-column: 1; }
  .top nav { gap: 16px; flex-wrap: wrap; }
}
@media (max-width: 700px) {
  .docs-page .wrap { padding-left: 16px; padding-right: 16px; }
  .d-band { padding: 22px 0 28px; }
}
