/* Fonts: Word-to-PDF, the same Office faces as the other Source Audio guides.
     Calibri 400, Calibri-Italic 400, Calibri-Bold 700 -> Carlito 400 / italic / 700
     Calibri-Light 300 (every heading), Calibri-LightItalic 300 (italic run-ins)
       -> Carlito 400: Carlito has no Light cut
     AndaleMono (cover title only) -> Roboto Mono 400
   Run-in labels are Calibri-Bold: 700, no semibold anywhere. */
@import url("https://fonts.googleapis.com/css2?family=Carlito:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Mono:wght@400&display=swap");

:root {
  --ink: #000;
  --accent: #2e74b5; /* headings and italic run-ins, sampled off the pages */
  --rule: #c9c9c9;
  --paper: #eef3f9;
  --muted: #5e5e5e;
  --link: #0563c1;
  --body-font: Carlito, Calibri, "Segoe UI", sans-serif;
  --head-font: var(--body-font);
  --mono-font: "Andale Mono", "Roboto Mono", ui-monospace, monospace;
  --led-on: #88d03f; /* LED ON cell of the insert-card table */
  --led-off: #d4d4d4;
}

/* ---- structure: keep as is, restyle below the brand line ---- */

*, *::before, *::after { box-sizing: border-box; }
* { margin-top: 0; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: var(--body-font);
  font-size: 1rem;
  line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--head-font); line-height: 1.2; }

main { margin-left: 20vw; padding-bottom: 3em; }
footer { margin-left: 20vw; padding: 1.6em 3em; }

a { color: var(--link); }

img { max-width: 100%; height: auto; margin-bottom: 0.75em; }
.topic > img, li > img, figure > img { display: block; }
figure { margin: 0 0 1em; }

/* NAV */
#side-nav {
  position: fixed; top: 0; left: 0;
  width: 20vw; height: 100%;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--rule);
  z-index: 5;
}
.nav-container { display: flex; flex-direction: column; margin: 1.5em 1em; }
#side-nav h4, #side-nav h5 { font-weight: 400; margin-bottom: 0.45em; }
#side-nav h4 { font-weight: 700; }
#side-nav h5 { font-size: 0.9em; margin-left: 1em; }
#side-nav a, #toc-mobile a { color: inherit; text-decoration: none; }
#side-nav a:hover, #toc-mobile a:hover { text-decoration: underline; }

/* SECTIONS */
section + section { margin-top: 3em; }
.flex-container { display: flex; padding-left: 2em; }
/* A container has no intrinsic width: a half-container sized by its
   content (width: auto) collapses to 0 unless it sets container-type: normal. */
.half-container { width: 100%; padding: 0 1em; container-type: inline-size; }
.half-container > header { column-span: all; }
.flow > * + * { margin-bottom: 1em; }

/* One .topic per heading carries the columns, so no column runs taller than
   one topic. 63rem below = the two-column threshold of `columns: 2 30rem`. */
.topic { columns: 2 30rem; column-gap: 3em; }
.no-columns { columns: auto !important; }
/* a heading stands above everything it introduces */
:not(.topic-group) > .topic > .keep-together:first-child > :is(h3, h4):first-child,
:not(.topic-group) > .topic > :is(h3, h4):first-child { column-span: all; }
/* topics the source sets on one page share its columns, each whole in one */
.topic-group { columns: 2 30rem; column-gap: 3em; }
.topic-group > .topic { columns: auto; break-inside: avoid; }
/* the right column's first heading loses its margin at the break; so does the left's */
.topic-group > .topic:first-child,
.topic-group > .topic:first-child > :is(h3, h4):first-child,
.topic-group > .topic:first-child > .keep-together:first-child > :is(h3, h4):first-child { margin-top: 0; }

/* COLUMN BREAKS. A paragraph, list item, figure, table or callout is never
   cut by the gutter. Chrome's balancer drops `break-after: avoid` when it
   gets in the way, so it is only a hint: what keeps a heading off a column's
   foot is a .keep-together holding the heading and its first block. */
p, li, figure, table, .table-scroll, .keep-together, .callout, .grid-wrapper {
  break-inside: avoid;
}
h2, h3, h4, h5, h6 { break-after: avoid; }
/* a lead-in ending in ":" stays with what it introduces */
:has(+ p > .menu-path:only-child) { break-after: avoid; }
@container (min-width: 63rem) {
  .column-end { break-after: column; }
}

/* Figure rows: the max stays indefinite, or auto-fit counts its tracks off
   it and stacks one figure per row in a narrow column. */
.grid-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(8em, 100%), 1fr));
  gap: 1em;
}
.grid-wrapper img { width: 100%; }

