/*
 * Jazzity
 *
 * Midnight blue and brass, after the record sleeves and horns of the music
 * itself. Big Shoulders (a Chicago face) for display type, Instrument Sans for
 * reading, IBM Plex Mono for note names and intervals.
 *
 * Each page opens like the front of a sleeve: the masthead and the title share
 * a midnight band, set in big condensed type, and the page's first panel is
 * laid over its foot like a sheet slid half out. Sections are headed in heavy
 * capitals over a thick rule, and lists read like the tracks on the back.
 */

:root {
  --paper: #f2f4f7;
  --surface: #ffffff;
  --ink: #131a2a;
  --muted: #5b6577;
  --rule: #d6dbe4;
  --midnight: #0f2d63;
  --midnight-ink: #e9edf5;
  --brass: #d9a441;
  --brass-ink: #8a6216;
  --on-brass: #131a2a;

  /* Type and lines on the midnight band. */
  --band-text: #c3cbdb;
  --band-muted: #9fb0d0;
  --band-rule: #3a5a96;
  --sheet-shadow: 0 1px 0 var(--rule), 0 1.5rem 3rem -1.5rem rgb(15 45 99 / 0.4);

  /* The piano keyboard: the right hand in brass, the left in blue, and the
     note sounding now picked out. */
  --key-white: #ffffff;
  --key-black: #1b2233;
  --key-edge: #8792a5;
  --key-label: #8792a5;
  --hand-right: #d9a441;
  --hand-left: #7c9fe0;
  --hand-ink: #131a2a;
  --key-sounding: #d9512c;
  --key-sounding-ink: #ffffff;
  --current: rgb(217 164 65 / 0.22);

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 4px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 80rem;

  /* How far the page's first panel rides up over the band. */
  --overlap: clamp(2.5rem, 6vw, 4.5rem);
  --page-top: clamp(2rem, 5vw, 3.5rem);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1220;
    --surface: #141c2d;
    --ink: #e6eaf1;
    --muted: #9aa4b6;
    --rule: #26314a;
    --midnight: #08183a;
    --brass-ink: #e3b158;
    --band-rule: #22396b;
    --sheet-shadow: 0 0 0 1px var(--rule), 0 1.5rem 3rem -1.5rem rgb(0 0 0 / 0.7);

    --key-white: #d5dbe5;
    --key-black: #05080f;
    --key-edge: #0c1220;
    --key-label: #5b6577;
    --hand-left: #8fb0f0;
    --key-sounding: #ff8a65;
    --key-sounding-ink: #131a2a;
    --current: rgb(227 177 88 / 0.2);
  }
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--brass-ink);
}

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.notes {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
}

/* The band: masthead and title on midnight */

.band {
  background: var(--midnight);
  color: var(--midnight-ink);
}

/* Room under the band for the page's first panel to ride up over it. */
.band:has(~ .page > .feature:first-child) {
  padding-bottom: var(--overlap);
}

.band-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) var(--gutter) clamp(2rem, 5vw, 3rem);
  display: grid;
  gap: 1.75rem;
}

.band .eyebrow {
  color: var(--band-muted);
}

.band a:hover {
  color: var(--brass);
}

.band > .flash {
  margin-top: 0;
  margin-bottom: 2rem;
  background: transparent;
  color: var(--midnight-ink);
}

/* Masthead */

.masthead-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font: 800 2.1rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brass);
  text-decoration: none;
}

/* The mark stands 1.45 times the height of the capitals, centred on them. */
.logo-mark {
  flex: none;
  height: 1.16em;
  width: auto;
  aspect-ratio: 68 / 91;
}

.wordmark:hover {
  color: var(--brass);
}

.wordmark-small {
  font-size: 1.5rem;
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
}

.primary-nav a {
  font: 600 1.15rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  padding-block: 0.4rem;
  border-bottom: 3px solid transparent;
}

.primary-nav a:hover {
  color: var(--midnight-ink);
  border-color: var(--midnight-ink);
}

.primary-nav a[aria-current="page"] {
  color: var(--brass);
  border-color: var(--brass);
}

