/* ============================================================
   SP PRO → AERL Nexus Setup — multi-page A4 integration guide.
   Forked from the protocol-spec sheet; trimmed to setup-guide
   needs (callouts, pinout, register table, kv-strip, summary
   checklist). Imports tokens transitively via tokens.css.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  color: var(--fg-1);
  background: var(--gray-200);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- A4 page sheet ---------- */
.sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px 16px 64px;
}

.page {
  width: 794px;
  height: 1123px;
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  padding: 68px 60px 92px;       /* footer band reserved (see DESIGN_NOTES.md) */
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------- Page header ---------- */
.ph {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--gray-900);
  margin-bottom: 22px;
}
.ph__brand { display: flex; align-items: center; gap: 14px; }
.ph__logo  { height: 28px; width: auto; display: block; }
.ph__rule  { width: 1px; height: 22px; background: var(--border-strong); }
.ph__product {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--fg-1);
  letter-spacing: -0.01em;
}
.ph__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.ph__meta .dot {
  width: 3px; height: 3px;
  background: var(--gray-300);
  border-radius: 50%;
}

/* ---------- Cover ---------- */
.cover { flex: 1; display: flex; flex-direction: column; }
.cover__hero {
  display: grid;
  grid-template-columns: 1fr;     /* single column — no product photo on cover */
  gap: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.cover__copy { min-width: 0; max-width: none; }
.cover__badges {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-accent);
  margin-bottom: 8px;
}
.cover__title {
  font-size: 38px; line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--fg-1);
}
.cover__subtitle {
  font-size: 18px; font-weight: 400;
  color: var(--fg-2);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.cover__model {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  letter-spacing: var(--tracking-wide);
  color: var(--fg-accent);
  background: var(--primary-50);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}
.cover__lede {
  font-size: 13px; line-height: 1.55;
  color: var(--fg-2);
  margin: 0 0 14px;
  max-width: 62ch;
  text-wrap: pretty;
}

/* ---------- Doc meta block ---------- */
.docmeta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.docmeta__cell {
  padding: 9px 12px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 2px;
}
.docmeta__k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-3);
}
.docmeta__v {
  font-size: 12.5px; font-weight: 600;
  color: var(--fg-1);
}

/* ---------- Section title (TOC heading on cover) ---------- */
.sec-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 10px;
}
.sec-title::before {
  content: "";
  width: 12px; height: 2px;
  background: var(--primary-500);
}

/* ---------- Chapter heading ---------- */
.chapter {
  font-size: 26px; font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--fg-1);
}
.chapter__num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-accent);
  margin-bottom: 2px;
}
.chapter__rule {
  height: 2px; width: 48px;
  background: var(--primary-500);
  margin: 8px 0 14px;
}

/* ---------- H3 / H4 ---------- */
.h3 {
  font-size: 15px; font-weight: 700;
  margin: 16px 0 6px;
  color: var(--fg-1);
  letter-spacing: -0.01em;
}
.h4 {
  font-size: 12.5px; font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 12px 0 6px;
}

p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); }
p strong { color: var(--fg-1); font-weight: 600; }

ul, ol { margin: 0 0 10px; padding-left: 20px; }
li { font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
li + li { margin-top: 2px; }

/* ---------- TOC ---------- */
.toc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  border-top: 1px solid var(--border-subtle);
}
.toc__entry {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: 8px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.toc__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-accent);
  font-weight: 600;
}
.toc__name { color: var(--fg-1); font-weight: 500; }
.toc__name small {
  display: block;
  font-size: 10.5px; font-weight: 400;
  color: var(--fg-3);
  margin-top: 1px;
}
.toc__page {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  text-align: right;
}

/* ---------- Callouts ---------- */
.callout {
  border-left: 4px solid var(--primary-500);
  background: var(--primary-50);
  padding: 10px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 10px 0;
  display: flex; gap: 10px;
  align-items: flex-start;
}
.callout__icon {
  width: 20px; height: 20px;
  flex: 0 0 20px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.callout__icon img { width: 20px; height: 20px; }
.callout__body { min-width: 0; }
.callout__label {
  display: block;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.callout__body p {
  margin: 0 0 4px;
  font-size: 11.5px; line-height: 1.45;
  color: var(--fg-1);
}
.callout__body p:last-child { margin-bottom: 0; }
.callout__body ul { margin: 4px 0 0; padding-left: 18px; }
.callout__body li { font-size: 11.5px; color: var(--fg-1); }
.callout--important {
  border-left-color: var(--status-info);
  background: var(--status-info-bg);
}
.callout--important .callout__label { color: var(--status-info); }
.callout--caution {
  border-left-color: var(--status-danger);
  background: var(--status-danger-bg);
}
.callout--caution .callout__label { color: var(--status-danger); }
.callout--warn {
  border-left-color: var(--status-warn);
  background: var(--status-warn-bg);
}
.callout--warn .callout__label { color: var(--status-warn); }
.callout--note {
  border-left-color: var(--gray-700);
  background: var(--gray-50);
}
.callout--note .callout__label { color: var(--fg-2); }

/* ---------- Spec / data tables ---------- */
table.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin: 6px 0 12px;
}
table.spec-table th,
table.spec-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
table.spec-table th {
  background: var(--gray-900);
  color: var(--white);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 7px 10px;
}
table.spec-table tbody tr:nth-child(even) td {
  background: var(--gray-50);
}
table.spec-table td:first-child {
  font-weight: 500;
  color: var(--fg-1);
}
table.spec-table td.value,
table.spec-table td:not(:first-child) {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-1);
}
.spec-block + .spec-block { margin-top: 8px; }
.spec-block__head {
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-accent);
  margin: 10px 0 4px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primary-500);
  display: inline-block;
}

