/* Docs pages (Docs.vue, DocsNav.vue, StageList.vue, BuyList.vue, LightsTable.vue). Linked on every page, so every rule sits
   under a .docs or docs component class. Every value is a design-system token, except layout widths with no token (the
   40rem container query, the 14rem buy-list shop column, the 24px checkbox box width) and the type values restated from
   tokens.css classes where a class can't go (Markdown headings, the step numbers). Breakpoint: web.md's 900px, where the
   side nav becomes the Contents disclosure. */

.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding-block: var(--space-6) var(--space-16); }

/* Docs nav (web.md Docs: left nav, scrolls with the page, "Contents" disclosure on mobile) -------------------------- */
.docs-side { display: none; }
.docs-nav__group { margin-block: var(--space-6) var(--space-2); padding-inline: var(--space-3); }
.docs-nav__list { display: grid; gap: var(--target-gap); }
/* 48px rows; the current page has a brand-soft fill, a brand edge and bold text, plus aria-current. The edge is a real
   border (not a shadow) so forced-colors mode keeps it; other rows pad the same space instead of a transparent border,
   which forced colors would draw. */
.docs-nav__link {
  display: flex; align-items: center; box-sizing: border-box; min-height: var(--target);
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + var(--space-1));
  border-radius: var(--radius-sm); color: var(--ink); text-decoration: none;
}
.docs-nav__link:hover { background: var(--surface-sunken); }
.docs-nav__link[aria-current] {
  padding-left: var(--space-3); border-left: var(--space-1) solid var(--brand);
  background: var(--brand-soft); font-weight: 700;
}

.docs-contents > .docs-nav { padding-top: var(--space-4); }

@media (min-width: 900px) {
  .docs { grid-template-columns: calc(var(--space-16) * 4) minmax(0, 1fr); gap: var(--space-10); padding-top: var(--space-8); }
  .docs-contents { display: none; }
  .docs-side { display: block; }
}

/* Content column: layout inside it follows the column's own width (container queries) ----------------------- */
.docs-main { min-width: 0; container-type: inline-size; }
.docs-rail { margin-bottom: var(--space-8); }
.docs-title { margin-top: var(--space-1); }
.docs-lead { margin-top: var(--space-4); max-width: var(--prose-max); }

/* "You'll need" Card beside the stage's figure on wide columns, stacked on narrow */
.docs-intro { display: grid; gap: var(--space-6); margin-top: var(--space-8); }
/* site.css gives every .bb-card a 12px flex gap; Checkbox rows stack with line dividers instead (Checkbox README) */
.docs-need { gap: 0; }
.docs-need__group { margin-top: var(--space-6); }
.docs-need__list { margin-top: var(--space-2); }
.docs-need__list > li + li { border-top: var(--border-hairline) solid var(--line); }
.docs .shot figcaption { margin-top: var(--space-2); }

/* Markdown content. <Content /> wraps the page in its own div, so its children are .docs-body > div > *. */
.docs-body { margin-top: var(--space-4); }
.docs-body > div > * { max-width: var(--prose-max); }
.docs-body > div > * + * { margin-top: var(--space-4); }
/* tokens.css .title-l and .title-m, restated for Markdown headings (which can't carry a class); must equal them */
.docs-body > div > h2 { margin-top: var(--space-12); font-family: var(--font-display); font-size: 1.5rem; line-height: 2rem; font-weight: 600; }
.docs-body > div > h3 { margin-top: var(--space-8); font-family: var(--font-display); font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; }
.docs-body > div > ul { padding-left: var(--space-6); }

/* Steps: a top-level ordered list. Each step is a row: number in metric and brand, then the text, and a 15rem
   thumbnail at the right when the step has one. Numbers restart at 1 in every list (a start= attribute is ignored). */
.docs-body > div > ol { max-width: none; margin-top: var(--space-2); padding: 0; list-style: none; counter-reset: docs-step; }
.docs-body > div > ol > li {
  position: relative; counter-increment: docs-step; max-width: var(--prose-max);
  padding: var(--space-5) 0 var(--space-5) calc(var(--space-10) + var(--space-4));
  border-top: var(--border-hairline) solid var(--line);
}
/* tokens.css .metric, restated (a pseudo-element can't carry a class); must equal it, except the line height, which is
   body's so the number centres on the step's first line. Re-check after a design-system re-import. */
.docs-body > div > ol > li::before {
  content: counter(docs-step); position: absolute; left: 0; top: var(--space-5); width: var(--space-10);
  font-family: var(--font-display); font-size: 2.25rem; line-height: 1.625rem; font-weight: 500; letter-spacing: -0.01em;
  color: var(--brand);
}
.docs-body > div > ol > li > * + * { margin-top: var(--space-3); }
.docs-body > div > ol > li > .shot { max-width: calc(var(--space-20) * 4); }
/* a step with a thumbnail: the text in the first column, the thumbnail beside it. Up to four text blocks sit beside
   it; the last row is flexible, so a tall thumbnail adds its height there instead of spreading the text apart. */