@media (max-width: 30rem) {
  .primary-nav {
    gap: 0.25rem 1.1rem;
  }

  .primary-nav a {
    font-size: 1.05rem;
    letter-spacing: 0.06em;
  }
}

.masthead-search {
  margin-left: auto;
  flex: 1 1 18rem;
  min-width: 0;
  max-width: 26rem;
}

/* Search */

.search-field {
  display: flex;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--ink);
  overflow: hidden;
}

.band .search-field {
  border-color: var(--brass);
}

.search-field:focus-within {
  outline: 3px solid var(--brass);
  outline-offset: 1px;
}

.search input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.search input[type="search"]:focus {
  outline: none;
}

.search input[type="submit"] {
  border: 0;
  padding: 0 1.1rem;
  background: var(--brass);
  color: var(--on-brass);
  font: 800 1.05rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.search input[type="submit"]:hover {
  background: #e7b75c;
}

/* Suggestions open under the field, over whatever follows it. */
.search-combobox {
  position: relative;
}

.search-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: min(24rem, 60vh);
  overflow-y: auto;
  padding: 0.3rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 0.2);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion {
  padding: 0.5rem 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}

.search-suggestion[aria-selected="true"] {
  background: var(--paper);
  box-shadow: inset 3px 0 0 var(--brass);
}

.search-suggestion-label {
  font: 500 0.95rem/1.3 var(--font-mono);
}

.search-suggestion-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Search results and the page for nothing found */

.section-count {
  font: 500 0.8rem/1 var(--font-mono);
  color: var(--muted);
  letter-spacing: 0;
}

.more-results {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.suggestion-list a {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
}

.suggestion-list a:hover {
  color: inherit;
  border-color: var(--brass);
}

.suggestion-label {
  font-family: var(--font-mono);
  font-weight: 500;
}

.suggestion-detail {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Flash */

.flash {
  max-width: var(--measure);
  width: calc(100% - 2 * var(--gutter));
  margin: 1.5rem auto 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--brass);
  background: var(--surface);
}

/* Page */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--page-top) var(--gutter) 5rem;
}

/* The first panel, laid over the foot of the band like a sheet half out of
   its sleeve. */
.page > .feature:first-child {
  position: relative;
  margin-top: calc(-1 * (var(--overlap) + var(--page-top)));
}

.eyebrow,
.card-kind {
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* Chord symbols and numerals keep their case: Dm7 is not DM7, nor ii II. */
.card-kind-cased,
.cased {
  text-transform: none;
  letter-spacing: 0.04em;
}

/* Titles keep their case too: "Eb" and "ii-V-I" mean something different in
   capitals. */
.title-block h1 {
  margin-top: 0.6rem;
  font: 800 clamp(2.75rem, 7vw, 5.5rem)/0.88 var(--font-display);
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
}

.title-block h1.title-long {
  font-size: clamp(2.25rem, 4.75vw, 3.75rem);
  line-height: 0.9;
}

.title-accent {
  color: var(--brass);
}

.subtitle {
  margin-top: 1rem;
  max-width: 44rem;
  color: var(--band-text);
  font-size: 1.1rem;
}

.subtitle a {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--midnight-ink);
}

.aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.aliases li {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--band-rule);
  border-radius: 999px;
  font: 500 0.9rem/1 var(--font-mono);
}

/* Sections are headed in heavy capitals over a thick rule. */
.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 6px solid var(--ink);
  font: 800 clamp(1.6rem, 3vw, 2.25rem)/0.95 var(--font-display);
  text-transform: uppercase;
}

.section-link {
  margin-left: auto;
  font: 600 1rem/1 var(--font-body);
  text-transform: none;
}

.section-note {
  margin-left: auto;
  font: 500 0.75rem/1.2 var(--font-mono);
  letter-spacing: 0.14em;
  color: var(--muted);
}

.group + .group,
.feature + .group {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.empty {
  margin-top: 2rem;
  color: var(--muted);
}

/* Keys: a row of the twelve round the cycle of fourths */

.key-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.key-picker-label {
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--band-muted);
}