/* Compact register/telemetry table */
table.spec-table.spec-table--tight {
  font-size: 11px;
}
table.spec-table.spec-table--tight th,
table.spec-table.spec-table--tight td { padding: 3px 9px; }

/* Verification telemetry list — prose readings, override the spec-table's
   mono-in-column-2 default so the right column reads as sentence-case copy
   rather than a register-value chip. */
table.spec-table.telemetry-table td:not(:first-child) {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-2);
}
table.spec-table.telemetry-table td small {
  color: var(--fg-3);
  font-weight: 400;
}
table.spec-table.spec-table--tight td.k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-accent);
  white-space: nowrap;
}
table.spec-table.spec-table--tight td.dec {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---------- Two-column grid ---------- */
.col2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 22px;
}

/* ---------- Procedures (numbered) ---------- */
.procedure {
  list-style: none;
  counter-reset: step;
  margin: 8px 0 12px;
  padding: 0;
}
.procedure > li {
  counter-increment: step;
  position: relative;
  padding: 8px 12px 8px 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--bg-surface);
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-1);
}
.procedure > li::before {
  content: counter(step);
  position: absolute;
  left: 8px; top: 7px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gray-900);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.procedure > li > strong { color: var(--fg-1); }
.procedure ul.substeps,
.procedure ol.substeps {
  list-style: disc;
  margin: 4px 0 2px;
  padding-left: 18px;
}
.procedure .substeps li {
  font-size: 11.5px;
  color: var(--fg-2);
  margin-top: 1px;
}

/* ---------- Inline code chips & code blocks ---------- */
code, .mono-inline {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--gray-100);
  color: var(--fg-1);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

pre.cmd-block {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.45;
  background: var(--gray-950);
  color: var(--gray-100);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 6px 0 10px;
  white-space: pre;
}
pre.cmd-block .prompt { color: var(--primary-400); user-select: none; }
pre.cmd-block .cmt    { color: var(--gray-400); }

/* ---------- "Path" key/value strip (for setup parameters) ---------- */
.kv-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
  margin: 6px 0 10px;
}
.kv-strip__cell {
  padding: 8px 10px;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 2px;
}
.kv-strip__k {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-3);
}
.kv-strip__v {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  color: var(--fg-1);
}
.kv-strip__cell--accent { background: var(--primary-50); }
.kv-strip__cell--accent .kv-strip__v { color: var(--fg-accent); }

/* ---------- Wiring diagram figure ---------- */
figure.wiring-fig {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  text-align: center;
}
figure.wiring-fig img {
  max-width: 100%;
  max-height: 230px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}
figure.wiring-fig figcaption {
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 6px;
  font-style: italic;
}

/* ---------- LED / symptom diagnostic table ---------- */
table.led-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin: 8px 0 12px;
  table-layout: fixed;
}
table.led-table th, table.led-table td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  word-wrap: break-word;
}
table.led-table thead th {
  background: var(--gray-900);
  color: var(--white);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
table.led-table th:first-child { width: 32%; }
table.led-table tbody tr:nth-child(even) td { background: var(--gray-50); }
table.led-table td.symptom { font-weight: 600; color: var(--fg-1); }
table.led-table td.cause   { color: var(--fg-2); line-height: 1.45; }

/* Inline source-cite footnote */
.src-cite {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
  margin: 2px 0 8px;
  display: block;
}
.src-cite strong { color: var(--fg-2); font-weight: 600; }

/* Summary checklist (clean numbered list, no procedure card chrome) */
ol.summary {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 8px 0 0;
}
ol.summary > li {
  counter-increment: step;
  position: relative;
  padding: 4px 0 4px 32px;
  font-size: 12.5px;
  color: var(--fg-1);
  border-bottom: 1px dashed var(--border-subtle);
}
ol.summary > li:last-child { border-bottom: 0; }
ol.summary > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-500);
  color: var(--gray-950);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Contact card ---------- */
.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
  background: var(--gray-50);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-top: 10px;
}
.contact h4 {
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0 0 6px;
}
.contact p {
  font-size: 12px; line-height: 1.55;
  margin: 0 0 3px;
  color: var(--fg-2);
}
.contact strong { color: var(--fg-1); font-weight: 600; }
.contact a { color: var(--fg-accent); text-decoration: none; }
.contact a:hover { text-decoration: underline; }

/* ---------- Page footer (absolute in the reserved band) ---------- */
.pf {
  position: absolute;
  left: 60px;
  right: 60px;
  bottom: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-3);
}
.pf__folio b { color: var(--fg-accent); font-weight: 700; }

/* ---------- Print ----------
   In screen mode the in-content `.pf` is absolutely positioned in the
   reserved bottom band of `.page` (height: 1123px). In print mode doc.css
   collapses `.page` to height: auto, which leaves the absolute `.pf`
   anchored to the content edge instead of the printed page edge — on a
   sparse cover (no product image, short TOC) this lands the footer band
   on top of the TOC rows. Hide it on the cover; the `@page` running
   footer already supplies AERL + "Page N of M". Body pages are dense
   enough that `.pf` lands naturally at the bottom. ------------------ */
@media print {
  .page:first-of-type .pf { display: none; }
  .page:not(:first-of-type) .ph,
  .page:not(:first-of-type) .pf { display: none; }

  .no-print, #tweaks-root, tweaks-panel { display: none !important; }
}
