/* Fonts: Helvetica 400 -> Inter 400, Helvetica-Bold 700 -> Inter 700,
   Helvetica-Oblique / BoldOblique -> Inter italic 400 / 700,
   HelveticaNeue-Black 900 (section bands, cover) -> Inter 900 (from fonts-used.txt) */
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Noto+Music&display=swap");

:root {
  --ink: #1a1a1a;    /* body text */
  --accent: #000;    /* the cover's ground: masthead, banners, table heads */
  --rule: #b0b0b0;   /* hairlines */
  --paper: #eaeaea;  /* tint behind callouts */
  --muted: #5e5e5e;
  --link: #0a58ca;
  --body-font: "Inter", system-ui, sans-serif;
  --head-font: var(--body-font);
  --band: #dcdcdc;   /* the pale grey band behind second-level titles */
  --cover-grey: #9a9a9a;
}

/* ---- 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; }
.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; }

/* 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 ---- */

/* MASTHEAD: the cover — grey ALESIS logo box beside the grey SR18 title, the
   photo centred on black, REFERENCE MANUAL at the bottom right */
#masthead { background: var(--accent); color: var(--cover-grey); padding: 2.5em 0 2em; margin-bottom: 2.5em; }
#masthead .half-container { max-width: 60rem; margin: 0 auto; }
#masthead h1 { display: flex; align-items: center; gap: 0.6em; margin: 0 0 1em; font-weight: 900; }
#masthead h1 img { width: 32%; max-width: 14rem; margin: 0; }
#masthead h1 span { display: flex; flex-direction: column; font-size: clamp(2.4rem, 7vw, 4.5rem); letter-spacing: -0.02em; line-height: 0.95; }
#masthead h1 small { font-size: 0.38em; font-weight: 400; letter-spacing: -0.01em; margin-top: 0.15em; }
.masthead-photo { display: block; width: 100%; max-width: 44rem; margin: 0 auto; }
#masthead .doc-title { text-align: right; font-weight: 900; font-stretch: condensed; letter-spacing: 0.04em; text-transform: uppercase; margin: 0.5em 0 0; }

/* TITLES: reversed white caps on a black band, as the manual's chapter heads */
main h2 {
  background: var(--accent); color: #fff;
  font-weight: 900; text-transform: uppercase;
  padding: 0.3em 0.5em; font-size: 1.6rem; margin-bottom: 0.8em;
}
/* second level: bold caps on a pale grey band */
main h3 {
  background: var(--band); font-weight: 700; text-transform: uppercase;
  font-size: 1.05rem; padding: 0.3em 0.5em; margin: 0.4em 0 0.7em;
}
/* third level: bold, underlined */
main h4 { font-size: 1rem; font-weight: 700; text-decoration: underline; margin: 0.9em 0 0.4em; }
.topic { margin-bottom: 1.2em; }

/* grey italic sidebars: Tip:, side notes */
.callout { border-left: 0; font-style: italic; }
.callout b, .run-in { font-weight: 700; }
/* inline Note:/Example: paragraphs: indented italic, bold-italic label */
.note { font-style: italic; padding-left: 1.2em; }
.example { background: var(--paper); font-style: italic; padding: 0.4em 0.8em; }

/* the manual names buttons in brackets; carry the key look over */
kbd {
  font-family: var(--body-font); font-size: 0.82em; font-weight: 700;
  border: 2px solid var(--ink); border-radius: 4px; padding: 0 0.3em; white-space: nowrap;
}

.lcd { display: block; width: min(100%, 17rem); margin: 0.3em 0 0.9em; }
figure.panel img { width: 100%; }
dl.params dt { font-weight: 700; }
dl.params dd { margin: 0 0 0.5em 1.5em; }
ol.numbered > li::marker { font-weight: 700; }
.bullets { list-style: square; }

.doc-table thead th { text-transform: uppercase; font-size: 0.85em; }
.doc-table caption { font-weight: 700; text-align: left; padding: 0.3em 0; text-transform: uppercase; }

/* PATTERN / SOUND LISTS: long reference tables side by side */
.list-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 1.5em; align-items: start; }
.sound-list { columns: 4 13rem; column-gap: 1.5em; }
.sound-list .table-scroll { break-inside: auto; }
.sound-list table { break-inside: auto; }
.list-table { font-size: 0.85em; }
.list-table td, .list-table th { padding: 0.15em 0.5em; }
.list-table td:first-child { font-variant-numeric: tabular-nums; }

footer { color: var(--muted); font-size: 0.9em; border-top: 1px solid var(--rule); }

/* PANEL: the diagram stays in view beside its numbered list */
.panel-layout { display: grid; grid-template-columns: minmax(16em, 28em) 1fr; gap: 2em; align-items: start; }
.sticky-figure { position: sticky; top: 1em; }
.panel-list { columns: 2 22rem; column-gap: 2.5em; }
@media (max-width: 1100px) {
  .panel-layout { grid-template-columns: 1fr; }
  .sticky-figure { position: static; }
}

/* a note on which companion document a section comes from */
.doc-update { background: var(--paper); border-left: 4px solid var(--accent); padding: 0.7em 1em; font-size: 0.95em; }

/* Noto Music carries the 16th and 32nd note glyphs (U+1D161, U+1D162) */
.note-glyph { font-family: "Noto Music", serif; font-size: 1.5em; line-height: 1.2; white-space: nowrap; }
.note-glyph sup { font-family: var(--body-font); font-size: 0.5em; }
.spec-table th { width: 16em; font-weight: 700; background: none; }
.spec-table { margin-bottom: 1.5em; max-width: 50rem; }
.note-map, .pad-notes, .midi-chart { font-variant-numeric: tabular-nums; }
.note-map td, .note-map th { text-align: center; padding: 0.3em 0.4em; }
.midi-chart tbody th, .pad-notes tbody th { font-weight: 700; background: none; }
.save-table ol { padding-left: 1.3em; margin: 0; }
.save-table td p { margin-bottom: 0.4em; }
figcaption { font-size: 0.85em; color: var(--muted); }