.key-picker ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.key-picker li {
  display: flex;
}

.key-picker a {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding-inline: 0.45rem;
  border: 2px solid var(--band-rule);
  border-radius: var(--radius);
  color: var(--midnight-ink);
  font: 800 1.3rem/1 var(--font-display);
  text-decoration: none;
}

.key-picker a:hover {
  border-color: var(--brass);
}

.key-picker a[aria-current="page"] {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
}

/* Gb and F# share a place, as one key with two names. */
.key-picker-enharmonic a:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.key-picker-enharmonic a + a {
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Modes of a scale, under its title */
.band .mode-tabs {
  margin: 0;
}

.band .mode-tabs a {
  border-color: var(--band-rule);
}

.band .mode-tabs a:hover {
  color: var(--brass);
}

/* Staff notation */

.staff {
  min-width: 0;
  min-height: 6rem;
  color: var(--ink);
}

.staff svg {
  display: block;
  width: 100%;
  max-width: var(--staff-width);
  height: auto;
}

/* Featured staves are drawn larger and scroll sideways rather than shrink. */
.staff-large {
  overflow-x: auto;
}

.staff-large svg {
  max-width: calc(var(--staff-width) * 1.8);
  min-width: min(calc(var(--staff-width) * 1.1), 40rem);
}

/* A whole chart of chords is drawn barely larger than it engraves, so that
   eight bars fit on a line. */
.staff-score svg {
  max-width: calc(var(--staff-width) * 1.2);
  min-width: min(var(--staff-width), 40rem);
}

/* On a phone, though, a single chord or scale shrinks to fit rather than
   hide its last notes off the edge; only a chart scrolls. */
@media (max-width: 30rem) {
  .staff-large:not(.staff-score) svg {
    min-width: 0;
  }
}

.staff-only {
  padding: 1rem;
  background: var(--surface);
}

/* Feature panel: the large staff and its facts, on a sheet */

.feature {
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--sheet-shadow);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
}

