/* ---------- The score: how a marked-up speech looks ----------
 * Used by Mark, Rehearse, the help legend and printing. The markup comes
 * from js/ui/score.js:
 *
 *   .para                     a paragraph
 *   .w                        a word (data-i = its position)
 *   .w.em                     emphasis
 *   .arrow.rise / .arrow.fall after the last word the voice rises or falls through
 *   .run.slower / .run.faster a passage taken more slowly or quickly, starting with .pace-tag
 *   .gap.breath / .pause / .long   the mark in the gap after a word
 *   .wg                       a word with an arrow or gap mark, kept together on one line
 */

.score {
  max-width: var(--measure);
  margin: 0 auto;
  font: var(--script-size) / 2.35 var(--serif);
  overflow-wrap: break-word;
}

.score:focus {
  outline: none;
}

.score:focus-visible {
  outline: 1px dashed var(--rule);
  outline-offset: 12px;
  border-radius: 4px;
}

.score .para {
  margin: 0 0 1.1em;
}

.score .empty-score {
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
}

/* A word and the marks after it, kept on one line */
.wg {
  white-space: nowrap;
}

.w {
  border-radius: 3px;
  transition: background-color 0.12s;
}

.w.em {
  font-weight: 600;
  text-decoration: underline 0.11em var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: none;
}

/* Pitch: an arrow after the last word of a rise or fall */
.arrow {
  display: inline-block;
  margin-left: 0.08em;
  color: var(--accent);
  font: 600 0.85em/1 var(--sans);
}

.arrow.rise {
  transform: translateY(-0.45em);
}

.arrow.fall {
  transform: translateY(0.15em);
}

/* Pace: a soft band with a small label at the start */
.run.slower,
.run.faster {
  padding: 0.12em 0.15em;
  border-radius: 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.run.slower {
  background: var(--slower);
}

.run.faster {
  background: var(--faster);
}

.pace-tag {
  display: inline-block;
  margin-right: 0.3em;
  font: 600 0.5em/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 0.5em;
}

.slower > .pace-tag {
  color: var(--slower-ink);
}

.faster > .pace-tag {
  color: var(--faster-ink);
}

/* Gaps: breath and pause marks between words */
.gap {
  display: inline-block;
  margin: 0 0.12em 0 0.04em;
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}

.gap.breath {
  font-size: 1.25em;
  transform: translateY(-0.18em);
}

.gap.pause,
.gap.long {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1.05em;
  letter-spacing: -0.08em;
}

/* ---------- Mark mode: choosing words ---------- */

.markable {
  cursor: text;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.markable .w {
  cursor: pointer;
}

.markable .w:hover {
  background: color-mix(in srgb, var(--select) 45%, transparent);
}

.markable .w.sel {
  background: var(--select);
  box-shadow:
    0.12em 0 0 var(--select),
    -0.12em 0 0 var(--select);
}

.markable.brushing,
.markable.brushing .w {
  cursor: crosshair;
}

/* ---------- The key to the marks (help and print) ---------- */

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.35rem 1rem;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.legend .score {
  margin: 0;
  font-size: 1rem;
  line-height: 1.8;
}

.legend-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.legend-sample {
  min-width: 4.2rem;
  color: var(--ink);
  font: 1rem/1.6 var(--serif);
}
