/* The fingering charts (/scales/fingering-chart/, /arpeggios/fingering-chart/). The page hero and breadcrumb come
   from page.css and keys.css. */

.chart {
  padding: 0 var(--pad) 56px;
}

/* the 1 octave / 2 octaves switch under the intro; each cell has both sets of numbers and shows one */
.chart-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.chart:not([data-octaves="2"]) .oct-2,
.chart[data-octaves="2"] .oct-1 {
  display: none;
}

.chart-group + .chart-group {
  margin-top: 48px;
}

.chart .key-group-title {
  margin: 0 0 16px;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.chart-table {
  width: 100%;
  border-collapse: separate; /* so the corners can be rounded like the other cards */
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.chart-table th,
.chart-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
}

.chart-table thead th {
  background: var(--bg-alt);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-table tbody th,
.chart-table tbody td {
  border-top: 1px solid var(--line);
}

/* the key: its name (a link), its notes, and for a minor scale its three forms */
.chart-table tbody th {
  font-weight: 400;
  white-space: nowrap;
}

/* the key's name stays in view while the finger numbers scroll sideways on a narrow screen */
.chart-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.chart-table thead th:first-child {
  background: var(--bg-alt);
  border-top-left-radius: 14px;
}

.chart-table thead th:last-child {
  border-top-right-radius: 14px;
}

.chart-table tbody tr:last-child th:first-child {
  border-bottom-left-radius: 14px;
}

/* the row under the pointer, to follow it across */
@media (hover: hover) {
  .chart-table tbody tr:hover th,
  .chart-table tbody tr:hover td {
    background: color-mix(in srgb, var(--surface) 60%, var(--bg-alt));
  }
}

.chart-table tbody th > a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chart-table tbody th > a:hover {
  color: var(--accent-ink);
}

.chart-notes,
.chart-more {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--muted);
}

.chart-more a {
  font-weight: 700;
  color: var(--accent-ink);
}

.chart-more a:hover {
  color: var(--text);
}

/* the fingering: the right hand above the left, each line labelled; the numbers evenly spaced and the thumb picked
   out as on the key pages */
.chart-table td {
  white-space: nowrap;
}

.chart-table .hand {
  display: flex;
  align-items: center;
}

/* a clear line between the right hand and the left hand */
.chart-table .hand + .hand {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--ink-faint);
}

.chart-table .hand abbr {
  flex: 0 0 2.4em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--muted);
}

.chart-table .f {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  line-height: 1.35em;
  text-align: center;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* the thumb on a felt disc, as on the key pages; printed too */
.chart-table .f.thumb {
  border-radius: 50%;
  background: var(--accent-light);
  font-weight: 700;
  color: var(--accent-ink);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* two octaves: the numbers sit a little closer, and the table may use the full width */
.chart[data-octaves="2"] .f {
  width: 1.15em;
  height: 1.15em;
  line-height: 1.15em;
}

/* a faint line where the second octave starts */
.chart-table .oct-split {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  margin: 0 5px;
  vertical-align: middle;
  background: var(--ink-faint);
}

.chart-foot {
  margin: 20px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Tablet */
@media (min-width: 768px) {
  .chart-table th,
  .chart-table td {
    padding: 12px 20px;
  }

  .chart .key-group-title {
    font-size: 2rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .chart {
    padding: 0 var(--gutter) 88px;
  }

  .chart-table {
    max-width: 640px;
  }

  .chart[data-octaves="2"] .chart-table {
    max-width: none;
  }
}

/* Printing: just the charts, to keep on the piano */
@media print {
  header,
  footer,
  .crumbs,
  .chart-options,
  .chart-more {
    display: none;
  }

  body {
    background: #fff;
  }

  .chart,
  main .page-hero {
    padding-inline: 0;
  }

  .chart-table {
    box-shadow: none;
    font-size: 0.8rem;
  }

  .chart-table thead th,
  .chart-table thead th:first-child {
    background: none;
  }

  .chart-table tr {
    break-inside: avoid;
  }

  .chart-group + .chart-group {
    break-before: page;
  }
}