.staff + .facts,
.keyboard + .facts,
.facts + .prose,
.staff + .prose,
.keyboard + .prose {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.facts dt {
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.facts dd {
  margin-top: 0.4rem;
  font-size: 1.05rem;
}

.facts .notes {
  font-size: 1.15rem;
}

.facts-wide {
  flex-basis: 100%;
}

/* With room, a chord's staff and keyboard sit on the left of the sheet and
   its facts on the right. */
@media (min-width: 60rem) {
  .feature-split {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr);
    column-gap: 3rem;
    align-items: start;
  }

  .feature-split > * {
    grid-column: 1;
  }

  .feature-split > .player-controls,
  .feature-split > .prose {
    grid-column: 1 / -1;
  }

  .feature-split > .staff-large svg {
    max-width: calc(var(--staff-width) * 2.4);
  }

  .feature-split > .keyboard {
    width: min(100%, calc(var(--keyboard-keys) * 2rem));
  }

  .feature-split > .facts {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    margin-top: 0;
    padding: 0 0 0 3rem;
    border-top: 0;
    border-left: 1px solid var(--rule);
  }

  /* Stacked in a column, a wide fact is as tall as it needs, not the whole
     column. */
  .feature-split > .facts > .facts-wide {
    flex-basis: auto;
  }
}

/* Notes as tiles, the root in brass, with the interval to the next between. */
.note-tiles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.note-tile {
  display: grid;
  place-items: center;
  min-width: 3.1rem;
  height: 3.5rem;
  padding-inline: 0.45rem;
  border-radius: var(--radius);
  background: var(--midnight);
  color: var(--midnight-ink);
  font: 800 1.9rem/1 var(--font-display);
}

.note-tile-root {
  color: var(--brass);
}

@media (prefers-color-scheme: dark) {
  .note-tile {
    box-shadow: inset 0 0 0 1px var(--band-rule);
  }
}

.note-interval {
  padding-inline: 0.1rem;
  font: 500 0.8rem/1 var(--font-mono);
  color: var(--brass-ink);
}

.prose {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.facts dt {
  font: 500 0.7rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.facts dd {
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

.prose {
  max-width: 42rem;
}

.prose p + p {
  margin-top: 0.75rem;
}

/* Lead sheet: a progression's chart in bars, four to a line, each chord's
   symbol over its roman numeral. */

.lead-sheet {
  display: grid;
  gap: 0.9rem;
}

.lead-sheet + .staff {
  margin-top: 1.5rem;
}

.lead-sheet-labelled .lead-sheet-section {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.lead-sheet-label {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-top: 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font: 800 1.25rem/1 var(--font-display);
}

.lead-sheet-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  row-gap: 0.6rem;
}

.lead-sheet-bar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  min-height: 4.25rem;
  border-right: 2px solid var(--ink);
}

.lead-sheet-bar:nth-child(4n + 1) {
  border-left: 2px solid var(--ink);
}

.lead-sheet-chord,
.lead-sheet-repeat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.45rem 0.55rem 0.4rem;
  text-decoration: none;
}

.lead-sheet-chord:hover {
  background: var(--paper);
}

.lead-sheet-symbol {
  font: 800 1.5rem/1 var(--font-display);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.lead-sheet-numeral {
  font: 400 0.75rem/1.2 var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
}

.lead-sheet-repeat {
  justify-content: center;
  align-items: center;
  font: 600 1.5rem/1 var(--font-display);
  color: var(--muted);
}

@media (max-width: 40rem) {
  .lead-sheet-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-sheet-bar:nth-child(4n + 1) {
    border-left: 0;
  }

  .lead-sheet-bar:nth-child(2n + 1) {
    border-left: 2px solid var(--ink);
  }

  .lead-sheet-symbol {
    font-size: 1.2rem;
  }

  .lead-sheet-labelled .lead-sheet-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem;
  }

  .lead-sheet-label {
    margin-top: 0;
  }
}

/* Reharmonizations: the new chords stand out. */

.reharmonized strong {
  color: var(--brass-ink);
  font-weight: 500;
}

/* Analysis of chord changes */

.analysis-key {
  margin-bottom: 1rem;
  color: var(--muted);
}

.analysis-key strong {
  color: var(--ink);
  font: 600 1.35rem/1 var(--font-display);
  letter-spacing: 0.02em;
}

.table-scroll {
  overflow-x: auto;
}

.analysis-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
}

.analysis-table th,
.analysis-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: baseline;
}

