/* Dozer Sandbox docs (/docs/…): loads AFTER ../site.css and reuses its tokens (--accent, --tint, --tint-soft, --ink-2,
   --hair, --font, --mono, --navh). Nothing here may introduce a colour other than black, white, greys and the accent.
   DRAFT from DESIGN.md. The page body carries class="docs". */
.docs { --measure: 70ch; --side: 264px; --toc: 224px; --shadow: 0 4px 0 #000; --grey: #555; }
.docs main { display: block; }

/* ---------- layout: sidebar | article | on-this-page ---------- */
.dlayout { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: grid; gap: 0 48px;
  grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; }
.dlayout > .article { grid-column: 2; min-width: 0; max-width: var(--measure); padding: 40px 0 72px; }
.dlayout > .toc { display: none; }
.chapters { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: var(--navh); max-height: calc(100vh - var(--navh));
  overflow-y: auto; padding: 32px 8px 32px 0; border-right: 1px solid var(--hair); margin-right: -24px; padding-right: 24px; font-size: 15px; line-height: 1.35; }
@media (min-width: 1180px) {
  .dlayout { grid-template-columns: var(--side) minmax(0, var(--measure)) var(--toc); justify-content: center; }
  .dlayout > .toc { display: block; grid-column: 3; position: sticky; top: calc(var(--navh) + 32px); max-height: calc(100vh - var(--navh) - 64px); overflow-y: auto; margin-top: 40px; font-size: 14px; line-height: 1.35; }
}
/* the Chapters <details>: always open on wide screens (no JS), a button on narrow ones */
.chapters > summary { display: none; }
@media (min-width: 860px) { .chapters::details-content { content-visibility: visible; } }
@supports not selector(::details-content) { .chapters > summary { display: flex; } }
@media (max-width: 859px) {
  .dlayout { display: block; padding: 0 16px; }
  .chapters { position: static; max-height: none; overflow: visible; border: 0; margin: 16px 0 0; padding: 0; }
  .chapters > summary { display: flex; }
  .chapters[open] > .chapters-body { border: 1px solid #000; border-radius: 14px; margin-top: 8px; padding: 8px 16px 16px; background: #fff; }
  .dlayout > .article { padding-top: 24px; }
}
.chapters > summary, .toc-m > summary { list-style: none; cursor: pointer; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #000; border-radius: 980px; padding: 8px 16px; font-weight: 600; font-size: 15px; background: #fff; box-shadow: 0 2px 0 #000; }
.chapters > summary::-webkit-details-marker, .toc-m > summary::-webkit-details-marker { display: none; }
.chapters > summary::after, .toc-m > summary::after { content: "+"; font-weight: 700; }
.chapters[open] > summary::after, .toc-m[open] > summary::after { content: "\2212"; }
.chapters > summary:hover, .toc-m > summary:hover { background: var(--accent); }

/* ---------- sidebar + on-this-page lists ---------- */
.chapters h2, .toc h2 { margin: 24px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.chapters h2:first-child, .toc h2:first-child { margin-top: 0; }
.chapters ol, .toc ol { list-style: none; margin: 0; padding: 0; }
.chapters a { display: block; padding: 5px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; color: #000; }
.chapters a:hover { background: var(--tint-soft); text-decoration: underline; text-underline-offset: 3px; }
.chapters a[aria-current="page"] { background: var(--tint); font-weight: 700; box-shadow: inset 3px 0 0 #000; }
.toc ol ol { margin-left: 12px; }
.toc a { display: block; padding: 3px 0 3px 12px; border-left: 2px solid var(--hair); color: var(--ink-2); text-decoration: none; }
.toc ol ol a { font-size: 13px; }
.toc a:hover { color: #000; border-left-color: #000; }
.toc a[aria-current="true"] { color: #000; font-weight: 600; border-left: 3px solid #000; padding-left: 11px; }
.toc-m { display: block; margin: 0 0 28px; }
.toc-m > summary { display: flex; }
.toc-m[open] > ol { border: 1px solid #000; border-radius: 14px; margin-top: 8px; padding: 12px 16px; }
@media (min-width: 1180px) { .toc-m { display: none; } }

/* ---------- breadcrumb + chapter header ---------- */
.crumbs { font-size: 14px; color: var(--ink-2); margin: 0 0 20px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.crumbs li + li::before { content: "\203A"; margin-right: 8px; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: #000; background: var(--accent); }
.crumbs [aria-current] { color: #000; font-weight: 600; }
.chead { margin: 0 0 36px; padding-bottom: 28px; border-bottom: 1px solid #000; }
.chead .eyebrow { display: inline-block; background: var(--accent); border: 1px solid #000; border-radius: 980px; padding: 2px 12px; margin: 0 0 16px; font-size: 13px; color: #000; }
.chead h1 { font-size: clamp(34px, 6vw, 46px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 14px; text-wrap: balance; font-weight: 700; }
.chead .summary { font-size: clamp(18px, 2.4vw, 21px); line-height: 1.38; color: var(--ink-2); margin: 0; letter-spacing: -.01em; }
.chead .meta { margin: 18px 0 0; font-size: 14px; color: var(--ink-2); }

/* ---------- prose ---------- */
.prose { font-size: 17px; line-height: 1.65; overflow-wrap: break-word; }
.prose > * { margin: 0 0 1.1em; }
.prose h2 { font-size: 28px; line-height: 1.15; letter-spacing: -.025em; margin: 2.2em 0 .6em; font-weight: 700; padding-top: .6em; border-top: 1px solid var(--hair); text-wrap: balance; }
.prose h3 { font-size: 21px; line-height: 1.25; letter-spacing: -.015em; margin: 1.9em 0 .5em; font-weight: 700; }
.prose h4 { font-size: 17px; line-height: 1.3; margin: 1.6em 0 .4em; font-weight: 700; letter-spacing: 0; }
.prose h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.prose h2, .prose h3, .prose h4 { position: relative; scroll-margin-top: calc(var(--navh) + 16px); }
.prose h2 .anchor, .prose h3 .anchor, .prose h4 .anchor { margin-left: .4em; font-weight: 400; color: var(--grey); text-decoration: none; opacity: 0; padding: 0 .25em; border-radius: 4px; }
.prose :is(h2, h3, h4):hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose .anchor:hover { background: var(--accent); color: #000; }
@media (hover: none) { .prose .anchor { opacity: .45; } }
.prose :target { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--tint); } to { background: transparent; } }
.prose strong { font-weight: 700; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { background: var(--accent); text-decoration-thickness: 2px; }
.prose a[href^="http"]::after { content: " \2197"; font-size: .8em; text-decoration: none; display: inline-block; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: 0 0 .4em; padding-left: .2em; }
.prose li > :is(ul, ol) { margin: .4em 0 0; }
.prose ul li::marker { color: #000; }
.prose ol li::marker { font-weight: 700; font-variant-numeric: tabular-nums; }
.prose hr { border: 0; border-top: 1px solid #000; margin: 2.4em 0; }

/* inline code: light accent tint, black text */
.prose :not(pre) > code, .chead code, .callout code, .toc code, .chapters code { font: 0.88em var(--mono); background: var(--tint-soft); color: #000; padding: .1em .38em; border-radius: 5px; overflow-wrap: anywhere; }
.prose h2 code, .prose h3 code { font-size: .8em; }
kbd { font: 600 .85em var(--mono); background: #fff; color: #000; border: 1px solid #000; border-bottom-width: 2px; border-radius: 6px; padding: .05em .45em; white-space: nowrap; }

/* ---------- code blocks ---------- */
.code { margin: 1.4em 0 1.6em; background: #fff; border: 1px solid #000; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.code figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #000; background: var(--tint-soft); padding: 4px 6px 4px 14px; font: 600 12px var(--mono); letter-spacing: .04em; text-transform: lowercase; min-height: 34px; }
.code .copy { display: none; font: 600 12px var(--font); letter-spacing: 0; background: #fff; color: #000; border: 1px solid #000; border-radius: 980px; padding: 3px 12px; cursor: pointer; }
.js .code .copy { display: inline-block; }
.code .copy:hover, .code .copy[data-done] { background: var(--accent); }
.code pre { margin: 0; max-width: none; border: 0; border-radius: 0; padding: 16px 18px; background: #fff; text-align: left; font: 14.5px/1.65 var(--mono); overflow-x: auto; tab-size: 4; -webkit-text-size-adjust: none; }
.code pre:focus-visible { outline-offset: -3px; }
.code code { font: inherit; background: none; padding: 0; }
.code .c { color: var(--grey); }          /* shell comments: the only syntax colouring there is */
.code .p { font-weight: 700; user-select: none; }  /* a literal "$ " prompt */
.code.diagram pre { line-height: 1.3; }
@media (max-width: 600px) { .code pre { font-size: 13px; padding: 14px; } .code { border-radius: 12px; } }

/* ---------- tables ---------- */
.tablewrap { margin: 1.4em 0 1.8em; overflow-x: auto; border: 1px solid #000; border-radius: 14px; background: #fff; max-width: 100%; }
.tablewrap:focus-visible { outline: 3px solid #000; outline-offset: 3px; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
.prose thead th { background: var(--tint); border-bottom: 1px solid #000; font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
.prose tbody tr:last-child :is(th, td) { border-bottom: 0; }
.prose tbody tr:nth-child(even) > * { background: rgb(0 0 0 / .025); }
.prose :is(td, th):first-child { position: sticky; left: 0; z-index: 1; background: #fff; border-right: 1px solid var(--hair); font-weight: 600; }
.prose thead th:first-child { background: var(--tint); z-index: 2; }
.prose tbody tr:nth-child(even) > :first-child { background: #f7f7f7; }
.tablewrap.wide table { min-width: 860px; }
.prose td code { white-space: nowrap; }
.prose td { min-width: 9em; }
.prose td:first-child, .prose th:first-child { min-width: 8em; }

/* ---------- blockquotes and callouts ---------- */
.prose blockquote { margin: 1.4em 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose blockquote.example { background: var(--tint-soft); border: 1px solid #000; border-radius: 14px; padding: 14px 18px; font-family: var(--mono); font-size: 15px; line-height: 1.6; }
.prose blockquote.example::before { content: "Example"; display: block; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.prose blockquote.note { border-left: 4px solid #000; padding: 2px 0 2px 18px; background: none; }
.callout.warn { background: var(--tint); border: 1px solid #000; border-radius: 14px; padding: 14px 18px; }
.callout.warn::before { content: "Warning"; display: inline-block; background: #000; color: #fff; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; border-radius: 980px; padding: 2px 10px; margin-bottom: 8px; }
.callout :is(p, ul) { margin-bottom: .6em; }

/* ---------- figures ---------- */
.prose figure.shot { margin: 1.6em 0 2em; }
.shot .frame { border: 1px solid #000; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; background: #fff; }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { margin-top: 12px; font-size: 14px; line-height: 1.4; color: var(--ink-2); }

/* ---------- prev / next, edit link, contents page ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 56px 0 0; padding: 0; list-style: none; }
.pager a { display: block; height: 100%; border: 1px solid #000; border-radius: 14px; padding: 14px 18px; text-decoration: none; background: #fff; }
.pager a:hover { background: var(--accent); }
.pager small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.pager b { font-size: 17px; letter-spacing: -.01em; }
.pager .next { grid-column: 2; text-align: right; }
.pager .prev { grid-column: 1; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager .next, .pager .prev { grid-column: 1; text-align: left; } }
.edit { margin: 28px 0 0; font-size: 14px; color: var(--ink-2); }
.edit a { color: #000; }
.chlist { list-style: none; margin: 0 0 2em; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chlist a { display: block; height: 100%; border: 1px solid #000; border-radius: 14px; padding: 14px 18px; text-decoration: none; background: #fff; }
.chlist a:hover { background: var(--tint); }
.chlist b { display: block; letter-spacing: -.01em; }
.chlist span { font-size: 14px; color: var(--ink-2); line-height: 1.4; display: block; margin-top: 2px; }
.chlist .n { font: 600 12px var(--mono); color: var(--ink-2); }
@media (max-width: 700px) { .chlist { grid-template-columns: 1fr; } }
.docs .foot .wrap { max-width: 1320px; }
@media print { .nav, .chapters, .toc, .toc-m, .pager, .edit, .code .copy, .skip { display: none !important; } .dlayout { display: block; } .code { box-shadow: none; } }
.tablewrap.wide td:last-child, .tablewrap.wide th:last-child { min-width: 22em; white-space: normal; }
.prose blockquote.callout.warn { margin: 1.4em 0; }
.prose ul.pager, .prose ul.chlist, .prose ul.swatches { padding-left: 0; } .prose .pager li, .prose .chlist li { margin: 0; padding: 0; }

/* ---------- a drawn diagram (chapter 5's states): scrolls inside its frame on phones; its source under it ---------- */
.shot.diagram .frame { overflow-x: auto; }
.shot.diagram .frame:focus-visible { outline: 3px solid #000; outline-offset: 3px; }
@media (max-width: 600px) { .shot.diagram img { width: 640px; max-width: none; } }
.diagram-text { margin-top: 14px; }
.diagram-text > summary { display: inline-block; cursor: pointer; font-size: 14px; font-weight: 600; border: 1px solid #000; border-radius: 980px; padding: 3px 12px; background: #fff; }
.diagram-text > summary:hover { background: var(--accent); }
.diagram-text > .code { margin-top: 12px; }

/* wide tables (the settings reference): room for the description, and long values in the middle columns wrap
   (a path default would otherwise take the description's width and make every row tall) */
.tablewrap.wide table { min-width: 1200px; }
.tablewrap.wide td:last-child, .tablewrap.wide th:last-child { min-width: 30em; }
.tablewrap.wide td:not(:first-child):not(:last-child) code { white-space: normal; overflow-wrap: anywhere; }
.tablewrap.wide td:not(:first-child):not(:last-child) { max-width: 14em; }
