/* FM-1 MIDI guide — Baud Girl. Tokens and primitives lifted from the brand
   package (Brand/brand-package/css/tokens.css, base.css); page styles below. */

/* ---------- fonts (self-hosted, OFL) ---------- */
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 300; font-display: swap; src: url("../assets/fonts/montserrat-300-italic.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/montserrat-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/montserrat-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 800; font-display: swap; src: url("../assets/fonts/montserrat-800-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/ibmplexmono-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/ibmplexmono-500-normal.woff2") format("woff2"); }

/* ---------- tokens ---------- */
:root {
  --bg-ink: #17151c;
  --bg-plum: #2a2734;
  --bg-plum-raised: #34303d;
  --ivory: #ffffe8;
  --magenta: #c22483;
  --magenta-deep: #9d1c69;
  --magenta-soft: #d95aa6;
  --haze: #cbc6d1;
  --mist: #9d97a6;
  --shadow: #48434f;
  --line-on-dark: rgba(255, 255, 232, 0.13);

  --bg: var(--bg-ink);
  --surface: var(--bg-plum);
  --surface-raised: var(--bg-plum-raised);
  --fg: var(--ivory);
  --fg-muted: var(--haze);
  --fg-faint: var(--mist);
  --hairline: var(--line-on-dark);
  --accent: var(--magenta);

  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-caption: 0.75rem;
  --t-small: 0.85rem;
  --t-body: 1.0625rem;
  --t-lead: clamp(1.2rem, 1.6vw, 1.45rem);
  --t-h3: clamp(1.35rem, 2.2vw, 1.8rem);
  --t-h2: clamp(1.9rem, 3.6vw, 2.8rem);
  --t-h1: clamp(2.8rem, 7vw, 5.6rem);

  --track-wide: 0.34em;
  --leading-tight: 0.98;
  --leading-body: 1.62;

  --sp-xs: 0.625rem;
  --sp-sm: 1rem;
  --sp-md: 1.75rem;
  --sp-lg: 3rem;
  --sp-xl: 5rem;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 4px;
  --border-w: 1.5px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--t-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
::selection { background: var(--magenta); color: var(--ivory); }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- type primitives ---------- */
.display {
  font-family: var(--font-sans);
  font-weight: 800;
  font-style: italic;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}
.label {
  font-family: var(--font-sans);
  font-weight: 300;
  font-style: italic;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  font-size: var(--t-caption);
  color: var(--fg-faint);
}
.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

/* ---------- masthead: sticky; the wordmark shrinks and the title fades in on scroll ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--gutter);
  background: var(--bg);
  border-bottom: var(--border-w) solid var(--hairline);
}
.masthead__brand { display: block; line-height: 0; }
.masthead__wordmark {
  height: 30px;
  width: auto;
  transition: height 0.35s var(--ease);
}
.masthead__title {
  font-size: 1.05rem;
  color: var(--fg);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
  text-align: right;
}
.masthead.is-scrolled .masthead__wordmark { height: 16px; }
.masthead.is-scrolled .masthead__title { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .masthead__wordmark, .masthead__title { transition: none; }
}

/* ---------- hero ---------- */
.hero {
  padding: var(--sp-xl) var(--gutter) var(--sp-lg);
  border-bottom: var(--border-w) solid var(--hairline);
}
.hero__inner { max-width: 1100px; margin-inline: auto; }
.hero__kicker { margin-bottom: var(--sp-sm); }
.hero__title { font-size: var(--t-h1); }
.hero__title em { font-style: italic; color: var(--accent); }
.hero__lead {
  margin-top: var(--sp-md);
  max-width: var(--measure);
  font-size: var(--t-lead);
  line-height: 1.45;
  color: var(--fg-muted);
}
.hero__after { margin-top: var(--sp-md); max-width: var(--measure); }
.hero__adds {
  margin-top: var(--sp-sm);
  display: grid;
  gap: 0.5rem;
  max-width: var(--measure);
}
.hero__adds li {
  position: relative;
  padding-left: 1.4em;
}
.hero__adds li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.68em;
  width: 0.7em; height: 1px;
  background: var(--fg-faint);
}
.hero__note {
  margin-top: var(--sp-md);
  font-size: var(--t-small);
  color: var(--fg-faint);
}

/* ---------- layout: nav + article ---------- */
.page {
  max-width: 1100px;
  margin-inline: auto;
  padding: var(--sp-lg) var(--gutter) var(--sp-xl);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-lg);
}
@media (min-width: 900px) {
  .page { grid-template-columns: 200px minmax(0, 1fr); gap: var(--sp-xl); }
  .toc { position: sticky; top: 5rem; align-self: start; }
}
.toc__title { margin-bottom: var(--sp-sm); }
.toc ol { display: grid; gap: 0.35rem; }
.toc a {
  display: block;
  font-size: var(--t-small);
  color: var(--fg-muted);
  padding: 0.15rem 0 0.15rem 0.75rem;
  border-left: 2px solid var(--hairline);
}
.toc a:hover { color: var(--fg); border-left-color: var(--accent); }

.article { max-width: 72ch; }
.section { padding-block: var(--sp-lg); border-top: var(--border-w) solid var(--hairline); }
.section:first-child { padding-top: 0; border-top: 0; }
.section h2 { font-size: var(--t-h2); margin-bottom: var(--sp-md); scroll-margin-top: 5rem; }
.section h3 { font-size: var(--t-h3); margin-top: var(--sp-md); margin-bottom: var(--sp-sm); font-weight: 600; }
.section p { max-width: var(--measure); }
.section p + p, .section ul + p, .section table + p, .section p + ul { margin-top: var(--sp-sm); }
.section .callout + p, .section .table-wrap + p { margin-top: var(--sp-md); }
.section p + table, .section p + .table-wrap { margin-top: var(--sp-md); }
.section strong { font-weight: 600; color: var(--fg); }
.section em { font-style: italic; }
.section code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface);
  padding: 0.05em 0.35em;
  border-radius: var(--radius);
}
.section ul.list { display: grid; gap: 0.6rem; max-width: var(--measure); }
.section ul.list li { position: relative; padding-left: 1.4em; }
.section ul.list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.68em;
  width: 0.7em; height: 1px;
  background: var(--fg-faint);
}

/* set-off block: the brand book's card — hairline border, small radius, plum surface */
.callout {
  margin-top: var(--sp-md);
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: var(--measure);
}
.callout p { max-width: none; }
.callout__tag {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.6rem;
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: var(--sp-md); }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--t-small);
}
table { border-top: var(--border-w) solid var(--fg); }
thead th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--t-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-align: left;
  padding: 0.8rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--hairline);
}
tbody td {
  padding: 0.6rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
tbody td:first-child {
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
}
tbody tr:last-child td { border-bottom: 0; }
.table-wrap.wide td:first-child { white-space: normal; }
.cc-table tr.group-start td { border-top: var(--border-w) solid var(--shadow); }
.cc-table tbody tr:first-child td { border-top: 0; }