.analysis-table thead th {
  font: 500 0.7rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.analysis-symbol {
  font: 600 1.3rem/1 var(--font-display);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.analysis-symbol .accidental,
.lead-sheet-symbol .accidental {
  font-family: var(--font-body);
  font-size: 0.8em;
  font-weight: 400;
  margin-inline: 0.02em;
}

.analysis-numeral {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.analysis-unclear .analysis-numeral {
  color: var(--brass-ink);
  font-weight: 500;
}

.analysis-form label {
  display: block;
  margin-bottom: 0.4rem;
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.analysis-form-inline {
  max-width: 32rem;
  margin-top: 1.5rem;
}

.analysis-start {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.feature-heading {
  font: 600 1.5rem/1.1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.analysis-start + .group {
  margin-top: 3rem;
}

.card-numerals {
  color: var(--ink);
}

.card-changes {
  color: var(--muted);
}

.analysis-start .flash {
  margin: 0;
}

/* Cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.25rem;
}

.card-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}

.card-grid-compact .card-title {
  font-size: 1.4rem;
}

/* On a phone, compact cards go two abreast rather than one to a row, so
   that a page of chords or voicings isn't a long scroll of half-empty
   cards. */
@media (max-width: 30rem) {
  .card-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .card-grid-compact .card {
    padding: 0.8rem 0.75rem;
  }

  .card-grid-compact .card-title {
    font-size: 1.2rem;
  }
}

/* Scales are long runs of notes, so give them room to stay legible. */
.card-grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
}

.card-grid > li {
  display: flex;
  min-width: 0;
}

.card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
}

/* A card lifts off the page with a brass shadow, like a printed block. */
.card:hover {
  color: inherit;
  box-shadow: 6px 6px 0 var(--brass);
  translate: -2px -2px;
}

.card-title {
  font: 800 1.6rem/1 var(--font-display);
  letter-spacing: 0.01em;
}

/* The key a progression is shown in on the index, when it isn't C. */
.card-title-key {
  color: var(--brass-ink);
}

.card .staff {
  margin-block: 0.25rem;
}

.card-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Tracklist: modes numbered down the page like the back of a sleeve, the
   staff on the right. */

.tracklist {
  counter-reset: track;
}

.tracklist > li {
  display: flex;
  counter-increment: track;
}

.tracklist .card {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 22rem);
  grid-auto-rows: auto;
  align-content: center;
  column-gap: 1.5rem;
  row-gap: 0.35rem;
  padding: 1.5rem 3.5rem 1.5rem 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}

.tracklist .card::before {
  content: counter(track, decimal-leading-zero);
  grid-row: 1 / span 3;
  align-self: center;
  font: 800 3rem/1 var(--font-display);
  color: var(--brass);
}

.tracklist .card > * {
  grid-column: 2;
}

.tracklist .card > .staff {
  grid-column: 3;
  grid-row: 1 / span 3;
  align-self: center;
  margin: 0;
}

.tracklist .card-title {
  font-size: 1.8rem;
}

.tracklist .card-meta {
  font-size: 1rem;
}

.tracklist .card:hover {
  box-shadow: none;
  translate: none;
  background: var(--surface);
}

.tracklist .play-button {
  top: 50%;
  translate: 0 -50%;
}

@media (max-width: 48rem) {
  .tracklist .card {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  .tracklist .card {
    padding-right: 0;
  }

  .tracklist .card::before {
    grid-row: 1;
    font-size: 2rem;
  }

  .tracklist .card > :is(.card-kind, .card-title) {
    padding-right: 3rem;
  }

  .tracklist .play-button {
    top: 1.25rem;
    translate: none;
  }

  .tracklist .card > .staff {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

/* Scales index: each parent scale a numbered track */

.scale-list {
  display: grid;
  counter-reset: track;
  border-top: 6px solid var(--ink);
}

.scale-entry {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 24rem);
  gap: 1.5rem;
  align-items: center;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
  counter-increment: track;
}

.scale-entry::before {
  content: counter(track, decimal-leading-zero);
  font: 800 2.4rem/1 var(--font-display);
  color: var(--brass);
}

.scale-entry-title {
  font: 800 clamp(1.6rem, 3vw, 2.1rem)/1 var(--font-display);
}

.scale-entry-title a {
  text-decoration: none;
}

.scale-entry-text p {
  margin-top: 0.5rem;
  color: var(--muted);
}

@media (max-width: 48rem) {
  .scale-entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .scale-entry::before {
    font-size: 1.75rem;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.chips a,
.mode-tabs a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
}

.chips a:hover,
.mode-tabs a:hover {
  border-color: var(--brass);
  color: inherit;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.mode-tabs a[aria-current="page"] {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
}

/* Voicing choices */

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0.25rem;
  gap: 0.25rem;
  border: 2px solid var(--ink);
  border-radius: calc(var(--radius) + 0.25rem);
  background: var(--surface);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.segmented label:hover span {
  background: var(--paper);
}

.segmented input:checked + span {
  background: var(--midnight);
  color: var(--brass);
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

/* In the chart, between the lead sheet and the staff it voices. */
.voicing-form {
  margin-block: 1.25rem;
  padding-block: 1rem;
  border-block: 1px solid var(--rule);
}

.transport + .voicing-form {
  margin-top: 0;
}

.voicing-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.voicing-family-description {
  flex: 1 1 16rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.voicing-details {
  margin-top: 0.75rem;
}

.voicing-details summary {
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.voicing-details[open] summary {
  margin-bottom: 1rem;
}

.voicing-details summary:hover {
  color: var(--brass-ink);
}

.voicing-reset {
  margin-top: 1rem;
}

.voicing-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
}

.voicing-choices label {
  display: block;
  margin-bottom: 0.3rem;
  font: 600 1.2rem/1 var(--font-display);
}

.voicing-choices select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.spelled-chords {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.spelled-chords li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.spelled-chords .notes {
  min-width: 8rem;
  color: var(--muted);
}

/* Players: play buttons, and the transport for progressions */

.player-controls,
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

/* On a screen with room for it, the transport stays in view while a long
   chart scrolls by. */
@media (min-width: 40rem) {
  .transport {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -0.5rem 0 1rem;
    padding-block: 0.5rem;
    background: var(--surface);
  }
}

.player-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem 0.5rem 0.95rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 800 1.1rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.player-button:hover {
  border-color: var(--brass);
  color: var(--brass-ink);
}

/* The player's first button, the one that plays, is filled in brass. */
:where(.player-controls, .transport) > .player-button:where(:first-child) {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
}

.player-button[aria-pressed="true"] {
  background: var(--midnight);
  border-color: var(--midnight);
  color: var(--brass);
}

/* A toggle shows its state in a little lamp. */
.player-toggle::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.player-toggle[aria-pressed="true"]::before {
  background: var(--brass);
  border-color: var(--brass);
}

.icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.icon-stop,
[aria-pressed="true"] > .icon .icon-play {
  display: none;
}

[aria-pressed="true"] > .icon .icon-stop {
  display: inline;
}

.transport-tempo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.transport-tempo input {
  width: 8rem;
  accent-color: var(--brass);
}

.transport-tempo output {
  min-width: 4.5rem;
  font: 400 0.85rem/1 var(--font-mono);
  color: var(--muted);
}

.transport-link {
  margin-left: auto;
  font-weight: 600;
}

.player-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (hover: none) {
  .player-hint {
    display: none;
  }
}

/* On a phone, player buttons are a little smaller, so that a pair like
   Play voicing and Arpeggiate share a line; the tempo slider shares a line
   with Play (its BPM reading standing for its label); and the toggles
   shrink further to fit on one line together. */
@media (max-width: 40rem) {
  .player-button {
    padding: 0.5rem 1rem 0.5rem 0.8rem;
    font-size: 1rem;
  }

  .transport {
    gap: 0.5rem;
  }

  .transport-tempo {
    flex: 1 1 9rem;
  }

  .transport-tempo label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .transport-tempo input {
    flex: 1;
    width: 0;
    min-width: 4rem;
  }

  .transport-tempo output {
    min-width: 7ch;
  }

  .transport .player-toggle {
    min-height: 2.5rem;
    padding: 0.4rem 0.8rem 0.4rem 0.7rem;
    gap: 0.4rem;
    font-size: 0.85rem;
  }
}

/* A round play button in the corner of a card. */
.playable {
  position: relative;
}

.playable > .card > :first-child {
  padding-right: 2.25rem;
}

.scale-entry.playable {
  padding-right: 3.5rem;
}

.play-button {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
}

.play-button:hover {
  border-color: var(--brass);
  color: var(--brass-ink);
}

.play-button[aria-pressed="true"] {
  background: var(--midnight);
  border-color: var(--midnight);
  color: var(--brass);
}

/* The chord sounding, on the staff and on the lead sheet. */
.staff .is-current {
  color: var(--brass-ink);
}

.lead-sheet-chord.is-current,
.lead-sheet-repeat.is-current {
  background: var(--current);
  box-shadow: inset 0 -3px 0 var(--brass);
}

/* Piano keyboard */

.keyboard {
  display: block;
  width: min(100%, calc(var(--keyboard-keys) * 1.4rem));
  height: auto;
  margin-top: 1rem;
}

.keyboard rect {
  stroke: var(--key-edge);
  stroke-width: 0.6;
}

.keyboard-white rect {
  fill: var(--key-white);
}

.keyboard-black rect {
  fill: var(--key-black);
}

.keyboard text {
  font: 600 5.5px var(--font-body);
  text-anchor: middle;
  fill: var(--hand-ink);
}

.keyboard-black text {
  font-size: 4.2px;
}

.keyboard .keyboard-octave {
  font-weight: 400;
  font-size: 4.4px;
  fill: var(--key-label);
}

.keyboard .is-right rect {
  fill: var(--hand-right);
}

.keyboard .is-left rect {
  fill: var(--hand-left);
}

.keyboard .is-sounding rect {
  fill: var(--key-sounding);
}

.keyboard .is-sounding text {
  fill: var(--key-sounding-ink);
}

/* Practice sheets: a progression in all twelve keys */

.practice-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.practice-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.practice-sheet {
  display: grid;
  gap: 1rem;
}

/* Short progressions go two keys to a row. */
.practice-sheet-short {
  grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr));
}

.practice-key {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.practice-key-title {
  font: 800 1.9rem/1 var(--font-display);
}

@media (max-width: 40rem) {
  .practice-key {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Home */

/* Short enough on a laptop screen to show what follows: the headline and
   search on the left, the featured progression and its keys on the right. */
.hero {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 1.75rem) var(--gutter) clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem 3.5rem;
  align-items: center;
}

@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.hero-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
}

.hero-side {
  display: grid;
  gap: 1.1rem;
}

/* Beside the featured progression, the keys are smaller to fit one row. */
@media (min-width: 64rem) {
  .hero-side .key-picker {
    gap: 0.6rem 1rem;
  }

  .hero-side .key-picker ol {
    gap: 0.3rem;
  }

  .hero-side .key-picker a {
    min-width: 2.3rem;
    height: 2.3rem;
    padding-inline: 0.3rem;
    font-size: 1.1rem;
  }
}

.hero .eyebrow {
  color: var(--brass);
}

.hero-title {
  font: 800 clamp(3.5rem, 6.8vw, 6.5rem)/0.98 var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}

.hero-lede {
  max-width: 38rem;
  font-size: 1.15rem;
  color: var(--band-text);
}

.hero-search {
  max-width: 38rem;
}

.hero-search input[type="search"] {
  padding: 0.85rem 1.1rem;
  font-size: 1.15rem;
}

.hero-search input[type="submit"] {
  padding: 0 1.6rem;
  font-size: 1.3rem;
}

/* The featured progression, on a brass panel like a sticker on the sleeve. */
.hero-figure {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: clamp(1rem, 2.5vw, 1.4rem);
  border-radius: var(--radius);
  background: var(--brass);
  color: var(--on-brass);
}

.hero-figure-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hero-figure-staff {
  padding: 0.75rem 0.75rem 0.25rem;
  border-radius: 3px;
  background: var(--surface);
}

.hero-figure .staff svg {
  max-width: calc(var(--staff-width) * 1.15);
  margin-inline: auto;
}

.hero-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-figure figcaption > span {
  flex: 1 1 14rem;
}

.hero-figure figcaption a {
  font-family: var(--font-mono);
  color: inherit;
  text-decoration-color: currentColor;
}

.hero-figure .player-button {
  background: var(--midnight);
  border-color: var(--midnight);
  color: var(--midnight-ink);
}

.hero-figure .player-button .icon {
  color: var(--brass);
}

/* Things to try, in groups by what they find */

.example-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem 0;
}

.example-group {
  padding-right: 1.5rem;
}

.example-group + .example-group {
  padding-left: 1.5rem;
  border-left: 1px solid var(--rule);
}

.example-group h3 {
  margin-bottom: 1rem;
  font: 800 1.35rem/1.05 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brass-ink);
}

.example-group ul {
  display: grid;
  gap: 0.5rem;
}

.example-group li {
  font: 400 1rem/1.3 var(--font-mono);
}

@media (max-width: 40rem) {
  .example-group,
  .example-group + .example-group {
    padding-inline: 0;
    border-left: 0;
  }
}

/* From the reference: picks as record covers, in midnight, brass and white */

/* Nine picks fill three rows of three; with fewer columns, rows stay full. */
.covers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

.covers > li:nth-child(n + 7) {
  display: none;
}

@media (min-width: 40rem) {
  .covers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .covers > li:nth-child(-n + 8) {
    display: flex;
  }
}

@media (min-width: 60rem) {
  .covers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .covers > li:nth-child(n) {
    display: flex;
  }
}

.covers > li {
  display: flex;
  min-width: 0;
}

.cover {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.cover:hover {
  color: inherit;
  box-shadow: 6px 6px 0 var(--brass);
  translate: -3px -3px;
}

.cover-kind {
  font: 500 0.75rem/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brass-ink);
}

.cover-body {
  display: grid;
  gap: 0.6rem;
}

.cover-title {
  font: 800 clamp(1.9rem, 3vw, 2.5rem)/0.9 var(--font-display);
  overflow-wrap: break-word;
}

.cover-notes {
  font: 400 0.95rem/1.35 var(--font-mono);
}

.cover-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.covers > li:nth-child(6n + 1) .cover,
.covers > li:nth-child(6n + 5) .cover {
  background: var(--midnight);
  border-color: var(--midnight);
  color: var(--midnight-ink);
}

.covers > li:nth-child(6n + 1) :is(.cover-kind, .cover-meta),
.covers > li:nth-child(6n + 5) :is(.cover-kind, .cover-meta) {
  color: var(--band-text);
}

.covers > li:nth-child(6n + 1) .cover-kind,
.covers > li:nth-child(6n + 5) .cover-kind {
  color: var(--brass);
}

.covers > li:nth-child(6n + 2) .cover,
.covers > li:nth-child(6n) .cover {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
}

.covers > li:nth-child(6n + 2) :is(.cover-kind, .cover-meta),
.covers > li:nth-child(6n) :is(.cover-kind, .cover-meta) {
  color: var(--on-brass);
}

.covers > li:nth-child(6n + 2) .cover:hover,
.covers > li:nth-child(6n) .cover:hover {
  box-shadow: 6px 6px 0 var(--ink);
}

/* Colophon */

.colophon {
  background: var(--midnight);
  color: var(--band-text);
}

.colophon-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-size: 0.95rem;
}

.colophon a:not(.wordmark):hover {
  color: var(--brass);
}

.colophon-credits {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

/* The source link stands apart from the credit, as a button. */
.colophon-source {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--band-rule);
  border-radius: 999px;
  font: 500 0.75rem/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.colophon a.colophon-source:hover {
  border-color: var(--brass);
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  .cover,
  .key-picker a,
  .chips a,
  .mode-tabs a,
  .player-button {
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease, translate 120ms ease;
  }
}

/* Print: black on white, just the music, a key never split across pages */

@media print {
  :root {
    color-scheme: light;
    --paper: #ffffff;
    --surface: #ffffff;
    --ink: #000000;
    --muted: #333333;
    --rule: #999999;
    --key-white: #ffffff;
    --key-black: #1b2233;
    --key-edge: #555555;
    --key-label: #555555;
    --hand-left: #7c9fe0;
  }

  @page {
    margin: 1.2cm;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 10pt;
  }

  .masthead,
  .colophon,
  .key-picker,
  .mode-tabs,
  .aliases,
  .flash,
  .practice-options,
  .transport,
  .player-controls,
  .play-button,
  .player-button {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .band {
    padding: 0 !important;
    background: none;
    color: #000000;
  }

  .band-inner {
    max-width: none;
    padding: 0 0 0.4cm;
  }

  .title-block h1 {
    font-size: 22pt;
  }

  .eyebrow,
  .subtitle,
  .title-accent {
    color: #333333 !important;
  }

  .page > .feature:first-child {
    margin-top: 0;
  }

  a {
    text-decoration: none;
  }

  .feature,
  .card,
  .practice-key {
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  .practice-sheet {
    gap: 0.5cm;
  }

  .practice-sheet-short {
    grid-template-columns: 1fr 1fr;
  }

  .practice-key {
    grid-template-columns: 1.4cm minmax(0, 1fr);
    break-inside: avoid;
  }

  .practice-key-title {
    font-size: 20pt;
  }

  .staff-large,
  .staff {
    overflow: visible;
  }

  .staff svg,
  .staff-large svg {
    min-width: 0;
    max-width: 100%;
  }
}

