:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #16150f;
  --paper-muted: #6f6a5a;
  --paper-muted-dark: #5c584a;
  --hairline: #c9c2ae;
  --silence: #8a8474;
  --paper-width: 210mm;
  --paper-height: 297mm;
}

html[data-paper="letter"] {
  --paper-width: 8.5in;
  --paper-height: 11in;
}

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

body {
  margin: 0;
  padding: 3rem 1.5rem;
  background: #f5f5f4;
  color: var(--ink);
  font-family: var(--mono);
}

.reference-actions {
  display: flex;
  width: min(100%, var(--paper-width));
  margin: 0 auto 1rem;
  justify-content: space-between;
  gap: 1rem;
}

.reference-downloads {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  color: var(--paper-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.reference-downloads [data-paper-alternate] {
  opacity: 0.65;
}

.reference-actions a {
  padding-block: 0.35rem;
  border-bottom: 1px solid currentColor;
  color: #8a5a1a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.reference-actions a:focus-visible {
  outline: 2px solid #8a5a1a;
  outline-offset: 3px;
}

.reference-actions a:hover {
  color: var(--ink);
}

.reference-sheet {
  container-type: inline-size;
  display: flex;
  width: min(100%, var(--paper-width));
  min-height: var(--paper-height);
  margin: 0 auto;
  padding: 0.62in 0.6in;
  flex-direction: column;
  background: var(--paper);
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.reference-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.reference-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25pt;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
}

.reference-header p {
  margin: 6px 0 0;
  color: var(--paper-muted-dark);
  font-size: 9.5pt;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.14em;
}

.reference-header > span {
  color: var(--paper-muted);
  font-size: 8pt;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-align: right;
  white-space: nowrap;
}

.reference-letterhead {
  position: relative;
  flex: 0 0 2px;
  height: 2px;
  margin-top: 11px;
}

.reference-letterhead > span {
  position: absolute;
  inset: 0;
}

.reference-letterhead__mobile {
  display: none;
}

.reference-letterhead i {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--ink);
}

.reference-group {
  margin-top: 34px;
}

.reference-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--paper-muted);
  font-size: 8pt;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
}

.reference-section-title h2 {
  margin: 0;
  font: inherit;
  letter-spacing: 0.17em;
}

.reference-section-title::after {
  order: 2;
  height: 1px;
  flex: 1;
  background: var(--hairline);
  content: "";
}

.reference-section-title span {
  order: 3;
}

.reference-grid {
  display: grid;
  margin-top: 9px;
  column-gap: 20px;
  row-gap: 12px;
}

.reference-grid--5 {
  grid-template-columns: repeat(5, minmax(119px, 1fr));
}

.reference-grid--4 {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.reference-grid--2 {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
}

.reference-item {
  display: flex;
  min-width: 0;
  min-height: 17px;
  align-items: center;
  gap: 9px;
}

.reference-item__label {
  width: 15px;
  flex: none;
  font-family: var(--serif);
  font-size: 13pt;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.reference-grid--2 .reference-item__label {
  width: var(--action-label-width, 110px);
  font-family: var(--mono);
  font-size: 9.5pt;
  font-weight: 700;
  line-height: 1.2;
}

.reference-marks {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.reference-marks i {
  display: block;
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 3px;
  background: var(--ink);
}

.reference-marks i.dah {
  width: 15px;
}

.timing-reference {
  margin-top: 34px;
}

.timing-rows {
  display: flex;
  margin-top: 12px;
  flex-direction: column;
  gap: 10px;
}

.timing-row {
  display: flex;
  min-height: calc(100cqi / 45);
  align-items: flex-start;
  gap: 12px;
}

.timing-row strong {
  width: 154px;
  flex: none;
  color: var(--paper-muted-dark);
  font-size: 8.5pt;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.timing-row > span:last-child {
  width: 26px;
  flex: none;
  color: var(--ink);
  font-size: 9pt;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
}

.timing-track {
  position: relative;
  height: calc(100cqi / 45);
  flex: 1;
}

.timing-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100cqi / 45 * var(--units));
  height: calc(100cqi / 45);
  border: 1px solid var(--silence);
  border-radius: 999px;
}

.timing-bar--mark {
  border: 0;
  background: var(--ink);
}

.timing-bar--1-unit {
  --units: 1;
}

.timing-bar--3-units {
  --units: 3;
}

.timing-bar--7-units {
  --units: 7;
}

.try-it {
  margin-top: 36px;
}

.try-it__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.try-it__heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12pt;
  font-weight: 600;
  line-height: 1.1;
}

.try-it__heading > span {
  color: var(--paper-muted);
  font-size: 8pt;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
}

.phrase-strip {
  margin-top: 10px;
}

.phrase-band {
  position: relative;
  width: 100%;
  aspect-ratio: 45 / 1;
}

.phrase-band::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--silence);
  content: "";
  transform: translateY(-50%);
}

.phrase-band i {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--ink);
}

.phrase-labels {
  position: relative;
  width: 100%;
  height: 24px;
  margin-top: 7px;
}

.phrase-label {
  position: absolute;
  top: 0;
}

.phrase-label i {
  display: block;
  height: 4px;
  border-right: 1px solid var(--silence);
  border-bottom: 1px solid var(--silence);
  border-left: 1px solid var(--silence);
}

.phrase-label span {
  display: block;
  margin-top: 5px;
  color: var(--paper-muted-dark);
  font-family: var(--serif);
  font-size: 9pt;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.reference-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
  color: var(--paper-muted);
  font-size: 8pt;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
}

@media screen and (hover: hover) and (pointer: fine) {
  body {
    min-width: calc(var(--paper-width) + 3rem);
  }
}

@media screen and (max-width: 849px) and (hover: none),
  screen and (max-width: 849px) and (pointer: coarse) {
  body {
    padding: 0;
    background: var(--paper);
  }

  .reference-actions {
    padding: 1rem 20px 0;
    margin: 0;
  }

  .reference-sheet {
    width: 100%;
    min-height: 0;
    padding: 26px 20px;
    border-radius: 0;
    box-shadow: none;
  }

  .reference-marks {
    zoom: 1.3;
  }

  .reference-grid {
    column-gap: 28px;
  }

  .reference-grid--5,
  .reference-grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  }

  .reference-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reference-footer {
    margin-top: 18px;
  }
}

@media screen and (max-width: 619px) and (hover: none),
  screen and (max-width: 619px) and (pointer: coarse) {
  .reference-letterhead__desktop {
    display: none;
  }

  .reference-letterhead__mobile {
    display: block;
  }
}

@media screen and (max-width: 519px) and (hover: none),
  screen and (max-width: 519px) and (pointer: coarse) {
  .reference-grid--2 {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 379px) and (hover: none),
  screen and (max-width: 379px) and (pointer: coarse) {
  .reference-downloads > span:first-child {
    display: none;
  }

  .reference-sheet {
    padding: 22px 16px;
  }

  .timing-row strong {
    width: 92px;
    white-space: normal;
  }
}

@page {
  margin: 0;
}

@media print {
  body {
    padding: 0;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .reference-actions {
    display: none;
  }

  .reference-sheet {
    width: var(--paper-width);
    height: var(--paper-height);
    min-height: var(--paper-height);
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
