:root {
  --ink: #17212a;
  --muted: #67717a;
  --rule: #1f2933;
  --light-rule: #d9dde1;
  --link: #244f6b;
  --paper: #ffffff;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #111;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.frame {
  width: min(1000px, calc(100% - 64px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: -100px;
  left: 10px;
  clip-path: inset(50%);
  padding: 6px 10px;
  color: white;
  background: #111;

}

.skip-link:focus {
  top: 10px;
  clip-path: none;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  border-bottom: 1px solid var(--rule);
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 10px;
}

.site-header nav span {
  color: #90979e;
}

.site-header a {
  color: #171717;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.site-header a:hover,
.site-header .home-link {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.github-link {
  white-space: nowrap;
}

.masthead {
  max-width: 840px;
  padding: 82px 0 92px;
}

.section-label {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: #17212a;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

h1 {
  max-width: 780px;
  margin-bottom: 24px;
  font-size: clamp(2.7rem, 6vw, 4.65rem);
}

.subtitle {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  line-height: 1.42;
}

.byline {
  margin: 0 0 44px;
  color: var(--muted);
  font-size: 15px;
}

.introduction {
  max-width: 760px;
  margin: 0 0 22px;
  font-size: 18px;
  line-height: 1.7;
}

.project-links {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.theorem-section {
  padding-top: 72px;
}

.theorem-section > h2 {
  max-width: 820px;
  margin-bottom: 22px;
}

.theorem-introduction {
  max-width: 800px;
  margin: 0 0 44px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2.3vw, 1.55rem);
  line-height: 1.55;
}

.theorem-list {
  max-width: 860px;
  border-top: 1px solid var(--rule);
}

.theorem-result {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 30px;
  padding: 27px 0 29px;
  border-bottom: 1px solid var(--light-rule);
}

.theorem-number {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.theorem-result h3 {
  margin-bottom: 9px;
  font-size: 21px;
}

.theorem-result div > p {
  max-width: 700px;
  margin: 0;
}

.theorem-result sub {
  font-size: 70%;
}

.theorem-coda {
  max-width: 800px;
  margin: 30px 0 0;
  font-weight: 650;
}

.content-section {
  padding: 66px 0 78px;
  border-top: 1px solid var(--rule);
}

.content-section > h2 {
  margin-bottom: 30px;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
}

.section-intro,
.prose {
  max-width: 800px;
}

.section-intro {
  margin: -12px 0 38px;
  font-size: 17px;
}

.prose p {
  margin: 0 0 22px;
}

.composition-guide {
  max-width: 800px;
  margin-top: 42px;
  padding: 28px 0 0;
  border-top: 1px solid var(--light-rule);
}

.composition-guide > h3 {
  margin-bottom: 16px;
  font-size: 22px;
}

.composition-guide h4 {
  margin: 0 0 14px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.composition-guide h5 {
  margin: 0 0 16px;
  font-size: 16px;
}

.composition-guide > p {
  max-width: 760px;
}

.display-math {
  margin: 13px 0 17px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 400;
  line-height: 1.5;
}

.display-math sub {
  font-size: 70%;
}

.born-q {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 650;
}

.commuting-figure {
  max-width: 800px;
  margin: 32px 0 0;
}

.diagram-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--light-rule);
  border-bottom: 1px solid var(--light-rule);
}

.commuting-diagram {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.commuting-diagram text {
  fill: var(--ink);
}

.commuting-diagram .diagram-heading {
  font-size: 15px;
  font-weight: 700;
}

.commuting-diagram .diagram-math {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
}

.commuting-diagram .diagram-label {
  fill: var(--muted);
  font-size: 13px;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-linejoin: round;
  stroke-width: 5px;
}

.diagram-arrow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
  marker-end: url(#arrowhead);
}

.commuting-diagram marker path {
  fill: var(--ink);
}

.diagram-equals {
  stroke: var(--ink);
  stroke-width: 1.2;
}

.current-definition,
.cue-explainer,
.rhythm-example {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

.current-definition > p,
.cue-explainer > p,
.rhythm-example > p {
  max-width: 760px;
}

.equivalence-line {
  margin: 24px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--light-rule);
  border-bottom: 1px solid var(--light-rule);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  text-align: center;
}

.cue-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
  border-top: 1px solid var(--light-rule);
  border-bottom: 1px solid var(--light-rule);
}

.cue-comparison article {
  padding: 24px 24px 26px 0;
}

.cue-comparison article + article {
  padding-right: 0;
  padding-left: 24px;
  border-left: 1px solid var(--light-rule);
}

.cue-name {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.passage-stack {
  display: grid;
  gap: 7px;
}

.passage-line {
  display: grid;
  grid-template-columns: 108px repeat(3, minmax(34px, 1fr));
  min-height: 38px;
}

.passage-line span {
  display: grid;
  place-items: center;
  border-top: 1px solid var(--light-rule);
  border-right: 1px solid var(--light-rule);
  border-bottom: 1px solid var(--light-rule);
  font-family: Georgia, "Times New Roman", serif;
}

.passage-line .cue-cell {
  justify-items: start;
  padding-left: 8px;
  border-left: 1px solid var(--light-rule);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 650;
}

.passage-line .blank-step {
  color: #b5bbc0;
}

.intervals {
  margin: 17px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.interval-register {
  margin-top: 17px;
  border-top: 1px solid var(--light-rule);
}

.interval-head,
.interval-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 62px;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--light-rule);
}

.interval-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.interval-row {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.interval-row > span:last-child {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 650;
}

.interval-fails > span:last-child {
  color: var(--ink);
}

.composition-conclusion {
  margin: 26px 0 0;
}

.rhythm-table {
  max-width: 760px;
  margin: 25px 0;
  border-top: 1px solid var(--light-rule);
}

.rhythm-head,
.rhythm-row {
  display: grid;
  grid-template-columns: 100px minmax(260px, 1fr) 120px;
  gap: 18px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--light-rule);
}

.rhythm-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rhythm-row > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.rhythm-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 34px;
  margin-right: 4px;
}

.rhythm-bar span {
  position: relative;
  min-height: 48px;
  text-align: center;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 12px;
}

.rhythm-bar span::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  z-index: 1;
}

.score-player { margin: 24px 0 10px; padding: 18px 0; border-top: 1px solid var(--light-rule); border-bottom: 1px solid var(--light-rule); }
.score-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; font-size: 14px; }
.score-controls button, .score-controls input { font: inherit; color: var(--ink); background: white; border: 1px solid #a8a8a2; border-radius: 2px; padding: 7px 10px; }
.score-controls button { cursor: pointer; }
.score-controls button:disabled { cursor: default; opacity: 0.5; }
.score-controls input { width: 74px; }
.score-controls label { display: flex; align-items: center; gap: 7px; }
.score-scroll { overflow-x: auto; margin: 18px 0; }
.score-scroll svg { display: block; width: 100%; min-width: 600px; font: 12px Georgia, serif; fill: var(--ink); }
.score-detail, #qutrit-status { font-size: 14px; line-height: 1.55; }
.score-detail { color: var(--muted); }

.rhythm-bar span:first-child {
  border-left: 1px solid var(--ink);
}

.rhythm-bar .hold-1 {
  grid-column: span 1;
}

.rhythm-bar .hold-2 {
  grid-column: span 2;
}

.rhythm-bar .hold-3 {
  grid-column: span 3;
}

.rhythm-fails .rhythm-bar span {
  border-style: dashed;
}

.rhythm-realization {
  display: grid;
  gap: 7px;
}

.rhythm-unitaries {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.resource {
  display: grid;
  grid-template-columns: 42px minmax(0, 720px);
  gap: 18px;
  max-width: 800px;
  padding: 30px 0 18px;
  border-top: 1px solid var(--light-rule);
}

.resource:last-child {
  border-bottom: 1px solid var(--light-rule);
}

.resource-number {
  color: var(--muted);
  font-size: 14px;
}

.resource h3,
.paper-entry h3 {
  margin-bottom: 10px;
  font-size: 21px;
}

.resource p {
  margin: 0 0 13px;
}

figure {
  max-width: 850px;
  margin: 38px 0 0;
}

video {
  display: block;
  width: 100%;
  height: auto;
  background: #f1f2f3;
  border: 1px solid var(--light-rule);
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.file-list {
  max-width: 800px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--light-rule);
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--light-rule);
}

.file-list span,
.muted {
  color: var(--muted);
}

.file-list span {
  white-space: nowrap;
  font-size: 14px;
}

.paper-entry {
  max-width: 720px;
}

.paper-entry p {
  margin-bottom: 10px;
}

.site-footer {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 42px;
  padding: 38px 0 60px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.credits {
  max-width: 620px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .frame {
    width: min(100% - 36px, 1000px);
  }

  .site-header {
    align-items: flex-start;
    padding: 18px 0;
  }

  .site-header nav {
    row-gap: 4px;
  }

  .site-header nav span {
    display: none;
  }

  .site-header nav a {
    margin-right: 16px;
  }

  .masthead {
    padding: 62px 0 72px;
  }

  .byline {
    margin-bottom: 34px;
  }

  .content-section {
    padding: 52px 0 62px;
  }

  .theorem-result {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cue-comparison {
    display: block;
  }

  .cue-comparison article {
    padding-right: 0;
  }

  .cue-comparison article + article {
    padding-left: 0;
    border-top: 1px solid var(--light-rule);
    border-left: 0;
  }

  .rhythm-head {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .rhythm-row {
    grid-template-columns: 70px minmax(190px, 1fr);
    gap: 12px;
  }

  .rhythm-row > span:last-child {
    grid-column: 2;
  }

  .file-list li,
  .site-footer {
    display: block;
  }

  .file-list span {
    display: block;
    margin-top: 2px;
  }

  .site-footer p {
    margin-bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Direct access to the musical examples. */
[id] { scroll-margin-top: 28px; }
.play-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.masthead-actions { margin: 30px 0 22px; }
.play-link, .score-controls .primary-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 11px 18px; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: white; font: 600 14px/1.5 var(--sans);
  text-decoration: none; min-height: 44px;
}
.play-link:hover, .score-controls .primary-play:hover { background: #294451; color: white; }
.play-link-secondary { background: white; color: var(--ink); }
.play-link-secondary:hover { background: #f3f5f5; color: var(--ink); }
.resource .example-label { margin-bottom: 7px; color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.resource .play-links { margin: 20px 0 12px; }
.paper-realization h3 { font-size: clamp(24px, 3vw, 30px); }
.example-details { margin: 18px 0 14px; }
.example-details summary { cursor: pointer; color: var(--link); font-size: 14px; padding: 8px 0; }
.example-details[open] summary { margin-bottom: 10px; }
.example-details p { font-size: 15px; }
.video-actions { margin-top: 18px; font-size: 14px; }
button:focus-visible, input:focus-visible, summary:focus-visible, .score-scroll:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
@media (max-width: 480px) {
  .resource { grid-template-columns: 24px minmax(0, 1fr); gap: 12px; }
  .score-controls { gap: 12px; }
  .score-controls label { flex-basis: 100%; }
  .rhythm-row { grid-template-columns: 54px minmax(0, 1fr); gap: 10px; }
  .rhythm-unitaries { font-size: 13px; overflow-wrap: anywhere; }
}

.mobile-score-hint { display: none; }
@media (max-width: 760px) {
  .resource .mobile-score-hint { display: block; margin-top: -6px; color: var(--muted); font-size: 12px; }
}