@container (min-width: 40rem) {
  .docs-intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .docs-intro:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
  .docs-body > div > ol > li:has(> .shot) {
    display: grid; grid-template-columns: minmax(0, 1fr) calc(var(--space-20) * 3); grid-template-rows: repeat(3, auto) 1fr;
    column-gap: var(--space-6); align-items: start; max-width: none;
  }
  .docs-body > div > ol > li:has(> .shot) > * { grid-column: 1; max-width: var(--prose-max); }
  .docs-body > div > ol > li:has(> .shot) > * + * { margin-top: 0; }
  .docs-body > div > ol > li:has(> .shot) > :not(.shot) + :not(.shot) { margin-top: var(--space-3); }
  .docs-body > div > ol > li:has(> .shot) > .shot { grid-column: 2; grid-row: 1 / -1; max-width: none; }
}

.docs-pager { margin-top: var(--space-16); }

/* Markdown components (Banner, Notices, Checklist, BuyList) -------------------------------------------------- */
.docs-body .bb-banner__text p + p { margin-top: var(--space-2); }
/* Checkbox rows stack in a Card with line dividers (Checkbox README) */
.docs-checklist { padding: var(--space-2); }
.docs-checklist > ul > li + li { border-top: var(--border-hairline) solid var(--line); }
.docs-body > div > .buy-list { max-width: none; border-top: var(--border-hairline) solid var(--line); }
.buy-list > li { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; padding-block: var(--space-2); border-bottom: var(--border-hairline) solid var(--line); }
.buy-list__shop { gap: var(--space-2); font-weight: 600; justify-self: start; /* narrow: under the spec, aligned with the text after the checkbox box (24px, the DS Checkbox's fixed size) */ margin-left: calc(var(--space-4) + 24px + var(--space-3)); }
.buy-list__shop--none { color: var(--ink-muted); display: flex; align-items: center; min-height: var(--target); font-weight: 400; }
@container (min-width: 40rem) {
  .buy-list > li { grid-template-columns: minmax(0, 1fr) 14rem; /* 14rem fits the longest shop name ('Amazon (5-pack)') beside the spec */ }
  .buy-list__shop { margin-left: 0; justify-self: end; text-align: right; padding-right: var(--space-4); }
}

/* Page content: images outside a step, tables, download rows, Start here's stage list ------------------------- */
/* an image outside a step (a part on its own) is no larger than a step thumbnail under its text */
.docs-body > div > .shot { max-width: calc(var(--space-20) * 4); }
.docs-files { display: flex; flex-wrap: wrap; align-items: center; gap: var(--target-gap); }
/* the Updater download badges (UpdaterDownloads.vue) wrap from the left like .docs-files, instead of site.css's centred phone stack */
.docs-body .button-row { flex-direction: row; align-items: center; }
/* Markdown tables (finger-to-port, cost, case contents). VitePress gives each one tabindex="0", so it shows focus. */
.docs-body > div > table { width: 100%; border-collapse: collapse; }
.docs-body th, .docs-body td { padding: var(--space-3) var(--space-4) var(--space-3) 0; border-bottom: var(--border-hairline) solid var(--line); text-align: left; vertical-align: top; }
.docs-body th { border-bottom-color: var(--line-strong); font-weight: 600; }
.docs-body table:focus-visible { outline: var(--focus-width) solid transparent; outline-offset: var(--focus-offset); box-shadow: var(--focus-ring); }
/* What the lights mean (LightsTable.vue): the "Pause the lights" checkbox, then the table. Each light cell is a slot as
   wide as three lights, so the words line up down the column, then the words. The meaning's first line centres on the
   light. Narrow columns stack each row: the lights and their words (no slot), the meaning under them. */
.docs-body > div > .lights-pause { width: fit-content; margin-left: calc(var(--space-4) * -1); } /* the box lines up with the table edge (bb-check pads space-4 inline) */
.lights-table__light { display: flex; align-items: center; gap: var(--space-3); }
.lights-table__lamps { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); flex: none; min-width: calc(var(--icon-l) * 3 + var(--space-2) * 2); }
.lights-table tbody th { border-bottom-color: var(--line); }
.lights-table td { padding-top: calc(var(--space-3) + (var(--icon-l) - 1lh) / 2); }
@container (width < 40rem) {
  .lights-table, .lights-table tbody, .lights-table tr, .lights-table th, .lights-table td { display: block; }
  /* bundle.css .bb-sr, restated for this layout only: the column headers stay for screen readers */
  .lights-table thead { position: absolute; width: var(--border-hairline); height: var(--border-hairline); margin: calc(var(--border-hairline) * -1); overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lights-table tbody tr { padding-block: var(--space-4); border-bottom: var(--border-hairline) solid var(--line); }
  .lights-table tbody tr:first-child { border-top: var(--border-hairline) solid var(--line-strong); }
  .lights-table tbody th, .lights-table td { padding: 0; border: 0; }
  .lights-table__lamps { min-width: 0; }
  .lights-table td { margin-top: var(--space-2); }
}
/* Start here (StageList.vue): 48px link rows with a line between and target-gap between neighbours */
.docs-stages__list > li { padding-block: calc(var(--target-gap) / 2); border-top: var(--border-hairline) solid var(--line); }
.docs-stages__list > li:last-child { border-bottom: var(--border-hairline) solid var(--line); }
.docs-stages__link {
  display: flex; align-items: center; gap: var(--space-4); box-sizing: border-box; min-height: var(--target);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; text-decoration: none;
}
.docs-stages__link:hover { background: var(--surface-sunken); }
.docs-stages__num { min-width: var(--space-8); color: var(--brand); }
.docs-stages__start { margin-top: var(--space-8); }