/* TABLES */
.table-scroll { overflow-x: auto; margin-bottom: 1em; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.doc-table th, .doc-table td {
  padding: 0.4em 0.6em;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--rule);
}
.doc-table thead th { background: var(--accent); color: #fff; }

.callout {
  background: var(--paper);
  border-left: 4px solid var(--accent);
  padding: 0.7em 1em;
  margin-bottom: 1em;
}
.callout > :last-child { margin-bottom: 0; }

@media (max-width: 900px) {
  .flex-container { flex-direction: column; padding-left: 0; }
  .half-container { padding: 0 1em; }
  nav { display: none; }
  main, footer { margin: 0 auto; }
  footer { padding: 1.6em 1em; }
  #toc-mobile { display: block; }
  /* a diagram with small labels scrolls instead of shrinking */
  .wide-figure { overflow-x: auto; }
  .wide-figure img { min-width: 700px; }
}
/* 901, not 900: at exactly 900px both queries match and the mobile TOC
   would vanish together with the nav */
@media (min-width: 901px) { #toc-mobile { display: none; } }

/* ---- brand: masthead, heading treatment, callouts, from this manual ---- */

body { font-size: 1.0625rem; line-height: 1.5; }
p { margin-bottom: 0.7em; }
b, strong { font-weight: 700; }
a { text-decoration: none; }
a:hover, a:active { text-decoration: underline; }

/* MASTHEAD: logo, the monospaced cover title, the pedal photo, all on white as on the cover */
#masthead { padding: 1.5em 3em 1em; }
#masthead h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  margin: 0;
  font-family: var(--mono-font);
  font-weight: 400;
  font-size: 1.7em;
  line-height: 1.25;
  text-align: center;
}
#masthead h1 img { align-self: flex-end; width: 8.5rem; margin: 0; }
#masthead > img { display: block; width: min(13em, 100%); margin: 1em auto 0; }

/* HEADINGS: plain blue, no rules or blocks; level shown by size only */
h2, h3, h4, h5, h6 { font-weight: 400; color: var(--accent); }
h2 { font-size: 1.9em; margin-bottom: 0.5em; }
h3 { font-size: 1.3em; margin: 1.2em 0 0.3em; }
h4 { font-size: 1.1em; margin: 1em 0 0.25em; }
h5 { font-size: 1em; font-style: italic; margin: 0.9em 0 0.2em; }
.half-container > header + *, .topic > :is(h3, h4):first-child { margin-top: 0; }
#side-nav .nav-container h3, #toc-mobile h2 { margin: 0 0 1rem; }
#side-nav h4, #toc-mobile h4 { color: var(--ink); font-size: 1em; font-weight: 400; margin: 0.55em 0 0.2em; }
#side-nav h5, #toc-mobile h5 { color: var(--ink); font-size: 0.92em; font-style: normal; margin: 0 0 0.2em 0.9em; }
#toc-mobile { padding: 0 1em; }

ul, ol { padding-left: 1.4em; margin-bottom: 0.8em; }
li + li { margin-top: 0.3em; }

/* italic run-in labels ("JFET:") and sub-heads */
.lbl { font-style: italic; color: var(--accent); }
.warn { font-weight: 700; text-decoration: underline; }

/* FIGURES */
/* legal text, the icon-over-text note and the insert card read as one block at a book measure */
.topic.single { columns: auto; max-width: 52em; }
/* a photo beside the text it illustrates, both starting at the top: columns would
   balance them by height and strand the text under an empty half */
.photo-text {
  columns: auto;
  display: grid;
  grid-template-columns: minmax(12em, 22em) minmax(0, 1fr);
  gap: 0 2.5em;
  align-items: start;
}
.photo-text > h3 { grid-column: 1 / -1; }
.photo-text > figure { margin: 0; }
.photo-text > figure img { width: 100%; }
.photo-text-body > :first-child { margin-top: 0; }

/* each mode's graph sits centred under its paragraph at three quarters of the measure, as printed */
.mode > figure { width: 75%; margin: 0 auto 1.5em; }
.mode figure img { width: 100%; }
/* sub-heads set like the print's small italic ones */
h3.it { font-size: 1em; font-style: italic; margin: 0.9em 0 0.2em; }

/* Controls: the labelled panel photo stays in view beside the descriptions */
.panel-layout {
  display: grid;
  grid-template-columns: minmax(16em, 30em) minmax(0, 1fr);
  gap: 2.5em;
  align-items: start;
}
.panel-layout > figure { position: sticky; top: 1em; }
.panel-layout > figure img { width: 100%; }

.weee { width: 4em; height: auto; }

/* INSERT CARD */
.card { border: 1px solid var(--rule); padding: 1em 1.2em; max-width: 34em; }
.card-logo { display: block; width: 9em; margin: 0 auto 0.3em; }
.card-sub {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.7em;
}
.card p { margin-bottom: 0.45em; }
.card-table { width: 100%; border-collapse: collapse; font-size: 0.9em; text-align: center; }
.card-table th, .card-table td { border: 1px solid var(--muted); padding: 0.15em 0.4em; font-weight: 400; }
.card-table thead th b { font-size: 1.1em; }
.card-table thead tr:first-child td { border: 0; }
.sig { text-align: right; }
.card-table .led-on { background: var(--led-on); }
.card-table .led-off { background: var(--led-off); }

footer { font-size: 0.9em; }
footer p { margin-bottom: 0.3em; }

@media (max-width: 900px) {
  #masthead { padding: 1em 0; }
  #masthead h1 { font-size: 1.3em; }
  #masthead h1 img { width: 6.5rem; }
  .panel-layout, .photo-text { grid-template-columns: minmax(0, 1fr); }
  .mode > figure { width: 100%; }
  .panel-layout > figure { position: static; }
  .card-table { font-size: 0.8em; }
}
